[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source svx/source

2023-10-27 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   31 
 libreofficekit/source/gtk/lokdocview.cxx |2 
 sfx2/source/view/viewsh.cxx  |  835 ---
 svx/source/accessibility/ChildrenManagerImpl.cxx |   17 
 5 files changed, 642 insertions(+), 245 deletions(-)

New commits:
commit f3b20f31d55f304ed9d4a3eb257bf9d468fffe5f
Author: Marco Cecchetti 
AuthorDate: Tue Oct 10 10:50:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 27 19:28:52 2023 +0200

lok: a11y: impress: help screen reader to report shape selection

Refactored LOKDocumentFocusListener::notifyEvent.

Implemented 2 new callbacks:
- LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE: it says the client if
editing in a shape or cell is active or it isn't.
- LOK_CALLBACK_A11Y_SELECTION_CHANGED: it says if a shape has been
selected/unselected, the name of the shape and text content are sent
too for being reported by a screen reader.

(cherry picked from commit 76899152ec3d1924cc72d2b869e197a1e34a0a1a)

Conflicts:
sfx2/source/view/viewsh.cxx

Change-Id: I644bcc7daeb8772805688a9bccdabd0631ce0a22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158562
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bccac7338367..ab4987376f4f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1818,6 +1818,8 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
 {
 const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), 
type);
 auto pos2 = toQueue2(pos);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 883a68ce09c6..378347108de6 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -1001,7 +1001,32 @@ typedef enum
  *   the user got in from the outer to the inner; row/column span default
  *   value is 1; paragraph is the cell text content.
  */
-LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67
+LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67,
+
+/**
+ * Accessibility event: text editing in a shape or cell has been 
enabled/disabled
+ *
+ *  {
+ *  "cell": true/false (editing a cell ?)
+ *  "enabled": true|false
+ *  "selection": a selection description
+ *  "paragraph": focused paragraph
+ *  }
+ */
+LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE = 68,
+
+/**
+ * Accessibility event: a selection (of a shape/graphic, etc.) has changed
+ *
+ *  {
+ *  "cell": true/false (selected object is a cell ?)
+ *  "action": "create"|"add"|"remove"
+ *  "name": selected object name
+ *  "text": text content if any
+ *  }
+ */
+LOK_CALLBACK_A11Y_SELECTION_CHANGED = 69
+
 }
 LibreOfficeKitCallbackType;
 
@@ -1166,6 +1191,10 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET";
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 return "LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED";
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+return "LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE";
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
+return "LOK_CALLBACK_A11Y_SELECTION_CHANGED";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index c3df48448815..6c7e6dbfc652 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1494,6 +1494,8 @@ callback (gpointer pData)
 case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET:
+case LOK_CALLBACK_A11Y_EDITING_IN_SELECTION_STATE:
+case LOK_CALLBACK_A11Y_SELECTION_CHANGED:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 34edb460d4e3..8f2218c66175 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -253,6 +253,29 @@ typedef 
std::list> XAccessibleTa
 
 namespace
 {
+constexpr
+bool isText(sal_Int16 nRole)
+{
+return nRole == accessibility::AccessibleRole::DOCUMENT_TEXT;
+}
+
+constexpr
+bool isSpreadsheet(sal_Int16 nRole)
+{
+return nRole == accessibility::AccessibleRole::DOCUMENT_SPREADSHEET;
+}
+
+constexpr
+bool isPresentati

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sfx2/source

2023-08-13 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   44 +++-
 libreofficekit/source/gtk/lokdocview.cxx |1 
 sfx2/source/view/viewsh.cxx  |  280 ---
 4 files changed, 302 insertions(+), 25 deletions(-)

New commits:
commit 59c2e114f76247158a0da9dcf91d6449d5d61224
Author: Marco Cecchetti 
AuthorDate: Wed Jun 7 14:03:56 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 14 08:09:53 2023 +0200

lok: a11y: when we are inside a table notify table and current cell info

When we get in one or more tables we notify row and column count.
When we get out one or more table we notify we are leaving a table.
When the fosused cell changes we notify the new row/col index.
The paragraph content is notified together with table info, so that
client has some opportunity for getting the screen reader to report
together content and table info.

Change-Id: Ic524259aa1879a70fc3de2467bdee27475352b7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155577
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 42d838b889b6..6d5295222f74 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1798,6 +1798,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_FOCUS_CHANGED:
 case LOK_CALLBACK_A11Y_CARET_CHANGED:
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 {
 const auto& pos = std::find(m_queue1.rbegin(), m_queue1.rend(), 
type);
@@ -1860,6 +1861,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 case LOK_CALLBACK_A11Y_FOCUS_CHANGED:
 case LOK_CALLBACK_A11Y_CARET_CHANGED:
 case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED:
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
 case LOK_CALLBACK_COLOR_PALETTES:
 {
 if (removeAll(type))
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index b7a43acf7d27..e7f31c2a14fe 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -924,14 +924,17 @@ typedef enum
LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR = 61,
 
 /**
- * Accessibility event: a paragraph get focus.
+ * Accessibility event: a paragraph got focus.
  * The payload is a json with the following structure.
  *
  *   {
  *   "content": ""
  *   "position": N
+ *   "start": N1
+ *   "end": N2
  *   }
- *   where N is the position of the text cursor inside the focused 
paragraph.
+ *   where N is the position of the text cursor inside the focused 
paragraph,
+ *   and [N1,N2] is the range of the text selection inside the focused 
paragraph.
  */
 LOK_CALLBACK_A11Y_FOCUS_CHANGED = 62,
 
@@ -946,7 +949,7 @@ typedef enum
 LOK_CALLBACK_A11Y_CARET_CHANGED = 63,
 
 /**
- * Accessibility event: text cursor position has changed.
+ * Accessibility event: text selection has changed.
  *
  *  {
  *  "start": N1
@@ -965,7 +968,38 @@ typedef enum
  * Informs that the document password has been successfully changed.
  * The payload contains the new password and the type.
 */
-LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66
+LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66,
+
+/**
+ * Accessibility event: a cell got focus.
+ * The payload is a json with the following structure.
+ *
+ *   {
+ *   "outCount": 
+ *   "inList": [
+ *   {
+ *   "rowCount": 
+ *   "colCount": 
+ *   },
+ *   ...
+ *   {
+ *   "rowCount": 
+ *   "colCount": 
+ *   }
+ *   ]
+ *   "row": 
+ *   "col": 
+ *   "rowSpan": 
+ *   "colSpan": 
+ *   "paragraph": {
+ *   
+ *}
+ *   }
+ *   where row/column indexes start from 0, inList is the list of tables
+ *   the user got in from the outer to the inner; row/column span default
+ *   value is 1; paragraph is the cell text content.
+ */
+LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED = 67
 }
 LibreOfficeKitCallbackType;
 
@@ -1128,6 +1162,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_COLOR_PALETTES";
 case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET:
 return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET";
+case LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED:
+return "LOK_CALLBACK_A11Y_FOCUSED_CELL_CHANGED";
 }
 
 assert(!"Unknown LibreOfficeKitC

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2023-04-26 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx   |  102 +++---
 include/LibreOfficeKit/LibreOfficeKit.h   |   12 ---
 include/LibreOfficeKit/LibreOfficeKit.hxx |   28 
 3 files changed, 25 insertions(+), 117 deletions(-)

New commits:
commit 0340cbbc34d2c97baa5b7ebc4a57650861907067
Author: Tor Lillqvist 
AuthorDate: Wed Apr 26 15:39:38 2023 +0300
Commit: Tor Lillqvist 
CommitDate: Thu Apr 27 06:53:22 2023 +0200

Bin the unused paintTileToCGContext special thing for iOS

It was used by "LibreOfficeLight" which died years ago.

Change-Id: I71a1315448baa4f1ec7a22b20cb3dd39c88cda78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151066
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af31b1829163..d6ce62b38be4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1119,13 +1119,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
-#ifdef IOS
-static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
- void* rCGContext,
- const int nCanvasWidth, const int 
nCanvasHeight,
- const int nTilePosX, const int nTilePosY,
- const int nTileWidth, const int 
nTileHeight);
-#endif
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
   unsigned char* pBuffer,
   const int nPart,
@@ -1392,9 +1385,6 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference 
 xC
 m_pDocumentClass->setPartMode = doc_setPartMode;
 m_pDocumentClass->getEditMode = doc_getEditMode;
 m_pDocumentClass->paintTile = doc_paintTile;
-#ifdef IOS
-m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext;
-#endif
 m_pDocumentClass->paintPartTile = doc_paintPartTile;
 m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -2586,41 +2576,6 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl()
 namespace
 {
 
-#ifdef IOS
-void paintTileToCGContext(ITiledRenderable* pDocument,
-  void* rCGContext, const Size nCanvasSize,
-  const int nTilePosX, const int nTilePosY,
-  const int nTileWidth, const int nTileHeight)
-{
-SystemGraphicsData aData;
-aData.rCGContext = reinterpret_cast(rCGContext);
-
-ScopedVclPtrInstance pDevice(aData, Size(1, 1), 
DeviceFormat::WITHOUT_ALPHA);
-pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
-pDevice->SetOutputSizePixel(nCanvasSize);
-pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
-nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-}
-
-void paintTileIOS(LibreOfficeKitDocument* pThis,
- unsigned char* pBuffer,
- const int nCanvasWidth, const int nCanvasHeight, const double 
fDPIScale,
- const int nTilePosX, const int nTilePosY,
- const int nTileWidth, const int nTileHeight)
-{
-CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
-nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
-
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
-
-CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
-CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
-
-doc_paintTileToCGContext(pThis, (void*) pCGContext, nCanvasWidth, 
nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-CGContextRelease(pCGContext);
-}
-#endif
-
 void setLanguageAndLocale(OUString const & aLangISO)
 {
 SvtSysLocaleOptions aLocalOptions;
@@ -3933,8 +3888,31 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 comphelper::ScopeGuard dpiScaleGuard([]() { 
comphelper::LibreOfficeKit::setDPIScale(1.0); });
 
 #if defined(IOS)
-double fDPIScaleX = 1.0;
-paintTileIOS(pThis, pBuffer, nCanvasWidth, nCanvasHeight, fDPIScaleX, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+double fDPIScale = 1.0;
+
+CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8,
+nCanvasWidth * 4, 
CGColorSpaceCreateDeviceRGB(),
+
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little);
+
+CGContextTranslateCTM(pCGContext, 0, nCanvasHeight);
+CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale);
+
+SAL_INFO( "lok.tiledrendering", "doc_pa

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2023-03-01 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx   |   23 +--
 include/LibreOfficeKit/LibreOfficeKit.h   |7 +--
 include/LibreOfficeKit/LibreOfficeKit.hxx |   24 ++--
 3 files changed, 48 insertions(+), 6 deletions(-)

New commits:
commit 91afabee6bece4cbf61a8f32a6e6a69becd857ae
Author: Tor Lillqvist 
AuthorDate: Tue Feb 28 18:23:06 2023 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Mar 1 08:28:21 2023 +

Improve the LibreOfficeKit Document::paintThumbnail() API

No implementation yet.

Change-Id: Ie1dc955bc8b589bd336af0545a2270cbe84a8b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148028
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index eee57facee65..903dc2b06687 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1114,7 +1114,12 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y);
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+   unsigned char* pBuffer,
+   int bufferWidth,
+   int bufferHeight,
+   int width,
+   const char* pURL);
 #ifdef IOS
 static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
  void* rCGContext,
@@ -4010,8 +4015,14 @@ static void 
doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
 
 #endif
 
-static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, unsigned char* 
pBuffer, int x, int y)
+static void doc_paintThumbnail(LibreOfficeKitDocument* pThis,
+   unsigned char* pBuffer,
+   int bufferWidth,
+   int bufferHeight,
+   int width,
+   const char* pURL)
 {
+#if 0
 constexpr float zoom = 0.5f;
 constexpr int pixelWidth = 120;
 constexpr int pixelHeight = 120;
@@ -4021,6 +4032,14 @@ static void doc_paintThumbnail(LibreOfficeKitDocument* 
pThis, unsigned char* pBu
 constexpr int offsetYTwips = 15 * 15;
 
 doc_paintTile(pThis, pBuffer, pixelWidth, pixelHeight, x-offsetXTwips, 
y-offsetYTwips, pixelWidthTwips, pixelHeightTwips);
+#else
+(void) pThis;
+(void) pBuffer;
+(void) bufferWidth;
+(void) bufferHeight;
+(void) width;
+(void) pURL;
+#endif
 }
 
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 4de2380998b4..09d3e91e8640 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -501,10 +501,13 @@ struct _LibreOfficeKitDocumentClass
 /// @see lok::Document::setViewTimezone().
 void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const 
char* timezone);
 
+/// @see lok::Document::paintThumbnail().
 void (*paintThumbnail) (LibreOfficeKitDocument* pThis,
 unsigned char* pBuffer,
-int x,
-int y);
+int bufferWidth,
+int bufferHeight,
+int width,
+const char* pURL);
 
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 17fc518fbe13..04a3b82e6eca 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -886,9 +886,29 @@ public:
 mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone);
 }
 
-void paintThumbnail(unsigned char* pBuffer, int x, int y)
+/**
+ * Create a thumbnail of a location in the document.
+ *
+ * @param pBuffer Where the thumbnail is painted. Same format as a tile 
painted
+ * by paintTile().
+ * @param bufferWidth number of pixels in a row of pBuffer.
+ * @param bufferHeight number of pixels in a column of pBuffer.
+ * @param width logical width of the rendered rectangle, in TWIPs.
+ * @param pURL Just the fragment part of a URL, indicating the location in 
the document
+ * to render as a thumbnail. As returned by extractRequest(), or null, 
meaning the start
+ * of the document.
+ *
+ * Note that there is no parameter for the logical height of the
+ * rendered rectangle. The aspect ratio of the rendered rectangle
+ * is determined by the buffer

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2022-12-13 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx |   10 ++
 include/LibreOfficeKit/LibreOfficeKitInit.h |4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 1e421b30e2440f8a6e82ba4df1be3fb7c63e6996
Author: Tor Lillqvist 
AuthorDate: Mon Dec 12 17:59:30 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Dec 13 08:19:40 2022 +

Attempt to add ifdefs for WASM (Emscripten) for LOKit-based code

Change-Id: I5b2556d1be61fa3a1d7996ce8d61958fbe7984c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144002
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c777bc7bb731..19937da00d6d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6768,7 +6768,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
LibreOfficeKitWakeCallback pWakeCallback,
void* pData)
 {
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 Application::GetSolarMutex().acquire();
 #endif
 
@@ -6779,7 +6779,7 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
 Application::UpdateMainThread();
 soffice_main();
 }
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 vcl::lok::unregisterPollCallbacks();
 Application::ReleaseSolarMutex();
 #endif
@@ -7100,6 +7100,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 {
 #ifdef ANDROID
 aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program";
+#elif defined __EMSCRIPTEN__
+aAppPath = OUString::fromUtf8("instdir/program");
 #else
 // Fun conversion dance back and forth between URLs and system paths...
 OUString aAppURL;
@@ -7296,8 +7298,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 comphelper::ThreadPool::getSharedOptimalPool().shutdown();
 }
 
-// Turn off quick editing on IOS and ANDROID
-#if defined IOS || defined ANDROID
+// Turn off quick editing on iOS, Android and Emscripten
+#if defined IOS || defined ANDROID || defined __EMSCRIPTEN__
 if (officecfg::Office::Impress::Misc::TextObject::QuickEditing::get())
 {
 std::shared_ptr 
batch(comphelper::ConfigurationChanges::create());
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 08feb42c1e18..506f373c5108 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -259,13 +259,13 @@ typedef int (LokHookPreInit)  ( const char 
*install_path, const char
 
 typedef int (LokHookPreInit2) ( const char *install_path, const 
char *user_profile_url, LibreOfficeKit** kit);
 
-#if defined(IOS) || defined(ANDROID)
+#if defined(IOS) || defined(ANDROID) || defined(__EMSCRIPTEN__)
 LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* 
user_profile_path);
 #endif
 
 static LibreOfficeKit *lok_init_2( const char *install_path,  const char 
*user_profile_url )
 {
-#if !defined(IOS) && !defined(ANDROID)
+#if !defined(IOS) && !defined(ANDROID) && !defined(__EMSCRIPTEN__)
 void *dlhandle;
 char *imp_lib;
 LokHookFunction *pSym;


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 include/svx libreofficekit/source sfx2/source svx/source

2022-10-25 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx  |1 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   19 +++
 include/sfx2/lokhelper.hxx   |4 
 include/svx/svdomedia.hxx|3 +++
 libreofficekit/source/gtk/lokdocview.cxx |1 +
 sfx2/source/view/lokhelper.cxx   |9 +
 svx/source/svdraw/svdmrkv.cxx|9 +
 svx/source/svdraw/svdomedia.cxx  |   25 +
 svx/source/svdraw/svdxcgv.cxx|   13 +
 9 files changed, 84 insertions(+)

New commits:
commit 038c4a42834014b421a2e8a99ae436eb2dc8f8c5
Author: Ashod Nakashian 
AuthorDate: Sun May 15 10:05:54 2022 -0400
Commit: Miklos Vajna 
CommitDate: Wed Oct 26 08:18:55 2022 +0200

lok: support embedded media

Change-Id: Ie8f3ed188cec0050a10a5d49325756931b902ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141807
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ee6802ebb24e..b0ebc21138eb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1545,6 +1545,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 type != LOK_CALLBACK_TEXT_SELECTION &&
 type != LOK_CALLBACK_TEXT_SELECTION_START &&
 type != LOK_CALLBACK_TEXT_SELECTION_END &&
+type != LOK_CALLBACK_MEDIA_SHAPE &&
 type != LOK_CALLBACK_REFERENCE_MARKS)
 {
 SAL_INFO("lok", "Skipping while painting [" << type << "]: [" << 
aCallbackData.getPayload() << "].");
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 3bc0ad940b18..1e9821204c0b 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -882,6 +882,23 @@ typedef enum
  *
  */
 LOK_CALLBACK_FONTS_MISSING = 57,
+
+/**
+ * Insertion, removal, movement, and selection of a media shape.
+ * The payload is a json with the relevant details.
+ *
+ *  {
+ *  "action": "insert",
+ *  "id": 123456,
+ *  "url": "file:// ..."
+ *  "x": ...,
+ *  "y": ...,
+ *  }
+ *
+ *  where the "svg" property is a string containing an svg document
+ *  which is a representation of the pie segment.
+ */
+LOK_CALLBACK_MEDIA_SHAPE = 58,
 }
 LibreOfficeKitCallbackType;
 
@@ -1026,6 +1043,8 @@ static inline const char* lokCallbackTypeToString(int 
nType)
 return "LOK_CALLBACK_PRINT_RANGES";
 case LOK_CALLBACK_FONTS_MISSING:
 return "LOK_CALLBACK_FONTS_MISSING";
+case LOK_CALLBACK_MEDIA_SHAPE:
+return "LOK_CALLBACK_MEDIA_SHAPE";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 1c5a94966776..eaa7abe9785c 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -157,6 +157,10 @@ public:
 /// Helper for diagnosing run-time problems
 static void dumpState(rtl::OStringBuffer &rState);
 
+/// Notify all views of a media update.
+/// This could be a new insertion or property modifications to an existing 
one.
+static void notifyMediaUpdate(boost::property_tree::ptree& json);
+
 private:
 static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId);
 };
diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx
index 020f4d56c947..6199fcaffe5b 100644
--- a/include/svx/svdomedia.hxx
+++ b/include/svx/svdomedia.hxx
@@ -72,6 +72,9 @@ public:
 
 virtual bool shouldKeepAspectRatio() const override { return true; }
 
+/// When Lokit is enabled, notify the media details.
+void notifyPropertiesForLOKit();
+
 private:
 voidmediaPropertiesChanged( const 
::avmedia::MediaItem& rNewState );
 virtual std::unique_ptr 
CreateObjectSpecificViewContact() override;
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index fba48d9293ef..ce4bd1890619 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1485,6 +1485,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_SC_FOLLOW_JUMP:
 case LOK_CALLBACK_PRINT_RANGES:
 case LOK_CALLBACK_FONTS_MISSING:
+case LOK_CALLBACK_MEDIA_SHAPE:
 {
 // TODO: Implement me
 break;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index e0cdb25505ec..b168538fe0c8 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -892,4 +892,13 @@ void SfxLokHelper::dumpState(rtl::OStringBuffer &rState)
 }
 }
 
+void SfxLokHelper::notifyMediaUpdate(boost::property_tree::ptree& json)
+{
+std::stringstream aStream;
+ 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sw/source

2022-05-23 Thread Miklos Vajna (via logerrit)
 desktop/source/lib/init.cxx  |4 -
 include/LibreOfficeKit/LibreOfficeKit.hxx|   10 +++-
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   23 ---
 libreofficekit/source/gtk/lokdocview.cxx |   27 -
 sw/source/uibase/uno/unotxdoc.cxx|   56 ++-
 sw/source/uibase/wrtsh/wrtsh3.cxx|   18 +++-
 6 files changed, 106 insertions(+), 32 deletions(-)

New commits:
commit 9a76be53dfb801b754bf55f9d4b8c5f82991a62f
Author: Miklos Vajna 
AuthorDate: Mon May 23 08:39:34 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 23 18:04:09 2022 +0200

sw content controls, picture: add LOK API

- send a LOK_CALLBACK_CONTENT_CONTROL callback with
  action=change-picture when a file picker should be shown

- extend lok::Document::sendContentControlEvent() to be able to replace
  the placeholder with the selected URL

- update gtktiledviewer to work with these

Change-Id: Ifb3750803885fc09fc82905b0cf85b2b8ca06e77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134750
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 45f059a73d7d..fbba1847078a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6093,9 +6093,9 @@ static void 
doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const cha
 }
 
 // Sanity check
-if (aMap.find("type") == aMap.end() || aMap.find("selected") == aMap.end())
+if (aMap.find("type") == aMap.end())
 {
-SetLastExceptionMsg("Wrong arguments for sendContentControlEvent");
+SetLastExceptionMsg("Missing 'type' argument for 
sendContentControlEvent");
 return;
 }
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 3140e121151d..827856c3ebeb 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -812,14 +812,18 @@ public:
  *
  * @param pArguments arguments of the event.
  *
- * Example argument string:
- *
+ * Examples:
+ * To select the 3rd list item of the drop-down:
  * {
  * "type": "drop-down",
  * "selected": "2"
  * }
  *
- * selects the 3rd list item of the drop-down.
+ * To change a picture place-holder:
+ * {
+ * "type": "picture",
+ * "changed": "file:///path/to/test.png"
+ * }
  */
 void sendContentControlEvent(const char* pArguments)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 05544b5473a5..339b0183f153 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -799,15 +799,28 @@ typedef enum
 /**
  * Sends all information for displaying metadata for a text based content 
control.
  *
- * The payload example:
+ * Examples:
+ * Entered a rich text content control:
  * {
- *  "action": "show",
- *  "rectangles": "1418, 1694, 720, 551; 10291, 1418, 1099, 275"
+ * "action": "show",
+ * "rectangles": "1418, 1694, 720, 551; 10291, 1418, 1099, 275"
  * }
  *
- * or
+ * Left a rich text content control:
+ * {
+ * "action": "hide"
+ * }
+ *
+ * Entered a dropdown content control:
+ * {
+ * "action": "show",
+ * "rectangles": "...",
+ * "items": ["red", "green", "blue"]
+ * }
+ *
+ * Clicked on a picture content control's placeholder:
  * {
- *  "action": "hide"
+ * "action": "change-picture"
  * }
  */
 LOK_CALLBACK_CONTENT_CONTROL = 55,
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index aafaa084be9c..39f2281b0c7d 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1397,9 +1397,9 @@ callback (gpointer pData)
 
 case LOK_CALLBACK_CONTENT_CONTROL:
 {
-std::stringstream aStream(pCallback->m_aPayload);
+std::stringstream aPayloadStream(pCallback->m_aPayload);
 boost::property_tree::ptree aTree;
-boost::property_tree::read_json(aStream, aTree);
+boost::property_tree::read_json(aPayloadStream, aTree);
 auto aAction = aTree.get("action");
 if (aAction == "show")
 {
@@ -1410,6 +1410,29 @@ callback (gpointer pData)
 {
 priv->m_aContentControlRectangles.clear();
 }
+else if (aAction == "change-picture")
+{
+GtkWidget* pDialog = gtk_file_chooser_dialog_new(
+"Open File", 
GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView))),
+GTK_FILE_CHOOSER_ACTION_OPEN, "Cancel", GTK_RESPONSE_CANCEL, 
"Open",
+GTK_RESPONSE_ACCEPT, nullptr);
+ 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sal include/vcl vcl/unx

2022-04-13 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx|   27 ++---
 include/LibreOfficeKit/LibreOfficeKit.hxx  |4 +++
 include/LibreOfficeKit/LibreOfficeKitInit.h|2 +
 include/sal/log-areas.dox  |1 
 include/vcl/outdev.hxx |4 +--
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |7 ++
 6 files changed, 40 insertions(+), 5 deletions(-)

New commits:
commit 5de22d1e559cd0f1f5fa4e247f0ce153710fbeab
Author: Tor Lillqvist 
AuthorDate: Wed Mar 9 11:33:16 2022 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Apr 13 12:54:04 2022 +0200

Handle "addfont" from Collabora Online

We use the AddTempDevFont() API to add a new font. Sadly there is no
corresponding way to remove such a temporarily added font.

Change-Id: I6fe61919daa5af29e964cec1caf7293aefa8ea4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132948
Tested-by: Tor Lillqvist 
Reviewed-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 33b763b3a1cb..442297d5d348 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4113,6 +4113,13 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, 
const char *pOption, const c
 else
 sal_detail_set_log_selector(pCurrentSalLogOverride);
 }
+else if (strcmp(pOption, "addfont") == 0)
+{
+OutputDevice *pDevice = Application::GetDefaultDevice();
+OutputDevice::ImplClearAllFontData(true);
+pDevice->AddTempDevFont(OUString::fromUtf8(pValue), "");
+OutputDevice::ImplRefreshAllFontData(true);
+}
 }
 
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* 
pCommand, const char* pArguments, bool bNotifyWhenFinished)
@@ -6476,7 +6483,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 
 // What stage are we at ?
 if (pThis == nullptr)
+{
 eStage = PRE_INIT;
+SAL_INFO("lok", "Create libreoffice object");
+gImpl = new LibLibreOffice_Impl();
+}
 else if (bPreInited)
 eStage = SECOND_INIT;
 else
@@ -6760,11 +6771,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 SAL_JNI_EXPORT
 LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* 
user_profile_url)
 {
-if (!gImpl)
+static bool alreadyCalled = false;
+
+if (!alreadyCalled)
 {
-SAL_INFO("lok", "Create libreoffice object");
+alreadyCalled = true;
 
-gImpl = new LibLibreOffice_Impl();
 if (!lo_initialize(gImpl, install_path, user_profile_url))
 {
 lo_destroy(gImpl);
@@ -6785,6 +6797,15 @@ int lok_preinit(const char* install_path, const char* 
user_profile_url)
 return lo_initialize(nullptr, install_path, user_profile_url);
 }
 
+SAL_JNI_EXPORT
+int lok_preinit_2(const char* install_path, const char* user_profile_url, 
LibLibreOffice_Impl** kit)
+{
+int result = lo_initialize(nullptr, install_path, user_profile_url);
+if (kit != nullptr)
+*kit = gImpl;
+return result;
+}
+
 static void lo_destroy(LibreOfficeKit* pThis)
 {
 SolarMutexClearableGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 064caae2729b..912b3e0d2203 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -1036,6 +1036,10 @@ public:
  * environment variable SAL_LOG is again used as by default. You
  * can switch back and forth as you like.
  *
+ * "addfont": ""
+ *
+ * Adds the font at the URL given.
+ *
  * @param pOption the option name
  * @param pValue its value
  */
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index ccd42863ba25..5bbb722b5b18 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -255,6 +255,8 @@ typedef LibreOfficeKit *(LokHookFunction2)( const char 
*install_path, const char
 
 typedef int (LokHookPreInit)  ( const char *install_path, const 
char *user_profile_url );
 
+typedef int (LokHookPreInit2) ( const char *install_path, const 
char *user_profile_url, LibreOfficeKit** kit);
+
 #if defined(IOS) || defined(ANDROID)
 LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* 
user_profile_path);
 #endif
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index b00d1c1c8236..4e9c3105c844 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -509,6 +509,7 @@ certain functionality.
 @li @c vcl.uitest - The UI testing framework code
 @li @c vcl.unity
 @li @c vcl.unx.dtrans
+@li @c vcl.unx.freetype
 @li @c vcl.unx.print
 @li @c vcl.virdev
 @li @c vcl.watchdog
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index d

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sal sal/osl sal/util

2021-04-28 Thread Tor Lillqvist (via logerrit)
 desktop/source/lib/init.cxx   |   30 ++
 include/LibreOfficeKit/LibreOfficeKit.h   |3 +
 include/LibreOfficeKit/LibreOfficeKit.hxx |   33 +++
 include/sal/log.hxx   |2 
 sal/osl/all/log.cxx   |   63 +-
 sal/util/sal.map  |1 
 6 files changed, 106 insertions(+), 26 deletions(-)

New commits:
commit 41ff704cc49b7097b717882616011962ecd7198f
Author: Tor Lillqvist 
AuthorDate: Wed Apr 21 17:37:57 2021 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Apr 28 09:30:17 2021 +0200

Add API to LibreOfficeKit to set arbitrary run-time options in core

Add setOption(const char*, const char*)

At the moment this enables starting and stopping the ProfileZone event
recording and overriding the SAL_LOG environment variable.

Change-Id: Ic3a934bb4246c755a91eee8a8343fafc15815116
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114439
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114656
Tested-by: Tor Lillqvist 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 23400d906628..ecbd0f3f97e5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2076,6 +2076,8 @@ static void lo_sendDialogEvent(LibreOfficeKit* pThis,
unsigned long long int nLOKWindowId,
const char* pArguments);
 
+static void lo_setOption(LibreOfficeKit* pThis, const char* pOption, const 
char* pValue);
+
 LibLibreOffice_Impl::LibLibreOffice_Impl()
 : m_pOfficeClass( gOfficeClass.lock() )
 , maThread(nullptr)
@@ -2101,6 +2103,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
 m_pOfficeClass->signDocument = lo_signDocument;
 m_pOfficeClass->runLoop = lo_runLoop;
 m_pOfficeClass->sendDialogEvent = lo_sendDialogEvent;
+m_pOfficeClass->setOption = lo_setOption;
 
 gOfficeClass = m_pOfficeClass;
 }
@@ -3842,6 +3845,33 @@ static void lo_sendDialogEvent(LibreOfficeKit* 
/*pThis*/, unsigned long long int
 lcl_sendDialogEvent(nWindowId, pArguments);
 }
 
+static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const 
char* pValue)
+{
+static char* pCurrentSalLogOverride = nullptr;
+
+if (strcmp(pOption, "profilezonerecording") == 0)
+{
+if (strcmp(pValue, "start") == 0)
+comphelper::ProfileZone::startRecording();
+else if (strcmp(pValue, "stop") == 0)
+comphelper::ProfileZone::stopRecording();
+}
+else if (strcmp(pOption, "sallogoverride") == 0)
+{
+if (pCurrentSalLogOverride != nullptr)
+free(pCurrentSalLogOverride);
+if (pValue == nullptr)
+pCurrentSalLogOverride = nullptr;
+else
+pCurrentSalLogOverride = strdup(pValue);
+
+if (pCurrentSalLogOverride == nullptr || pCurrentSalLogOverride[0] == 
'\0')
+sal_detail_set_log_selector(nullptr);
+else
+sal_detail_set_log_selector(pCurrentSalLogOverride);
+}
+}
+
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* 
pCommand, const char* pArguments, bool bNotifyWhenFinished)
 {
 comphelper::ProfileZone aZone("doc_postUnoCommand");
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 2279260d0e90..82738d65ff93 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -115,6 +115,9 @@ struct _LibreOfficeKitClass
 void (*sendDialogEvent) (LibreOfficeKit* pThis,
 unsigned long long int nLOKWindowId,
 const char* pArguments);
+
+/// @see lok::Office::setOption
+void (*setOption) (LibreOfficeKit* pThis, const char* pOption, const char* 
pValue);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 962270452e20..06fe5abc19e2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -990,6 +990,39 @@ public:
 {
 mpThis->pClass->sendDialogEvent(mpThis, nWindowId, pArguments);
 }
+
+/**
+ * Generic function to toggle and tweak various things in the core LO
+ *
+ * The currently available option names and their allowed values are:
+ *
+ * "profilezonerecording": "start" or "stop"
+ * Start or stop recording profile zone trace data in the process.
+ *
+ * "sallogoverride": ""
+ * Override the SAL_LOG environment variable
+ *
+ * For the syntax of the string see the documentation f

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2021-01-04 Thread Henry Castro (via logerrit)
 desktop/source/lib/init.cxx   |   19 ++-
 include/LibreOfficeKit/LibreOfficeKit.h   |5 +
 include/LibreOfficeKit/LibreOfficeKit.hxx |   11 +++
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 04211e7ca1c0caec9aa72ac70112842a1f2f1a50
Author: Henry Castro 
AuthorDate: Fri Dec 25 17:30:42 2020 -0400
Commit: Henry Castro 
CommitDate: Mon Jan 4 18:38:20 2021 +0100

lok: add lo_sendDialogEvent to post dialog events

When the "Macro Security Warning" is shown in client side,
the model/view/controller are not created yet. It is necessary
to create a function to posts a dialog event.

Change-Id: I2bfc9edecc708dc79da575ea515e3144e78c10e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108293
Tested-by: Jenkins
Reviewed-by: Henry Castro 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a512f33868ac..2682f3cf6e1a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2068,6 +2068,10 @@ static void lo_runLoop(LibreOfficeKit* pThis,
LibreOfficeKitWakeCallback pWakeCallback,
void* pData);
 
+static void lo_sendDialogEvent(LibreOfficeKit* pThis,
+   unsigned long long int nLOKWindowId,
+   const char* pArguments);
+
 LibLibreOffice_Impl::LibLibreOffice_Impl()
 : m_pOfficeClass( gOfficeClass.lock() )
 , maThread(nullptr)
@@ -2092,6 +2096,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
 m_pOfficeClass->runMacro = lo_runMacro;
 m_pOfficeClass->signDocument = lo_signDocument;
 m_pOfficeClass->runLoop = lo_runLoop;
+m_pOfficeClass->sendDialogEvent = lo_sendDialogEvent;
 
 gOfficeClass = m_pOfficeClass;
 }
@@ -3692,7 +3697,8 @@ public:
 
 } // anonymous namespace
 
-static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned 
long long int nWindowId, const char* pArguments)
+
+static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* 
pArguments)
 {
 SolarMutexGuard aGuard;
 
@@ -3775,6 +3781,17 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* 
/*pThis*/, unsigned long
 pWindow->Resize();
 }
 
+
+static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned 
long long int nWindowId, const char* pArguments)
+{
+lcl_sendDialogEvent(nWindowId, pArguments);
+}
+
+static void lo_sendDialogEvent(LibreOfficeKit* /*pThis*/, unsigned long long 
int nWindowId, const char* pArguments)
+{
+lcl_sendDialogEvent(nWindowId, pArguments);
+}
+
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* 
pCommand, const char* pArguments, bool bNotifyWhenFinished)
 {
 comphelper::ProfileZone aZone("doc_postUnoCommand");
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index f4244def5a6b..2279260d0e90 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -110,6 +110,11 @@ struct _LibreOfficeKitClass
  LibreOfficeKitPollCallback pPollCallback,
  LibreOfficeKitWakeCallback pWakeCallback,
  void* pData);
+
+/// @see lok::Office::sendDialogEvent
+void (*sendDialogEvent) (LibreOfficeKit* pThis,
+unsigned long long int nLOKWindowId,
+const char* pArguments);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 23b79c742c09..962270452e20 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -979,6 +979,17 @@ public:
 {
 mpThis->pClass->runLoop(mpThis, pPollCallback, pWakeCallback, pData);
 }
+
+/**
+ * Posts a dialog event for the window with given id
+ *
+ * @param nWindowId id of the window to notify
+ * @param pArguments arguments of the event.
+ */
+void sendDialogEvent(unsigned long long int nWindowId, const char* 
pArguments = NULL)
+{
+mpThis->pClass->sendDialogEvent(mpThis, nWindowId, pArguments);
+}
 };
 
 /// Factory method to create a lok::Office instance.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sc/source

2020-07-04 Thread Dennis Francis (via logerrit)
 desktop/source/lib/init.cxx  |1 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   16 +
 libreofficekit/source/gtk/lokdocview.cxx |1 
 sc/source/ui/inc/tabvwsh.hxx |4 ++
 sc/source/ui/undo/undoblk.cxx|   36 +-
 sc/source/ui/undo/undoblk2.cxx   |7 +++-
 sc/source/ui/undo/undodat.cxx|   28 +
 sc/source/ui/view/dbfunc.cxx |5 +++
 sc/source/ui/view/dbfunc3.cxx|   42 +
 sc/source/ui/view/tabvwshc.cxx   |   44 +++
 sc/source/ui/view/viewfun2.cxx   |   17 +-
 sc/source/ui/view/viewfunc.cxx   |   21 +++-
 12 files changed, 210 insertions(+), 12 deletions(-)

New commits:
commit 2c798d6715194e910cef9cad1039f464d86dc06f
Author: Dennis Francis 
AuthorDate: Tue May 19 12:42:33 2020 +0530
Commit: Dennis Francis 
CommitDate: Sat Jul 4 15:27:29 2020 +0200

lokit: add new callback type LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY

This is to notify the clients about changes in current sheet's geometry
data. Use this to notify clients of various sheet geometry invalidations
if the new feature flag scPrintTwipsMsgs is set.

Change-Id: I478d2e646606320399905d7b15881a165a53146d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96969
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 
(cherry picked from commit 7d0181f519f83b978b9040986738ad0cedc020ba)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97956
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e20fc2f5e37f..767204cf05ee 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1410,6 +1410,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_INVALIDATE_HEADER:
 case LOK_CALLBACK_WINDOW:
 case LOK_CALLBACK_CALC_FUNCTION_LIST:
+case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY:
 {
 const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(),
 [type] (const queue_type::value_type& elem) { return 
(elem.Type == type); });
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 8a741d5f62e2..dfafd94656d9 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -752,6 +752,20 @@ typedef enum
  * }
  */
 LOK_CALLBACK_FORM_FIELD_BUTTON = 49,
+
+/**
+ * This is Calc specific. Indicates that some or all of the current sheet's
+ * geometry data has changed. Clients must request a full or partial sheet
+ * geometry data set.
+ *
+ * The payload specifies what part of the sheet geometry data has changed.
+ * The payload format is:
+ * 'all|rows|columns [sizes [hidden [filtered [groups'
+ *
+ * For example, the payload 'rows sizes groups' indicates that the row 
heights
+ * and row-groups data have changed.
+ */
+LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY = 50,
 }
 LibreOfficeKitCallbackType;
 
@@ -880,6 +894,8 @@ static inline const char* lokCallbackTypeToString(int nType)
 return "LOK_CALLBACK_TAB_STOP_LIST";
 case LOK_CALLBACK_FORM_FIELD_BUTTON:
 return "LOK_CALLBACK_FORM_FIELD_BUTTON";
+case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY:
+return "LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ae2c00bcaa08..559b03fcc189 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1401,6 +1401,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_CALC_FUNCTION_LIST:
 case LOK_CALLBACK_TAB_STOP_LIST:
 case LOK_CALLBACK_FORM_FIELD_BUTTON:
+case LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY:
 {
 // TODO: Implement me
 break;
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index ee7b6e18cb49..7a9b32c32729 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -390,6 +390,10 @@ public:
 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab 
is equal to nCurrentTabIndex
 static void notifyAllViewsHeaderInvalidation(SfxViewShell* pForViewShell, 
HeaderType eHeaderType, SCTAB nCurrentTabIndex);
 static bool isAnyEditViewInRange(SfxViewShell* pForViewShell, bool 
bColumns, SCCOLROW nStart, SCCOLROW nEnd);
+/// Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose 
current tab
+/// is equal to nCurrentTabIndex
+static void notifyAllViewsSheetGeomInvalidation(SfxViewShell* 
pForViewShell, bool bColumns, bool bRows, bool bSizes,
+ 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source

2020-05-10 Thread Jan Holesovsky (via logerrit)
 desktop/source/lib/init.cxx   |6 +++---
 include/LibreOfficeKit/LibreOfficeKit.h   |2 +-
 include/LibreOfficeKit/LibreOfficeKit.hxx |4 ++--
 include/vcl/ITiledRenderable.hxx  |2 +-
 sc/inc/docuno.hxx |2 +-
 sc/source/ui/app/inputhdl.cxx |   16 ++--
 sc/source/ui/inc/inputhdl.hxx |2 +-
 sc/source/ui/unoobj/docuno.cxx|6 +++---
 8 files changed, 22 insertions(+), 18 deletions(-)

New commits:
commit c6a3f51a89449f61ad20a1787c0a3cb41fa91466
Author: Jan Holesovsky 
AuthorDate: Thu May 7 15:47:49 2020 +0200
Commit: Andras Timar 
CommitDate: Sun May 10 21:43:51 2020 +0200

formula bar: Change completeFunction() to accept string instead of index.

The 'index' is unsafe, because the set it tries to index can change in
the meantime.  Instead, use the function name and search for it in the
set, to get the recent index.

Change-Id: Id2a021c32f421057c87b6f7f4fffcc1c98009acb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93666
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93910
Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1a26cdd20b94..40e3d8b3b6a3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1136,7 +1136,7 @@ static size_t 
doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
 static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned 
nLOKWindowId,
  const int nWidth, const int nHeight);
 
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex);
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char*);
 
 
 static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis,
@@ -5405,7 +5405,7 @@ static void doc_resizeWindow(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKWin
 pWindow->SetSizePixel(Size(nWidth, nHeight));
 }
 
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex)
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char* 
pFunctionName)
 {
 SolarMutexGuard aGuard;
 SetLastExceptionMsg();
@@ -5417,7 +5417,7 @@ static void doc_completeFunction(LibreOfficeKitDocument* 
pThis, int nIndex)
 return;
 }
 
-pDoc->completeFunction(nIndex);
+pDoc->completeFunction(OUString::fromUtf8(pFunctionName));
 }
 
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 309744522004..8b68452697b3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -437,7 +437,7 @@ struct _LibreOfficeKitDocumentClass
 int viewId);
 
 /// @see lok::Document::completeFunction().
-void (*completeFunction) (LibreOfficeKitDocument* pThis, int nIndex);
+void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* 
pFunctionName);
 
 /// @see lok::Document::setWindowTextSelection
 void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 37eacdfb3649..c85143821717 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -761,9 +761,9 @@ public:
  *
  * @param nIndex is the index of the selected function
  */
-void completeFunction(int nIndex)
+void completeFunction(const char* pFunctionName)
 {
-mpDoc->pClass->completeFunction(mpDoc, nIndex);
+mpDoc->pClass->completeFunction(mpDoc, pFunctionName);
 }
 
 /**
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 32192796a08a..9e995216e573 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -287,7 +287,7 @@ public:
 virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
 
 /// @see lok::Document::completeFunction().
-virtual void completeFunction(int /*nIndex*/)
+virtual void completeFunction(const OUString& /*rFunctionName*/)
 {
 }
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 47757a7503b7..7c9c87a4f109 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -387,7 +387,7 @@ public:
 OUString getPostItsPos() override;
 
 /// @see vcl::ITiledRenderable::completeFunction().
-virtual void completeFunction(int nIndex) override;
+virtual void completeFunction(const OUString& rFunctionName) override;
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d3f8aa8ec392..83079851a552 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1637,7 +1637,7 @@ void ScInputHandler::PasteFunctionData()
 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sc/source

2019-11-26 Thread Marco Cecchetti (via logerrit)
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |8 +++
 libreofficekit/source/gtk/lokdocview.cxx |1 
 sc/source/ui/app/inputhdl.cxx|   57 +++
 4 files changed, 68 insertions(+)

New commits:
commit fa42338091ecd96b637ea52984c2642b89966f44
Author: Marco Cecchetti 
AuthorDate: Mon Nov 25 21:35:42 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 26 16:26:28 2019 +0100

lok: calc formula bar tunneling: function list callback

Added a lok callback for sending the list of functions matching the
current characters typed by the user.

Change-Id: Ia971fc55ec5eb961b4098592a8049dd0eed3ba14
Reviewed-on: https://gerrit.libreoffice.org/83750
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index db7ca361ba88..2d8f7290a05d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1187,6 +1187,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
 case LOK_CALLBACK_INVALIDATE_HEADER:
 case LOK_CALLBACK_WINDOW:
+case LOK_CALLBACK_CALC_FUNCTION_LIST:
 {
 const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(),
 [type] (const queue_type::value_type& elem) { return 
(elem.Type == type); });
@@ -1263,6 +1264,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
 case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+case LOK_CALLBACK_CALC_FUNCTION_LIST:
 {
 const int nViewId = lcl_getViewId(payload);
 removeAll(
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 829eca07e500..fb4822613724 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -709,6 +709,12 @@ typedef enum
  * the description.
  */
 LOK_CALLBACK_JSDIALOG = 46,
+
+/**
+ * Send the list of functions whose name starts with the characters entered
+ * by the user in the formula input bar.
+ */
+LOK_CALLBACK_CALC_FUNCTION_LIST = 47
 }
 LibreOfficeKitCallbackType;
 
@@ -831,6 +837,8 @@ static inline const char* lokCallbackTypeToString(int nType)
 return "LOK_CALLBACK_REFERENCE_MARKS";
 case LOK_CALLBACK_JSDIALOG:
 return "LOK_CALLBACK_JSDIALOG";
+case LOK_CALLBACK_CALC_FUNCTION_LIST:
+return "LOK_CALLBACK_CALC_FUNCTION_LIST";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index f6fc2d8160ea..d5c9b919e0a9 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1389,6 +1389,7 @@ callback (gpointer pData)
 case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
 case LOK_CALLBACK_TABLE_SELECTED:
 case LOK_CALLBACK_JSDIALOG:
+case LOK_CALLBACK_CALC_FUNCTION_LIST:
 {
 // TODO: Implement me
 break;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 950a8280a055..640ea40060e0 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1022,6 +1022,11 @@ bool lcl_hasSingleToken(const OUString& s, sal_Unicode c)
 
 void ScInputHandler::ShowArgumentsTip( OUString& rSelText )
 {
+if (comphelper::LibreOfficeKit::isActive())
+{
+return;
+}
+
 ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
 const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
 const sal_Unicode cSheetSep = 
lcl_getSheetSeparator(&pDocSh->GetDocument());
@@ -1276,6 +1281,58 @@ bool ScInputHandler::GetFuncName( OUString& aStart, 
OUString& aResult )
 
 void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & 
rFuncStrVec )
 {
+if (comphelper::LibreOfficeKit::isActive())
+{
+SfxViewShell* pViewShell = SfxViewShell::Current();
+if (pViewShell && rFuncStrVec.size())
+{
+OUString aFuncNameStr;
+OUString aDescFuncNameStr;
+OStringBuffer aPayload;
+aPayload.append("[ ");
+for (const OUString& rFunc : rFuncStrVec)
+{
+if ( rFunc[rFunc.getLength()-1] == cParenthesesReplacement )
+{
+aFuncNameStr = rFunc.copy(0, rFunc.getLength()-1);
+}
+else
+{
+aFuncNameStr = rFunc;
+}
+
+FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr());
+aDescFuncNameStr = aFuncNameStr + "()";
+sal_Int32 nNextFStart = 0;
+

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sc/source

2019-09-24 Thread Szymon Kłos (via logerrit)
 desktop/source/lib/init.cxx  |3 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   16 ++
 libreofficekit/source/gtk/lokdocview.cxx |   45 +++
 sc/source/ui/app/inputhdl.cxx|  152 +++
 sc/source/ui/app/inputwin.cxx|8 +
 sc/source/ui/inc/inputhdl.hxx|6 +
 sc/source/ui/inc/output.hxx  |   49 +++-
 sc/source/ui/miscdlgs/anyrefdg.cxx   |9 +
 sc/source/ui/view/gridwin.cxx|2 
 sc/source/ui/view/gridwin4.cxx   |7 -
 sc/source/ui/view/output.cxx |  114 +++-
 sc/source/ui/view/tabview3.cxx   |3 
 sc/source/ui/view/tabview4.cxx   |   15 ++
 13 files changed, 414 insertions(+), 15 deletions(-)

New commits:
commit 8d0869246db0b080bf45f077c484618b7c82253f
Author: Szymon Kłos 
AuthorDate: Thu Sep 13 15:26:31 2018 +0200
Commit: Michael Meeks 
CommitDate: Tue Sep 24 21:16:15 2019 +0200

Add reference marks callback

Change-Id: Ic749e138356392b0c327a30cff28055f06e23e2e
Reviewed-on: https://gerrit.libreoffice.org/79464
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 400e0e7f82d9..2af356e0bb7b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1077,7 +1077,8 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 type != LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR &&
 type != LOK_CALLBACK_CURSOR_VISIBLE &&
 type != LOK_CALLBACK_VIEW_CURSOR_VISIBLE &&
-type != LOK_CALLBACK_TEXT_SELECTION)
+type != LOK_CALLBACK_TEXT_SELECTION &&
+type != LOK_CALLBACK_REFERENCE_MARKS)
 {
 SAL_INFO("lok", "Skipping while painting [" << type << "]: [" << 
payload << "].");
 return;
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 44bf83eab205..e7ba66fe7f14 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -685,6 +685,20 @@ typedef enum
  * cell.
  */
 LOK_CALLBACK_TABLE_SELECTED = 44,
+
+/*
+ * Show reference marks from payload.
+ *
+ * Example payload:
+ * {
+ * "marks": [
+ * { "rectangle": "3825, 3315, 1245, 2010", "color": "ff", 
"part": "0" },
+ * { "rectangle": "8925, 4335, 2520, 735", "color": "ff", 
"part": "0" },
+ * ...
+ * ]
+ * }
+ */
+LOK_CALLBACK_REFERENCE_MARKS = 45,
 }
 LibreOfficeKitCallbackType;
 
@@ -803,6 +817,8 @@ static inline const char* lokCallbackTypeToString(int nType)
 return "LOK_CALLBACK_CELL_AUTO_FILL_AREA";
 case LOK_CALLBACK_TABLE_SELECTED:
 return "LOK_CALLBACK_TABLE_SELECTED";
+case LOK_CALLBACK_REFERENCE_MARKS:
+return "LOK_CALLBACK_REFERENCE_MARKS";
 }
 
 assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 4fa07b9c60c1..2e304a07ee49 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -139,6 +139,9 @@ struct LOKDocViewPrivateImpl
 /// see them, can't modify them. Key is the view id.
 std::map m_aCellViewCursors;
 gboolean m_bInDragGraphicSelection;
+/// Position, size and color of the reference marks. The current view can 
only
+/// see them, can't modify them. Key is the view id.
+std::vector> m_aReferenceMarks;
 
 /// @name Start/middle/end handle.
 ///@{
@@ -1363,6 +1366,27 @@ callback (gpointer pData)
 case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
 case LOK_CALLBACK_TABLE_SELECTED:
 break; // TODO
+case LOK_CALLBACK_REFERENCE_MARKS:
+{
+std::stringstream aStream(pCallback->m_aPayload);
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+
+priv->m_aReferenceMarks.clear();
+
+for(auto& rMark : aTree.get_child("marks"))
+{
+sal_uInt32 nColor = 
std::stoi(rMark.second.get("color"), nullptr, 16);
+std::string sRect = rMark.second.get("rectangle");
+sal_uInt32 nPart = 
std::stoi(rMark.second.get("part"));
+
+GdkRectangle aRect = payloadToRectangle(pDocView, sRect.c_str());
+priv->m_aReferenceMarks.push_back(std::pair(ViewRectangle(nPart, aRect), nColor));
+}
+
+gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+break;
+}
 default:
 g_assert(false);
 break;
@@ -1819,6 +1843,27 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
 cairo_stroke(pCairo);
 }
 
+// Draw reference marks.
+for (auto& rPair : priv->m_aReferenceMarks)
+{
+const ViewRectangle& rM

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 include/svx libreofficekit/source svx/sdi sw/inc sw/sdi sw/source

2019-08-14 Thread Tomaž Vajngerl (via logerrit)
 desktop/source/lib/init.cxx  |   16 -
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++
 include/sfx2/sfxsids.hrc |3 +
 include/svx/svxids.hrc   |1 
 libreofficekit/source/gtk/lokdocview.cxx |2 
 svx/sdi/svx.sdi  |   21 ++-
 sw/inc/crsrsh.hxx|1 
 sw/sdi/_viewsh.sdi   |4 +
 sw/source/core/crsr/crsrsh.cxx   |   81 +++
 sw/source/uibase/uiview/viewtab.cxx  |   80 ++
 10 files changed, 214 insertions(+), 4 deletions(-)

New commits:
commit 43cce4ef2cf865b2bb637e17b70102a4260295b0
Author: Tomaž Vajngerl 
AuthorDate: Wed Aug 14 18:08:18 2019 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 15 04:49:33 2019 +0200

tdf#122529 lok - table border position manipulation

This adds a new LOK callback (LOK_CALLBACK_TABLE_SELECTED) that
sends the border positions to the client when the user has the
cursor or slelection in a table.

In addition this adds a .uno:TableChangeCurrentBorderPosition
uno command, which implements changing a specific border in
the current table. Border can be either a column or a row border,
which is either at the first, middle or last position.

Change-Id: Ife7cff14d91ffc84c95c040f0b42319e3d6194b4
Reviewed-on: https://gerrit.libreoffice.org/77365
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a2a6ba56f496..2a86c3f6a94f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -368,9 +368,21 @@ std::vector 
desktop::jsonToPropertyValuesVector(const char
 else if (rType == "long")
 aValue.Value <<= OString(rValue.c_str()).toInt32();
 else if (rType == "short")
-aValue.Value <<= 
static_cast(OString(rValue.c_str()).toInt32());
+aValue.Value <<= sal_Int16(OString(rValue.c_str()).toInt32());
 else if (rType == "unsigned short")
-aValue.Value <<= 
static_cast(OString(rValue.c_str()).toUInt32());
+aValue.Value <<= 
sal_uInt16(OString(rValue.c_str()).toUInt32());
+else if (rType == "int64")
+aValue.Value <<= OString(rValue.c_str()).toInt64();
+else if (rType == "int32")
+aValue.Value <<= OString(rValue.c_str()).toInt32();
+else if (rType == "int16")
+aValue.Value <<= sal_Int16(OString(rValue.c_str()).toInt32());
+else if (rType == "uint64")
+aValue.Value <<= OString(rValue.c_str()).toUInt64();
+else if (rType == "uint32")
+aValue.Value <<= OString(rValue.c_str()).toUInt32();
+else if (rType == "uint16")
+aValue.Value <<= 
sal_uInt16(OString(rValue.c_str()).toUInt32());
 else if (rType == "[]byte")
 {
 aNodeValue = rPair.second.get_child("value", aNodeNull);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 0680c7e6c44f..43762cc54c48 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -674,6 +674,15 @@ typedef enum
  * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
  */
 LOK_CALLBACK_CELL_AUTO_FILL_AREA = 43,
+
+/**
+ * When the cursor is in a table or a table is selected in the
+ * document, this sends the table's column and row border positions
+ * to the client. If the payload is empty (empty JSON object), then
+ * no table is currently selected or the cursor is not inside a table
+ * cell.
+ */
+LOK_CALLBACK_TABLE_SELECTED = 44,
 }
 LibreOfficeKitCallbackType;
 
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 20c9e4db5c94..b535f26e7489 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -565,6 +565,9 @@ class SvxSearchItem;
 #define SID_OPEN_SMARTTAGOPTIONS(SID_SVX_START + 1062)
 #define SID_RULER_MARGIN1   (SID_SVX_START + 1063)
 #define SID_RULER_MARGIN2   (SID_SVX_START + 1064)
+#define SID_TABLE_BORDER_TYPE   (SID_SVX_START + 1065)
+#define SID_TABLE_BORDER_INDEX  (SID_SVX_START + 1066)
+#define SID_TABLE_BORDER_NEW_POSITION   (SID_SVX_START + 1067)
 
 #define FID_SVX_START   (SID_LIB_START + 500)
 #define FID_SEARCH_NOW  (FID_SVX_START + 2)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 06bec32a4869..e4851b4f2fb5 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -241,6 +241,7 @@ class SvxSetItem;
 #define SID_ATTR_TRANSFORM_ROT_Y
TypedWhichId( SID_SVX_START + 94 )
 #define SID_ATTR_

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl vcl/headless vcl/inc vcl/source

2019-04-22 Thread Ashod Nakashian (via logerrit)
 desktop/source/lib/init.cxx  |   48 ---
 include/LibreOfficeKit/LibreOfficeKit.h  |6 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx|   19 ++
 include/LibreOfficeKit/LibreOfficeKitTypes.h |6 +++
 include/vcl/lok.hxx  |   28 +++
 vcl/headless/svpinst.cxx |   32 --
 vcl/inc/headless/svpinst.hxx |3 -
 vcl/inc/svdata.hxx   |6 +++
 vcl/source/app/svapp.cxx |   19 ++
 9 files changed, 150 insertions(+), 17 deletions(-)

New commits:
commit b34786d2774b261be48de92f65a5d0aa3c32b289
Author: Ashod Nakashian 
AuthorDate: Wed Apr 17 16:23:39 2019 +0100
Commit: Ashod Nakashian 
CommitDate: Tue Apr 23 02:59:45 2019 +0200

Unipoll: add LibreOfficeKit API for polling, and an option to use it.

Change-Id: Iee7556ee52541ddbf1ef8f31e1ed4697f805a2ac
Reviewed-on: https://gerrit.libreoffice.org/70898
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0842c98ed3e4..0853678a0008 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -39,6 +39,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1513,6 +1514,11 @@ static bool lo_signDocument(LibreOfficeKit* pThis,
const unsigned char* pPrivateKeyBinary,
const int nPrivateKeyBinarySize);
 
+static void lo_runLoop(LibreOfficeKit* pThis,
+   LibreOfficeKitPollCallback pPollCallback,
+   LibreOfficeKitWakeCallback pWakeCallback,
+   void* pData);
+
 LibLibreOffice_Impl::LibLibreOffice_Impl()
 : m_pOfficeClass( gOfficeClass.lock() )
 , maThread(nullptr)
@@ -1536,6 +1542,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
 m_pOfficeClass->getVersionInfo = lo_getVersionInfo;
 m_pOfficeClass->runMacro = lo_runMacro;
 m_pOfficeClass->signDocument = lo_signDocument;
+m_pOfficeClass->runLoop = lo_runLoop;
 
 gOfficeClass = m_pOfficeClass;
 }
@@ -4491,6 +4498,16 @@ static void lo_startmain(void*)
 Application::ReleaseSolarMutex();
 }
 
+static void lo_runLoop(LibreOfficeKit* /*pThis*/,
+   LibreOfficeKitPollCallback pPollCallback,
+   LibreOfficeKitWakeCallback pWakeCallback,
+   void* pData)
+{
+SolarMutexGuard aGuard;
+vcl::lok::registerPollCallbacks(pPollCallback, pWakeCallback, pData);
+lo_startmain(nullptr);
+}
+
 static bool bInitialized = false;
 
 static void lo_status_indicator_callback(void *data, 
comphelper::LibreOfficeKit::statusIndicatorCallbackType type, int percent)
@@ -4639,7 +4656,24 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 
 // Did we do a pre-initialize
 static bool bPreInited = false;
-static bool bProfileZones = getenv("SAL_PROFILEZONE_EVENTS") != nullptr;
+static bool bUnipoll = false;
+static bool bProfileZones = false;
+
+{ // cf. string lifetime for preinit
+std::vector aOpts;
+
+// ':' delimited options - avoiding ABI change for new parameters
+const char *pOptions = getenv("SAL_LOK_OPTIONS");
+if (pOptions)
+aOpts = comphelper::string::split(OUString(pOptions, 
strlen(pOptions), RTL_TEXTENCODING_UTF8), ':');
+for (auto &it : aOpts)
+{
+if (it == "unipoll")
+bUnipoll = true;
+else if (it == "profile_events")
+bProfileZones = true;
+}
+}
 
 // What stage are we at ?
 if (pThis == nullptr)
@@ -4857,10 +4891,14 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 RequestHandler::Enable(false);
 SAL_INFO("lok", "Starting soffice_main");
 RequestHandler::SetReady(false);
-pLib->maThread = osl_createThread(lo_startmain, nullptr);
-SAL_INFO("lok", "Waiting for RequestHandler");
-RequestHandler::WaitForReady();
-SAL_INFO("lok", "RequestHandler ready -- continuing");
+if (!bUnipoll)
+{
+// Start the main thread only in non-unipoll mode (i.e. 
multithreaded).
+pLib->maThread = osl_createThread(lo_startmain, nullptr);
+SAL_INFO("lok", "Waiting for RequestHandler");
+RequestHandler::WaitForReady();
+SAL_INFO("lok", "RequestHandler ready -- continuing");
+}
 }
 
 if (eStage != SECOND_INIT)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 0e596f5067ba..f2c8dd40f1b3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -104,6

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source

2019-04-15 Thread Michael Meeks (via logerrit)
 desktop/source/lib/init.cxx  |   36 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |6 
 libreofficekit/source/gtk/lokdocview.cxx |2 +
 3 files changed, 44 insertions(+)

New commits:
commit 35aff9067796ee7b108ffee88126f837b573d3c1
Author: Michael Meeks 
AuthorDate: Fri Apr 12 21:16:38 2019 +0100
Commit: Michael Meeks 
CommitDate: Mon Apr 15 11:36:28 2019 +0200

lok: emit ProfileZone data in messages when requested.

Change-Id: I42a773e2d5b8e4deeafa8eeb2785913db36a47d7
Reviewed-on: https://gerrit.libreoffice.org/70688
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 279232e07c99..e6feceb595b2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4495,6 +4496,31 @@ static void preloadData()
 rtl::Bootstrap::set("UserInstallation", sUserPath);
 }
 
+class ProfileZoneDumper : public AutoTimer
+{
+static const int dumpTimeoutMS = 5000;
+public:
+ProfileZoneDumper() : AutoTimer( "zone dumper" )
+{
+SetTimeout(dumpTimeoutMS);
+Start();
+}
+virtual void Invoke() override
+{
+css::uno::Sequence aEvents =
+comphelper::ProfileRecording::getRecordingAndClear();
+OStringBuffer aOutput;
+for (auto &s : aEvents)
+{
+aOutput.append(OUStringToOString(s, RTL_TEXTENCODING_UTF8));
+aOutput.append("\n");
+}
+OString aChunk = aOutput.makeStringAndClear();
+if (gImpl && gImpl->mpCallback)
+gImpl->mpCallback(LOK_CALLBACK_PROFILE_FRAME, aChunk.getStr(), 
gImpl->mpCallbackData);
+}
+};
+
 static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const 
char* pUserProfileUrl)
 {
 enum {
@@ -4505,6 +4531,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 
 // Did we do a pre-initialize
 static bool bPreInited = false;
+static bool bProfileZones = getenv("SAL_PROFILEZONE_STDOUT") != nullptr;
 
 // What stage are we at ?
 if (pThis == nullptr)
@@ -4519,6 +4546,15 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 if (bInitialized)
 return 1;
 
+// Turn profile zones on early
+if (bProfileZones && eStage == SECOND_INIT)
+{
+comphelper::ProfileRecording::startRecording(true);
+new ProfileZoneDumper();
+}
+
+comphelper::ProfileZone aZone("lok-init");
+
 if (eStage == PRE_INIT)
 rtl_alloc_preInit(true);
 else if (eStage == SECOND_INIT)
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 1d55ce8583b3..ef24828988f7 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -610,6 +610,12 @@ typedef enum
  * On-load notification of the document signature status.
  */
 LOK_CALLBACK_SIGNATURE_STATUS = 40,
+
+/**
+ * Profiling tracing information single string of multiple lines
+ * containing   and zone start/stop information
+ */
+LOK_CALLBACK_PROFILE_FRAME = 41
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 1221b056c2a3..36601e385173 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -448,6 +448,8 @@ callbackTypeToString (int nType)
 return "LOK_CALLBACK_CONTEXT_CHANGED";
 case LOK_CALLBACK_SIGNATURE_STATUS:
 return "LOK_CALLBACK_SIGNATURE_STATUS";
+case LOK_CALLBACK_PROFILE_FRAME:
+return "LOK_CALLBACK_PROFILE_FRAME";
 }
 g_assert(false);
 return nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2018-11-07 Thread Libreoffice Gerrit user
 desktop/source/lib/init.cxx  |6 --
 include/LibreOfficeKit/LibreOfficeKitEnums.h |5 +
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 30bb64dc2deb53409c72bc8d4c083bbc3fd99a7d
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 30 00:20:42 2018 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 7 09:58:27 2018 +0100

lok: send signature status on document load

Change-Id: If164d0edc9343b1db5ee96a2da46c9436ddbc73f
Reviewed-on: https://gerrit.libreoffice.org/62776
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index faf1dfa40936..baa87e12ca97 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1515,8 +1515,10 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 return nullptr;
 }
 
-return new LibLODocument_Impl(xComponent);
-
+LibLODocument_Impl* pDocument = new LibLODocument_Impl(xComponent);
+int nState = doc_getSignatureState(pDocument);
+pLib->mpCallback(LOK_CALLBACK_SIGNATURE_STATUS, 
OString::number(nState).getStr(), pLib->mpCallbackData);
+return pDocument;
 }
 catch (const uno::Exception& exception)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index e34efb3576ca..cb9091711acc 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -603,6 +603,11 @@ typedef enum
  * Eg. com.sun.star.presentation.PresentationDocument TextObject
  */
 LOK_CALLBACK_CONTEXT_CHANGED = 39,
+
+/**
+ * On-load notification of the document signature status.
+ */
+LOK_CALLBACK_SIGNATURE_STATUS = 40,
 }
 LibreOfficeKitCallbackType;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit ios/LibreOfficeLight ios/UnitTest libreofficekit/qa

2018-10-10 Thread Libreoffice Gerrit user
 desktop/source/lib/init.cxx |   72 
+++---
 include/LibreOfficeKit/LibreOfficeKit.h |   12 +
 include/LibreOfficeKit/LibreOfficeKit.hxx   |   28 +++
 ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj |5 
 ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift  |   24 +--
 ios/UnitTest/UnitTest/ViewController.mm |   25 ---
 libreofficekit/qa/tilebench/tilebench.cxx   |   21 --
 7 files changed, 110 insertions(+), 77 deletions(-)

New commits:
commit 1d279e9c9123d50788cefb186663ef3842aaa8c2
Author: Tor Lillqvist 
AuthorDate: Wed Oct 10 16:17:18 2018 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Oct 10 16:25:20 2018 +0300

Move the iOS CGBitmapContextCreate() call do doc_paintTile()

Thus it now actually takes a buffer pointer also on iOS, like on Linux
and Android. Less confusing, more uniform. Add a separate iOS-specific
paintTileToCGContext() method to LibreOfficeKitDocumentClass that
takes a CGContextRef. Adapt callers correspondingly. (The
LibreOfficeLight code in particular needs the paintTileToCGContext().)

Change-Id: I81084806d37b9aac9f2b2bc03d0c262e991eec81

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bd907e407a89..5a505910bbfa 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -579,6 +579,13 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
+#ifdef IOS
+static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
+ void* rCGContext,
+ const int nCanvasWidth, const int 
nCanvasHeight,
+ const int nTilePosX, const int nTilePosY,
+ const int nTileWidth, const int 
nTileHeight);
+#endif
 static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
   unsigned char* pBuffer,
   const int nPart,
@@ -692,6 +699,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
getPartName = doc_getPartName;
 m_pDocumentClass->setPartMode = doc_setPartMode;
 m_pDocumentClass->paintTile = doc_paintTile;
+#ifdef IOS
+m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext;
+#endif
 m_pDocumentClass->paintPartTile = doc_paintPartTile;
 m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -2095,29 +2105,15 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #if defined(UNX) && !defined(MACOSX)
 
 #if defined(IOS)
-SystemGraphicsData aData;
-aData.rCGContext = reinterpret_cast(pBuffer);
-// the Size argument is irrelevant, I hope
-ScopedVclPtrInstance pDevice(&aData, Size(1, 1), 
DeviceFormat::DEFAULT);
+CGContextRef cgc = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8, nCanvasWidth*4, CGColorSpaceCreateDeviceRGB(), 
kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little);
 
-pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
+CGContextTranslateCTM(cgc, 0, nCanvasHeight);
+CGContextScaleCTM(cgc, 1, -1);
 
-pDevice->SetOutputSizePixel(Size(nCanvasWidth, nCanvasHeight));
+doc_paintTileToCGContext(pThis, (void*) cgc, nCanvasWidth, nCanvasHeight, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 
-pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
-nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+CGContextRelease(cgc);
 
-#if 0
-// Draw something at least, to see that the context as such is correctly 
set up
-CGContextSetRGBFillColor(aData.rCGContext, 0, 0, 1, .5);
-CGContextFillRect(aData.rCGContext, CGRectMake(20, 0, nCanvasWidth-20, 
20));
-CGContextSetRGBFillColor(aData.rCGContext, 0, 1, 1, .5);
-CGContextFillRect(aData.rCGContext, CGRectMake(nCanvasWidth-20, 20, 20, 
nCanvasHeight-20));
-CGContextSetRGBFillColor(aData.rCGContext, 0, 1, 0, .5);
-CGContextFillRect(aData.rCGContext, CGRectMake(0, nCanvasHeight-20, 
nCanvasWidth-20, 20));
-CGContextSetRGBFillColor(aData.rCGContext, 0, 1, 1, .5);
-CGContextFillRect(aData.rCGContext, CGRectMake(0, 0, 20, 
nCanvasHeight-20));
-#endif
 #else
 ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT) ;
 
@@ -2139,6 +2135,44 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #endif
 }
 
+#ifdef IOS
+
+static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis,
+ void* rCGContext,
+ const int nCanvasWidth, const int 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sc/inc sc/qa sc/source sd/qa sd/source sw/inc sw/qa sw/source vcl/source

2018-02-14 Thread Pranav Kant
 desktop/source/lib/init.cxx|   36 +
 include/LibreOfficeKit/LibreOfficeKit.h|1 
 include/LibreOfficeKit/LibreOfficeKit.hxx  |6 ++--
 include/vcl/ITiledRenderable.hxx   |   12 +++-
 sc/inc/docuno.hxx  |6 ++--
 sc/qa/unit/tiledrendering/tiledrendering.cxx   |6 ++--
 sc/source/ui/unoobj/docuno.cxx |   34 ++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |6 ++--
 sd/source/ui/inc/unomodel.hxx  |3 --
 sd/source/ui/unoidl/unomodel.cxx   |   36 ++---
 sw/inc/unotxdoc.hxx|4 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx |6 ++--
 sw/source/uibase/uno/unotxdoc.cxx  |   30 ++--
 vcl/source/window/window.cxx   |8 -
 14 files changed, 96 insertions(+), 98 deletions(-)

New commits:
commit 712540224d7c5c8cdb4a5214e2d7963a314c1928
Author: Pranav Kant 
Date:   Wed Feb 14 17:33:16 2018 +0530

lok IME: support dialogs as well

Change-Id: Ic78da45dadaa5a4e1ca78e20d04974108581121e
Reviewed-on: https://gerrit.libreoffice.org/49714
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bc788d243b9e..8d0611c21d07 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -543,6 +543,7 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
  int nCharCode,
  int nKeyCode);
 static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis,
+  unsigned nWindowId,
   int nType,
   const char* pText);
 static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis,
@@ -2298,18 +2299,43 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* 
pThis, int nType, int nChar
 pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
 }
 
-static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, int 
nType, const char* pText)
+static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned 
nWindowId, int nType, const char* pText)
 {
 SolarMutexGuard aGuard;
+VclPtr pWindow;
+if (nWindowId == 0)
+{
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+gImpl->maLastExceptionMsg = "Document doesn't support tiled 
rendering";
+return;
+}
+pWindow = pDoc->getDocWindow();
+}
+else
+{
+pWindow = vcl::Window::FindLOKWindow(nWindowId);
+}
 
-ITiledRenderable* pDoc = getTiledRenderable(pThis);
-if (!pDoc)
+if (!pWindow)
 {
-gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+gImpl->maLastExceptionMsg = "No window found for window id: " + 
OUString::number(nWindowId);
 return;
 }
 
-pDoc->postExtTextInputEvent(nType, OUString::fromUtf8(OString(pText, 
strlen(pText;
+switch (nType)
+{
+case LOK_EXT_TEXTINPUT:
+pWindow->PostExtTextInputEvent(VclEventId::ExtTextInput,
+   OUString::fromUtf8(OString(pText, 
strlen(pText;
+break;
+case LOK_EXT_TEXTINPUT_END:
+pWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, "");
+break;
+default:
+assert(false && "Unhandled External Text input event!");
+}
 }
 
 static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned 
nLOKWindowId, int nType, int nCharCode, int nKeyCode)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index ebc112fb7bd5..7492fcc7a561 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -302,6 +302,7 @@ struct _LibreOfficeKitDocumentClass
 
 /// @see lok::Document::postExtTextInputEvent
 void (*postExtTextInputEvent) (LibreOfficeKitDocument* pThis,
+   unsigned nWindowId,
int nType,
const char* pText);
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 0983560898a4..55e29ebda1c8 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -540,12 +540,14 @@ public:
 /**
  * Post the text input from external input window, like IME
  *
+ * @param nWindowId Specify the window id to post the input event to. If
+ * nWindow is 0, the event is posted into the document
  * @param nType see LibreOfficeKitExtTextInputType
  * @param pText Text for LOK_EXT_TEXTINPUT
  */
-void postExtTextInputEvent(int nType, const char* pText)
+void postExtTextInputEve

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2018-01-25 Thread Miklos Vajna
 desktop/source/lib/init.cxx   |   95 ++
 include/LibreOfficeKit/LibreOfficeKit.hxx |5 -
 2 files changed, 95 insertions(+), 5 deletions(-)

New commits:
commit 027abe22f11a8c7dac38697f02d03156bb91a8a1
Author: Miklos Vajna 
Date:   Wed Jan 24 22:05:17 2018 +0100

desktop: always clear LOK error message on success

Change-Id: Idefdbd3d9ae19f7cf5889017b111c12620ab08c2
Reviewed-on: https://gerrit.libreoffice.org/48541
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b3631ba3ade7..338d11221566 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1332,6 +1332,7 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 SolarMutexGuard aGuard;
 
 LibLibreOffice_Impl* pLib = static_cast(pThis);
+pLib->maLastExceptionMsg.clear();
 
 OUString aURL(getAbsoluteURL(pURL));
 if (aURL.isEmpty())
@@ -1435,6 +1436,7 @@ static int lo_runMacro(LibreOfficeKit* pThis, const char 
*pURL)
 SolarMutexGuard aGuard;
 
 LibLibreOffice_Impl* pLib = static_cast(pThis);
+pLib->maLastExceptionMsg.clear();
 
 OUString sURL( pURL, strlen(pURL), RTL_TEXTENCODING_UTF8 );
 if (sURL.isEmpty())
@@ -1525,6 +1527,7 @@ static void lo_registerCallback (LibreOfficeKit* pThis,
 SolarMutexGuard aGuard;
 
 LibLibreOffice_Impl* pLib = static_cast(pThis);
+pLib->maLastExceptionMsg.clear();
 
 pLib->mpCallback = pCallback;
 pLib->mpCallbackData = pData;
@@ -1533,6 +1536,8 @@ static void lo_registerCallback (LibreOfficeKit* pThis,
 static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const 
char* pFormat, const char* pFilterOptions)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 LibLODocument_Impl* pDocument = static_cast(pThis);
 
@@ -1660,6 +1665,8 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, 
const char* sUrl, const cha
 static void doc_iniUnoCommands ()
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 OUString sUnoCommands[] =
 {
@@ -1799,6 +1806,8 @@ static void doc_iniUnoCommands ()
 static int doc_getDocumentType (LibreOfficeKitDocument* pThis)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 LibLODocument_Impl* pDocument = static_cast(pThis);
 
@@ -1851,6 +1860,8 @@ static int doc_getParts (LibreOfficeKitDocument* pThis)
 static int doc_getPart (LibreOfficeKitDocument* pThis)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1865,6 +1876,8 @@ static int doc_getPart (LibreOfficeKitDocument* pThis)
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1879,6 +1892,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, 
int nPart)
 static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1898,6 +1913,8 @@ static char* 
doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
 static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1917,6 +1934,8 @@ static char* doc_getPartName(LibreOfficeKitDocument* 
pThis, int nPart)
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1937,6 +1956,8 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
 int nPartMode)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1976,6 +1997,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
   const int nTileWidth, const int nTileHeight)
 {
 SolarMutexGuard aGuard;
+if (gImpl)
+gImpl->maLastExceptionMsg.clear();
 
 SAL_INFO( "lok.tiledrendering", "paintTile: painting [" << nTileWidth << 
"x" << nTileHeight <<
   "]@(" << nTilePosX << ", " << nTilePosY << ") to [" <<
@@ -2028,6 +2051,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* 
pThis,
   const int nTileWidth, const int nTileHeight)
 {
 SolarMutexGuard aGuard;
+if (gImp

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sc/source

2017-11-30 Thread Marco Cecchetti
 desktop/source/lib/init.cxx   |   33 ++
 include/LibreOfficeKit/LibreOfficeKit.h   |4 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx |   13 +++
 include/vcl/ITiledRenderable.hxx  |   26 +++
 sc/source/ui/unoobj/docuno.cxx|   27 +++-
 5 files changed, 59 insertions(+), 44 deletions(-)

New commits:
commit f7c841f56f7c1e9b7757ba3a5c22ab499ac1a48e
Author: Marco Cecchetti 
Date:   Tue Nov 28 23:08:34 2017 +0100

lok: calc: set outline state

use a specific message from the client for set the visibility state of
a group instead of hijacking the update row/column header message

Change-Id: I9634c24bbffaddc916c8ad716ac6d5d31e735a55
Reviewed-on: https://gerrit.libreoffice.org/45445
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f58714623fbe..c4b922c75332 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -599,6 +599,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis,
 int nTileTwipWidth,
 int nTileTwipHeight);
 static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, 
int nY, int nWidth, int nHeight);
+static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, 
int nLevel, int nIndex, bool bHidden);
 static int doc_createView(LibreOfficeKitDocument* pThis);
 static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId);
 static void doc_setView(LibreOfficeKitDocument* pThis, int nId);
@@ -656,6 +657,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
getCommandValues = doc_getCommandValues;
 m_pDocumentClass->setClientZoom = doc_setClientZoom;
 m_pDocumentClass->setClientVisibleArea = doc_setClientVisibleArea;
+m_pDocumentClass->setOutlineState = doc_setOutlineState;
 
 m_pDocumentClass->createView = doc_createView;
 m_pDocumentClass->destroyView = doc_destroyView;
@@ -2986,10 +2988,6 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 int nY = 0;
 int nWidth = 0;
 int nHeight = 0;
-bool bColumn = false;
-int nLevel = -1;
-int nGroupIndex = -2;
-bool bHidden = false;
 OString aArguments = 
aCommand.copy(aViewRowColumnHeaders.getLength() + 1);
 sal_Int32 nParamIndex = 0;
 do
@@ -3015,23 +3013,10 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 nWidth = aValue.toInt32();
 else if (aKey == "height")
 nHeight = aValue.toInt32();
-else if (aKey == "columnOutline")
-bColumn = aValue.toBoolean();
-else if (aKey == "groupLevel")
-nLevel = aValue.toInt32();
-else if (aKey == "groupIndex")
-nGroupIndex = aValue.toInt32();
-else if (aKey == "groupHidden")
-bHidden = aValue.toBoolean();
 }
 while (nParamIndex >= 0);
 
 aRectangle = tools::Rectangle(nX, nY, nX + nWidth, nY + nHeight);
-
-if (nGroupIndex != -2)
-{
-pDoc->setOutlineState(bColumn, nLevel, nGroupIndex, bHidden);
-}
 }
 
 OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle);
@@ -3133,6 +3118,20 @@ static void 
doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int
 pDoc->setClientVisibleArea(aRectangle);
 }
 
+static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, 
int nLevel, int nIndex, bool bHidden)
+{
+SolarMutexGuard aGuard;
+
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+return;
+}
+
+pDoc->setOutlineState(bColumn, nLevel, nIndex, bHidden);
+}
+
 static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* 
/*pThis*/)
 {
 SolarMutexGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index e623ecb2508e..68b5f7338032 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -224,9 +224,13 @@ struct _LibreOfficeKitDocumentClass
 int nTilePixelHeight,
 int nTileTwipWidth,
 int nTileTwipHeight);
+
 /// @see lok::Document::setVisibleArea).
 void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int 
nY, int nWidth, int nHeight);
 
+/// @see lok::Document::setOutlineState).
+void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int 
nLevel, int nIndex, bool bHidden);
+
 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa sw/inc sw/source

2017-11-08 Thread Pranav Kant
 desktop/source/lib/init.cxx |   46 +---
 include/LibreOfficeKit/LibreOfficeKit.h |   10 +++-
 include/LibreOfficeKit/LibreOfficeKit.hxx   |   40 ++---
 include/vcl/IDialogRenderable.hxx   |5 +-
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |6 +-
 sw/inc/unotxdoc.hxx |3 -
 sw/source/uibase/uno/unotxdoc.cxx   |   24 --
 7 files changed, 91 insertions(+), 43 deletions(-)

New commits:
commit 25822ff930edd13442442a47714755a99fbb9992
Author: Pranav Kant 
Date:   Sun Nov 5 18:40:52 2017 +0530

lokdialog: Move getting dialog information in separate LOK call

Using outparameters to get the dialog information with the paintDialog
call was quite confusing.

Change-Id: Ief331b251dc66e66084b827ce5b025ba6c9ce7d2
Reviewed-on: https://gerrit.libreoffice.org/44473
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d126da925b2b..a5df72c72ac9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -610,7 +610,12 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, const int x, const int y, unsigned char* pBuffer, char** 
pDialogTitle, int* nWidth, int* nHeight);
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer,
+const int nX, const int nY,
+const int nWidth, const int nHeight);
+
+static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, const char* 
pDialogId,
+  char** pDialogTitle, int* nWidth, int* nHeight);
 
 static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, const 
char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
@@ -664,6 +669,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
getPartHash = doc_getPartHash;
 
 m_pDocumentClass->paintDialog = doc_paintDialog;
+m_pDocumentClass->getDialogInfo = doc_getDialogInfo;
 m_pDocumentClass->paintActiveFloatingWindow = 
doc_paintActiveFloatingWindow;
 
 gDocumentClass = m_pDocumentClass;
@@ -3091,11 +3097,29 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* /*pTh
 return nullptr;
 }
 
+static void doc_getDialogInfo(LibreOfficeKitDocument* pThis, const char* 
pDialogId,
+  char** pDialogTitle, int* nWidth, int* nHeight)
+{
+SolarMutexGuard aGuard;
+
+IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis);
+vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId);
+OUString aDialogTitle;
+pDialogRenderable->getDialogInfo(aDialogID, aDialogTitle, *nWidth, 
*nHeight);
+
+// copy dialog title
+if (!aDialogTitle.isEmpty())
+{
+OString aTitleString = OUStringToOString(aDialogTitle, 
RTL_TEXTENCODING_UTF8);
+*pDialogTitle = static_cast(malloc(aTitleString.getLength() + 
1));
+strcpy(*pDialogTitle, aTitleString.getStr());
+}
+}
+
 static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId,
-const int x, const int y,
 unsigned char* pBuffer,
-char** pDialogTitle,
-int* nWidth, int* nHeight)
+const int nX, const int nY,
+const int nWidth, const int nHeight)
 {
 SolarMutexGuard aGuard;
 
@@ -3104,24 +3128,16 @@ static void doc_paintDialog(LibreOfficeKitDocument* 
pThis, const char* pDialogId
 ScopedVclPtrInstance pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
 pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
 
-pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(*nWidth, *nHeight), 
Fraction(1.0), Point(), pBuffer);
+pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), 
Fraction(1.0), Point(), pBuffer);
 
 vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId);
 
 MapMode aMapMode(pDevice->GetMapMode());
-aMapMode.SetOrigin(Point(-x, -y));
+aMapMode.SetOrigin(Point(-nX, -nY));
 pDevice->SetMapMode(aMapMode);
 
 comphelper::LibreOfficeKit::setDialogPainting(true);
-// copy the title of the dialog to outparam
-OUString aDialogTitle;
-pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), aDialogTitle, 
*nWidth, *nHeight);
-if (!aDialogTitle.isEmpty())
-{
-OString aTitleString = OUStringToOString(aDialogTitle, 
RTL_TEXTENCODING_UTF8);
-*pDialogTitle = static_cast(malloc(aTitleString.getLength() + 
1));
- 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 include/vcl libreofficekit/qa sfx2/source sw/inc sw/source vcl/source

2017-11-08 Thread Pranav Kant
 desktop/source/lib/init.cxx |   13 
-
 include/LibreOfficeKit/LibreOfficeKit.h |6 ++
 include/LibreOfficeKit/LibreOfficeKit.hxx   |   14 
+-
 include/sfx2/lokhelper.hxx  |2 
 include/vcl/IDialogRenderable.hxx   |2 
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx|   19 

 libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx|2 
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   22 
+++---
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx |2 
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |   21 
-
 sfx2/source/view/lokhelper.cxx  |   11 
+++--
 sw/inc/unotxdoc.hxx |2 
 sw/source/uibase/uno/unotxdoc.cxx   |4 -
 vcl/source/control/ctrl.cxx |4 +
 vcl/source/window/dialog.cxx|6 +-
 15 files changed, 100 insertions(+), 30 deletions(-)

New commits:
commit 446a37ece35dbe4c442f0679dd1cb4df79ed87a7
Author: Pranav Kant 
Date:   Sun Nov 5 14:01:42 2017 +0530

lokdialog: Support painting parts of the dialog

Pass the dimensions of the region to the paintDialog call to paint only
that much of the region in the dialog.

The DIALOG_INVALIDATE callback also returns a 'rectangle' field now in
the payload that tells the region of the dialog invalidated. It can be
used in combination with the new paintDialog call then to paint only the
invalidated region in the dialog.

Change-Id: Iebb228865c71684e0f75dd01271b71ae41a0f906
Reviewed-on: https://gerrit.libreoffice.org/44472
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 891911429438..d126da925b2b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -610,7 +610,7 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* 
nHeight);
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, const int x, const int y, unsigned char* pBuffer, char** 
pDialogTitle, int* nWidth, int* nHeight);
 
 static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, const 
char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
@@ -3091,7 +3091,11 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* /*pTh
 return nullptr;
 }
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* 
nHeight)
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId,
+const int x, const int y,
+unsigned char* pBuffer,
+char** pDialogTitle,
+int* nWidth, int* nHeight)
 {
 SolarMutexGuard aGuard;
 
@@ -3104,8 +3108,11 @@ static void doc_paintDialog(LibreOfficeKitDocument* 
pThis, const char* pDialogId
 
 vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId);
 
-comphelper::LibreOfficeKit::setDialogPainting(true);
+MapMode aMapMode(pDevice->GetMapMode());
+aMapMode.SetOrigin(Point(-x, -y));
+pDevice->SetMapMode(aMapMode);
 
+comphelper::LibreOfficeKit::setDialogPainting(true);
 // copy the title of the dialog to outparam
 OUString aDialogTitle;
 pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), aDialogTitle, 
*nWidth, *nHeight);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index cc4752e04ab2..cb0f17a41655 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -268,7 +268,11 @@ struct _LibreOfficeKitDocumentClass
 
 /// Paints dialog with given dialog id to the buffer
 /// @see lok::Document::paintDialog().
-void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, 
unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight);
+void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId,
+ const int x, const int y,
+ unsigned char* pBuffer,
+ char** pDialogTitle,
+ int* nWidth, int* nHeight);
 
 /// @see lok::Document::paintActiveFloatingWindow().
 void (*pain

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa sw/inc sw/source

2017-10-28 Thread Pranav Kant
 desktop/source/lib/init.cxx |   15 ---
 include/LibreOfficeKit/LibreOfficeKit.h |2 +-
 include/LibreOfficeKit/LibreOfficeKit.hxx   |5 -
 include/vcl/IDialogRenderable.hxx   |2 +-
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   15 ++-
 sw/inc/unotxdoc.hxx |2 +-
 sw/source/uibase/uno/unotxdoc.cxx   |5 -
 7 files changed, 33 insertions(+), 13 deletions(-)

New commits:
commit fdb56a741a66e152f0f120d00bf62049fe566a79
Author: Pranav Kant 
Date:   Thu Oct 26 18:31:39 2017 -0700

lokdialog: Tunnel dialog title to lokclient as outparam

Change-Id: I1beb5ab3f06debdca7ebf999af7ac879a41ea47e
Reviewed-on: https://gerrit.libreoffice.org/43959
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bd09ed1dd987..906e271f5c30 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -610,7 +610,7 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* 
nHeight);
 
 static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, const 
char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
 
@@ -3089,7 +3089,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER 
LibreOfficeKitDocument* /*pTh
 return nullptr;
 }
 
-static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight)
+static void doc_paintDialog(LibreOfficeKitDocument* pThis, const char* 
pDialogId, unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* 
nHeight)
 {
 SolarMutexGuard aGuard;
 
@@ -3103,7 +3103,16 @@ static void doc_paintDialog(LibreOfficeKitDocument* 
pThis, const char* pDialogId
 vcl::DialogID aDialogID = OUString::createFromAscii(pDialogId);
 
 comphelper::LibreOfficeKit::setDialogPainting(true);
-pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), *nWidth, 
*nHeight);
+
+// copy the title of the dialog to outparam
+OUString aDialogTitle;
+pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), aDialogTitle, 
*nWidth, *nHeight);
+if (!aDialogTitle.isEmpty())
+{
+OString aTitleString = OUStringToOString(aDialogTitle, 
RTL_TEXTENCODING_UTF8);
+*pDialogTitle = static_cast(malloc(aTitleString.getLength() + 
1));
+strcpy(*pDialogTitle, aTitleString.getStr());
+}
 comphelper::LibreOfficeKit::setDialogPainting(false);
 }
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index cf030a7f69e8..cc4752e04ab2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -268,7 +268,7 @@ struct _LibreOfficeKitDocumentClass
 
 /// Paints dialog with given dialog id to the buffer
 /// @see lok::Document::paintDialog().
-void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, 
unsigned char* pBuffer, int* nWidth, int* nHeight);
+void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId, 
unsigned char* pBuffer, char** pDialogTitle, int* nWidth, int* nHeight);
 
 /// @see lok::Document::paintActiveFloatingWindow().
 void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, const 
char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index e573a88249a9..ad5e6d74e878 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -162,16 +162,19 @@ public:
  *
  * @param pDialogId Unique dialog id to be painted
  * @param pBuffer Buffer with enough memory allocated to render any dialog
+ * @param pDialogTitle output parameter pointing to a dialog title
+ * string. Should be freed by the caller.
  * @param nWidth output parameter returning the width of the rendered 
dialog.
  * @param nHeight output parameter returning the height of the rendered 
dialog
  */
 void paintDialog(const char* pDialogId,
  unsigned char* pBuffer,
+ char** pDialogTitle,
  int& nWidth,
  int& nHeight)
 {
 return mpDoc->pClass->paintDialog(mpDoc, pDialogId, pBuffer,
-  &nWidth, &nHeight);
+  pDialogTitle, &nWidth, &nH

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2017-09-14 Thread Jan Holesovsky
 desktop/source/lib/init.cxx   |8 
 desktop/source/lib/lokandroid.cxx |2 +-
 include/LibreOfficeKit/LibreOfficeKit.h   |   13 -
 include/LibreOfficeKit/LibreOfficeKit.hxx |2 +-
 4 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 5bcc79e825d542c40c9ee0f48d1d72ea9aa53c54
Author: Jan Holesovsky 
Date:   Thu Sep 14 09:23:46 2017 +0200

[API CHANGE] lok: Don't use 'bool' and 'uint64_t' in the stable API.

This is a f70e0ec6b3c61a7c7caa469949b0ac8016c89854 follow-up.

Change-Id: I4acf00a6da85ed14be4ed0ca20d541a9441736e7
Reviewed-on: https://gerrit.libreoffice.org/42266
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ad88ab270252..6e8136d740a0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1098,12 +1098,12 @@ static voidlo_registerCallback 
(LibreOfficeKit* pThis,
 LibreOfficeKitCallback 
pCallback,
 void* pData);
 static char* lo_getFilterTypes(LibreOfficeKit* pThis);
-static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t features);
+static voidlo_setOptionalFeatures(LibreOfficeKit* pThis, 
unsigned long long features);
 static voidlo_setDocumentPassword(LibreOfficeKit* pThis,
const char* pURL,
const char* pPassword);
 static char*   lo_getVersionInfo(LibreOfficeKit* pThis);
-static boollo_runMacro  (LibreOfficeKit* pThis, const 
char* pURL);
+static int lo_runMacro  (LibreOfficeKit* pThis, const 
char* pURL);
 
 LibLibreOffice_Impl::LibLibreOffice_Impl()
 : m_pOfficeClass( gOfficeClass.lock() )
@@ -1262,7 +1262,7 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 return nullptr;
 }
 
-static bool lo_runMacro( LibreOfficeKit* pThis, const char *pURL)
+static int lo_runMacro(LibreOfficeKit* pThis, const char *pURL)
 {
 SolarMutexGuard aGuard;
 
@@ -3014,7 +3014,7 @@ static char* lo_getFilterTypes(LibreOfficeKit* pThis)
 return strdup(aStream.str().c_str());
 }
 
-static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t const 
features)
+static void lo_setOptionalFeatures(LibreOfficeKit* pThis, unsigned long long 
const features)
 {
 SolarMutexGuard aGuard;
 
diff --git a/desktop/source/lib/lokandroid.cxx 
b/desktop/source/lib/lokandroid.cxx
index 3055d38957da..b85619d3dad8 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -163,7 +163,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL 
Java_org_libreoffice_kit_Office_setOption
 {
 LibreOfficeKit* pLibreOfficeKit = getHandle(pEnv, aObject);
 
-uint64_t pOptions = (uint64_t)options;
+unsigned long long pOptions = (unsigned long long)options;
 
 pLibreOfficeKit->pClass->setOptionalFeatures(pLibreOfficeKit, pOptions);
 }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 34b67ac092b1..0633f46f97e2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -12,11 +12,14 @@
 
 #include 
 
-#ifndef _WIN32
 // the unstable API needs C99's bool
-# include 
+// TODO remove the C99 types from the API before making stable
+#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+# ifndef _WIN32
+#  include 
+# endif
+# include 
 #endif
-#include 
 
 #include 
 
@@ -73,7 +76,7 @@ struct _LibreOfficeKitClass
 /** @see lok::Office::setOptionalFeatures().
 @since LibreOffice 6.0
  */
-void (*setOptionalFeatures)(LibreOfficeKit* pThis, uint64_t features);
+void (*setOptionalFeatures)(LibreOfficeKit* pThis, unsigned long long 
features);
 
 /** @see lok::Office::setDocumentPassword().
 @since LibreOffice 6.0
@@ -90,7 +93,7 @@ struct _LibreOfficeKitClass
 /** @see lok::Office::runMacro().
 @since LibreOffice 6.0
  */
-bool (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
+int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 18122a7e3b05..10e0f0f199d0 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -554,7 +554,7 @@ public:
  * @since LibreOffice 6.0
  * @see LibreOfficeKitOptionalFeatures
  */
-void setOptionalFeatures(uint64_t features)
+void setOptionalFeatures(unsigned long long features)
 {
 return mpThis

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 include/svtools include/svx include/vcl libreofficekit/qa libreofficekit/source sfx2/source svtools/source svx/sdi sv

2017-08-17 Thread Aditya Dewan
 desktop/source/lib/init.cxx  |   18 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   19 
 include/sfx2/sfxsids.hrc |2 
 include/svtools/ruler.hxx|1 
 include/svx/ruler.hxx|9 +++-
 include/svx/svxids.hrc   |1 
 include/vcl/ITiledRenderable.hxx |9 +++-
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx|1 
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |8 +++
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx |2 
 libreofficekit/qa/gtktiledviewer/gtv.ui  |   14 ++
 libreofficekit/source/gtk/lokdocview.cxx |   16 +++
 sfx2/source/appl/appuno.cxx  |2 
 svtools/source/control/ruler.cxx |5 ++
 svx/sdi/svx.sdi  |   18 
 svx/source/dialog/svxruler.cxx   |   13 +
 sw/inc/unotxdoc.hxx  |3 +
 sw/sdi/_viewsh.sdi   |4 +
 sw/source/uibase/inc/swruler.hxx |2 
 sw/source/uibase/misc/swruler.cxx|   33 ++-
 sw/source/uibase/uiview/viewtab.cxx  |   19 
 sw/source/uibase/uno/unotxdoc.cxx|8 +++
 22 files changed, 202 insertions(+), 5 deletions(-)

New commits:
commit d64a7f4ba80fa2a0a0ad2bddc6906ab6b78a23c8
Author: Aditya Dewan 
Date:   Sat Jul 15 21:47:14 2017 +0530

implementing callback for ruler invalidation

adding commands to fetch and changee ruler state
'.uno:RulerState' and '.uno:RulerStateChange'

Change-Id: I66107039a7ae5893691feb45c8ab2e4aa476ea76
Reviewed-on: https://gerrit.libreoffice.org/40727
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c713b4b3831a..fca53b297529 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -805,6 +806,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_CURSOR_VISIBLE:
 case LOK_CALLBACK_SET_PART:
 case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+case LOK_CALLBACK_RULER_UPDATE:
 {
 removeAll([type] (const queue_type::value_type& elem) { return 
(elem.first == type); });
 }
@@ -2044,6 +2046,18 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis)
 return strdup(aComments.toUtf8().getStr());
 }
 
+static char* getRulerState(LibreOfficeKitDocument* pThis)
+{
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+return nullptr;
+}
+OUString state = pDoc->getRulerState();
+return strdup(state.toUtf8().getStr());
+}
+
 static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int 
nCharCode, int nKeyCode)
 {
 SolarMutexGuard aGuard;
@@ -2651,6 +2665,10 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 {
 return getPostItsPos(pThis);
 }
+else if (aCommand == ".uno:RulerState")
+{
+return getRulerState(pThis);
+}
 else if (aCommand.startsWith(aViewRowColumnHeaders))
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 300b71bb01ff..c3b71f3f1aad 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -504,7 +504,24 @@ typedef enum
 /**
  * The text content of the address field in Calc.
  */
-LOK_CALLBACK_CELL_ADDRESS = 34
+LOK_CALLBACK_CELL_ADDRESS = 34,
+/**
+ * The key ruler related properties on change are reported by this.
+ *
+ * The payload format is:
+ *
+ * {
+ *  "margin1": "...",
+ *  "margin2": "...",
+ *  "leftOffset": "...",
+ *  "pageOffset": "...",
+ *  "pageWidth": "...",
+ *  "unit": "..."
+ *  }
+ *
+ * Here all aproperties are same as described in svxruler.
+ */
+LOK_CALLBACK_RULER_UPDATE = 35
 
 }
 LibreOfficeKitCallbackType;
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index d8703674810e..ea38db1e3cea 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -541,6 +541,8 @@
 #define SID_COMP_BIBLIOGRAPHY   (SID_SVX_START + 880)
 #define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934)
 #define SID_OPEN_SMARTTAGOPTIONS

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/qa libreofficekit/source sc/source

2017-05-11 Thread Marco Cecchetti
 desktop/source/lib/init.cxx |3 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h|7 ++
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   52 
 libreofficekit/source/gtk/lokdocview.cxx|   28 ++
 sc/source/ui/app/inputhdl.cxx   |   21 +---
 5 files changed, 103 insertions(+), 8 deletions(-)

New commits:
commit 9cc9300bc20e9367728aa4b7ec3a789fdd274aff
Author: Marco Cecchetti 
Date:   Mon May 8 00:26:08 2017 +0200

lok: sc: notify cell cursor position to address control in client

A new callback has been introduced for notifying the client:
LOK_CALLBACK_CELL_ADDRESS

Change-Id: I40b38a3cb8fb658c3f00332d56cfcbaf98e13771
Reviewed-on: https://gerrit.libreoffice.org/37357
Reviewed-by: pranavk 
Tested-by: pranavk 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4003d4565df5..b090ae4e377c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -673,6 +673,7 @@ 
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li
 m_states.emplace(LOK_CALLBACK_MOUSE_POINTER, "NIL");
 m_states.emplace(LOK_CALLBACK_CELL_CURSOR, "NIL");
 m_states.emplace(LOK_CALLBACK_CELL_FORMULA, "NIL");
+m_states.emplace(LOK_CALLBACK_CELL_ADDRESS, "NIL");
 m_states.emplace(LOK_CALLBACK_CURSOR_VISIBLE, "NIL");
 m_states.emplace(LOK_CALLBACK_SET_PART, "NIL");
 
@@ -752,6 +753,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_CELL_CURSOR:
 case LOK_CALLBACK_CELL_VIEW_CURSOR:
 case LOK_CALLBACK_CELL_FORMULA:
+case LOK_CALLBACK_CELL_ADDRESS:
 case LOK_CALLBACK_CURSOR_VISIBLE:
 case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
 case LOK_CALLBACK_SET_PART:
@@ -812,6 +814,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_MOUSE_POINTER:
 case LOK_CALLBACK_CELL_CURSOR:
 case LOK_CALLBACK_CELL_FORMULA:
+case LOK_CALLBACK_CELL_ADDRESS:
 case LOK_CALLBACK_CURSOR_VISIBLE:
 case LOK_CALLBACK_SET_PART:
 case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index dffc728eb641..300b71bb01ff 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -500,7 +500,12 @@ typedef enum
  *
  * The payload says if we are invalidating a row or column header.
  */
-LOK_CALLBACK_INVALIDATE_HEADER = 33
+LOK_CALLBACK_INVALIDATE_HEADER = 33,
+/**
+ * The text content of the address field in Calc.
+ */
+LOK_CALLBACK_CELL_ADDRESS = 34
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx 
b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index ed1d7f10a694..14bb2c1a2b6d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -138,6 +138,7 @@ public:
 GtkToolItem* m_pInsertAnnotation;
 GtkToolItem* m_pDeleteComment;
 GtkToolItem* m_pTrackChanges;
+GtkWidget* m_pAddressbarEntry;
 GtkWidget* m_pFormulabarEntry;
 GtkWidget* m_pScrolledWindow;
 std::map m_aToolItemCommandNames;
@@ -590,6 +591,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* 
pDocView, GdkEventConfi
 }
 gtk_widget_show(rWindow.m_pColumnBar->m_pDrawingArea);
 gtk_widget_queue_draw(rWindow.m_pColumnBar->m_pDrawingArea);
+gtk_widget_show(rWindow.m_pAddressbarEntry);
 gtk_widget_show(rWindow.m_pFormulabarEntry);
 
 }
@@ -1402,6 +1404,39 @@ static gboolean signalFindbar(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointer
 return FALSE;
 }
 
+/// Handles the key-press-event of the address entry widget.
+static gboolean signalAddressbar(GtkWidget* pWidget, GdkEventKey* pEvent, 
gpointer /*pData*/)
+{
+TiledWindow& rWindow = lcl_getTiledWindow(pWidget);
+switch(pEvent->keyval)
+{
+case GDK_KEY_Return:
+{
+GtkEntry* pEntry = GTK_ENTRY(rWindow.m_pAddressbarEntry);
+const char* pText = gtk_entry_get_text(pEntry);
+
+boost::property_tree::ptree aTree;
+aTree.put(boost::property_tree::ptree::path_type("ToPoint/type", 
'/'), "string");
+aTree.put(boost::property_tree::ptree::path_type("ToPoint/value", 
'/'), pText);
+std::stringstream aStream;
+boost::property_tree::write_json(aStream, aTree);
+std::string aArguments = aStream.str();
+
+lok_doc_view_post_command(LOK_DOC_VIEW(rWindow.m_pDocView), 
".uno:GoToCell", aArguments.c_str(), false);
+gtk_widget_grab_focus(rWindow.m_pDocView);
+return TRUE;
+}
+case GDK_KEY_Escape:

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 sc/source sfx2/source

2017-04-21 Thread Marco Cecchetti
 desktop/source/lib/init.cxx  |1 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   10 +-
 include/sfx2/lokhelper.hxx   |3 ++-
 sc/source/ui/view/viewfunc.cxx   |   26 --
 sfx2/source/view/lokhelper.cxx   |   11 +++
 5 files changed, 47 insertions(+), 4 deletions(-)

New commits:
commit 5751291e8cefea4d07b701c51051fc06ce14486e
Author: Marco Cecchetti 
Date:   Thu Apr 20 12:48:59 2017 +0200

LOK - Calc: changed the way header is updated on row/col insert/remove

This patch introduce a new LOK callback for informing the client that
the row/col header is no more valid and needs to be updated.

Change-Id: I21a3a41d69bd1a3c11c9ffaf1d7d53dbc3b9681d
Reviewed-on: https://gerrit.libreoffice.org/36733
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 5c3bcd0a4526..8e5e89d0dbad 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -756,6 +756,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
 case LOK_CALLBACK_SET_PART:
 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
+case LOK_CALLBACK_INVALIDATE_HEADER:
 {
 const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(),
 [type] (const queue_type::value_type& elem) { return 
(elem.first == type); });
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 8a59b4cc8ad1..dffc728eb641 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -492,7 +492,15 @@ typedef enum
  * - 'action' can be 'Add', 'Remove' or 'Modify' depending on whether
  *comment has been added, removed or modified.
  */
-LOK_CALLBACK_COMMENT = 32
+LOK_CALLBACK_COMMENT = 32,
+
+/**
+ * The column/row header is no more valid because of a column/row insertion
+ * or a similar event. Clients must query a new column/row header set.
+ *
+ * The payload says if we are invalidating a row or column header.
+ */
+LOK_CALLBACK_INVALIDATE_HEADER = 33
 }
 LibreOfficeKitCallbackType;
 
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 9cc7492f70ae..4dc088d64d59 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -42,7 +42,8 @@ public:
 static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell* 
pOtherView, int nType, const OString& rKey, const OString& rPayload);
 /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to 
setOptionalFeatures() if needed.
 static void notifyInvalidation(SfxViewShell* pThisView, const OString& 
rPayload);
-
+/// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views.
+static void notifyAllViewsHeaderInvalidation(const OString& rPayload);
 /// A special value to signify 'infinity'.
 /// This value is chosen such that sal_Int32 will not overflow when 
manipulated.
 static const long MaxTwips = 1e9;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 7d4720bbbad7..9c3ff1118dbd 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -78,6 +78,7 @@
 #include "tokenarray.hxx"
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1458,17 +1459,26 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool 
bRecord, bool bPartOfPaste )
 bool bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, 
eCmd, bRecord, false, bPartOfPaste );
 if (bSuccess)
 {
+bool bInsertCols = ( eCmd == INS_INSCOLS_BEFORE || eCmd == 
INS_INSCOLS_AFTER);
+bool bInsertRows = ( eCmd == INS_INSROWS_BEFORE || eCmd == 
INS_INSROWS_AFTER );
+
 pDocSh->UpdateOle(&GetViewData());
 CellContentChanged();
 ResetAutoSpell();
 
-if ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSCOLS_BEFORE || 
eCmd == INS_INSROWS_AFTER || eCmd == INS_INSCOLS_AFTER )
+if ( bInsertCols || bInsertRows )
 {
-OUString aOperation = ( eCmd == INS_INSROWS_BEFORE || eCmd == 
INS_INSROWS_AFTER ) ?
+OUString aOperation = bInsertRows ?
 OUString("insert-rows"):
 OUString("insert-columns");
 HelperNotifyChanges::NotifyIfChangesListeners(*pDocSh, aRange, 
aOperation);
 }
+
+if (bInsertCols)
+SfxLokHelper::notifyAllViewsHeaderInvalidation("column");
+
+if (bInsertRows)
+SfxLokHelper::notifyAllViewsHeaderInvalidation("row");
 }
 return bSuccess;
 }
@@ -1535,6 +1545,12 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd )
 else
 nCurY = aRange.aStart.Row();
 SetCurs

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-11-14 Thread Henry Castro
 desktop/source/lib/init.cxx   |   10 --
 include/LibreOfficeKit/LibreOfficeKit.h   |1 +
 include/LibreOfficeKit/LibreOfficeKit.hxx |5 +++--
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 32d0378284a42f0eba1df92555767a43be079117
Author: Henry Castro 
Date:   Fri Nov 11 16:29:57 2016 -0400

lok: add character parameter to renderFont

When client side request special character, it is very useful to send a
preview of the rendered font character

Conflicts:
desktop/source/lib/init.cxx

Change-Id: I1f5727163dfcc861add121e616bdb17881c28197
Reviewed-on: https://gerrit.libreoffice.org/30784
Tested-by: Jenkins 
Reviewed-by: Andras Timar 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ddbcc3c..ea543ed 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -484,6 +484,7 @@ static int doc_getViewsCount(LibreOfficeKitDocument* pThis);
 static bool doc_getViewIds(LibreOfficeKitDocument* pThis, int* pArray, size_t 
nSize);
 static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
   const char *pFontName,
+  const char *pChar,
   int* pFontWidth,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
@@ -2468,12 +2469,14 @@ static bool doc_getViewIds(LibreOfficeKitDocument* 
/*pThis*/, int* pArray, size_
 
 unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/,
 const char* pFontName,
+const char* pChar,
 int* pFontWidth,
 int* pFontHeight)
 {
 SolarMutexGuard aGuard;
 
 OString aSearchedFontName(pFontName);
+OUString aText(OStringToOUString(pChar, RTL_TEXTENCODING_UTF8));
 SfxObjectShell* pDocSh = SfxObjectShell::Current();
 const SvxFontListItem* pFonts = static_cast(
 pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST));
@@ -2489,6 +2492,9 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* 
/*pThis*/,
 if (!aSearchedFontName.equals(aFontName.toUtf8().getStr()))
 continue;
 
+if (aText.isEmpty())
+aText = rFontMetric.GetFamilyName();
+
 auto aDevice(
 VclPtr::Create(
 nullptr, Size(1, 1), DeviceFormat::DEFAULT));
@@ -2496,7 +2502,7 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* 
/*pThis*/,
 vcl::Font aFont(rFontMetric);
 aFont.SetFontSize(Size(0, 25));
 aDevice->SetFont(aFont);
-aDevice->GetTextBoundRect(aRect, aFontName);
+aDevice->GetTextBoundRect(aRect, aText);
 int nFontWidth = aRect.BottomRight().X() + 1;
 *pFontWidth = nFontWidth;
 int nFontHeight = aRect.BottomRight().Y() + 1;
@@ -2509,7 +2515,7 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* 
/*pThis*/,
 aDevice->SetOutputSizePixelScaleOffsetAndBuffer(
 Size(nFontWidth, nFontHeight), Fraction(1.0), Point(),
 pBuffer);
-aDevice->DrawText(Point(0,0), aFontName);
+aDevice->DrawText(Point(0,0), aText);
 
 return pBuffer;
 }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index c97655f..c7a2130 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -225,6 +225,7 @@ struct _LibreOfficeKitDocumentClass
 /// @see lok::Document::renderFont().
 unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
const char* pFontName,
+   const char* pChar,
int* pFontWidth,
int* pFontHeight);
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 7c90df5..1c9474f 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -404,14 +404,15 @@ public:
 }
 
 /**
- * Paints a font name to be displayed in the font list
+ * Paints a font name or character if provided to be displayed in the font 
list
  * @param pFontName the font to be painted
  */
 inline unsigned char* renderFont(const char *pFontName,
+  const char *pChar,
   int *pFontWidth,
   int *pFontHeight)
 {
-return mpDoc->pClass->renderFont(mpDoc, pFontName, pFontWidth, 
pFontHeight);
+return mpDoc->pClass->renderFont(mpDoc, pFontName, pChar, pFontWidth, 
pFontHeight);
 }
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-09-15 Thread Marco Cecchetti
 desktop/source/lib/init.cxx   |   19 +--
 include/LibreOfficeKit/LibreOfficeKit.h   |4 
 include/LibreOfficeKit/LibreOfficeKit.hxx |   11 ---
 3 files changed, 1 insertion(+), 33 deletions(-)

New commits:
commit a097d680d2e8eccbfba42ae1cf6b316235460291
Author: Marco Cecchetti 
Date:   Wed Sep 14 10:26:55 2016 +0200

Revert "LOK: we use callbacks latch for not missing messages sent very 
early"

This reverts commit bbae556d12e4edf7795b0b5643df77fd8cdbdacd.

Change-Id: If1370751b612ff06ef5be13e8a4017af7dc34a7c
Reviewed-on: https://gerrit.libreoffice.org/28908
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 
(cherry picked from commit c0dd075d52409031876f5bc3923062ba5847fd53)
Reviewed-on: https://gerrit.libreoffice.org/28929
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 18cb053..affc019 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -391,6 +391,7 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* 
pThis,
 long* pHeight);
 static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments);
+
 static void doc_registerCallback(LibreOfficeKitDocument* pThis,
 LibreOfficeKitCallback pCallback,
 void* pData);
@@ -442,9 +443,6 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   int* pFontWidth,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
-static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis,
- bool bCallbackLatch);
-
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
 &xComponent)
 : mxComponent(xComponent)
@@ -491,8 +489,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
renderFont = doc_renderFont;
 m_pDocumentClass->getPartHash = doc_getPartHash;
 
-m_pDocumentClass->setCallbackLatch = doc_setCallbackLatch;
-
 gDocumentClass = m_pDocumentClass;
 }
 pClass = m_pDocumentClass.get();
@@ -2366,19 +2362,6 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* 
/*pThis*/,
 return nullptr;
 }
 
-static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis, bool 
bCallbackLatch)
-{
-SolarMutexGuard aGuard;
-LibLODocument_Impl* pDocument = static_cast(pThis);
-
-int nView = SfxLokHelper::getView();
-if (nView < 0)
-return;
-
-if (pDocument->mpCallbackFlushHandlers[nView])
-
pDocument->mpCallbackFlushHandlers[nView]->setEventLatch(bCallbackLatch);
-}
-
 static char* lo_getError (LibreOfficeKit *pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 53162a3..81d65c1 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -244,10 +244,6 @@ struct _LibreOfficeKitDocumentClass
const int nTileWidth,
const int nTileHeight);
 
-/// @see lok::Document::setCallbackLatch().
-void (*setCallbackLatch) (LibreOfficeKitDocument* pThis,
-  bool bCallbackLatch);
-
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 7c6a8d7..eae43af 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -435,17 +435,6 @@ public:
 nTileWidth, nTileHeight);
 }
 
-/**
- * Enable/disable callbacks latch. LOK will set the latch when it wants to
- * queue new callbacks but not flush them.
- *
- * @param bCallbackLatch: true enables the latch, false disables it.
- */
-inline void setCallbackLatch(bool bCallbackLatch)
-{
-mpDoc->pClass->setCallbackLatch(mpDoc, bCallbackLatch);
-}
-
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-09-11 Thread Marco Cecchetti
 desktop/source/lib/init.cxx   |   19 ++-
 include/LibreOfficeKit/LibreOfficeKit.h   |4 
 include/LibreOfficeKit/LibreOfficeKit.hxx |   11 +++
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 539f981900e1823d880f2050291b48f4c51994dd
Author: Marco Cecchetti 
Date:   Sat Sep 10 21:02:36 2016 +0200

LOK: we use callbacks latch for not missing messages sent very early

- lok::Document::setCallbackLatch: used on document load for
set/unset the latch

- now cell cursors of other views are correctly notified to the new
view

Change-Id: Ife6dca0e3e329b801d44070f55869afe95a2f313
Reviewed-on: https://gerrit.libreoffice.org/28812
Tested-by: Jenkins 
Reviewed-by: Marco Cecchetti 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0a83941..37a65d1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -391,7 +391,6 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* 
pThis,
 long* pHeight);
 static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments);
-
 static void doc_registerCallback(LibreOfficeKitDocument* pThis,
 LibreOfficeKitCallback pCallback,
 void* pData);
@@ -443,6 +442,9 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   int* pFontWidth,
   int* pFontHeight);
 static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
+static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis,
+ bool bCallbackLatch);
+
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
 &xComponent)
 : mxComponent(xComponent)
@@ -489,6 +491,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
renderFont = doc_renderFont;
 m_pDocumentClass->getPartHash = doc_getPartHash;
 
+m_pDocumentClass->setCallbackLatch = doc_setCallbackLatch;
+
 gDocumentClass = m_pDocumentClass;
 }
 pClass = m_pDocumentClass.get();
@@ -2338,6 +2342,19 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* 
/*pThis*/,
 return nullptr;
 }
 
+static void doc_setCallbackLatch(LibreOfficeKitDocument* pThis, bool 
bCallbackLatch)
+{
+SolarMutexGuard aGuard;
+LibLODocument_Impl* pDocument = static_cast(pThis);
+
+int nView = SfxLokHelper::getView();
+if (nView < 0)
+return;
+
+if (pDocument->mpCallbackFlushHandlers[nView])
+
pDocument->mpCallbackFlushHandlers[nView]->setEventLatch(bCallbackLatch);
+}
+
 static char* lo_getError (LibreOfficeKit *pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 81d65c1..53162a3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -244,6 +244,10 @@ struct _LibreOfficeKitDocumentClass
const int nTileWidth,
const int nTileHeight);
 
+/// @see lok::Document::setCallbackLatch().
+void (*setCallbackLatch) (LibreOfficeKitDocument* pThis,
+  bool bCallbackLatch);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index eae43af..7c6a8d7 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -435,6 +435,17 @@ public:
 nTileWidth, nTileHeight);
 }
 
+/**
+ * Enable/disable callbacks latch. LOK will set the latch when it wants to
+ * queue new callbacks but not flush them.
+ *
+ * @param bCallbackLatch: true enables the latch, false disables it.
+ */
+inline void setCallbackLatch(bool bCallbackLatch)
+{
+mpDoc->pClass->setCallbackLatch(mpDoc, bCallbackLatch);
+}
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sd/qa sfx2/source svx/source

2016-07-01 Thread Miklos Vajna
 desktop/source/lib/init.cxx  |2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   16 ++
 libreofficekit/source/gtk/lokdocview.cxx |   43 +++--
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   68 +++
 sfx2/source/view/viewsh.cxx  |2 
 svx/source/svdraw/svdmrkv.cxx|   10 +++
 6 files changed, 137 insertions(+), 4 deletions(-)

New commits:
commit 3ebfc5b95559a9bcb2fc0508b51fd00e8eb20260
Author: Miklos Vajna 
Date:   Fri Jul 1 18:05:43 2016 +0200

svx lok: add LOK_CALLBACK_GRAPHIC_VIEW_SELECTION

So a view can be aware where the graphic selections of other views are.

Change-Id: I0cc420cfe4bf3824fbfa1a58da889cac5e9a7b60
Reviewed-on: https://gerrit.libreoffice.org/26863
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 581eb89..9762cd82 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -446,6 +446,7 @@ 
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li
 m_states.emplace(LOK_CALLBACK_TEXT_SELECTION_END, "NIL");
 m_states.emplace(LOK_CALLBACK_TEXT_SELECTION, "NIL");
 m_states.emplace(LOK_CALLBACK_GRAPHIC_SELECTION, "NIL");
+m_states.emplace(LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "NIL");
 m_states.emplace(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, "NIL");
 m_states.emplace(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR , "NIL");
 m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
@@ -552,6 +553,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_TEXT_SELECTION_END:
 case LOK_CALLBACK_TEXT_SELECTION:
 case LOK_CALLBACK_GRAPHIC_SELECTION:
+case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
 case LOK_CALLBACK_MOUSE_POINTER:
 case LOK_CALLBACK_CELL_CURSOR:
 case LOK_CALLBACK_CELL_VIEW_CURSOR:
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index c687879..d8e46db 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -358,6 +358,22 @@ typedef enum
  */
 LOK_CALLBACK_CELL_VIEW_CURSOR,
 
+/**
+ * The size and/or the position of a graphic selection in one of the other
+ * views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "selection": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - selection uses the format of LOK_CALLBACK_INVALIDATE_TILES.
+ */
+LOK_CALLBACK_GRAPHIC_VIEW_SELECTION,
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 502ae5d..8bf889f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -101,9 +101,12 @@ struct LOKDocViewPrivateImpl
 /// Position and size of the selection end.
 GdkRectangle m_aTextSelectionEnd;
 GdkRectangle m_aGraphicSelection;
+/// Position and size of the graphic view selections. The current view can 
only
+/// see them, can't modify them. Key is the view id.
+std::map m_aGraphicViewSelections;
 GdkRectangle m_aCellCursor;
 /// Position and size of the cell view cursors. The current view can only
-//see / them, can't modify them. Key is the view id.
+/// see them, can't modify them. Key is the view id.
 std::map m_aCellViewCursors;
 gboolean m_bInDragGraphicSelection;
 
@@ -323,6 +326,8 @@ callbackTypeToString (int nType)
 return "LOK_CALLBACK_CURSOR_VISIBLE";
 case LOK_CALLBACK_GRAPHIC_SELECTION:
 return "LOK_CALLBACK_GRAPHIC_SELECTION";
+case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
+return "LOK_CALLBACK_GRAPHIC_VIEW_SELECTION";
 case LOK_CALLBACK_CELL_CURSOR:
 return "LOK_CALLBACK_CELL_CURSOR";
 case LOK_CALLBACK_HYPERLINK_CLICKED:
@@ -1108,6 +1113,25 @@ callback (gpointer pData)
 gtk_widget_queue_draw(GTK_WIDGET(pDocView));
 }
 break;
+case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
+{
+std::stringstream aStream(pCallback->m_aPayload);
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+int nViewId = aTree.get("viewId");
+const std::string& rRectangle = aTree.get("selection");
+if (rRectangle != "EMPTY")
+priv->m_aGraphicViewSelections[nViewId] = 
payloadToRectangle(pDocView, rRectangle.c_str());
+else
+{
+auto it = priv->m_aGraphicViewSelections.find(nViewId);
+if (it != priv->m_aGraphicViewSelections.end())
+priv->m_aGraphicViewSelections.erase(it);
+}
+gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+break;
+}
+break;
 case LOK_C

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source sc/source

2016-07-01 Thread Miklos Vajna
 desktop/source/lib/init.cxx  |2 +
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   17 ++
 libreofficekit/source/gtk/lokdocview.cxx |   43 +++
 sc/source/ui/view/gridwin.cxx|3 +
 4 files changed, 64 insertions(+), 1 deletion(-)

New commits:
commit 68c5c0bb7eed007bbfbb2e51107fc0196825e85a
Author: Miklos Vajna 
Date:   Fri Jul 1 10:55:27 2016 +0200

sc lok: add LOK_CALLBACK_CELL_VIEW_CURSOR

So a view can be aware where the cell cursors of other views are.

Change-Id: Ifcf06c0019c6af8b859e2e9e4f3fd18da74f
Reviewed-on: https://gerrit.libreoffice.org/26844
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 10f3430..581eb89 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -451,6 +451,7 @@ 
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li
 m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
 m_states.emplace(LOK_CALLBACK_MOUSE_POINTER, "NIL");
 m_states.emplace(LOK_CALLBACK_CELL_CURSOR, "NIL");
+m_states.emplace(LOK_CALLBACK_CELL_VIEW_CURSOR, "NIL");
 m_states.emplace(LOK_CALLBACK_CELL_FORMULA, "NIL");
 m_states.emplace(LOK_CALLBACK_CURSOR_VISIBLE, "NIL");
 m_states.emplace(LOK_CALLBACK_SET_PART, "NIL");
@@ -553,6 +554,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 case LOK_CALLBACK_GRAPHIC_SELECTION:
 case LOK_CALLBACK_MOUSE_POINTER:
 case LOK_CALLBACK_CELL_CURSOR:
+case LOK_CALLBACK_CELL_VIEW_CURSOR:
 case LOK_CALLBACK_CELL_FORMULA:
 case LOK_CALLBACK_CURSOR_VISIBLE:
 case LOK_CALLBACK_SET_PART:
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 4dfb8be..c687879 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -329,7 +329,7 @@ typedef enum
 LOK_CALLBACK_INVALIDATE_VIEW_CURSOR,
 
 /**
- * The the text selection in one of the other views has changed.
+ * The text selection in one of the other views has changed.
  *
  * The payload format:
  *
@@ -343,6 +343,21 @@ typedef enum
  */
 LOK_CALLBACK_TEXT_VIEW_SELECTION,
 
+/**
+ * The cell cursor in one of the other views has changed.
+ *
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "rectangle": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - rectangle uses the format of LOK_CALLBACK_CELL_CURSOR.
+ */
+LOK_CALLBACK_CELL_VIEW_CURSOR,
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 8e2d278..cb2118e 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -102,6 +102,9 @@ struct LOKDocViewPrivateImpl
 GdkRectangle m_aTextSelectionEnd;
 GdkRectangle m_aGraphicSelection;
 GdkRectangle m_aCellCursor;
+/// Position and size of the cell view cursors. The current view can only
+//see / them, can't modify them. Key is the view id.
+std::map m_aCellViewCursors;
 gboolean m_bInDragGraphicSelection;
 
 /// @name Start/middle/end handle.
@@ -355,7 +358,12 @@ callbackTypeToString (int nType)
 return "LOK_CALLBACK_INVALIDATE_VIEW_CURSOR";
 case LOK_CALLBACK_TEXT_VIEW_SELECTION:
 return "LOK_CALLBACK_TEXT_VIEW_SELECTION";
+case LOK_CALLBACK_CELL_VIEW_CURSOR:
+return "LOK_CALLBACK_CELL_VIEW_CURSOR";
+case LOK_CALLBACK_CELL_FORMULA:
+return "LOK_CALLBACK_CELL_FORMULA";
 }
+g_assert(false);
 return nullptr;
 }
 
@@ -1193,6 +1201,24 @@ callback (gpointer pData)
 gtk_widget_queue_draw(GTK_WIDGET(pDocView));
 break;
 }
+case LOK_CALLBACK_CELL_VIEW_CURSOR:
+{
+std::stringstream aStream(pCallback->m_aPayload);
+boost::property_tree::ptree aTree;
+boost::property_tree::read_json(aStream, aTree);
+int nViewId = aTree.get("viewId");
+const std::string& rRectangle = aTree.get("rectangle");
+if (rRectangle != "EMPTY")
+priv->m_aCellViewCursors[nViewId] = payloadToRectangle(pDocView, 
rRectangle.c_str());
+else
+{
+auto it = priv->m_aCellViewCursors.find(nViewId);
+if (it != priv->m_aCellViewCursors.end())
+priv->m_aCellViewCursors.erase(it);
+}
+gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+break;
+}
 default:
 g_assert(false);
 break;
@@ -1580,6 +1606,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
 g_free (handleGraphicPath);
 }
 
+// Draw the cell cursor.
 if (!isEmptyRectangle(priv->m_aCellCursor))
 {
 cairo_

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-06-21 Thread Pranav Kant
 desktop/source/lib/init.cxx|   10 +-
 include/LibreOfficeKit/LibreOfficeKit.hxx  |9 ++---
 include/LibreOfficeKit/LibreOfficeKitGtk.h |   11 +++
 3 files changed, 22 insertions(+), 8 deletions(-)

New commits:
commit d7b45c97b30f109aff0be6602a8fc8103af71e7f
Author: Pranav Kant 
Date:   Tue Jun 21 20:23:13 2016 +0530

lok: Change version string to JSON format

Change-Id: Ie1264fed9964b09006980df2e151e170b48b4082

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2d30a32..ab765dc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2007,7 +2007,15 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
 
 static char* lo_getVersionInfo(LibreOfficeKit* /*pThis*/)
 {
-const OString sVersionStr = 
OUStringToOString(ReplaceStringHookProc("%PRODUCTNAME %PRODUCTVERSION 
%PRODUCTEXTENSION %BUILDID"), RTL_TEXTENCODING_UTF8);
+const OUString sVersionStrTemplate(
+"{ "
+"\"ProductName\": \"%PRODUCTNAME\", "
+"\"ProductVersion\": \"%PRODUCTVERSION\", "
+"\"ProductExtension\": \"%PRODUCTEXTENSION\", "
+"\"BuildId\": \"%BUILDID\" "
+"}"
+);
+const OString sVersionStr = 
OUStringToOString(ReplaceStringHookProc(sVersionStrTemplate), 
RTL_TEXTENCODING_UTF8);
 
 char* pVersion = static_cast(malloc(sVersionStr.getLength() + 1));
 strcpy(pVersion, sVersionStr.getStr());
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 46a5e96..eae43af 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -550,10 +550,13 @@ public:
 /**
  * Get version information of the LOKit process
  *
- * @returns string containing version information in format:
- * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ * @returns JSON string containing version information in format:
+ * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
  *
- * Eg: LibreOffice 5.3 .0.0 alpha0 
+ * Eg: {"ProductName": "LibreOffice",
+ * "ProductVersion": "5.3",
+ * "ProductExtension": ".0.0.alpha0",
+ * "BuildId": ""}
  */
 inline char* getVersionInfo()
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h 
b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 4b4284e..fc7cec1 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -319,12 +319,15 @@ void
lok_doc_view_set_document_password (LOKDocView*
  * lok_doc_view_get_version_info:
  * @pDocView: The #LOKDocView instance
  *
- * Get version information of underlying LOKit process
+ * Get version information of the LOKit process
  *
- * Returns: string containing version information in format
- * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ * Returns: JSON string containing version information in format:
+ * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
  *
- * Eg: LibreOffice 5.3 .0.0.alpha0 
+ * Eg: {"ProductName": "LibreOffice",
+ * "ProductVersion": "5.3",
+ * "ProductExtension": ".0.0.alpha0",
+ * "BuildId": ""}
  */
 gchar* lok_doc_view_get_version_info   
(LOKDocView* pDocView);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source

2016-06-21 Thread Pranav Kant
 desktop/source/lib/init.cxx|   12 
 include/LibreOfficeKit/LibreOfficeKit.h|3 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx  |   13 +
 include/LibreOfficeKit/LibreOfficeKitGtk.h |   13 +
 libreofficekit/source/gtk/lokdocview.cxx   |9 +
 5 files changed, 50 insertions(+)

New commits:
commit 90c75f775b6d1ca68389782a3768ee554b528e5d
Author: Pranav Kant 
Date:   Tue Jun 21 00:15:38 2016 +0530

lok: Expose LO version information

Change-Id: Ided924e928c04385457c7a2e231fdf57e7e38970

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a150535..2d30a32 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -73,6 +73,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -656,6 +657,7 @@ static void lo_setOptionalFeatures(LibreOfficeKit* pThis, 
uint64_t features);
 static voidlo_setDocumentPassword(LibreOfficeKit* pThis,
const char* pURL,
const char* pPassword);
+static char*   lo_getVersionInfo(LibreOfficeKit* pThis);
 
 LibLibreOffice_Impl::LibLibreOffice_Impl()
 : m_pOfficeClass( gOfficeClass.lock() )
@@ -677,6 +679,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
 m_pOfficeClass->getFilterTypes = lo_getFilterTypes;
 m_pOfficeClass->setOptionalFeatures = lo_setOptionalFeatures;
 m_pOfficeClass->setDocumentPassword = lo_setDocumentPassword;
+m_pOfficeClass->getVersionInfo = lo_getVersionInfo;
 
 gOfficeClass = m_pOfficeClass;
 }
@@ -2002,6 +2005,15 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis,
 pLib->mInteractionMap.find(OString(pURL))->second->SetPassword(pPassword);
 }
 
+static char* lo_getVersionInfo(LibreOfficeKit* /*pThis*/)
+{
+const OString sVersionStr = 
OUStringToOString(ReplaceStringHookProc("%PRODUCTNAME %PRODUCTVERSION 
%PRODUCTEXTENSION %BUILDID"), RTL_TEXTENCODING_UTF8);
+
+char* pVersion = static_cast(malloc(sVersionStr.getLength() + 1));
+strcpy(pVersion, sVersionStr.getStr());
+return pVersion;
+}
+
 static void force_c_locale()
 {
 // force locale (and resource files loaded) to en-US
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index a337bc3..559d28a 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -75,6 +75,9 @@ struct _LibreOfficeKitClass
 void (*setDocumentPassword) (LibreOfficeKit* pThis,
 char const* pURL,
 char const* pPassword);
+
+/// @see lok::Office::getVersionInfo().
+char* (*getVersionInfo) (LibreOfficeKit* pThis);
 #endif
 
 };
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index c496e2e..46a5e96 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -546,6 +546,19 @@ public:
 {
 mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword);
 }
+
+/**
+ * Get version information of the LOKit process
+ *
+ * @returns string containing version information in format:
+ * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ *
+ * Eg: LibreOffice 5.3 .0.0 alpha0 
+ */
+inline char* getVersionInfo()
+{
+return mpThis->pClass->getVersionInfo(mpThis);
+}
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h 
b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index a0082be..4b4284e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -316,6 +316,19 @@ void
lok_doc_view_set_document_password (LOKDocView*
 const 
gchar* pPassword);
 
 /**
+ * lok_doc_view_get_version_info:
+ * @pDocView: The #LOKDocView instance
+ *
+ * Get version information of underlying LOKit process
+ *
+ * Returns: string containing version information in format
+ * PRODUCT_NAME PRODUCT_VERSION PRODUCT_EXTENSION BUILD_ID
+ *
+ * Eg: LibreOffice 5.3 .0.0.alpha0 
+ */
+gchar* lok_doc_view_get_version_info   
(LOKDocView* pDocView);
+
+/**
  * lok_doc_view_pixel_to_twip:
  * @pDocView: The #LOKDocView instance
  * @fInput: The value in pixels to convert to twips
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 90f01d9..60d4cce 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -3162,6 +3162,15 @@ lok_doc_view_set_document_password (LOKDocView* pDocView,
 priv->m_pOffice->pClass->setDocumentPassword(priv->m_pOffice, pURL, 
pPassword);
 }
 
+SAL_DLLPUBLIC_EXPORT gch

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/sfx2 libreofficekit/source sfx2/source sw/source

2016-06-20 Thread Miklos Vajna
 desktop/source/lib/init.cxx  |2 ++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |   17 +
 include/sfx2/lokhelper.hxx   |2 +-
 libreofficekit/source/gtk/lokdocview.cxx |7 +++
 sfx2/source/view/lokhelper.cxx   |   12 +---
 sw/source/core/crsr/viscrs.cxx   |   22 ++
 6 files changed, 58 insertions(+), 4 deletions(-)

New commits:
commit c544a8b674dd7ac9dd466a84a440ede030942438
Author: Miklos Vajna 
Date:   Mon Jun 20 16:42:34 2016 +0200

sw lok: add LOK_CALLBACK_INVALIDATE_VIEW_CURSOR

So a view can be aware where cursors of other views are.

Change-Id: I6133fb55aa2869843c0284b7d76264bab3b3d5da
Reviewed-on: https://gerrit.libreoffice.org/26513
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c0477a5..a150535 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -446,6 +446,7 @@ 
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li
 m_states.emplace(LOK_CALLBACK_TEXT_SELECTION, "NIL");
 m_states.emplace(LOK_CALLBACK_GRAPHIC_SELECTION, "NIL");
 m_states.emplace(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, "NIL");
+m_states.emplace(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR , "NIL");
 m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
 m_states.emplace(LOK_CALLBACK_MOUSE_POINTER, "NIL");
 m_states.emplace(LOK_CALLBACK_CELL_CURSOR, "NIL");
@@ -561,6 +562,7 @@ void CallbackFlushHandler::queue(const int type, const 
char* data)
 // These come with rects, so drop earlier
 // only when the latter includes former ones.
 case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
+case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
 case LOK_CALLBACK_INVALIDATE_TILES:
 if (payload.empty())
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 4b8ff35..4229e73 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -312,6 +312,23 @@ typedef enum
  */
 LOK_CALLBACK_CONTEXT_MENU,
 
+/**
+ * The size and/or the position of the view cursor changed. A view cursor
+ * is a cursor of an other view, the current view can't change it.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ * The payload format:
+ *
+ * {
+ * "viewId": "..."
+ * "rectangle": "..."
+ * }
+ *
+ * - viewId is a value returned earlier by lok::Document::createView()
+ * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
+ */
+LOK_CALLBACK_INVALIDATE_VIEW_CURSOR,
+
 }
 LibreOfficeKitCallbackType;
 
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 2a691f6..43c0189 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -26,7 +26,7 @@ public:
 /// Set a view shell as current one.
 static void setView(std::uintptr_t nId);
 /// Get the currently active view.
-static std::uintptr_t getView();
+static std::uintptr_t getView(SfxViewShell *pViewShell = nullptr);
 /// Get the number of views of the current object shell.
 static std::size_t getViews();
 };
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 6f2b8ea..d4ca4a9 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -341,6 +341,8 @@ callbackTypeToString (int nType)
 return "LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY";
 case LOK_CALLBACK_CONTEXT_MENU:
 return "LOK_CALLBACK_CONTEXT_MENU";
+case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
+return "LOK_CALLBACK_INVALIDATE_VIEW_CURSOR";
 }
 return nullptr;
 }
@@ -1158,6 +1160,11 @@ callback (gpointer pData)
 // TODO: Implement me
 break;
 }
+case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
+{
+// TODO: Implement me
+break;
+}
 default:
 g_assert(false);
 break;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 3a306cf..ba42188 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -60,16 +60,22 @@ void SfxLokHelper::setView(std::uintptr_t nId)
 
 }
 
-std::uintptr_t SfxLokHelper::getView()
+std::uintptr_t SfxLokHelper::getView(SfxViewShell *pViewShell)
 {
-return reinterpret_cast(SfxViewShell::Current());
+if (!pViewShell)
+pViewShell = SfxViewShell::Current();
+return reinterpret_cast(pViewShell);
 }
 
 std::size_t SfxLokHelper::getViews()
 {
 std::size_t nRet = 0;
 
-SfxObjectShell* pObjectShell = SfxViewFrame::Current()->GetObjectShell();
+SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+if (!pViewFrame)
+return nRet;
+
+ 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-04-21 Thread Jan Holesovsky
 desktop/source/lib/init.cxx |   22 +-
 include/LibreOfficeKit/LibreOfficeKit.h |8 
 2 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit b74163742ff1288ad9ea1ec8e83ac08faf686893
Author: Jan Holesovsky 
Date:   Thu Apr 21 19:04:58 2016 +0200

lok: getPartHash should be at the end, it is a new API call.

Also add it to the init.cxx so that it is actually used.

Change-Id: I255411158d0822718116ac05aad1ee925a9a7a9a

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d74ae31..ceb7f90 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -367,6 +367,7 @@ static unsigned char* 
doc_renderFont(LibreOfficeKitDocument* pThis,
   const char *pFontName,
   int* pFontWidth,
   int* pFontHeight);
+static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart);
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
 &xComponent)
 : mxComponent(xComponent)
@@ -388,7 +389,6 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
setPart = doc_setPart;
 m_pDocumentClass->getPartName = doc_getPartName;
 m_pDocumentClass->setPartMode = doc_setPartMode;
-m_pDocumentClass->renderFont = doc_renderFont;
 m_pDocumentClass->paintTile = doc_paintTile;
 m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -412,6 +412,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
getView = doc_getView;
 m_pDocumentClass->getViews = doc_getViews;
 
+m_pDocumentClass->renderFont = doc_renderFont;
+m_pDocumentClass->getPartHash = doc_getPartHash;
+
 gDocumentClass = m_pDocumentClass;
 }
 pClass = m_pDocumentClass.get();
@@ -905,6 +908,23 @@ static char* doc_getPartName(LibreOfficeKitDocument* 
pThis, int nPart)
 
 }
 
+static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart)
+{
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+return nullptr;
+}
+
+OUString sHash = pDoc->getPartHash(nPart);
+OString aString = OUStringToOString(sHash, RTL_TEXTENCODING_UTF8);
+char* pMemory = static_cast(malloc(aString.getLength() + 1));
+strcpy(pMemory, aString.getStr());
+return pMemory;
+
+}
+
 static void doc_setPartMode(LibreOfficeKitDocument* pThis,
 int nPartMode)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 863e377..1281a21 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -118,10 +118,6 @@ struct _LibreOfficeKitDocumentClass
 char* (*getPartName) (LibreOfficeKitDocument* pThis,
   int nPart);
 
-/// @see lok::Document::getPartHash().
-char* (*getPartHash) (LibreOfficeKitDocument* pThis,
-  int nPart);
-
 /// @see lok::Document::setPartMode().
 void (*setPartMode) (LibreOfficeKitDocument* pThis,
  int nMode);
@@ -228,6 +224,10 @@ struct _LibreOfficeKitDocumentClass
const char* pFontName,
int* pFontWidth,
int* pFontHeight);
+
+/// @see lok::Document::getPartHash().
+char* (*getPartHash) (LibreOfficeKitDocument* pThis,
+  int nPart);
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/qa

2016-04-19 Thread Stephan Bergmann
 desktop/source/lib/init.cxx |   21 +---
 include/LibreOfficeKit/LibreOfficeKit.hxx   |4 +--
 include/LibreOfficeKit/LibreOfficeKitGtk.h  |5 ++--
 include/LibreOfficeKit/LibreOfficeKitInit.h |   10 -
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |3 +-
 5 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit 024d2fde2aae13b07cf5c7b4d85fc3c6abce6913
Author: Stephan Bergmann 
Date:   Tue Apr 19 12:30:27 2016 +0200

In lok_init_2, allow vnd.sun.star.pathname user_profile_url

...which takes a raw filesystem pathname that is internally converted to a 
file
URL (similarly to what is supported for the INIFILENAME and URE_BOOTSTRAP
bootstrap variables in rtl::Bootstrap).  That way, the gtktiledviewer 
executable
doesn't need to try convert a pathname into a URL.

Also adapted various parameter names to make it obvious that URLs get 
passed,
not pathnames.

Change-Id: I33ab31fe142d94ee47885033ef48278ef5ff55a2
Reviewed-on: https://gerrit.libreoffice.org/24241
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b58f23e..0f46a04 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1816,7 +1816,7 @@ static void lo_status_indicator_callback(void *data, 
comphelper::LibreOfficeKit:
 }
 }
 
-static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const 
char* pUserProfilePath)
+static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const 
char* pUserProfileUrl)
 {
 enum {
 PRE_INIT, // setup shared data in master process
@@ -1849,8 +1849,23 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath, const char
 if (eStage != PRE_INIT)
 
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback,
 pLib);
 
-if (eStage != SECOND_INIT && pUserProfilePath)
-rtl::Bootstrap::set("UserInstallation", OUString(pUserProfilePath, 
strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
+if (eStage != SECOND_INIT && pUserProfileUrl)
+{
+OUString url(
+pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8);
+OUString path;
+if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path))
+{
+OUString url2;
+osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(
+path, url2);
+if (e == osl::FileBase::E_None)
+url = url2;
+else
+SAL_WARN("lok", "resolving <" << url << "> failed with " << 
+e);
+}
+rtl::Bootstrap::set("UserInstallation", url);
+}
 
 OUString aAppPath;
 if (pAppPath)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 9e18df0..44e321f 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -523,9 +523,9 @@ public:
 };
 
 /// Factory method to create a lok::Office instance.
-inline Office* lok_cpp_init(const char* pInstallPath, const char* 
pUserProfilePath = NULL)
+inline Office* lok_cpp_init(const char* pInstallPath, const char* 
pUserProfileUrl = NULL)
 {
-LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath);
+LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfileUrl);
 if (pThis == NULL || pThis->pClass->nSize == 0)
 return NULL;
 return new ::lok::Office(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h 
b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 8a64bff..a0082be 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -58,8 +58,9 @@ GtkWidget* lok_doc_view_new   
 (const gchar*
  * lok_doc_view_new_from_user_profile:
  * @pPath: (nullable): LibreOffice install path. Pass null to set it to default
  * path which in most cases would be $libdir/libreoffice/program
- * @pUserProfile: (nullable): User profile URL. Pass non-null to be able to
- * use this widget and LibreOffice itself in parallel.
+ * @pUserProfile: (nullable): User profile URL. Must be either a file URL or a
+ * special vnd.sun.star.pathname URL. Pass non-null to be able to use this
+ * widget and LibreOffice itself in parallel.
  * @cancellable: The cancellable object that you can use to cancel this
  * operation.
  * @error: The error that will be set if the object fails to initialize.
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index f1e513e..bdda642 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -212,11 +212,11 @@ static void *lok_dlopen( const char *install_path, char 
** _imp_lib )
 
 typedef LibreOfficeKit *(LokHookFunc

Re: [Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-01-19 Thread Stephan Bergmann

On 01/19/2016 04:38 PM, Miklos Vajna wrote:

On Tue, Jan 19, 2016 at 06:39:56AM -0800, Oliver Specht  
wrote:

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 7d4210e..8057d75 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -51,6 +51,7 @@ struct _LibreOfficeKitClass
   const char* pURL);

  char* (*getError) (LibreOfficeKit* pThis);
+void  (*freeError) (const char *pfree);

  LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
  const char* pURL,


Won't this break backwards compatibility with existing clients? I think
you can only append new functions to the end of the function list,
otherwise the LIBREOFFICEKIT_HAS_MEMBER() macro is quite pointless. ;-)


...and the usage of char* vs. char const* seems curiously inconsistent 
in that API


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-01-19 Thread Oliver Specht

Hi Miklos,
you're probably right.

Oliver

On 19.01.2016 16:38, Miklos Vajna wrote:

Hi Oliver,

On Tue, Jan 19, 2016 at 06:39:56AM -0800, Oliver Specht  
wrote:

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 7d4210e..8057d75 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -51,6 +51,7 @@ struct _LibreOfficeKitClass
   const char* pURL);
  
  char* (*getError) (LibreOfficeKit* pThis);

+void  (*freeError) (const char *pfree);
  
  LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,

  const char* pURL,

Won't this break backwards compatibility with existing clients? I think
you can only append new functions to the end of the function list,
otherwise the LIBREOFFICEKIT_HAS_MEMBER() macro is quite pointless. ;-)

Regards,

Miklos


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-01-19 Thread Miklos Vajna
Hi Oliver,

On Tue, Jan 19, 2016 at 06:39:56AM -0800, Oliver Specht  
wrote:
> diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
> b/include/LibreOfficeKit/LibreOfficeKit.h
> index 7d4210e..8057d75 100644
> --- a/include/LibreOfficeKit/LibreOfficeKit.h
> +++ b/include/LibreOfficeKit/LibreOfficeKit.h
> @@ -51,6 +51,7 @@ struct _LibreOfficeKitClass
>   const char* pURL);
>  
>  char* (*getError) (LibreOfficeKit* pThis);
> +void  (*freeError) (const char *pfree);
>  
>  LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* 
> pThis,
>  const char* pURL,

Won't this break backwards compatibility with existing clients? I think
you can only append new functions to the end of the function list,
otherwise the LIBREOFFICEKIT_HAS_MEMBER() macro is quite pointless. ;-)

Regards,

Miklos


signature.asc
Description: Digital signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2016-01-19 Thread Oliver Specht
 desktop/source/lib/init.cxx |6 ++
 include/LibreOfficeKit/LibreOfficeKit.h |2 ++
 include/LibreOfficeKit/LibreOfficeKit.hxx   |9 +
 include/LibreOfficeKit/LibreOfficeKitInit.h |   18 +-
 4 files changed, 26 insertions(+), 9 deletions(-)

New commits:
commit 442a022cf7baefbd5519ea55c7978cf839e1f44d
Author: Oliver Specht 
Date:   Tue Jan 19 10:58:07 2016 +0100

Make LibreOffice kit usable on windows

Uses Ascii variants of LoadLibrary,Get/SetEnvironmentVariable_A_
and adds a freeError function
includes windows.h instead of pre/postwin.h

Change-Id: I88b7e3ed3818078efec5688e207da47dc4049b98
Reviewed-on: https://gerrit.libreoffice.org/21600
Tested-by: Jenkins 
Reviewed-by: Oliver Specht 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 28a5442..f8d6a6c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -430,6 +430,7 @@ static voidlo_destroy   
(LibreOfficeKit* pThis);
 static int lo_initialize(LibreOfficeKit* pThis, const 
char* pInstallPath, const char* pUserProfilePath);
 static LibreOfficeKitDocument* lo_documentLoad  (LibreOfficeKit* pThis, const 
char* pURL);
 static char *  lo_getError  (LibreOfficeKit* pThis);
+static voidlo_freeError (const char *pfree);
 static LibreOfficeKitDocument* lo_documentLoadWithOptions  (LibreOfficeKit* 
pThis,
const char* pURL,
const char* 
pOptions);
@@ -451,6 +452,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
 m_pOfficeClass->destroy = lo_destroy;
 m_pOfficeClass->documentLoad = lo_documentLoad;
 m_pOfficeClass->getError = lo_getError;
+m_pOfficeClass->freeError = lo_freeError;
 m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions;
 m_pOfficeClass->registerCallback = lo_registerCallback;
 m_pOfficeClass->getFilterTypes = lo_getFilterTypes;
@@ -1571,6 +1573,10 @@ static char* lo_getError (LibreOfficeKit *pThis)
 strcpy(pMemory, aString.getStr());
 return pMemory;
 }
+static void lo_freeError(const char *pfree)
+{
+free((void *) pfree);
+}
 
 static char* lo_getFilterTypes(LibreOfficeKit* pThis)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 7d4210e..8057d75 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -51,6 +51,7 @@ struct _LibreOfficeKitClass
  const char* pURL);
 
 char* (*getError) (LibreOfficeKit* pThis);
+void  (*freeError) (const char *pfree);
 
 LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
 const char* pURL,
@@ -82,6 +83,7 @@ struct _LibreOfficeKitDocumentClass
const char* pUrl,
const char* pFormat,
const char* pFilterOptions);
+void  (*freeError) (const char *pfree);
 
 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 /// @see lok::Document::getDocumentType().
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 9396f1e..5623fad 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -56,6 +56,10 @@ public:
 
 /// Gives access to the underlying C pointer.
 inline LibreOfficeKitDocument *get() { return mpDoc; }
+inline void freeError(const char *pfree)
+{
+mpDoc->pClass->freeError(pfree);
+}
 
 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 /**
@@ -434,6 +438,11 @@ public:
 {
 return mpThis->pClass->getError(mpThis);
 }
+inline void freeError(const char *pfree)
+{
+mpThis->pClass->freeError(pfree);
+}
+
 
 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 /**
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 880f11e..23e5772 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -76,8 +76,7 @@ extern "C"
 
 #else
 
-#include "prewin.h"
-#include "postwin.h"
+#include  
 #define TARGET_LIB"sofficeapp" ".dll"
 #define TARGET_MERGED_LIB "mergedlo" ".dll"
 #define SEPARATOR '\\'
@@ -85,7 +84,7 @@ extern "C"
 
 void *lok_loadlib(const char *pFN)
 {
-return (void *) LoadLibrary(pFN);
+return (void *) LoadLibraryA(pFN);
 }
 
 char *lok_dlerror(void)
@@ -111,11 +110,11 @@ extern "C"
 return;
 
 char* sEnvPath = NULL;
-DWORD  cChars = GetEnvironmentVariable("PATH", sEnvPath, 

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2015-11-30 Thread Mihai Varga
 desktop/source/lib/init.cxx   |   53 ++
 include/LibreOfficeKit/LibreOfficeKit.h   |6 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx |   12 ++
 3 files changed, 71 insertions(+)

New commits:
commit 24d981998b5859c7601d5c804e0ee70c5fec280f
Author: Mihai Varga 
Date:   Fri Nov 27 16:19:09 2015 +0200

LOK: renderFont method

Renders the given font in a virtual output device. For now it iterates
over a list of fonts until it finds the one that matches the requested
font.

Change-Id: Ie4ecc3a1441519840d8f4f4a890e92670759b4fc

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8682ce8..d2f14de 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -364,6 +364,10 @@ static void doc_destroyView(LibreOfficeKitDocument* pThis, 
int nId);
 static void doc_setView(LibreOfficeKitDocument* pThis, int nId);
 static int doc_getView(LibreOfficeKitDocument* pThis);
 static int doc_getViews(LibreOfficeKitDocument* pThis);
+static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis,
+  const char *pFontName,
+  int* pFontWidth,
+  int* pFontHeight);
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
 &xComponent)
 : mxComponent(xComponent)
@@ -385,6 +389,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
setPart = doc_setPart;
 m_pDocumentClass->getPartName = doc_getPartName;
 m_pDocumentClass->setPartMode = doc_setPartMode;
+m_pDocumentClass->renderFont = doc_renderFont;
 m_pDocumentClass->paintTile = doc_paintTile;
 m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
@@ -1536,6 +1541,54 @@ static int doc_getViews(LibreOfficeKitDocument* 
/*pThis*/)
 return SfxLokHelper::getViews();
 }
 
+unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/,
+const char* pFontName,
+int* pFontWidth,
+int* pFontHeight)
+{
+OString aSearchedFontName(pFontName);
+SfxObjectShell* pDocSh = SfxObjectShell::Current();
+const SvxFontListItem* pFonts = static_cast(
+pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST));
+const FontList* pList = pFonts ? pFonts->GetFontList() : nullptr;
+
+if ( pList )
+{
+sal_uInt16 nFontCount = pList->GetFontNameCount();
+for (sal_uInt16 i = 0; i < nFontCount; ++i)
+{
+const vcl::FontInfo& rInfo = pList->GetFontName(i);
+OUString aFontName = rInfo.GetName();
+if (!aSearchedFontName.equals(aFontName.toUtf8().getStr()))
+continue;
+
+VirtualDevice aDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+::Rectangle aRect;
+vcl::Font aFont(rInfo);
+aFont.SetSize(Size(0, 25));
+aDevice.SetFont(aFont);
+aDevice.GetTextBoundRect(aRect, aFontName);
+int nFontWidth = aRect.BottomRight().X() + 1;
+*pFontWidth = nFontWidth;
+int nFontHeight = aRect.BottomRight().Y() + 1;
+*pFontHeight = nFontHeight;
+
+unsigned char* pBuffer = static_cast(malloc(4 * 
nFontWidth * nFontHeight));
+memset(pBuffer, 0, nFontWidth * nFontHeight * 4);
+boost::shared_array aBuffer(pBuffer, NoDelete< 
sal_uInt8 >());
+
+aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
+aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
+Size(nFontWidth, nFontHeight), Fraction(1.0), Point(),
+aBuffer, nullptr);
+aDevice.DrawText(Point(0,0), aFontName);
+
+return pBuffer;
+}
+}
+return nullptr;
+}
+
 static char* lo_getError (LibreOfficeKit *pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 5189cca..a78c0aa 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -202,6 +202,12 @@ struct _LibreOfficeKitDocumentClass
 int (*getView) (LibreOfficeKitDocument* pThis);
 /// @see lok::Document::getViews().
 int (*getViews) (LibreOfficeKitDocument* pThis);
+
+/// @see lok::Document::renderFont().
+unsigned char* (*renderFont) (LibreOfficeKitDocument* pThis,
+   const char* pFontName,
+   int* pFontWidth,
+   int* pFontHeight);
 #endif // LOK_USE_UNSTABLE_API
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 5e86101..2855f8b 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -376,6 +376,18 @@ public:
 {
 return mpDoc->pClass->getViews(mpDoc);
 }
+
+  

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2015-11-23 Thread Miklos Vajna
 desktop/source/lib/init.cxx  |7 +++
 include/LibreOfficeKit/LibreOfficeKit.h  |3 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx|   10 ++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |7 +++
 4 files changed, 27 insertions(+)

New commits:
commit fc06f801ee79fd49d54c27121ae9b2904d99f09c
Author: Miklos Vajna 
Date:   Mon Nov 23 09:32:37 2015 +0100

LOK: add Document::getTileMode()

So that clients can know if they get old-style RGBA or new-style ARGB
output in paintTile().

Change-Id: Icfde4b3259444b3524e64478ccd976664a3fe0ed

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 637e956..cd2f82a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -312,6 +312,7 @@ voiddoc_paintTile(LibreOfficeKitDocument* pThis,
   const int nCanvasWidth, const int nCanvasHeight,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
+static int doc_getTileMode(LibreOfficeKitDocument* pThis);
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
 long* pWidth,
 long* pHeight);
@@ -385,6 +386,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
getPartName = doc_getPartName;
 m_pDocumentClass->setPartMode = doc_setPartMode;
 m_pDocumentClass->paintTile = doc_paintTile;
+m_pDocumentClass->getTileMode = doc_getTileMode;
 m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
 m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
 m_pDocumentClass->registerCallback = doc_registerCallback;
@@ -958,6 +960,11 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 #endif
 }
 
+static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
+{
+return LOK_TILEMODE_RGBA;
+}
+
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
 long* pWidth,
 long* pHeight)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 93f7dca..5189cca 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -118,6 +118,9 @@ struct _LibreOfficeKitDocumentClass
const int nTileWidth,
const int nTileHeight);
 
+/// @see lok::Document::getTileMode().
+int (*getTileMode) (LibreOfficeKitDocument* pThis);
+
 /// @see lok::Document::getDocumentSize().
 void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
  long* pWidth,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index a3c0cd8..5e86101 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -143,6 +143,16 @@ public:
 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 }
 
+/**
+ * Gets the tile mode: the pixel format used for the pBuffer of 
paintTile().
+ *
+ * @return an element of the LibreOfficeKitTileMode enum.
+ */
+inline int getTileMode()
+{
+return mpDoc->pClass->getTileMode(mpDoc);
+}
+
 /// Get the document sizes in TWIPs.
 inline void getDocumentSize(long* pWidth, long* pHeight)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 7b23fcb..b713f0e 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -35,6 +35,13 @@ LibreOfficeKitPartMode;
 
 typedef enum
 {
+LOK_TILEMODE_RGBA,
+LOK_TILEMODE_ARGB
+}
+LibreOfficeKitTileMode;
+
+typedef enum
+{
 /**
  * Any tiles which are over the rectangle described in the payload are no
  * longer valid.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source sd/source sw/inc sw/source

2015-11-11 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   69 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++
 include/vcl/ITiledRenderable.hxx |3 +
 sc/inc/docuno.hxx|3 +
 sc/source/ui/unoobj/docuno.cxx   |   15 +
 sd/source/ui/inc/unomodel.hxx|2 
 sd/source/ui/unoidl/unomodel.cxx |   14 +
 sw/inc/unotxdoc.hxx  |2 
 sw/source/uibase/uno/unotxdoc.cxx|   11 
 9 files changed, 127 insertions(+), 1 deletion(-)

New commits:
commit 81b8ca683d44ba9c37f2dc8c74470a86ce70513f
Author: Andrzej Hunt 
Date:   Wed Nov 11 10:05:25 2015 +0100

Implement LOK_CALLBACK_MOUSE_POINTER

Change-Id: I8d1f63208baf277b0a9d15908f3ea7ff3b56bf10
Reviewed-on: https://gerrit.libreoffice.org/19883
Reviewed-by: Andrzej Hunt 
Tested-by: Andrzej Hunt 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4523675..6d7d079 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -66,6 +66,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,6 +175,58 @@ static const ExtensionMap aDrawExtensionMap[] =
 { nullptr, nullptr }
 };
 
+/*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+static const std::map  aPointerMap {
+{ PointerStyle::Arrow, "default" },
+// PointerStyle::Null ?
+{ PointerStyle::Wait, "wait" },
+{ PointerStyle::Text, "text" },
+{ PointerStyle::Help, "help" },
+{ PointerStyle::Cross, "crosshair" },
+{ PointerStyle::Move, "move" },
+{ PointerStyle::NSize, "n-resize" },
+{ PointerStyle::SSize, "s-resize" },
+{ PointerStyle::WSize, "w-resize" },
+{ PointerStyle::ESize, "e-resize" },
+{ PointerStyle::NWSize, "ne-resize" },
+{ PointerStyle::NESize, "ne-resize" },
+{ PointerStyle::SWSize, "sw-resize" },
+{ PointerStyle::SESize, "se-resize" },
+// WindowNSize through WindowSESize
+{ PointerStyle::HSplit, "col-resize" },
+{ PointerStyle::VSplit, "row-resize" },
+{ PointerStyle::HSizeBar, "col-resize" },
+{ PointerStyle::VSizeBar, "row-resize" },
+{ PointerStyle::Hand, "grab" },
+{ PointerStyle::RefHand, "grabbing" },
+// Pen, Magnify, Fill, Rotate
+// HShear, VShear
+// Mirror, Crook, Crop, MovePoint, MoveBezierWeight
+// MoveData
+{ PointerStyle::CopyData, "copy" },
+{ PointerStyle::LinkData, "alias" },
+// MoveDataLink, CopyDataLink
+//MoveFile, CopyFile, LinkFile
+// MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
+{ PointerStyle::NotAllowed, "not-allowed" },
+// DrawLine through DrawCaption
+// Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
+// TimeEventMove, TimeEventSize
+// AutoScrollN through AutoScrollNSWE
+// Airbrush
+{ PointerStyle::TextVertical, "vertical-text" }
+// Pivot Delete, TabSelectS through TabSelectSW
+// PaintBrush, HideWhiteSpace, ShowWhiteSpace
+};
+
 static OUString getUString(const char* pString)
 {
 if (pString == nullptr)
@@ -1040,6 +1093,22 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* 
pThis, int nType, int nX,
 }
 
 pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+
+Pointer aPointer = pDoc->getPointer();
+
+// We don't map all possible pointers hence we need a default
+OString aPointerString = "default";
+auto aIt = aPointerMap.find(aPointer.GetStyle());
+if (aIt != aPointerMap.end())
+{
+aPointerString = aIt->second;
+}
+
+LibLODocument_Impl* pLib = static_cast(pThis);
+if (pLib->mpCallback && pLib->mpCallbackData)
+{
+pLib->mpCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr(), 
pLib->mpCallbackData);
+}
 }
 
 static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int 
nX, int nY)
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index bf62675..37837ea 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -202,7 +202,14 @@ typedef enum
  *
  * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
  */
-LOK_CALLBACK_CELL_CURSOR
+LOK_CALLBACK_CELL_CURSOR,
+
+/**
+ * The current mouse pointer style.
+ *
+ * Payload is a css mouse pointer style.
+ */
+LOK_CALLBACK_MOUSE_POINTER
 }
 LibreOfficeKitCallbackType;
 
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.h

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl libreofficekit/Library_libreofficekitgtk.mk libreofficekit/source sc/inc sc/source sd/source sw/inc sw/source

2015-10-05 Thread Mihai Varga
 desktop/source/lib/init.cxx |8 ++-
 include/LibreOfficeKit/LibreOfficeKit.h |4 +
 include/LibreOfficeKit/LibreOfficeKit.hxx   |4 -
 include/vcl/ITiledRenderable.hxx|2 
 libreofficekit/Library_libreofficekitgtk.mk |4 +
 libreofficekit/source/gtk/lokdocview.cxx|   57 +++-
 libreofficekit/source/gtk/tilebuffer.hxx|4 +
 sc/inc/docuno.hxx   |3 -
 sc/source/ui/unoobj/docuno.cxx  |5 +-
 sd/source/ui/inc/unomodel.hxx   |3 -
 sd/source/ui/unoidl/unomodel.cxx|5 +-
 sw/inc/unotxdoc.hxx |3 -
 sw/source/uibase/uno/unotxdoc.cxx   |4 -
 13 files changed, 88 insertions(+), 18 deletions(-)

New commits:
commit c90c08a65c480a1012182979d5e9218f17a2ba2e
Author: Mihai Varga 
Date:   Sun Oct 4 19:40:13 2015 +0300

LOK: added the button type and key modifier to postMouseEvent()

To get a better functionality we need to know the button type (left,
right, middle). We also need the key modifier (ctrl, alt, shift) for
actions such as ctrl+click (to open a link) or shift+click to select

Change-Id: Iaccb93b276f8a6870dd41cc5132dbb85d2bbf71b

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7eb54d3..8fe6295 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -230,7 +230,9 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* 
pThis,
 int nType,
 int nX,
 int nY,
-int nCount);
+int nCount,
+int nButtons,
+int nModifier);
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
const char* pCommand,
const char* pArguments);
@@ -925,7 +927,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
/*pThis*/, const char* pC
 }
 }
 
-static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int 
nX, int nY, int nCount)
+static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int 
nX, int nY, int nCount, int nButtons, int nModifier)
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -934,7 +936,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* 
pThis, int nType, int nX,
 return;
 }
 
-pDoc->postMouseEvent(nType, nX, nY, nCount);
+pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
 }
 
 static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int 
nX, int nY)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index d83dd49..83dcc98 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -137,7 +137,9 @@ struct _LibreOfficeKitDocumentClass
 int nType,
 int nX,
 int nY,
-int nCount);
+int nCount,
+int nButtons,
+int nModifier);
 
 /// @see lok::Document::postUnoCommand
 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index acdfa27..72231ad 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -192,9 +192,9 @@ public:
  * @param nY vertical position in document coordinates
  * @param nCount number of clicks: 1 for single click, 2 for double click
  */
-inline void postMouseEvent(int nType, int nX, int nY, int nCount)
+inline void postMouseEvent(int nType, int nX, int nY, int nCount, int 
nButtons, int nModifier)
 {
-mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount);
+mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, 
nModifier);
 }
 
 /**
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index fd336f6..c294d20 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -112,7 +112,7 @@ public:
  *
  * @see lok::Document::postMouseEvent().
  */
-virtual void postMouseEvent(int nType, int nX, int nY, int nCount) = 0;
+virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int 
nButtons, int nModifier) = 0;
 
 /**
  * Sets the start or end of a text selection.
diff --git a/libreofficekit/Library_libreofficekitgtk.mk 
b/libreofficekit/Library_libreofficekitgtk.mk
index 71a77e9..7d25abf 100644
--- a/libreofficekit/Library_libreofficekitgtk.mk
+++ b/libreofficekit/Library_libreofficekitgtk.mk
@@ -16,6 +16,10 @@ $(eval $(call 
gb_Li

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/qa

2015-09-04 Thread Mihai Varga
 desktop/source/lib/init.cxx   |   24 
 include/LibreOfficeKit/LibreOfficeKit.h   |2 +-
 include/LibreOfficeKit/LibreOfficeKit.hxx |9 +++--
 libreofficekit/qa/unit/tiledrendering.cxx |8 ++--
 4 files changed, 10 insertions(+), 33 deletions(-)

New commits:
commit 262e7be01461887202f629d1ccc57751b1a085c5
Author: Mihai Varga 
Date:   Fri Sep 4 15:45:51 2015 +0300

Revert "LOK: added a general getCommandValues method"

This reverts commit 9640dcea46dd3201aa4c27f6a3918f7419288a2a.

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f15417c..c7f3aab 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -235,7 +235,7 @@ static void doc_setGraphicSelection 
(LibreOfficeKitDocument* pThis,
   int nX,
   int nY);
 static void doc_resetSelection (LibreOfficeKitDocument* pThis);
-static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* 
pCommand);
+static char* doc_getStyles(LibreOfficeKitDocument* pThis);
 
 struct LibLODocument_Impl : public _LibreOfficeKitDocument
 {
@@ -270,7 +270,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
 m_pDocumentClass->getTextSelection = doc_getTextSelection;
 m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
 m_pDocumentClass->resetSelection = doc_resetSelection;
-m_pDocumentClass->getCommandValues = doc_getCommandValues;
+m_pDocumentClass->getStyles = doc_getStyles;
 
 gDocumentClass = m_pDocumentClass;
 }
@@ -870,17 +870,15 @@ static void doc_resetSelection(LibreOfficeKitDocument* 
pThis)
 pDoc->resetSelection();
 }
 
-static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
+static char* doc_getStyles(LibreOfficeKitDocument* pThis)
 {
 LibLODocument_Impl* pDocument = static_cast(pThis);
 
 boost::property_tree::ptree aTree;
-aTree.put("commandName", pCommand);
 uno::Reference 
xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
 uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
 uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
 
-boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
 {
 boost::property_tree::ptree aChildren;
@@ -893,9 +891,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const 
char* pCommand)
 aChild.put("", aStyles[nInd]);
 aChildren.push_back(std::make_pair("", aChild));
 }
-aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
+aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren);
 }
-aTree.add_child("commandValues", aValues);
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
 char* pJson = static_cast(malloc(aStream.str().size() + 1));
@@ -903,19 +900,6 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 pJson[aStream.str().size()] = '\0';
 return pJson;
 }
-
-static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* 
pCommand)
-{
-if (!strcmp(pCommand, ".uno:StyleApply"))
-{
-return getStyles(pThis, pCommand);
-}
-else {
-gImpl->maLastExceptionMsg = "Unknown command, no values returned";
-return NULL;
-}
-}
-
 static char* lo_getError (LibreOfficeKit *pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 8060f0e..af7155c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -161,7 +161,7 @@ struct _LibreOfficeKitDocumentClass
 void (*resetSelection) (LibreOfficeKitDocument* pThis);
 
 /// @see lok::Document:getStyles
-char* (*getCommandValues) (LibreOfficeKitDocument* pThis, const char* 
pCommand);
+char* (*getStyles) (LibreOfficeKitDocument* pThis);
 #endif // LOK_USE_UNSTABLE_API
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 4459994..c526bda 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -248,14 +248,11 @@ public:
 }
 
 /**
- * Returns a json mapping of the possible values for the given command
- * e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : 
["list of style names in the family1"], etc.}}
- * @param pCommand a uno command for which the possible values are 
requested
- * @return {commandName: unoCmd, commandValues: {possible_values}}
+ * Returns a json map, {"familyName1" : ["list of style names in the 
family1"], etc.}
  */
-inline char* getCommandValues(const char* pCommand)
+i

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/qa

2015-08-18 Thread Mihai Varga
 desktop/source/lib/init.cxx   |   34 +
 include/LibreOfficeKit/LibreOfficeKit.h   |3 ++
 include/LibreOfficeKit/LibreOfficeKit.hxx |8 ++
 libreofficekit/qa/unit/tiledrendering.cxx |   35 ++
 4 files changed, 80 insertions(+)

New commits:
commit c5a516bd1bf0216ee39f31322369f6bffdf464eb
Author: Mihai Varga 
Date:   Mon Aug 17 18:49:40 2015 +0300

lok::Document getStyles method

This method returns a JSON mapping of style families to a list of styles
from the corresponding family.
Will be used to know and apply styles in tiledrendering.

Change-Id: I0aa395c40b9573920ade44255f97c077475ae5f1

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index abd8ca0..51302d1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -35,11 +35,13 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -233,6 +235,7 @@ static void doc_setGraphicSelection 
(LibreOfficeKitDocument* pThis,
   int nX,
   int nY);
 static void doc_resetSelection (LibreOfficeKitDocument* pThis);
+static char* doc_getStyles(LibreOfficeKitDocument* pThis);
 
 struct LibLODocument_Impl : public _LibreOfficeKitDocument
 {
@@ -267,6 +270,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
 m_pDocumentClass->getTextSelection = doc_getTextSelection;
 m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
 m_pDocumentClass->resetSelection = doc_resetSelection;
+m_pDocumentClass->getStyles = doc_getStyles;
 
 gDocumentClass = m_pDocumentClass;
 }
@@ -864,6 +868,36 @@ static void doc_resetSelection(LibreOfficeKitDocument* 
pThis)
 pDoc->resetSelection();
 }
 
+static char* doc_getStyles(LibreOfficeKitDocument* pThis)
+{
+LibLODocument_Impl* pDocument = static_cast(pThis);
+
+boost::property_tree::ptree aTree;
+uno::Reference 
xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
+uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
+
+for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
+{
+boost::property_tree::ptree aChildren;
+OUString sStyleFam = aStyleFamilies[nStyleFam];
+uno::Reference 
xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY);
+uno::Sequence aStyles = xStyleFamily->getElementNames();
+for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd)
+{
+boost::property_tree::ptree aChild;
+aChild.put("", aStyles[nInd]);
+aChildren.push_back(std::make_pair("", aChild));
+}
+aTree.add_child(sStyleFam.toUtf8().getStr(), aChildren);
+}
+std::stringstream aStream;
+boost::property_tree::write_json(aStream, aTree);
+char* pJson = static_cast(malloc(aStream.str().size() + 1));
+strcpy(pJson, aStream.str().c_str());
+pJson[aStream.str().size()] = '\0';
+return pJson;
+}
 static char* lo_getError (LibreOfficeKit *pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index e3b4850..af7155c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -159,6 +159,9 @@ struct _LibreOfficeKitDocumentClass
 
 /// @see lok::Document::resetSelection
 void (*resetSelection) (LibreOfficeKitDocument* pThis);
+
+/// @see lok::Document:getStyles
+char* (*getStyles) (LibreOfficeKitDocument* pThis);
 #endif // LOK_USE_UNSTABLE_API
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 816ade5..c526bda 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -246,6 +246,14 @@ public:
 {
 mpDoc->pClass->resetSelection(mpDoc);
 }
+
+/**
+ * Returns a json map, {"familyName1" : ["list of style names in the 
family1"], etc.}
+ */
+inline char* getStyles()
+{
+return mpDoc->pClass->getStyles(mpDoc);
+}
 #endif // LOK_USE_UNSTABLE_API
 };
 
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx 
b/libreofficekit/qa/unit/tiledrendering.cxx
index 0ebbc6a..a4e5525 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -67,6 +68,7 @@ public:
 void testDocumentTypes( Office* pOffice );
 void testImpressSlideNames( Office* pOffice );
 void testCalcSheetNames( Office* pOffice );
+void testGetStyles( Office* pOffice );
 #if 0
 voi

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa sd/qa sd/source sw/inc sw/qa sw/source

2015-06-19 Thread Miklos Vajna
 desktop/source/lib/init.cxx |   17 ++---
 include/LibreOfficeKit/LibreOfficeKit.h |3 ++-
 include/LibreOfficeKit/LibreOfficeKit.hxx   |7 ---
 include/vcl/ITiledRenderable.hxx|2 +-
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |4 +++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx|5 +++--
 sd/source/ui/inc/ViewShell.hxx  |2 +-
 sd/source/ui/inc/unomodel.hxx   |2 +-
 sd/source/ui/unoidl/unomodel.cxx|4 ++--
 sd/source/ui/view/viewshel.cxx  |6 +-
 sw/inc/unotxdoc.hxx |2 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |9 +
 sw/source/uibase/uno/unotxdoc.cxx   |3 ++-
 13 files changed, 44 insertions(+), 22 deletions(-)

New commits:
commit af7cbebd8eed82b81e00e6c2e0dc6c2c467ad8e2
Author: Miklos Vajna 
Date:   Fri Jun 19 18:13:27 2015 +0200

LOK: return used format in Document::getTextSelection()

This allows requesting text/html, with falling back to plain text if
necessary.

Change-Id: Ie6d4e0e173311ba018553043b6a869abf193bf6f
Reviewed-on: https://gerrit.libreoffice.org/16377
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 23c52bc..c043e04 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -216,7 +216,8 @@ static void doc_setTextSelection (LibreOfficeKitDocument* 
pThis,
   int nX,
   int nY);
 static char* doc_getTextSelection(LibreOfficeKitDocument* pThis,
-const char* pMimeType);
+  const char* pMimeType,
+  char** pUsedMimeType);
 static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
   int nType,
   int nX,
@@ -791,7 +792,7 @@ static void doc_setTextSelection(LibreOfficeKitDocument* 
pThis, int nType, int n
 pDoc->setTextSelection(nType, nX, nY);
 }
 
-static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* 
pMimeType)
+static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* 
pMimeType, char** pUsedMimeType)
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -800,10 +801,20 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* 
pThis, const char* pMi
 return 0;
 }
 
-OString aRet = pDoc->getTextSelection(pMimeType);
+OString aUsedMimeType;
+OString aRet = pDoc->getTextSelection(pMimeType, aUsedMimeType);
+if (aUsedMimeType.isEmpty())
+aRet = pDoc->getTextSelection("text/plain;charset=utf-8", 
aUsedMimeType);
 
 char* pMemory = static_cast(malloc(aRet.getLength() + 1));
 strcpy(pMemory, aRet.getStr());
+
+if (pUsedMimeType)
+{
+*pUsedMimeType = static_cast(malloc(aUsedMimeType.getLength() + 
1));
+strcpy(*pUsedMimeType, aUsedMimeType.getStr());
+}
+
 return pMemory;
 }
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 7fbf71b..e3b4850 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -148,7 +148,8 @@ struct _LibreOfficeKitDocumentClass
 
 /// @see lok::Document::getTextSelection
 char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
-   const char* pMimeType);
+   const char* pMimeType,
+   char** pUsedMimeType);
 
 /// @see lok::Document::setGraphicSelection
 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 2b562b2..816ade5 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -219,11 +219,12 @@ public:
 /**
  * Gets the currently selected text.
  *
- * @param pMimeType determines the return format, for example 
text/plain;charset=utf-8.
+ * @param pMimeType suggests the return format, for example 
text/plain;charset=utf-8.
+ * @param pUsedMimeType output parameter to inform about the determined 
format (suggested one or plain text).
  */
-inline char* getTextSelection(const char* pMimeType)
+inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType 
= 0)
 {
-return mpDoc->pClass->getTextSelection(mpDoc, pMimeType);
+return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, 
pUsedMimeType);
 }
 
 /**
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 7de3c32..d212519 100644
--- a/include/vcl/ITiledRender

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sw/inc sw/source

2015-06-17 Thread Miklos Vajna
 desktop/source/lib/init.cxx   |   19 +
 include/LibreOfficeKit/LibreOfficeKit.h   |4 ++
 include/LibreOfficeKit/LibreOfficeKit.hxx |   10 +++
 include/vcl/ITiledRenderable.hxx  |7 +
 sw/inc/unotxdoc.hxx   |2 +
 sw/source/uibase/uno/unotxdoc.cxx |   42 ++
 6 files changed, 84 insertions(+)

New commits:
commit cfc4375158ee174e8dcb4df319b82c0bdd6f31cc
Author: Miklos Vajna 
Date:   Wed Jun 17 18:00:01 2015 +0200

LOK: add lok::Document::getTextSelection()

I.e. the copy part of copy&paste. Only the Writer bits for now.

Change-Id: Ia003e76e3b234735f472cdef125514f9771d8640

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 89e85af..23c52bc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -215,6 +215,8 @@ static void doc_setTextSelection (LibreOfficeKitDocument* 
pThis,
   int nType,
   int nX,
   int nY);
+static char* doc_getTextSelection(LibreOfficeKitDocument* pThis,
+const char* pMimeType);
 static void doc_setGraphicSelection (LibreOfficeKitDocument* pThis,
   int nType,
   int nX,
@@ -251,6 +253,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
 m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
 m_pDocumentClass->postUnoCommand = doc_postUnoCommand;
 m_pDocumentClass->setTextSelection = doc_setTextSelection;
+m_pDocumentClass->getTextSelection = doc_getTextSelection;
 m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
 m_pDocumentClass->resetSelection = doc_resetSelection;
 
@@ -788,6 +791,22 @@ static void doc_setTextSelection(LibreOfficeKitDocument* 
pThis, int nType, int n
 pDoc->setTextSelection(nType, nX, nY);
 }
 
+static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* 
pMimeType)
+{
+ITiledRenderable* pDoc = getTiledRenderable(pThis);
+if (!pDoc)
+{
+gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+return 0;
+}
+
+OString aRet = pDoc->getTextSelection(pMimeType);
+
+char* pMemory = static_cast(malloc(aRet.getLength() + 1));
+strcpy(pMemory, aRet.getStr());
+return pMemory;
+}
+
 static void doc_setGraphicSelection(LibreOfficeKitDocument* pThis, int nType, 
int nX, int nY)
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 7eb42e8..7fbf71b 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -146,6 +146,10 @@ struct _LibreOfficeKitDocumentClass
   int nX,
   int nY);
 
+/// @see lok::Document::getTextSelection
+char* (*getTextSelection) (LibreOfficeKitDocument* pThis,
+   const char* pMimeType);
+
 /// @see lok::Document::setGraphicSelection
 void (*setGraphicSelection) (LibreOfficeKitDocument* pThis,
  int nType,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index bd8832a..2b562b2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -217,6 +217,16 @@ public:
 }
 
 /**
+ * Gets the currently selected text.
+ *
+ * @param pMimeType determines the return format, for example 
text/plain;charset=utf-8.
+ */
+inline char* getTextSelection(const char* pMimeType)
+{
+return mpDoc->pClass->getTextSelection(mpDoc, pMimeType);
+}
+
+/**
  * Adjusts the graphic selection.
  *
  * @param nType @see LibreOfficeKitSetGraphicSelectionType
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 5cac9b6..7de3c32 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -122,6 +122,13 @@ public:
 virtual void setTextSelection(int nType, int nX, int nY) = 0;
 
 /**
+ * Gets the text selection.
+ *
+ * @see lok::Document::getTextSelection().
+ */
+virtual OString getTextSelection(const char* /*pMimeType*/) { return 
OString(); }
+
+/**
  * Adjusts the graphic selection.
  *
  * @see lok::Document::setGraphicSelection().
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 0f7a446..78ec974 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -417,6 +417,8 @@ public:
 virtual void postMouseEvent(int nType, int nX, int nY, int nCount) 
SAL_OVERRIDE;
 /// @see vcl::ITiledRenderable::setTextSelection().
 virtual void setTextSelection(int nType, int nX, int nY) SAL_

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/qa libreofficekit/source

2015-04-22 Thread Miklos Vajna
 desktop/source/lib/init.cxx |   36 ++--
 include/LibreOfficeKit/LibreOfficeKit.h |3 +
 include/LibreOfficeKit/LibreOfficeKit.hxx   |   20 ++-
 include/LibreOfficeKit/LibreOfficeKitGtk.h  |2 -
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |2 -
 libreofficekit/source/gtk/lokdocview.cxx|4 +-
 6 files changed, 57 insertions(+), 10 deletions(-)

New commits:
commit 6a8719b12e2f24e926fccdfabc60b95c089320fc
Author: Miklos Vajna 
Date:   Wed Apr 22 14:28:36 2015 +0200

lok::Document::postUnoCommand: allow passing arguments

Change-Id: I6c24a8e392473f3985d3bde9b76a3148fd03bc9a

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c1237ac..b783612 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 
 #define LOK_USE_UNSTABLE_API
 #include 
@@ -52,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -207,7 +209,8 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* 
pThis,
 int nY,
 int nCount);
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
-   const char* pCommand);
+   const char* pCommand,
+   const char* pArguments);
 static void doc_setTextSelection (LibreOfficeKitDocument* pThis,
   int nType,
   int nX,
@@ -701,11 +704,38 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* 
pThis, int nType, int nChar
 pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
 }
 
-static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* 
pCommand)
+static void jsonToPropertyValues(const char* pJSON, 
uno::Sequence& rPropertyValues)
+{
+boost::property_tree::ptree aTree;
+std::stringstream aStream(pJSON);
+boost::property_tree::read_json(aStream, aTree);
+
+std::vector aArguments;
+for (const std::pair& rPair : 
aTree)
+{
+const std::string& rType = rPair.second.get("type");
+const std::string& rValue = rPair.second.get("value");
+
+beans::PropertyValue aValue;
+aValue.Name = OUString::fromUtf8(rPair.first.c_str());
+if (rType == "string")
+aValue.Value <<= OUString::fromUtf8(rValue.c_str());
+else if (rType == "boolean")
+aValue.Value <<= OString(rValue.c_str()).toBoolean();
+else
+SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type 
'"<()))
+uno::Sequence aPropertyValues;
+jsonToPropertyValues(pArguments, aPropertyValues);
+if (!comphelper::dispatchCommand(aCommand, aPropertyValues))
 {
 gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command";
 }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index c078318..e576e0a 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -132,7 +132,8 @@ struct _LibreOfficeKitDocumentClass
 
 /// @see lok::Document::postUnoCommand
 void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
-const char* pCommand);
+const char* pCommand,
+const char* pArguments);
 
 /// @see lok::Document::setTextSelection
 void (*setTextSelection) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 4f0a77a..0140348 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -181,11 +181,27 @@ public:
 /**
  * Posts an UNO command to the document.
  *
+ * Example argument string:
+ *
+ * {
+ * "SearchItem.SearchString":
+ * {
+ * "type": "string",
+ * "value": "foobar"
+ * },
+ * "SearchItem.Backward":
+ * {
+ * "type": "boolean",
+ * "value": "false"
+ * }
+ * }
+ *
  * @param pCommand uno command to be posted to the document, like 
".uno:Bold"
+ * @param pArguments arguments of the uno command.
  */
-inline void postUnoCommand(const char* pCommand)
+inline void postUnoCommand(const char* pCommand, const char* pArguments = 
0)
 {
-mpDoc->pClass->postUnoCommand(mpDoc, pCommand);
+mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments);
 }
 
 /**
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h 
b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index f76c1fb..a517fca 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -68,7 +68,7 @@ voidlok_docview_set_edit(LOKDocView* 
pDocView,
 gboolean   

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit

2015-04-08 Thread Tor Lillqvist
 desktop/source/lib/init.cxx |   21 +---
 include/LibreOfficeKit/LibreOfficeKitInit.h |   36 ++--
 2 files changed, 46 insertions(+), 11 deletions(-)

New commits:
commit 5cc0da153e8516a11bbd3e5809e8dcaf0b0dc7d9
Author: Tor Lillqvist 
Date:   Wed Apr 8 22:44:29 2015 +0300

Add lok_init_2() that takes also the path to a user profile to use

In some LibreOfficeKit use cases it will be useful to use a separate
(initially empty) user profile each time, instead of whatever the default
might turn out to be. (When using the "instdir" of a LibreOffice build tree,
the user profile is the "instdir/user" directory.)

Also add a corresponding new function to be looked up, 
libreofficekit_hook_2.

I did not bother with any more descriptive name. After all, "lok_init" 
already
is quite terse, so calling the new function "lok_init_with_user_profile" or
something similarly verbose would in my humble opinion have been
inconsistent. (And if/when we need to extend the LibreOfficeKit 
initialisation
function with even more parameters, the name would become really long.) But
feel free to change this if you feel like it...

Make sure to stay backward-compatible with source code calling lok_init() 
and
with binaries looking for only the libreofficekit_hook entry point.

Change-Id: Ifa9ce8f72c2f60554fb3431d522e5784afa8d8d3

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 94c95ed..186f60b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -268,7 +268,7 @@ static void doc_destroy(LibreOfficeKitDocument *pThis)
 }
 
 static voidlo_destroy   (LibreOfficeKit* pThis);
-static int lo_initialize(LibreOfficeKit* pThis, const 
char* pInstallPath);
+static int lo_initialize(LibreOfficeKit* pThis, const 
char* pInstallPath, const char* pUserProfilePath);
 static LibreOfficeKitDocument* lo_documentLoad  (LibreOfficeKit* pThis, const 
char* pURL);
 static char *  lo_getError  (LibreOfficeKit* pThis);
 static LibreOfficeKitDocument* lo_documentLoadWithOptions  (LibreOfficeKit* 
pThis,
@@ -839,7 +839,7 @@ static void lo_startmain(void*)
 
 static bool bInitialized = false;
 
-static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
+static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const 
char* pUserProfilePath)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
 
@@ -848,6 +848,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* 
pAppPath)
 
 comphelper::LibreOfficeKit::setActive();
 
+if (pUserProfilePath)
+rtl::Bootstrap::set(OUString("UserInstallation"), 
OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
+
 OUString aAppPath;
 if (pAppPath)
 {
@@ -947,14 +950,14 @@ __attribute__ ((visibility("default")))
 #else
 SAL_DLLPUBLIC_EXPORT
 #endif
-LibreOfficeKit *libreofficekit_hook(const char* install_path)
+LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* 
user_profile_path)
 {
 if (!gImpl)
 {
 SAL_INFO("lok", "Create libreoffice object");
 
 gImpl = new LibLibreOffice_Impl();
-if (!lo_initialize(gImpl, install_path))
+if (!lo_initialize(gImpl, install_path, user_profile_path))
 {
 lo_destroy(gImpl);
 }
@@ -962,6 +965,16 @@ LibreOfficeKit *libreofficekit_hook(const char* 
install_path)
 return static_cast(gImpl);
 }
 
+#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) && 
defined(DISABLE_DYNLOADING)
+__attribute__ ((visibility("default")))
+#else
+SAL_DLLPUBLIC_EXPORT
+#endif
+LibreOfficeKit *libreofficekit_hook(const char* install_path)
+{
+return libreofficekit_hook_2(install_path, NULL);
+}
+
 static void lo_destroy(LibreOfficeKit* pThis)
 {
 LibLibreOffice_Impl* pLib = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h 
b/include/LibreOfficeKit/LibreOfficeKitInit.h
index fe10cd9..c0d3d5d 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -126,11 +126,14 @@ extern "C"
 
 typedef LibreOfficeKit *(HookFunction)( const char *install_path);
 
-static LibreOfficeKit *lok_init( const char *install_path )
+typedef LibreOfficeKit *(HookFunction2)( const char *install_path, const char 
*user_profile_path );
+
+static LibreOfficeKit *lok_init_2( const char *install_path,  const char 
*user_profile_path )
 {
 char *imp_lib;
 void *dlhandle;
 HookFunction *pSym;
+HookFunction2 *pSym2;
 
 #if !(defined(__APPLE__) && defined(__arm__))
 size_t partial_length;
@@ -173,17 +176,36 @@ static LibreOfficeKit *lok_init( const char *install_path 
)
 dlhandle = RTLD_MAIN_ONLY;
 #endif
 
-pSym = (HookFunction *) _dlsym( dlhandle, "libreofficekit_hook" );
-

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl ios/experimental libreofficekit/qa libreofficekit/source vcl/headless

2015-03-20 Thread Tor Lillqvist
 desktop/source/lib/init.cxx|7 ---
 desktop/source/lib/lokandroid.cxx  |4 +---
 include/LibreOfficeKit/LibreOfficeKit.h|1 -
 include/LibreOfficeKit/LibreOfficeKit.hxx  |3 +--
 include/vcl/svpforlokit.hxx|1 -
 ios/experimental/TiledLibreOffice/TiledLibreOffice/TiledView.m |2 --
 libreofficekit/qa/lokdocview_quad/lokdocview_quad.c|   10 
--
 libreofficekit/qa/tilebench/tilebench.cxx  |9 +++--
 libreofficekit/source/gtk/lokdocview.cxx   |3 ---
 vcl/headless/svpvd.cxx |8 
 10 files changed, 5 insertions(+), 43 deletions(-)

New commits:
commit 7edd92c5576cc358815eb21634b3c27a43990c20
Author: Tor Lillqvist 
Date:   Fri Mar 20 13:12:08 2015 +0200

Drop paintTile's row stride output parameter that nobody is interested in

Change-Id: I166b4b713c2ea52c62c52045bb2073b6d84c1547

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c29223b..d0ae29b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -185,7 +185,6 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, 
int nPartMode);
 voiddoc_paintTile(LibreOfficeKitDocument* pThis,
   unsigned char* pBuffer,
   const int nCanvasWidth, const int nCanvasHeight,
-  int* pRowStride,
   const int nTilePosX, const int nTilePosY,
   const int nTileWidth, const int nTileHeight);
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
@@ -585,7 +584,6 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
 void doc_paintTile (LibreOfficeKitDocument* pThis,
 unsigned char* pBuffer,
 const int nCanvasWidth, const int nCanvasHeight,
-int* pRowStride,
 const int nTilePosX, const int nTilePosY,
 const int nTileWidth, const int nTileHeight)
 {
@@ -615,8 +613,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 
 pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-*pRowStride = GetRowStrideForLibreOfficeKit(aDevice.getSalVirtualDevice());
 #else
 SystemGraphicsData aData;
 aData.rCGContext = reinterpret_cast(pBuffer);
@@ -625,8 +621,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 
 pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
 nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-
-(void) pRowStride;
 #endif
 
 static bool bDebug = getenv("LOK_DEBUG") != 0;
@@ -646,7 +640,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 (void) pBuffer;
 (void) nCanvasWidth;
 (void) nCanvasHeight;
-(void) pRowStride;
 (void) nTilePosX;
 (void) nTilePosY;
 (void) nTileWidth;
diff --git a/desktop/source/lib/lokandroid.cxx 
b/desktop/source/lib/lokandroid.cxx
index c23fd3f..5f7eab4 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -220,9 +220,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL 
Java_org_libreoffice_kit_Document_paintTi
 LibreOfficeKitDocument* pDocument = 
getHandle(pEnv, aObject);
 
 unsigned char* buffer = (unsigned char*) 
pEnv->GetDirectBufferAddress(aByteBuffer);
-int nStride = 0;
-pDocument->pClass->paintTile(pDocument, buffer, nCanvasWidth, 
nCanvasHeight, &nStride, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-(void) nStride;
+pDocument->pClass->paintTile(pDocument, buffer, nCanvasWidth, 
nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 }
 
 extern "C" SAL_JNI_EXPORT jlong JNICALL 
Java_org_libreoffice_kit_Document_getDocumentHeight
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 85f760c..98aa24d 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -97,7 +97,6 @@ struct _LibreOfficeKitDocumentClass
unsigned char* pBuffer,
const int nCanvasWidth,
const int nCanvasHeight,
-   int* pRowStride,
const int nTilePosX,
const int nTilePosY,
const int nTileWidth,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 1d7d709..25d8980 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -73,13 +73,12 @@ public:
   unsigned char* pBuffer,
   const int nCanvasWidth,
   const int nCanvasHei

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit sdext/source

2015-02-17 Thread Mihai
 desktop/source/lib/init.cxx   |   17 +-
 include/LibreOfficeKit/LibreOfficeKit.h   |3 +
 sdext/source/pdfimport/inc/wrapper.hxx|6 +-
 sdext/source/pdfimport/pdfiadaptor.cxx|   15 -
 sdext/source/pdfimport/pdfiadaptor.hxx|3 -
 sdext/source/pdfimport/wrapper/wrapper.cxx|   14 +++--
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   46 +-
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |2 
 sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx|   17 +-
 9 files changed, 104 insertions(+), 19 deletions(-)

New commits:
commit 98b27ea907517d585f5d951895ae733653a442d2
Author: Mihai 
Date:   Fri Feb 13 12:56:11 2015 +0200

SkipImages option for PDF import

This option allows images and drawings to be skipped while importing
a PDF, the main reason was performance improvement where images were
not needed.

Change-Id: Ibca342ff6e7005bedf7b16869473832ce2576fb2
Reviewed-on: https://gerrit.libreoffice.org/14470
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d7ca143..3be8a20 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -262,6 +262,9 @@ static voidlo_destroy   
(LibreOfficeKit* pThis);
 static int lo_initialize(LibreOfficeKit* pThis, const 
char* pInstallPath);
 static LibreOfficeKitDocument* lo_documentLoad  (LibreOfficeKit* pThis, const 
char* pURL);
 static char *  lo_getError  (LibreOfficeKit* pThis);
+static LibreOfficeKitDocument* lo_documentLoadWithOptions  (LibreOfficeKit* 
pThis,
+   const char* pURL,
+   const char* 
pOptions);
 static voidlo_postKeyEvent  (LibreOfficeKit* pThis, int 
nType, int nCode);
 
 
@@ -281,6 +284,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
 m_pOfficeClass->destroy = lo_destroy;
 m_pOfficeClass->documentLoad = lo_documentLoad;
 m_pOfficeClass->getError = lo_getError;
+m_pOfficeClass->documentLoadWithOptions = 
lo_documentLoadWithOptions;
 m_pOfficeClass->postKeyEvent = lo_postKeyEvent;
 
 gOfficeClass = m_pOfficeClass;
@@ -308,6 +312,11 @@ static uno::Reference 
xFactory;
 
 static LibreOfficeKitDocument* lo_documentLoad(LibreOfficeKit* pThis, const 
char* pURL)
 {
+return lo_documentLoadWithOptions(pThis, pURL, NULL);
+}
+
+static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* 
pThis, const char* pURL, const char* pOptions)
+{
 LibLibreOffice_Impl* pLib = static_cast(pThis);
 
 SolarMutexGuard aGuard;
@@ -334,10 +343,15 @@ static LibreOfficeKitDocument* 
lo_documentLoad(LibreOfficeKit* pThis, const char
 
 try
 {
+uno::Sequence aFilterOptions(1);
+aFilterOptions[0] = css::beans::PropertyValue( 
OUString("FilterOptions"),
+   0,
+   
uno::makeAny(OUString::createFromAscii(pOptions)),
+   
beans::PropertyState_DIRECT_VALUE);
 uno::Reference xComponent;
 xComponent = xComponentLoader->loadComponentFromURL(
 aURL, OUString("_blank"), 0,
-
uno::Sequence());
+aFilterOptions);
 
 if (!xComponent.is())
 {
@@ -357,7 +371,6 @@ static LibreOfficeKitDocument* 
lo_documentLoad(LibreOfficeKit* pThis, const char
 
 return NULL;
 }
-
 static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const 
char* pFormat, const char* pFilterOptions)
 {
 LibLODocument_Impl* pDocument = static_cast(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 9c5cca5..7cbaad3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -143,6 +143,9 @@ struct _LibreOfficeKitClass
   void(*destroy)   (LibreOfficeKit* pThis);
   LibreOfficeKitDocument* (*documentLoad)  (LibreOfficeKit* pThis, const char* 
pURL);
   char*   (*getError)  (LibreOfficeKit* pThis);
+  LibreOfficeKitDocument* (*documentLoadWithOptions)  (LibreOfficeKit* pThis,
+  const char* pURL,
+  const char* pOptions);
   void(*postKeyEvent)  (LibreOfficeKit* pThis, int nType, 
int nCode);
 };
 
diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 8f0fc10..6bafce4 100

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit smoketest/libtest.cxx

2014-06-23 Thread Andrzej Hunt
 desktop/source/lib/init.cxx   |   11 ++-
 include/LibreOfficeKit/LibreOfficeKit.h   |7 ++-
 include/LibreOfficeKit/LibreOfficeKit.hxx |   10 ++
 smoketest/libtest.cxx |   10 --
 4 files changed, 6 insertions(+), 32 deletions(-)

New commits:
commit 707a648eb3d8b8c216d4ee1d1f738552c6ac50a0
Author: Andrzej Hunt 
Date:   Tue Jun 17 19:33:34 2014 +0100

LOK: kill saveAsWithOptions.

The saveAsWithOptions/saveAs split existed for reasons of historical
API compatibility. Since we're breaking the API currently we can
now get a clean start, and get rid of the redundant saveAs, and
make saveAsWithOptions the standard saveAs function.

Change-Id: Ia3e2294a8604cab08e95b07544c9d10d42dd1152

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index eed7831..710b474 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -153,8 +153,7 @@ extern "C"
 {
 
 static void doc_destroy(LibreOfficeKitDocument* pThis);
-static int  doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const 
char* pFormat);
-static int  doc_saveAsWithOptions(LibreOfficeKitDocument* pThis, const char* 
pUrl, const char* pFormat, const char* pFilterOptions);
+static int  doc_saveAs(LibreOfficeKitDocument* pThis, const char* pUrl, const 
char* pFormat, const char* pFilterOptions);
 
 struct LibLODocument_Impl : public _LibreOfficeKitDocument
 {
@@ -172,7 +171,6 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
 
 m_pDocumentClass->destroy = doc_destroy;
 m_pDocumentClass->saveAs = doc_saveAs;
-m_pDocumentClass->saveAsWithOptions = doc_saveAsWithOptions;
 
 gDocumentClass = m_pDocumentClass;
 }
@@ -254,12 +252,7 @@ static LibreOfficeKitDocument* 
lo_documentLoad(LibreOfficeKit* pThis, const char
 return NULL;
 }
 
-static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const 
char* pFormat)
-{
-return doc_saveAsWithOptions(pThis, sUrl, pFormat, NULL);
-}
-
-static int doc_saveAsWithOptions(LibreOfficeKitDocument* pThis, const char* 
sUrl, const char* pFormat, const char* pFilterOptions)
+static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const 
char* pFormat, const char* pFilterOptions)
 {
 LibLODocument_Impl* pDocument = static_cast(pThis);
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 63c2c22..33b5872 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -58,11 +58,8 @@ struct _LibreOfficeKitDocumentClass
   void (*destroy)   (LibreOfficeKitDocument* pThis);
   int (*saveAs) (LibreOfficeKitDocument* pThis,
  const char *pUrl,
- const char *pFormat);
-  int (*saveAsWithOptions) (LibreOfficeKitDocument* pThis,
-const char *pUrl,
-const char *pFormat,
-const char *pFilterOptions);
+ const char *pFormat,
+ const char *pFilterOptions);
 };
 
 LibreOfficeKit* lok_init (const char* pInstallPath);
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index f1db388..51a8578 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -36,15 +36,9 @@ public:
 mpDoc->pClass->destroy(mpDoc);
 }
 
-// Save as the given format, if format is NULL sniff from ext'n
-inline bool saveAs(const char* pUrl, const char* pFormat = NULL)
+inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const 
char* pFilterOptions = NULL)
 {
-return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat);
-}
-
-inline bool saveAsWithOptions(const char* pUrl, const char* pFormat = 
NULL, const char* pFilterOptions = NULL)
-{
-return mpDoc->pClass->saveAsWithOptions(mpDoc, pUrl, pFormat, 
pFilterOptions);
+return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions);
 }
 inline LibreOfficeKitDocument *get() { return mpDoc; }
 };
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 211d056..8a0b724 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -69,16 +69,6 @@ int main (int argc, char **argv)
 return -1;
 }
 
-if (!LIBREOFFICEKIT_DOCUMENT_HAS(pDocument->get(), saveAsWithOptions))
-{
-fprintf( stderr, "using obsolete LibreOffice %" SAL_PRI_SIZET "d + %" 
SAL_PRI_SIZET "d vs. %" SAL_PRI_SIZET "d\n",
- (size_t)((unsigned char *)&((LibreOfficeKitDocumentClass *) 
0)->saveAsWithOptions),
- sizeof ((LibreOfficeKitDocumentClass *) 0)->saveAsWithOptions,
- pDocument->get()->pClass->nSize );
-return -1;
-}
-
-
 end = getTimeMS();
 fprintf( stderr, "load time: %ld ms\n", (end-start) )

[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source smoketest/libtest.cxx

2014-06-18 Thread Andrzej Hunt
 desktop/source/lib/init.cxx   |   20 +---
 include/LibreOfficeKit/LibreOfficeKit.h   |1 -
 include/LibreOfficeKit/LibreOfficeKit.hxx |5 -
 libreofficekit/source/shim.c  |4 ++--
 smoketest/libtest.cxx |7 ---
 5 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit f73e4594d363c67042089f79f056fc8dae7cf61e
Author: Andrzej Hunt 
Date:   Tue Jun 17 19:57:25 2014 +0100

LOK: kill double initialize.

Change-Id: I4d3dd913faea8b9f4a0bd3c13af37d097ced9888

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6c05f81..eed7831 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace css;
 using namespace utl;
@@ -207,7 +208,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
 m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass);
 
 m_pOfficeClass->destroy = lo_destroy;
-m_pOfficeClass->initialize = lo_initialize;
 m_pOfficeClass->documentLoad = lo_documentLoad;
 m_pOfficeClass->getError = lo_getError;
 
@@ -411,7 +411,17 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath)
 if (!pAppPath)
 return 0;
 
-OUString aAppPath(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8);
+OUString aAppPath;
+if (pAppPath)
+{
+aAppPath = OUString(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8);
+}
+else
+{
+::osl::Module::getUrlFromAddress( reinterpret_cast< oslGenericFunction 
>(lo_initialize),
+  aAppPath);
+}
+
 OUString aAppURL;
 if (osl::FileBase::getFileURLFromSystemPath(aAppPath, aAppURL) != 
osl::FileBase::E_None)
 return 0;
@@ -440,12 +450,16 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath)
 return bInitialized;
 }
 
-SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(void)
+SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(const char* 
install_path)
 {
 if (!gImpl)
 {
 fprintf(stderr, "create libreoffice object\n");
 gImpl = new LibLibreOffice_Impl();
+if (!lo_initialize(gImpl, install_path))
+{
+lo_destroy(gImpl);
+}
 }
 return static_cast(gImpl);
 }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 6bc91e4..63c2c22 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -40,7 +40,6 @@ struct _LibreOfficeKitClass
   size_t  nSize;
 
   void(*destroy)   (LibreOfficeKit *pThis);
-  int (*initialize)(LibreOfficeKit *pThis, const char 
*pInstallPath);
   LibreOfficeKitDocument* (*documentLoad)  (LibreOfficeKit *pThis, const char 
*pURL);
   char*   (*getError)  (LibreOfficeKit *pThis);
 };
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 4cd502a..f1db388 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -64,11 +64,6 @@ public:
 mpThis->pClass->destroy(mpThis);
 }
 
-inline bool initialize(const char* pInstallPath)
-{
-return mpThis->pClass->initialize(mpThis, pInstallPath);
-}
-
 inline Document* documentLoad(const char* pUrl)
 {
 LibreOfficeKitDocument* pDoc = mpThis->pClass->documentLoad(mpThis, 
pUrl);
diff --git a/libreofficekit/source/shim.c b/libreofficekit/source/shim.c
index 78002ab..6a3f9a7 100644
--- a/libreofficekit/source/shim.c
+++ b/libreofficekit/source/shim.c
@@ -23,7 +23,7 @@
 
 #define TARGET_LIB SAL_MODULENAME( "sofficeapp" )
 
-typedef LibreOfficeKit *(HookFunction)(void);
+typedef LibreOfficeKit *(HookFunction)( const char *install_path);
 
 SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char *install_path )
 {
@@ -59,7 +59,7 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *lok_init( const char 
*install_path )
 }
 
 free( imp_lib );
-return pSym();
+return pSym( install_path );
 }
 
 #endif // not LINUX => port me !
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index a116e0c..211d056 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -54,13 +54,6 @@ int main (int argc, char **argv)
 return -1;
 }
 
-// This separate init is lame I think.
-if( !pOffice->initialize( argv[1] ) )
-{
-fprintf( stderr, "failed to initialize\n" );
-return -1;
-}
-
 end = getTimeMS();
 fprintf( stderr, "init time: %ld ms\n", (end-start) );
 start = end;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit libreofficekit/source smoketest/libtest.cxx

2014-06-17 Thread Andrzej Hunt
 desktop/source/lib/init.cxx   |   44 +++---
 include/LibreOfficeKit/LibreOfficeKit.h   |   17 ++-
 include/LibreOfficeKit/LibreOfficeKit.hxx |   20 +
 libreofficekit/source/shim.c  |2 -
 smoketest/libtest.cxx |6 ++--
 5 files changed, 61 insertions(+), 28 deletions(-)

New commits:
commit 8ba3116a8f09650b47aa69cf3d828ca0b5f6b51e
Author: Andrzej Hunt 
Date:   Tue Jun 17 15:13:33 2014 +0100

LOK: Split into instance and class.

Change-Id: I2b6f33eaf12343c7da1328a932eb703bb4e4ef6f

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af812c6..6c05f81 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -13,6 +13,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 
 #include 
@@ -42,10 +45,14 @@
 using namespace css;
 using namespace utl;
 
+using namespace boost;
+
 struct LibLODocument_Impl;
 struct LibLibreOffice_Impl;
 
 static LibLibreOffice_Impl *gImpl = NULL;
+static weak_ptr< LibreOfficeKitClass > gOfficeClass;
+static weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass;
 
 typedef struct
 {
@@ -151,15 +158,24 @@ static int  doc_saveAsWithOptions(LibreOfficeKitDocument* 
pThis, const char* pUr
 struct LibLODocument_Impl : public _LibreOfficeKitDocument
 {
 uno::Reference mxComponent;
+shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
 
 LibLODocument_Impl(const uno::Reference  
&xComponent) :
 mxComponent( xComponent )
 {
-nSize = sizeof(LibreOfficeKitDocument);
+if (!(m_pDocumentClass = gDocumentClass.lock()))
+{
+m_pDocumentClass.reset(new LibreOfficeKitDocumentClass);
+
+m_pDocumentClass->nSize = sizeof(LibreOfficeKitDocument);
+
+m_pDocumentClass->destroy = doc_destroy;
+m_pDocumentClass->saveAs = doc_saveAs;
+m_pDocumentClass->saveAsWithOptions = doc_saveAsWithOptions;
 
-destroy = doc_destroy;
-saveAs = doc_saveAs;
-saveAsWithOptions = doc_saveAsWithOptions;
+gDocumentClass = m_pDocumentClass;
+}
+pClass = m_pDocumentClass.get();
 }
 
 ~LibLODocument_Impl()
@@ -182,15 +198,23 @@ static char *  lo_getError  
(LibreOfficeKit* pThis);
 struct LibLibreOffice_Impl : public _LibreOfficeKit
 {
 OUString maLastExceptionMsg;
+shared_ptr< LibreOfficeKitClass > m_pOfficeClass;
 
 LibLibreOffice_Impl()
 {
-nSize = sizeof(LibreOfficeKit);
+if(!(m_pOfficeClass = gOfficeClass.lock())) {
+m_pOfficeClass.reset(new LibreOfficeKitClass);
+m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass);
+
+m_pOfficeClass->destroy = lo_destroy;
+m_pOfficeClass->initialize = lo_initialize;
+m_pOfficeClass->documentLoad = lo_documentLoad;
+m_pOfficeClass->getError = lo_getError;
+
+gOfficeClass = m_pOfficeClass;
+}
 
-destroy = lo_destroy;
-initialize = lo_initialize;
-documentLoad = lo_documentLoad;
-getError = lo_getError;
+pClass = m_pOfficeClass.get();
 }
 };
 
@@ -416,7 +440,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* 
pAppPath)
 return bInitialized;
 }
 
-SAL_DLLPUBLIC_EXPORT LibreOfficeKit *liblibreoffice_hook(void)
+SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(void)
 {
 if (!gImpl)
 {
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 4c32fd2..6bc91e4 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -18,17 +18,25 @@ extern "C"
 #endif
 
 typedef struct _LibreOfficeKit LibreOfficeKit;
+typedef struct _LibreOfficeKitClass LibreOfficeKitClass;
+
 typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
+typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
 
 // Do we have an extended member in this struct ?
 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
 size_t)((unsigned char *)&((strct *) 0)->member) +  \
   sizeof ((strct *) 0)->member)) <= (nSize))
 
-#define LIBREOFFICEKIT_HAS(pKit,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKit,member,(pKit)->nSize)
+#define LIBREOFFICEKIT_HAS(pKit,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
 
 struct _LibreOfficeKit
 {
+LibreOfficeKitClass* pClass;
+};
+
+struct _LibreOfficeKitClass
+{
   size_t  nSize;
 
   void(*destroy)   (LibreOfficeKit *pThis);
@@ -37,10 +45,15 @@ struct _LibreOfficeKit
   char*   (*getError)  (LibreOfficeKit *pThis);
 };
 
-#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocument,member,(pDoc)->nSize)
+#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) 
LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,membe