libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 41 +++++++++++--------- sd/inc/Annotation.hxx | 2 sd/source/core/annotations/Annotation.cxx | 16 +++++++ sd/source/ui/annotations/annotationmanager.cxx | 12 +---- sd/source/ui/unoidl/unomodel.cxx | 3 - 5 files changed, 48 insertions(+), 26 deletions(-)
New commits: commit c62d2317472e2a02c7ace08a2f8ecc4135a9ba2c Author: Pranav Kant <pran...@collabora.co.uk> Date: Mon Feb 20 10:12:07 2017 +0530 gtktiledviewer: Id param is string now It was changed in ce96c5957c38384f8911d6307605c502eca0c644 Change-Id: I4cc1f90d85e31044306ab36eaeac9d4424d965c0 diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 19ae65c..c8bf3ee 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -296,7 +296,7 @@ static void editButtonClicked(GtkWidget* pWidget, gpointer userdata) 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", "/", "type", nullptr), '/'), "string"); 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"); @@ -320,7 +320,7 @@ static void replyButtonClicked(GtkWidget* pWidget, gpointer userdata) 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", "/", "type", nullptr), '/'), "string"); 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"); @@ -340,7 +340,7 @@ static void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata) 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", "/", "type", nullptr), '/'), "string"); aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentid)); std::stringstream aStream; commit 2acb622631453a3e4b74991986618ba161d9e4b8 Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Feb 19 19:10:07 2017 +0530 sd: Superfluous condition Change-Id: Ice8c5937e208880083b45d11aedcc3cb4a9f3c10 diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 4f895c53..70d53da 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -315,15 +315,11 @@ void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq) case SID_DELETE_POSTIT: { Reference< XAnnotation > xAnnotation; - - if( rReq.GetSlot() == SID_DELETE_POSTIT ) + if( pArgs ) { - if( pArgs ) - { - const SfxPoolItem* pPoolItem = nullptr; - if( SfxItemState::SET == pArgs->GetItemState( SID_DELETE_POSTIT, true, &pPoolItem ) ) - static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xAnnotation; - } + const SfxPoolItem* pPoolItem = nullptr; + if( SfxItemState::SET == pArgs->GetItemState( SID_DELETE_POSTIT, true, &pPoolItem ) ) + static_cast<const SfxUnoAnyItem*>(pPoolItem)->GetValue() >>= xAnnotation; } if( !xAnnotation.is() ) commit 6a4bf88c581b7fc1b6303099c804235027fd9f3e Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Feb 19 19:06:50 2017 +0530 gtktiledviewer: Adjust for different delete uno cmd for impress Change-Id: I7fa82096298a8a7c9f586a1d3c06aa5852e6842e diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 1996368f..19ae65c 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -1110,21 +1110,28 @@ static void initWindow(TiledWindow& rWindow) gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(rWindow.m_pEnableEditing), TRUE); LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(rWindow.m_pDocView)); - if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) + if (pDocument) { - // Align to top left corner, so the tiles are in sync with the - // row/column bar, even when zooming out enough that not all space is - // used. - gtk_widget_set_halign(GTK_WIDGET(rWindow.m_pDocView), GTK_ALIGN_START); - gtk_widget_set_valign(GTK_WIDGET(rWindow.m_pDocView), GTK_ALIGN_START); - - // Change cell alignment uno commands for spreadsheet - lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:AlignLeft"); - lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:AlignHorizontalCenter"); - lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:AlignRight"); - gtk_widget_hide(GTK_WIDGET(rWindow.m_pJustifypara)); - - lcl_registerToolItem(rWindow, rWindow.m_pDeleteComment, ".uno:DeleteNote"); + if (pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET) + { + // Align to top left corner, so the tiles are in sync with the + // row/column bar, even when zooming out enough that not all space is + // used. + gtk_widget_set_halign(GTK_WIDGET(rWindow.m_pDocView), GTK_ALIGN_START); + gtk_widget_set_valign(GTK_WIDGET(rWindow.m_pDocView), GTK_ALIGN_START); + + // Change cell alignment uno commands for spreadsheet + lcl_registerToolItem(rWindow, rWindow.m_pLeftpara, ".uno:AlignLeft"); + lcl_registerToolItem(rWindow, rWindow.m_pCenterpara, ".uno:AlignHorizontalCenter"); + lcl_registerToolItem(rWindow, rWindow.m_pRightpara, ".uno:AlignRight"); + gtk_widget_hide(GTK_WIDGET(rWindow.m_pJustifypara)); + + lcl_registerToolItem(rWindow, rWindow.m_pDeleteComment, ".uno:DeleteNote"); + } + else if (pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_PRESENTATION) + { + lcl_registerToolItem(rWindow, rWindow.m_pDeleteComment, ".uno:DeleteAnnotation"); + } } // Fill our comments sidebar commit 80d1ada96010a943ff1793139d176086f4598d98 Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Feb 19 18:51:13 2017 +0530 sd lok: Use IDs in ViewAnnotations output Change-Id: Ifb1f55ad5a1d21d63f9b37a83e3218c40dfa0b59 diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index fe2f39a..39e746c 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -35,6 +35,8 @@ void createAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotat SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, bool bInsert ); +sal_uInt32 getAnnotationId(const css::uno::Reference <css::office::XAnnotation>& xAnnotation); + } #endif diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 3289eb6..fcc0a60 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -370,6 +370,15 @@ SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation } } +sal_uInt32 getAnnotationId(const Reference<XAnnotation>& xAnnotation) +{ + Annotation* pAnnotation = dynamic_cast<Annotation*>(xAnnotation.get()); + sal_uInt32 nId = 0; + if (pAnnotation) + nId = pAnnotation->GetId(); + return nId; +} + UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ) : SdrUndoAction( *rAnnotation.GetModel() ) , mxAnnotation( &rAnnotation ) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3fcc45b..efd1b2d 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -78,6 +78,7 @@ #include "ViewShellBase.hxx" #include <UnoDocumentSettings.hxx> +#include <Annotation.hxx> #include <drawdoc.hxx> #include <glob.hrc> #include <sdresid.hxx> @@ -2380,7 +2381,7 @@ OUString SdXImpressDocument::getPostIts() uno::Reference<office::XAnnotation> xAnnotation(aPageAnnotation); boost::property_tree::ptree aAnnotation; - + aAnnotation.put("id", sd::getAnnotationId(xAnnotation)); aAnnotation.put("author", xAnnotation->getAuthor()); aAnnotation.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); uno::Reference<text::XText> xText(xAnnotation->getTextRange()); commit 46be94e3dc721d936de9699c1e24e5853b00c0fd Author: Pranav Kant <pran...@collabora.co.uk> Date: Sun Feb 19 18:33:46 2017 +0530 sd: Give ids to each annotation We want to refer to these annotations using these IDs from LOK clients, for example, to delete or modify them via the LOK API. Change-Id: I8f516977ece098713bdbf63f15575ae2ded1d2d2 diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index ef89314..3289eb6 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -57,8 +57,11 @@ public: Annotation(const Annotation&) = delete; Annotation& operator=(const Annotation&) = delete; + static sal_uInt32 m_nLastId; + SdPage* GetPage() const { return mpPage; } SdrModel* GetModel() { return (mpPage != nullptr) ? mpPage->GetModel() : nullptr; } + sal_uInt32 GetId() const { return m_nId; } // XInterface: virtual Any SAL_CALL queryInterface(Type const & type) override; @@ -99,6 +102,7 @@ private: // disposed, do it here. virtual void SAL_CALL disposing() override; + sal_uInt32 m_nId; SdPage* mpPage; RealPoint2D m_Position; RealSize2D m_Size; @@ -170,9 +174,12 @@ void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage ) pPage->addAnnotation(xAnnotation, -1); } +sal_uInt32 Annotation::m_nLastId = 1; + Annotation::Annotation( const Reference< XComponentContext >& context, SdPage* pPage ) : ::cppu::WeakComponentImplHelper< XAnnotation >(m_aMutex) , ::cppu::PropertySetMixin< XAnnotation >(context, static_cast< Implements >(IMPLEMENTS_PROPERTY_SET), Sequence< OUString >()) +, m_nId( m_nLastId++ ) , mpPage( pPage ) { } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits