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

Pranav Kant pranavk at collabora.co.uk
Thu Feb 16 04:52:34 UTC 2017


 desktop/qa/desktop_lib/test_desktop_lib.cxx         |    8 -
 include/svx/postattr.hxx                            |    4 
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   90 ++++++++++----------
 sc/source/ui/unoobj/docuno.cxx                      |   17 +--
 sc/source/ui/view/cellsh1.cxx                       |    3 
 svx/source/items/postattr.cxx                       |    4 
 sw/source/uibase/shells/textfld.cxx                 |   14 +--
 7 files changed, 70 insertions(+), 70 deletions(-)

New commits:
commit abef7dfae3d87f52464d1f0879927ffdcfd41656
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 16:13:11 2017 +0530

    gtktiledviewer: Kill signalSize; move its code to initWindow
    
    Change-Id: I8aa0a00768e074b016ea20680c67884f19fe26df

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 6ad2052..2f8dcdb 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -215,8 +215,6 @@ static std::map<GtkWidget*, TiledWindow> g_aWindows;
 static void setupDocView(GtkWidget* pDocView);
 static GtkWidget* createWindow(TiledWindow& rWindow);
 static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer userdata);
-/// Called when the document size is changed.
-static void signalSize(LOKDocView* pLOKDocView, gpointer pData);
 /// Handler for m_pPartModeComboBox.
 static void changePartMode( GtkWidget* pSelector, gpointer /*pItem*/);
 /// Handler for m_pPartSelector.
@@ -1135,10 +1133,15 @@ static void registerSelectorHandlers(TiledWindow& rWindow)
 /// document load)
 static void initWindow(TiledWindow& rWindow)
 {
+    rWindow.m_bPartSelectorBroadcast = false;
     populatePartSelector(LOK_DOC_VIEW(rWindow.m_pDocView));
+    rWindow.m_bPartSelectorBroadcast = true;
+
     populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) );
     registerSelectorHandlers(rWindow);
 
+    registerSelectorHandlers(rWindow);
+
     GList *focusChain = nullptr;
     focusChain = g_list_append( focusChain, rWindow.m_pDocView );
     gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain );
@@ -1170,9 +1173,6 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/)
     // Hide the unused progress bar.
     gtk_widget_show_all(rNewWindow.m_pStatusBar);
     gtk_widget_hide(rNewWindow.m_pProgressBar);
-    // Trigger a 'document size changed' event to populate the part selectors.
-    signalSize(LOK_DOC_VIEW(pDocView), nullptr);
-    registerSelectorHandlers(rNewWindow);
 }
 
 /// Creates a new model, i.e. LOK init and document load, one view implicitly.
@@ -1727,14 +1727,6 @@ static void populatePartSelector(LOKDocView* pLOKDocView)
     gtk_combo_box_set_active(GTK_COMBO_BOX(rWindow.m_pPartSelector), lok_doc_view_get_part(pLOKDocView));
 }
 
-static void signalSize(LOKDocView* pLOKDocView, gpointer /*pData*/)
-{
-    TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pLOKDocView));
-    rWindow.m_bPartSelectorBroadcast = false;
-    populatePartSelector(pLOKDocView);
-    rWindow.m_bPartSelectorBroadcast = true;
-}
-
 static void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
 {
     int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) );
@@ -2206,7 +2198,6 @@ static void setupDocView(GtkWidget* pDocView)
     g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), nullptr);
     g_signal_connect(pDocView, "search-result-count", G_CALLBACK(signalSearchResultCount), nullptr);
     g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), nullptr);
-    g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), nullptr);
     g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), nullptr);
     g_signal_connect(pDocView, "cursor-changed", G_CALLBACK(cursorChanged), nullptr);
     g_signal_connect(pDocView, "formula-changed", G_CALLBACK(formulaChanged), nullptr);
commit 786107e674877478b8c7fdc4e6b545c44ac6b6ac
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 15:49:41 2017 +0530

    gtktiledviewer: Factor out per view code to separate function
    
    This code (populating part selector, part mode selector etc.) is something
    that needs to be executed for each view, not just the view that makes
    open_document call. Put all such code in initWindow function from now.
    
    Change-Id: Ibf9b12adb156258aa3cfdf959fffb541a88da529

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index e7df903..6ad2052 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -221,6 +221,10 @@ static void signalSize(LOKDocView* pLOKDocView, gpointer pData);
 static void changePartMode( GtkWidget* pSelector, gpointer /*pItem*/);
 /// Handler for m_pPartSelector.
 static void changePart( GtkWidget* pSelector, gpointer /*pItem*/ );
+/// Part selector populator
+static void populatePartSelector(LOKDocView* pLOKDocView);
+/// Part mode selector populator
+static void populatePartModeSelector( GtkComboBoxText* pSelector );
 
 static TiledWindow& lcl_getTiledWindow(GtkWidget* pWidget)
 {
@@ -1127,6 +1131,24 @@ static void registerSelectorHandlers(TiledWindow& rWindow)
     g_signal_connect(G_OBJECT(rWindow.m_pPartSelector), "changed", G_CALLBACK(changePart), 0);
 }
 
+/// Helper function to do some tasks after widget is fully loaded (including
+/// document load)
+static void initWindow(TiledWindow& rWindow)
+{
+    populatePartSelector(LOK_DOC_VIEW(rWindow.m_pDocView));
+    populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) );
+    registerSelectorHandlers(rWindow);
+
+    GList *focusChain = nullptr;
+    focusChain = g_list_append( focusChain, rWindow.m_pDocView );
+    gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain );
+
+    gtk_widget_show_all(rWindow.m_pStatusBar);
+    gtk_widget_hide(rWindow.m_pProgressBar);
+
+    gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing), TRUE);
+}
+
 /// Creates a new view, i.e. no LOK init or document load.
 static void createView(GtkWidget* pButton, gpointer /*pItem*/)
 {
@@ -1144,6 +1166,7 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/)
     gboolean bTiledAnnotations;
     g_object_get(G_OBJECT(rWindow.m_pDocView), "tiled-annotations", &bTiledAnnotations, nullptr);
     TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView, bTiledAnnotations);
+    initWindow(rNewWindow);
     // Hide the unused progress bar.
     gtk_widget_show_all(rNewWindow.m_pStatusBar);
     gtk_widget_hide(rNewWindow.m_pProgressBar);
@@ -1757,7 +1780,6 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
     LOKDocView* pDocView = LOK_DOC_VIEW (source_object);
     TiledWindow& rWindow = lcl_getTiledWindow(GTK_WIDGET(pDocView));
     GError* error = nullptr;
-    GList *focusChain = nullptr;
 
     if (!lok_doc_view_open_document_finish(pDocView, res, &error))
     {
@@ -1787,17 +1809,7 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
         gtk_widget_set_valign(GTK_WIDGET(pDocView), GTK_ALIGN_START);
     }
 
-    populatePartSelector(pDocView);
-    populatePartModeSelector( GTK_COMBO_BOX_TEXT(rWindow.m_pPartModeComboBox) );
-    registerSelectorHandlers(rWindow);
-
-    focusChain = g_list_append( focusChain, pDocView );
-    gtk_container_set_focus_chain ( GTK_CONTAINER (rWindow.m_pVBox), focusChain );
-
-    gtk_widget_show_all(rWindow.m_pStatusBar);
-    gtk_widget_hide(rWindow.m_pProgressBar);
-
-    gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing), TRUE);
+    initWindow(rWindow);
 }
 
 /**
commit 2c622c188757143ecf2131210f34b1ca1b0c33e2
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 15:12:25 2017 +0530

    gtktiledviewer: Store author name of each view
    
    Change-Id: I9a5be9050f3bedd14b6b5602b51bf40da0a11175

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 1bdb256..e7df903 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -165,6 +165,8 @@ public:
     std::shared_ptr<CommentsSidebar> m_pCommentsSidebar;
     /// Rendering arguments, which are the same for all views.
     boost::property_tree::ptree m_aRenderingArguments;
+    /// Author of this window
+    std::string m_aAuthor;
 
     TiledWindow()
         : m_pDocView(nullptr),
@@ -1131,9 +1133,9 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/)
     TiledWindow& rWindow = lcl_getTiledWindow(pButton);
 
     boost::property_tree::ptree aTree = rWindow.m_aRenderingArguments;
-    std::string aAuthor = getNextAuthor();
+    rWindow.m_aAuthor = getNextAuthor();
     aTree.put(boost::property_tree::ptree::path_type(".uno:Author/type", '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", '/'), aAuthor);
+    aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", '/'), rWindow.m_aAuthor);
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
     std::string aArguments = aStream.str();
@@ -1195,9 +1197,9 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const
 
     // Save rendering arguments for views which are created later.
     rWindow.m_aRenderingArguments = aTree;
-
+    rWindow.m_aAuthor = getNextAuthor();
     aTree.put(boost::property_tree::ptree::path_type(".uno:Author/type", '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", '/'), getNextAuthor());
+    aTree.put(boost::property_tree::ptree::path_type(".uno:Author/value", '/'), rWindow.m_aAuthor);
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
commit 4d800a54bfa94421712c7dccc5437f50b8bfab9c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 14:55:49 2017 +0530

    sc lok: No need to set tiled rendering zoom here
    
    If we make sure that this code is executed after initializeForRendering
    is called, which is how it should be ideally, we will get the correct
    positions anyway.
    
    Change-Id: I1eb8f32823cb0b02539f077882372a73b6df5851

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 71a8753..eaf0ac9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1004,13 +1004,6 @@ OUString ScModelObj::getPostIts()
         ScGridWindow* pGridWindow = pViewData->GetActiveWin();
         if (pGridWindow)
         {
-            Fraction zoomX = Fraction(long(mnTilePixelWidth * TWIPS_PER_PIXEL), mnTileTwipWidth);
-            Fraction zoomY = Fraction(long(mnTilePixelHeight * TWIPS_PER_PIXEL), mnTileTwipHeight);
-
-            Fraction defaultZoomX = pViewData->GetZoomX();
-            Fraction defaultZoomY = pViewData->GetZoomY();
-            pViewData->SetZoom(zoomX, zoomY, true);
-
             SCCOL nX = aNote.maPos.Col();
             SCROW nY = aNote.maPos.Row();
             Point aScrPos = pViewData->GetScrPos(nX, nY, pViewData->GetActivePart(), true);
@@ -1023,8 +1016,6 @@ OUString ScModelObj::getPostIts()
             Rectangle aRect(Point(aScrPos.getX() / fPPTX, aScrPos.getY() / fPPTY),
                             Size(nSizeXPix / fPPTX, nSizeYPix / fPPTY));
 
-            pViewData->SetZoom(defaultZoomX, defaultZoomY, true);
-
             aAnnotation.put("cellPos", aRect.toString());
         }
 
commit 7d04c367158039f18f04b0b9e1157829e5e6e082
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 14:54:50 2017 +0530

    sc lok: comments: Use tab.rowcolumn string as postit id
    
    Change-Id: I5eaa7c82239ab65a567a893d76c68468cf116469

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f506fa5..71a8753 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -982,7 +982,7 @@ OUString ScModelObj::getPostIts()
     if (!pDocShell)
         return OUString();
 
-    const ScDocument& rDoc = pDocShell->GetDocument();
+    ScDocument& rDoc = pDocShell->GetDocument();
     std::vector<sc::NoteEntry> aNotes;
     rDoc.GetAllNoteEntries(aNotes);
 
@@ -990,7 +990,11 @@ OUString ScModelObj::getPostIts()
     for (const sc::NoteEntry& aNote : aNotes)
     {
         boost::property_tree::ptree aAnnotation;
-        aAnnotation.put("id", aNote.maPos.hash());
+        OStringBuffer aBuf;
+        aNote.maPos.Format(aBuf, ScRefFlags::VALID | ScRefFlags::TAB_3D, &rDoc,
+                           ScAddress::Details(formula::FormulaGrammar::AddressConvention::CONV_ODF, aNote.maPos));
+
+        aAnnotation.put("id", aBuf.toString());
         aAnnotation.put("author", aNote.mpNote->GetAuthor());
         aAnnotation.put("dateTime", aNote.mpNote->GetDate());
         aAnnotation.put("text", aNote.mpNote->GetText());
commit 4a22a8f16d144681d8a802a407f9aec43ca4a190
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 14:27:59 2017 +0530

    sc lok: Prevent editing note in case tiled annotations off
    
    Change-Id: Ie98a2cc3a5366bde912f4eeef9bb63a32342cdd6

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 7dd6809..00f51e1 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -25,6 +25,7 @@
 #include "scitems.hxx"
 #include <sfx2/viewfrm.hxx>
 
+#include <comphelper/lok.hxx>
 #include <svl/stritem.hxx>
 #include <svl/whiter.hxx>
 #include <svl/zforlist.hxx>
@@ -2213,7 +2214,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
                     pTabViewShell->ReplaceNote( aPos, pTextItem->GetValue(), &pAuthorItem->GetValue(), &pDateItem->GetValue() );
                 }
-                else
+                else if (!comphelper::LibreOfficeKit::isActive() || comphelper::LibreOfficeKit::isTiledAnnotations())
                 {
                     pTabViewShell->EditNote();                  // note object to edit
                 }
commit f5f3103187545952babf7b7efbdebc7d969f0974
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Feb 10 19:18:24 2017 +0530

    gtktiledviewer: comment id can be a string too now
    
    Change-Id: Ia94041884b7fde5f6c104a41c77c6a3aa96b7be1

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 542e631..1bdb256 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -291,11 +291,11 @@ static void editButtonClicked(GtkWidget* pWidget, gpointer userdata)
 
     userPromptDialog(rWindow.m_pDocView, "Edit comment", aEntries);
 
-    int *commentId = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+    gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentId));
+    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
 
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
@@ -315,11 +315,11 @@ static void replyButtonClicked(GtkWidget* pWidget, gpointer userdata)
 
     userPromptDialog(rWindow.m_pDocView, "Reply comment", aEntries);
 
-    int *commentId = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+    gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentId));
+    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
 
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
@@ -335,11 +335,11 @@ static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
 {
     TiledWindow& rWindow = lcl_getTiledWindow(pWidget);
 
-    int *commentid = static_cast<int*>(g_object_get_data(G_OBJECT(userdata), "id"));
+    gchar *commentid = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
     aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "long");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::to_string(*commentid));
+    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentid));
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
@@ -351,12 +351,11 @@ static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
 GtkWidget* CommentsSidebar::createCommentBox(const boost::property_tree::ptree& aComment)
 {
     GtkWidget* pCommentVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
-    int *id = g_new(int, 1);
-    *id =  aComment.get<int>("id");
+    gchar *id = g_strndup(aComment.get<std::string>("id").c_str(), 20);
     g_object_set_data_full(G_OBJECT(pCommentVBox), "id", id, g_free);
 
-    // Set left-margin if its a reply comment
-    if (aComment.get<int>("parent") > 0)
+    // Set background if its a reply comment
+    if (aComment.get("parent", -1) > 0)
     {
         GtkStyleContext* pStyleContext = gtk_widget_get_style_context(pCommentVBox);
         GtkCssProvider* pCssProvider = gtk_css_provider_get_default();
@@ -1603,13 +1602,13 @@ static void commentCallback(LOKDocView* pLOKDocView, gchar* pComment, gpointer /
     GtkWidget* pParent = nullptr;
     for (GList* l = pChildren; l != nullptr; l = l->next)
     {
-        int *id = static_cast<int*>(g_object_get_data(G_OBJECT(l->data), "id"));
+        gchar *id = static_cast<gchar*>(g_object_get_data(G_OBJECT(l->data), "id"));
 
-        if (*id == aComment.get<int>("id"))
+        if (g_strcmp0(id, aComment.get<std::string>("id").c_str()) == 0)
             pSelf = GTK_WIDGET(l->data);
 
         // There is no 'parent' in Remove callbacks
-        if (*id == aComment.get("parent", -1))
+        if (g_strcmp0(id, aComment.get("parent", std::string("0")).c_str()) == 0)
             pParent = GTK_WIDGET(l->data);
     }
 
commit ce96c5957c38384f8911d6307605c502eca0c644
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 15 14:27:08 2017 +0530

    SvxPostItIdItem is now string type
    
    Change-Id: Id44bf5dd623749b6e9a46f121f035aa5ce617557

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 0574fec..4e4ba10 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1918,7 +1918,7 @@ void DesktopLOKTest::testCommentsCallbacks()
     int nCommentId1 = aView1.m_aCommentCallbackResult.get<int>("id");
 
     // Reply to a comment just added
-    aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment\" } }";
+    aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment\" } }";
     pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false);
     Scheduler::ProcessEventsToIdle();
 
@@ -1932,7 +1932,7 @@ void DesktopLOKTest::testCommentsCallbacks()
     int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id");
 
     // Edit the previously added comment
-    aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId2) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Edited comment\" } }";
+    aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId2) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Edited comment\" } }";
     pDocument->pClass->postUnoCommand(pDocument, ".uno:EditAnnotation", aCommandArgs.getStr(), false);
     Scheduler::ProcessEventsToIdle();
 
@@ -1946,7 +1946,7 @@ void DesktopLOKTest::testCommentsCallbacks()
     CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get<std::string>("text"));
 
     // Delete the reply comment just added
-    aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\":  \"" + OString::number(nCommentId2) + "\" } }";
+    aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\":  \"" + OString::number(nCommentId2) + "\" } }";
     pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteComment", aCommandArgs.getStr(), false);
     Scheduler::ProcessEventsToIdle();
 
@@ -1957,7 +1957,7 @@ void DesktopLOKTest::testCommentsCallbacks()
     CPPUNIT_ASSERT_EQUAL(nCommentId2, aView2.m_aCommentCallbackResult.get<int>("id"));
 
     // Reply to nCommentId1 again
-    aCommandArgs = "{ \"Id\": { \"type\": \"long\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }";
+    aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }";
     pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false);
     Scheduler::ProcessEventsToIdle();
 
diff --git a/include/svx/postattr.hxx b/include/svx/postattr.hxx
index dbe378f..19477ac 100644
--- a/include/svx/postattr.hxx
+++ b/include/svx/postattr.hxx
@@ -120,14 +120,14 @@ public:
 The internal id of a note
 */
 
-class SVX_DLLPUBLIC SvxPostItIdItem: public SfxUInt32Item
+class SVX_DLLPUBLIC SvxPostItIdItem: public SfxStringItem
 {
 public:
     static SfxPoolItem* CreateDefault();
 
     SvxPostItIdItem( sal_uInt16 nWhich  );
 
-    SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 nWhich  );
+    SvxPostItIdItem( const OUString& rId, sal_uInt16 nWhich  );
 
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
 
diff --git a/svx/source/items/postattr.cxx b/svx/source/items/postattr.cxx
index 1426a1b..52d98a3 100644
--- a/svx/source/items/postattr.cxx
+++ b/svx/source/items/postattr.cxx
@@ -151,8 +151,8 @@ SvxPostItIdItem::SvxPostItIdItem( sal_uInt16 _nWhich )
     SetWhich( _nWhich );
 }
 
-SvxPostItIdItem::SvxPostItIdItem( sal_uInt32 rId, sal_uInt16 _nWhich ) :
-    SfxUInt32Item( _nWhich, rId )
+SvxPostItIdItem::SvxPostItIdItem( const OUString& rId, sal_uInt16 _nWhich ) :
+    SfxStringItem( _nWhich, rId )
 {
 }
 
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index a8fab5b..bf94094 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -330,9 +330,9 @@ void SwTextShell::ExecField(SfxRequest &rReq)
             case FN_DELETE_COMMENT:
             {
                 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
-                if (pIdItem && pIdItem->GetValue() && GetView().GetPostItMgr())
+                if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr())
                 {
-                    GetView().GetPostItMgr()->Delete(pIdItem->GetValue());
+                    GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32());
                 }
                 else if ( GetView().GetPostItMgr() &&
                           GetView().GetPostItMgr()->HasActiveSidebarWin() )
@@ -380,16 +380,16 @@ void SwTextShell::ExecField(SfxRequest &rReq)
             case FN_REPLY:
             {
                 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
-                if (pIdItem && pIdItem->GetValue())
+                if (pIdItem && !pIdItem->GetValue().isEmpty())
                 {
                     SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false);
                     SwIterator<SwFormatField,SwFieldType> aIter( *pType );
                     SwFormatField* pSwFormatField = aIter.First();
                     while( pSwFormatField )
                     {
-                        if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue())
+                        if ( static_cast<SwPostItField*>(pSwFormatField->GetField())->GetPostItId() == pIdItem->GetValue().toUInt32() )
                         {
-                            sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue());
+                            sw::annotation::SwAnnotationWin* pWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
                             if (pWin)
                             {
                                 const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
@@ -479,14 +479,14 @@ void SwTextShell::ExecField(SfxRequest &rReq)
             case SID_EDIT_POSTIT:
             {
                 const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID);
-                if (pIdItem && pIdItem->GetValue())
+                if (pIdItem && !pIdItem->GetValue().isEmpty())
                 {
                     const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
                     OUString sText;
                     if ( pTextItem )
                         sText = pTextItem->GetValue();
 
-                    sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue());
+                    sw::annotation::SwAnnotationWin* pAnnotationWin = GetView().GetPostItMgr()->GetAnnotationWin(pIdItem->GetValue().toUInt32());
                     if (pAnnotationWin)
                         pAnnotationWin->UpdateText(sText);
                 }


More information about the Libreoffice-commits mailing list