[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - 311 commits - accessibility/inc accessibility/source animations/source avmedia/source basctl/Library_basctl.mk basctl/source basic/source bridges/source chart2/inc chart2/Library_chartcontroller.mk chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk chart2/workbench comphelper/source compilerplugins/clang configmgr/source configure.ac connectivity/source connectivity/workben cppcanvas/source cpputools/source cui/source dbaccess/source desktop/inc desktop/source distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeWin32.conf distro-configs/LibreOfficeWin64.conf download.lst editeng/source embeddedobj/source extensions/source external/liblangtag extras/source filter/qa filter/source forms/source fpicker/Library_fps_office.mk fpicker/source fpicker/uiconfig fpicker/UIConfig_fps.mk framework/inc framework/Library_fwk.mk framework/source framework/util hwpfilter/source i18npool/inc icon-themes/breeze icon-themes/tang o include/animations include/avmedia include/basic include/connectivity include/dbaccess include/editeng include/filter include/LibreOfficeKit include/o3tl include/salhelper include/sfx2 include/svl include/svtools include/svx include/tools include/ucbhelper include/unotools include/vcl include/xmloff jvmfwk/plugins jvmfwk/source libreofficekit/qa libreofficekit/source lotuswordpro/source mysqlc/source o3tl/qa officecfg/registry oox/source readlicense_oo/docs registry/source reportdesign/source rsc/inc sal/qa sc/inc scripting/source sc/sdi sc/source sc/uiconfig sdext/source sd/inc sd/sdi sd/source sfx2/inc sfx2/Library_sfx.mk sfx2/sdi sfx2/source sfx2/uiconfig shell/source slideshow/source sot/source starmath/inc starmath/source stoc/source stoc/test store/source svgio/inc svgio/source svl/qa svl/source svtools/Library_svt.mk svtools/source svtools/uiconfig svx/inc svx/Library_svx.mk svx/source sw/inc sw/qa sw/source sw/uiconfig test/source toolkit/source tools/source ucbhelper/sour ce ucb/source udkapi/com unotools/source unoxml/source vbahelper/source vcl/headless vcl/inc vcl/source vcl/unx writerfilter/source writerperfect/source xmloff/source xmlsecurity/inc xmlsecurity/source
Pranav Kant
pranavk at gnome.org
Sat Jul 18 06:37:22 PDT 2015
Rebased ref, commits from common ancestor:
commit 207072cdc70bae5c48d0310004bc60bbdf216a85
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jul 15 23:39:09 2015 +0530
lokdocview: [WIP] Trying to draw in a separate thread
But it seems that this code is not able to correctly handle and
paint the cairo contexts.
Change-Id: I663d6ea4500ea8b132cb0371750f9970dd08ecb7
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0a5eca4..75e370b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -715,11 +715,16 @@ renderGraphicHandle(LOKDocView* pDocView,
}
}
-
-static gboolean
-renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
+static void
+renderDocument(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+ cairo_t* pCairo = static_cast<cairo_t*>(task_data);
+
GdkRectangle aVisibleArea;
long nDocumentWidthPixels = twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom);
long nDocumentHeightPixels = twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom);
@@ -773,14 +778,17 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
}
}
}
-
- return FALSE;
}
-static gboolean
-renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
+static void
+renderOverlay(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+ cairo_t* pCairo = static_cast<cairo_t*>(task_data);
if (priv->m_bEdit && priv->m_bCursorVisible && priv->m_bCursorOverlayVisible && !isEmptyRectangle(priv->m_aVisibleCursor))
{
@@ -850,8 +858,6 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
renderGraphicHandle(pDocView, pCairo, priv->m_aGraphicSelection, priv->m_pGraphicHandle);
g_free (handleGraphicPath);
}
-
- return FALSE;
}
static gboolean
@@ -1144,12 +1150,25 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
}
}
+static void
+lokCairoFree(gpointer cairo)
+{
+ cairo_t* pCairo = static_cast<cairo_t*>(cairo);
+ cairo_destroy(pCairo);
+}
+
+
static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo)
{
LOKDocView *pDocView = LOK_DOC_VIEW (pWidget);
+ GTask* taskDocument = g_task_new(pDocView, NULL, NULL, NULL);
+ GTask* taskOverlay = g_task_new(pDocView, NULL, NULL, NULL);
+
+ g_task_set_task_data(taskDocument, cairo_reference(pCairo), lokCairoFree);
+ g_task_set_task_data(taskOverlay, cairo_reference(pCairo), lokCairoFree);
- renderDocument (pDocView, pCairo);
- renderOverlay (pDocView, pCairo);
+ g_task_run_in_thread(taskDocument, renderDocument);
+ g_task_run_in_thread(taskDocument, renderOverlay);
return FALSE;
}
commit deb25e526b960d04bafcdab18043c0b0e2bcdd6a
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jul 15 23:14:56 2015 +0530
lokdocview: postKeyEvent goes async
Change-Id: I0486fdb5a96b960ebde29d726693acf3d4a02b16
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 50339d7..0a5eca4 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -225,6 +225,35 @@ isEmptyRectangle(const GdkRectangle& rRectangle)
return rRectangle.x == 0 && rRectangle.y == 0 && rRectangle.width == 0 && rRectangle.height == 0;
}
+struct PostKeyCallbackData
+{
+ int m_nType;
+ int m_nCharCode;
+ int m_nKeyCode;
+
+ PostKeyCallbackData(int nType, int nCharCode, int nKeyCode)
+ : m_nType(nType),
+ m_nCharCode(nCharCode),
+ m_nKeyCode(nKeyCode) {}
+};
+
+static void
+postKeyEventFunc(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
+{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
+ LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+
+ PostKeyCallbackData* pCallback = static_cast<PostKeyCallbackData*>(task_data);
+
+ priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument,
+ pCallback->m_nType,
+ pCallback->m_nCharCode,
+ pCallback->m_nKeyCode);
+}
+
static gboolean
signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
{
@@ -281,10 +310,27 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
if (pEvent->state & GDK_SHIFT_MASK)
nKeyCode |= KEY_SHIFT;
+
if (pEvent->type == GDK_KEY_RELEASE)
- priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode);
+ {
+ GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+ PostKeyCallbackData* pCallback = new PostKeyCallbackData(LOK_KEYEVENT_KEYUP,
+ nCharCode,
+ nKeyCode);
+ g_task_set_task_data(task, pCallback, g_free);
+ g_task_run_in_thread(task, postKeyEventFunc);
+ g_object_unref(task);
+ }
else
- priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode);
+ {
+ GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+ PostKeyCallbackData* pCallback = new PostKeyCallbackData(LOK_KEYEVENT_KEYINPUT,
+ nCharCode,
+ nKeyCode);
+ g_task_set_task_data(task, pCallback, g_free);
+ g_task_run_in_thread(task, postKeyEventFunc);
+ g_object_unref(task);
+ }
return FALSE;
}
commit df804f2dbf0003c8c39ad7c2f7b07867ab87584d
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jul 15 22:55:13 2015 +0530
lokdocview: *_set_part() goes async
Change-Id: I172b06ff8054a4d51f93764936071691005f8289
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 9a448fd..50339d7 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1569,11 +1569,28 @@ lok_doc_view_get_part (LOKDocView* pDocView)
return priv->m_pDocument->pClass->getPart( priv->m_pDocument );
}
+static void
+lok_doc_view_set_part_func(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
+{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
+ LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+ int* pPart = static_cast<int*>(task_data);
+
+ priv->m_pDocument->pClass->setPart( priv->m_pDocument, *pPart );
+}
+
SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_part (LOKDocView* pDocView, int nPart)
{
- LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
- priv->m_pDocument->pClass->setPart( priv->m_pDocument, nPart );
+ GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+ int* pPart = new int(nPart);
+ g_task_set_task_data(task, pPart, g_free);
+ g_task_run_in_thread(task, lok_doc_view_set_part_func);
+ g_object_unref(task);
+
}
SAL_DLLPUBLIC_EXPORT char*
commit 841171d19c2b7b2455cca0282c6672a4f5ed83c7
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jul 15 22:46:45 2015 +0530
lokdocview: *_set_partmode() goes async
Change-Id: I1beac707ee5cbf92f2c22493d488106dfde77f31
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index acd4fe1..9a448fd 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1583,12 +1583,28 @@ lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart)
return priv->m_pDocument->pClass->getPartName( priv->m_pDocument, nPart );
}
+static void
+lok_doc_view_set_partmode_func(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
+{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
+ LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+ int* pPartMode = static_cast<int*>(task_data);
+
+ priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, *pPartMode );
+}
+
SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_partmode(LOKDocView* pDocView,
int nPartMode)
{
- LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
- priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode );
+ GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+ int* pPartMode = new int(nPartMode);
+ g_task_set_task_data(task, pPartMode, g_free);
+ g_task_run_in_thread(task, lok_doc_view_set_partmode_func);
+ g_object_unref(task);
}
static void
commit 2134a0f76f2446cf4ea0fae4972d77691050dcaf
Author: Pranav Kant <pranavk at gnome.org>
Date: Wed Jul 15 22:25:24 2015 +0530
lokdocview: Make *_set_edit() async
Change-Id: I6dd396709f2099d93717a8b78fe8172d84d64494
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 6df8fa0..acd4fe1 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1591,33 +1591,48 @@ lok_doc_view_set_partmode(LOKDocView* pDocView,
priv->m_pDocument->pClass->setPartMode( priv->m_pDocument, nPartMode );
}
-/**
- * lok_doc_view_set_edit:
- * @pDocView: The #LOKDocView instance
- * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise
- *
- * Sets the edit-mode for pDocView
- */
-SAL_DLLPUBLIC_EXPORT void
-lok_doc_view_set_edit(LOKDocView* pDocView,
- gboolean bEdit)
+static void
+lok_doc_view_set_edit_func(GTask*,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable*)
{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
gboolean bWasEdit = priv->m_bEdit;
+ gboolean* pEdit = static_cast<gboolean*>(task_data);
- if (!priv->m_bEdit && bEdit)
+ if (!priv->m_bEdit && *pEdit)
g_info("lok_doc_view_set_edit: entering edit mode");
- else if (priv->m_bEdit && !bEdit)
+ else if (priv->m_bEdit && !*pEdit)
{
g_info("lok_doc_view_set_edit: leaving edit mode");
priv->m_pDocument->pClass->resetSelection(priv->m_pDocument);
}
- priv->m_bEdit = bEdit;
+ priv->m_bEdit = *pEdit;
g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit);
gtk_widget_queue_draw(GTK_WIDGET(pDocView));
}
/**
+ * lok_doc_view_set_edit:
+ * @pDocView: The #LOKDocView instance
+ * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise
+ *
+ * Sets the edit-mode for pDocView
+ */
+SAL_DLLPUBLIC_EXPORT void
+lok_doc_view_set_edit(LOKDocView* pDocView,
+ gboolean bEdit)
+{
+ GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
+ gboolean* pEdit = new gboolean(bEdit);
+ g_task_set_task_data(task, pEdit, g_free);
+ g_task_run_in_thread(task, lok_doc_view_set_edit_func);
+ g_object_unref(task);
+}
+
+/**
* lok_doc_view_get_edit:
* @pDocView: The #LOKDocView instance
*
@@ -1641,7 +1656,7 @@ struct PostCommandCallbackData
};
static void
-lok_doc_view_post_command_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable*)
+lok_doc_view_post_command_func (GTask*, gpointer source_object, gpointer task_data, GCancellable*)
{
LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
@@ -1664,12 +1679,11 @@ lok_doc_view_post_command (LOKDocView* pDocView,
const char* pCommand,
const char* pArguments)
{
- LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
GTask* task;
PostCommandCallbackData* pCallback = new PostCommandCallbackData(pCommand, pArguments);
task = g_task_new(pDocView, NULL, NULL, NULL);
- g_task_set_task_data(task, pCallback, NULL);
+ g_task_set_task_data(task, pCallback, g_free);
g_task_run_in_thread(task, lok_doc_view_post_command_func);
g_object_unref(task);
}
commit a94854e1f9559274bf519e9442986827b3dffb37
Author: Pranav Kant <pranavk at gnome.org>
Date: Sun Jul 12 23:22:51 2015 +0530
lokdocview: Run post_command in another thread
Change-Id: I53871265e4846be61c1e80ef48fc2af59cd4f45d
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0ab7f6e..6df8fa0 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1630,6 +1630,27 @@ lok_doc_view_get_edit (LOKDocView* pDocView)
return priv->m_bEdit;
}
+struct PostCommandCallbackData
+{
+ const char* m_pCommand;
+ const char* m_pArguments;
+
+ PostCommandCallbackData(const char* pCommand, const char* pArguments)
+ : m_pCommand(pCommand),
+ m_pArguments(pArguments) {}
+};
+
+static void
+lok_doc_view_post_command_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable*)
+{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
+ LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+
+ PostCommandCallbackData* pCallback = static_cast<PostCommandCallbackData*>(task_data);
+
+ priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pCallback->m_pCommand, pCallback->m_pArguments);
+}
+
/**
* lok_doc_view_post_command:
* @pDocView: the #LOKDocView instance
@@ -1644,7 +1665,13 @@ lok_doc_view_post_command (LOKDocView* pDocView,
const char* pArguments)
{
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
- priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pCommand, pArguments);
+ GTask* task;
+ PostCommandCallbackData* pCallback = new PostCommandCallbackData(pCommand, pArguments);
+
+ task = g_task_new(pDocView, NULL, NULL, NULL);
+ g_task_set_task_data(task, pCallback, NULL);
+ g_task_run_in_thread(task, lok_doc_view_post_command_func);
+ g_object_unref(task);
}
/**
commit 34629d0985d86b868de32a2b1c8f79960860d572
Author: Pranav Kant <pranavk at gnome.org>
Date: Sat Jul 11 21:29:53 2015 +0530
gtktiledviewer: Fill whole statusbar with progressbar
We don't have anything yet to put in statusbar. Let progressbar
fill the whole width of statusbar for now.
Change-Id: I4cd8745e997a0d2b917bc5baf358b097174d0df9
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 3b30e53..c6a6817 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -369,6 +369,11 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
}
}
+static void removeChildrenFromStatusbar(GtkWidget* children, gpointer)
+{
+ gtk_container_remove(GTK_CONTAINER(pStatusBar), children);
+}
+
static void populatePartModeSelector( GtkComboBoxText* pSelector )
{
gtk_combo_box_text_append_text( pSelector, "Standard" );
@@ -576,8 +581,10 @@ int main( int argc, char* argv[] )
g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar);
pStatusBar = gtk_statusbar_new ();
+ gtk_container_forall(GTK_CONTAINER(pStatusBar), removeChildrenFromStatusbar, NULL);
gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar);
gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar);
+ gtk_widget_set_hexpand(pProgressBar, true);
gtk_widget_show_all( pWindow );
// Hide the findbar by default.
commit 9d2e0207b67b7ee67025e28e904bc4d96eebd8b0
Author: Pranav Kant <pranavk at gnome.org>
Date: Tue Jul 7 21:16:45 2015 +0530
lokdocview: Emit load-changed signal showing load progress
Change-Id: I69b4c05d12c0c0b2ca6b7d1ad76ed74cc1f4346a
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index af3ba41..3b30e53 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -30,6 +30,7 @@ static int help()
}
static GtkWidget* pDocView;
+static GtkWidget* pStatusBar;
static GtkToolItem* pEnableEditing;
static GtkToolItem* pBold;
static GtkToolItem* pItalic;
@@ -286,6 +287,12 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer
}
}
+static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData)
+{
+ GtkWidget* pProgressBar = GTK_WIDGET (pData);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(pProgressBar), fValue);
+}
+
/// LOKDocView found no search matches -> set the search label accordingly.
static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpointer /*pData*/)
{
@@ -402,6 +409,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
focusChain = g_list_append( focusChain, pDocView1 );
gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+
+ gtk_widget_hide (pStatusBar);
}
int main( int argc, char* argv[] )
@@ -554,6 +563,7 @@ int main( int argc, char* argv[] )
g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL);
g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL);
+
// Scrolled window for DocView
pScrolledWindow = gtk_scrolled_window_new(0, 0);
gtk_widget_set_hexpand (pScrolledWindow, TRUE);
@@ -562,6 +572,13 @@ int main( int argc, char* argv[] )
gtk_container_add(GTK_CONTAINER(pScrolledWindow), pDocView);
+ GtkWidget* pProgressBar = gtk_progress_bar_new ();
+ g_signal_connect(pDocView, "load-changed", G_CALLBACK(loadChanged), pProgressBar);
+
+ pStatusBar = gtk_statusbar_new ();
+ gtk_container_add (GTK_CONTAINER(pVBox), pStatusBar);
+ gtk_container_add (GTK_CONTAINER(pStatusBar), pProgressBar);
+
gtk_widget_show_all( pWindow );
// Hide the findbar by default.
gtk_widget_hide(pFindbar);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 2812ca0..0ab7f6e 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -40,7 +40,7 @@ struct _LOKDocViewPrivate
{
gchar* m_aLOPath;
gchar* m_aDocPath;
- guint m_nLoadProgress;
+ gdouble m_nLoadProgress;
gboolean m_bIsLoading;
gboolean m_bCanZoomIn;
gboolean m_bCanZoomOut;
@@ -108,6 +108,7 @@ struct _LOKDocViewPrivate
enum
{
+ LOAD_CHANGED,
EDIT_CHANGED,
COMMAND_CHANGED,
SEARCH_NOT_FOUND,
@@ -341,17 +342,20 @@ globalCallback (gpointer pData)
{
case LOK_CALLBACK_STATUS_INDICATOR_START:
{
- priv->m_nLoadProgress = 0;
+ priv->m_nLoadProgress = 0.0;
+ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 0.0);
}
break;
case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
{
- priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload);
+ priv->m_nLoadProgress = static_cast<gdouble>(std::stoi(pCallback->m_aPayload)/100.0);
+ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, priv->m_nLoadProgress);
}
break;
case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
{
- priv->m_nLoadProgress = 100;
+ priv->m_nLoadProgress = 1.0;
+ g_signal_emit (pCallback->m_pDocView, doc_view_signals[LOAD_CHANGED], 0, 1.0);
}
break;
default:
@@ -1069,7 +1073,7 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
g_value_set_boolean (value, priv->m_bEdit);
break;
case PROP_LOAD_PROGRESS:
- g_value_set_uint (value, priv->m_nLoadProgress);
+ g_value_set_double (value, priv->m_nLoadProgress);
break;
case PROP_ZOOM:
g_value_set_float (value, priv->m_fZoom);
@@ -1210,11 +1214,11 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
*/
g_object_class_install_property (pGObjectClass,
PROP_LOAD_PROGRESS,
- g_param_spec_int("load-progress",
- "Estimated Load Progress",
- "Whether the content is in edit mode or not",
- 0, 100, 0,
- G_PARAM_READABLE));
+ g_param_spec_double("load-progress",
+ "Estimated Load Progress",
+ "Shows the progress of the document load operation",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READABLE));
/**
* LOKDocView:zoom-level:
@@ -1300,6 +1304,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
| G_PARAM_STATIC_STRINGS)));
/**
+ * LOKDocView::load-changed:
+ * @pDocView: the #LOKDocView on which the signal is emitted
+ * @fLoadProgress: the new progress value
+ */
+ doc_view_signals[LOAD_CHANGED] =
+ g_signal_new("load-changed",
+ G_TYPE_FROM_CLASS (pGObjectClass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__DOUBLE,
+ G_TYPE_NONE, 1,
+ G_TYPE_DOUBLE);
+
+ /**
* LOKDocView::edit-changed:
* @pDocView: the #LOKDocView on which the signal is emitted
* @bEdit: the new edit value of the view
@@ -1403,16 +1422,16 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr
{
GTask* task = G_TASK(res);
- g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL);
+ g_return_val_if_fail(g_task_is_valid(res, pDocView), false);
//FIXME: make source_tag workx
//g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
- g_return_val_if_fail(error == NULL || *error == NULL, NULL);
+ g_return_val_if_fail(error == NULL || *error == NULL, false);
return g_task_propagate_boolean(task, error);
}
static void
-lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable)
+lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer /*task_data*/, GCancellable* /*cancellable*/)
{
LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
commit 488fc68839c2aa057ab84b531aa50fba8b240917
Author: Pranav Kant <pranavk at gnome.org>
Date: Mon Jul 6 22:01:30 2015 +0530
lokdocview: Call open_document in another thread
This is to keep the widget responsive during document load.
Change-Id: I81acaffc75ca7deddd6cc2de6abae22d009d40cd
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 962f9d9..ec28348 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -45,8 +45,15 @@ GtkWidget* lok_doc_view_new (const gchar*
GCancellable *cancellable,
GError **error);
-gboolean lok_doc_view_open_document (LOKDocView* pDocView,
- const gchar* pPath);
+void lok_doc_view_open_document (LOKDocView* pDocView,
+ const gchar* pPath,
+ GCancellable* cancellable,
+ GAsyncReadyCallback callback,
+ gpointer userdata);
+
+gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView,
+ GAsyncResult* res,
+ GError** error);
/// Gets the document the viewer displays.
LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView);
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index ec70a88..af3ba41 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -41,6 +41,7 @@ std::map<std::string, GtkToolItem*> g_aCommandNameToolItems;
bool g_bToolItemBroadcast = true;
static GtkWidget* pVBox;
static GtkComboBoxText* pPartSelector;
+static GtkWidget* pPartModeComboBox;
/// Should the part selector avoid calling lok::Document::setPart()?
static bool g_bPartSelectorBroadcast = true;
GtkWidget* pFindbar;
@@ -291,6 +292,7 @@ static void signalSearch(LOKDocView* /*pLOKDocView*/, char* /*pPayload*/, gpoint
gtk_label_set_text(GTK_LABEL(pFindbarLabel), "Search key not found");
}
+
static void signalPart(LOKDocView* /*pLOKDocView*/, int nPart, gpointer /*pData*/)
{
g_bPartSelectorBroadcast = false;
@@ -380,6 +382,28 @@ static void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
}
}
+static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpointer /*userdata*/)
+{
+ LOKDocView* pDocView1 = LOK_DOC_VIEW (source_object);
+ GError* error = NULL;
+ GList *focusChain = NULL;
+
+ if (!lok_doc_view_open_document_finish(pDocView1, res, &error))
+ {
+ g_warning ("Error occurred while opening the document : %s", error->message);
+ g_error_free (error);
+ }
+
+ populatePartSelector();
+ populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
+ // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode.
+ g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0);
+ g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0);
+
+ focusChain = g_list_append( focusChain, pDocView1 );
+ gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+}
+
int main( int argc, char* argv[] )
{
if( argc < 3 ||
@@ -435,7 +459,7 @@ int main( int argc, char* argv[] )
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new();
- GtkWidget* pPartModeComboBox = gtk_combo_box_text_new();
+ pPartModeComboBox = gtk_combo_box_text_new();
gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox );
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
@@ -542,21 +566,7 @@ int main( int argc, char* argv[] )
// Hide the findbar by default.
gtk_widget_hide(pFindbar);
- int bOpened = lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2] );
- if (!bOpened)
- g_error("main: lok_doc_view_open_document() failed");
- assert(lok_doc_view_get_document(LOK_DOC_VIEW(pDocView)));
-
- populatePartSelector();
- populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
- // Connect these signals after populating the selectors, to avoid re-rendering on setting the default part/partmode.
- g_signal_connect(G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), 0);
- g_signal_connect(G_OBJECT(pPartSelector), "changed", G_CALLBACK(changePart), 0);
-
- // Make only LOKDocView widget as focussable
- GList *focusChain = NULL;
- focusChain = g_list_append( focusChain, pDocView );
- gtk_container_set_focus_chain ( GTK_CONTAINER (pVBox), focusChain );
+ lok_doc_view_open_document( LOK_DOC_VIEW(pDocView), argv[2], NULL, openDocumentCallback, pDocView );
gtk_main();
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index bf12ca0..2812ca0 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -108,8 +108,6 @@ struct _LOKDocViewPrivate
enum
{
- LOAD_CHANGED,
- LOAD_FAILED,
EDIT_CHANGED,
COMMAND_CHANGED,
SEARCH_NOT_FOUND,
@@ -337,19 +335,23 @@ static gboolean
globalCallback (gpointer pData)
{
CallbackData* pCallback = static_cast<CallbackData*>(pData);
+ LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pCallback->m_pDocView));
switch (pCallback->m_nType)
{
case LOK_CALLBACK_STATUS_INDICATOR_START:
{
+ priv->m_nLoadProgress = 0;
}
break;
case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
{
+ priv->m_nLoadProgress = std::stoi(pCallback->m_aPayload);
}
break;
case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
{
+ priv->m_nLoadProgress = 100;
}
break;
default:
@@ -1389,15 +1391,30 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
}
/**
- * lok_doc_view_open_document:
+ * lok_doc_view_open_document_finish:
* @pDocView: The #LOKDocView instance
- * @pPath: The path of the document that #LOKDocView widget should try to open
+ * @res:
+ * @error:
*
* Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise
*/
SAL_DLLPUBLIC_EXPORT gboolean
-lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
+lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GError** error)
+{
+ GTask* task = G_TASK(res);
+
+ g_return_val_if_fail(g_task_is_valid(res, pDocView), NULL);
+ //FIXME: make source_tag workx
+ //g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
+ g_return_val_if_fail(error == NULL || *error == NULL, NULL);
+
+ return g_task_propagate_boolean(task, error);
+}
+
+static void
+lok_doc_view_open_document_func (GTask* task, gpointer source_object, gpointer task_data, GCancellable* cancellable)
{
+ LOKDocView* pDocView = LOK_DOC_VIEW(source_object);
LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
if ( priv->m_pDocument )
@@ -1407,13 +1424,13 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
}
priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
- priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, pPath );
+ priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
if ( !priv->m_pDocument )
{
// FIXME: should have a GError parameter and populate it.
char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
fprintf( stderr, "Error opening document '%s'\n", pError );
- return FALSE;
+ g_task_return_new_error(task, 0, 0, pError);
}
else
{
@@ -1438,8 +1455,34 @@ lok_doc_view_open_document (LOKDocView* pDocView, const gchar* pPath)
nDocumentHeightPixels);
gtk_widget_set_can_focus(GTK_WIDGET(pDocView), TRUE);
gtk_widget_grab_focus(GTK_WIDGET(pDocView));
+ g_task_return_boolean (task, true);
}
- return TRUE;
+}
+
+/**
+ * lok_doc_view_open_document:
+ * @pDocView: The #LOKDocView instance
+ * @pPath: The path of the document that #LOKDocView widget should try to open
+ *
+ * Returns: %TRUE if the document is loaded succesfully, %FALSE otherwise
+ */
+SAL_DLLPUBLIC_EXPORT void
+lok_doc_view_open_document (LOKDocView* pDocView,
+ const gchar* pPath,
+ GCancellable* cancellable,
+ GAsyncReadyCallback callback,
+ gpointer userdata)
+{
+ GTask *task;
+ LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView));
+ priv->m_aDocPath = g_strdup(pPath);
+
+ task = g_task_new(pDocView, cancellable, callback, userdata);
+ // FIXME: Use source_tag to check the task.
+ //g_task_set_source_tag(task, lok_doc_view_open_document);
+
+ g_task_run_in_thread(task, lok_doc_view_open_document_func);
+ g_object_unref(task);
}
/**
commit 9f75bad228ca1f410b7a450084b02ad13745110e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Sat Jul 18 17:18:25 2015 +0900
tdf#91495 don't change tree entry height when preview is disabled
Change-Id: Ic707f4407bb3aef5f2a7b9d13a0340c6d9afb3fe
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index ab25ccd..c0d53ad 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -326,8 +326,11 @@ SfxActionListBox::SfxActionListBox(SfxCommonTemplateDialog_Impl* pParent, WinBit
void SfxActionListBox::Recalc()
{
- SetEntryHeight(32 * GetDPIScaleFactor());
- RecalcViewData();
+ if (officecfg::Office::Common::StylesAndFormatting::Preview::get())
+ {
+ SetEntryHeight(32 * GetDPIScaleFactor());
+ RecalcViewData();
+ }
}
PopupMenu* SfxActionListBox::CreateContextMenu()
commit c84dd5135a785204f78945f32eaa4d8dc7d27c9f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Jul 18 00:31:35 2015 +0200
fix build
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 79ab0d0..278d2de 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -244,6 +244,8 @@ IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl)
setShowPositiveError(mxModel, aCID, bPos);
setShowNegativeError(mxModel, aCID, bNeg);
+
+ return 0;
}
}} // end of namespace ::chart::sidebar
commit b7f20ddfab77de8d8e535ae6253111dc67610bbd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Jul 18 00:22:04 2015 +0200
add skeleton for error bar panel
Change-Id: I397b10d95356a1d376e868af6a93077fd996b680
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index d66aed0..85df1bc 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -190,6 +190,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/Chart2PanelFactory \
chart2/source/controller/sidebar/ChartAxisPanel \
chart2/source/controller/sidebar/ChartElementsPanel \
+ chart2/source/controller/sidebar/ChartErrorBarPanel \
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
))
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk
index 6a45f9d..1ddb6da 100644
--- a/chart2/UIConfig_chart2.mk
+++ b/chart2/UIConfig_chart2.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/paradialog \
chart2/uiconfig/ui/sidebaraxis \
chart2/uiconfig/ui/sidebarelements \
+ chart2/uiconfig/ui/sidebarerrorbar \
chart2/uiconfig/ui/sidebarseries \
chart2/uiconfig/ui/smoothlinesdlg \
chart2/uiconfig/ui/steppedlinesdlg \
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 6af84f8..a81304b 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -33,6 +33,7 @@
#include "ChartSeriesPanel.hxx"
#include "ChartController.hxx"
#include "ChartAxisPanel.hxx"
+#include "ChartErrorBarPanel.hxx"
using namespace css::uno;
using ::rtl::OUString;
@@ -93,6 +94,8 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController);
else if (rsResourceURL.endsWith("/AxisPanel"))
pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController);
+ else if (rsResourceURL.endsWith("/ErrorBarPanel"))
+ pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController);
if (pPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
new file mode 100644
index 0000000..79ab0d0
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -0,0 +1,251 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+
+#include "ChartErrorBarPanel.hxx"
+#include "ChartController.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+using ::sfx2::sidebar::Theme;
+
+namespace chart { namespace sidebar {
+
+namespace {
+
+css::uno::Reference<css::beans::XPropertySet> getErrorBarPropSet(
+ css::uno::Reference<css::frame::XModel> xModel, const OUString& rCID)
+{
+ return ObjectIdentifier::getObjectPropertySet(rCID, xModel);
+}
+
+bool showPositiveError(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getErrorBarPropSet(xModel, rCID);
+
+ if (!xPropSet.is())
+ return false;
+
+ css::uno::Any aAny = xPropSet->getPropertyValue("ShowPositiveError");
+
+ if (!aAny.hasValue())
+ return false;
+
+ bool bShow = false;
+ aAny >>= bShow;
+ return bShow;
+}
+
+bool showNegativeError(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getErrorBarPropSet(xModel, rCID);
+
+ if (!xPropSet.is())
+ return false;
+
+ css::uno::Any aAny = xPropSet->getPropertyValue("ShowNegativeError");
+
+ if (!aAny.hasValue())
+ return false;
+
+ bool bShow = false;
+ aAny >>= bShow;
+ return bShow;
+}
+
+void setShowPositiveError(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, bool bShow)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getErrorBarPropSet(xModel, rCID);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("ShowPositiveError", css::uno::makeAny(bShow));
+}
+
+void setShowNegativeError(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, bool bShow)
+{
+ css::uno::Reference<css::beans::XPropertySet> xPropSet =
+ getErrorBarPropSet(xModel, rCID);
+
+ if (!xPropSet.is())
+ return;
+
+ xPropSet->setPropertyValue("ShowNegativeError", css::uno::makeAny(bShow));
+}
+
+OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (!xSelectionSupplier.is())
+ return OUString();
+
+ uno::Any aAny = xSelectionSupplier->getSelection();
+ assert(aAny.hasValue());
+ OUString aCID;
+ aAny >>= aCID;
+#ifdef DBG_UTIL
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ assert(eType == OBJECTTYPE_DATA_ERRORS_X ||
+ eType == OBJECTTYPE_DATA_ERRORS_Y ||
+ eType == OBJECTTYPE_DATA_ERRORS_Z);
+#endif
+
+ return aCID;
+}
+
+}
+
+ChartErrorBarPanel::ChartErrorBarPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+ : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame),
+ mxFrame(rxFrame),
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this))
+{
+
+ get(mpRBPosAndNeg, "radiobutton_positive_negative");
+ get(mpRBPos, "radiobutton_positive");
+ get(mpRBNeg, "radiobutton_negative");
+
+ Initialize();
+}
+
+ChartErrorBarPanel::~ChartErrorBarPanel()
+{
+ disposeOnce();
+}
+
+void ChartErrorBarPanel::dispose()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mpRBPosAndNeg.clear();
+ mpRBPos.clear();
+ mpRBNeg.clear();
+
+ PanelLayout::dispose();
+}
+
+void ChartErrorBarPanel::Initialize()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
+
+ updateData();
+
+ Link<> aLink = LINK(this, ChartErrorBarPanel, RadioBtnHdl);
+ mpRBPosAndNeg->SetToggleHdl(aLink);
+ mpRBPos->SetToggleHdl(aLink);
+ mpRBNeg->SetToggleHdl(aLink);
+}
+
+void ChartErrorBarPanel::updateData()
+{
+ OUString aCID = getCID(mxModel);
+ bool bPos = showPositiveError(mxModel, aCID);
+ bool bNeg = showNegativeError(mxModel, aCID);
+
+ SolarMutexGuard aGuard;
+
+ if (bPos && bNeg)
+ mpRBPosAndNeg->Check(true);
+ else if (bPos)
+ mpRBPos->Check(true);
+ else if (bNeg)
+ mpRBNeg->Check(true);
+}
+
+VclPtr<vcl::Window> ChartErrorBarPanel::Create (
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+{
+ if (pParent == NULL)
+ throw lang::IllegalArgumentException("no parent Window given to ChartErrorBarPanel::Create", NULL, 0);
+ if ( ! rxFrame.is())
+ throw lang::IllegalArgumentException("no XFrame given to ChartErrorBarPanel::Create", NULL, 1);
+
+ return VclPtr<ChartErrorBarPanel>::Create(
+ pParent, rxFrame, pController);
+}
+
+void ChartErrorBarPanel::DataChanged(
+ const DataChangedEvent& )
+{
+ updateData();
+}
+
+void ChartErrorBarPanel::HandleContextChange(
+ const ::sfx2::sidebar::EnumContext& )
+{
+ updateData();
+}
+
+void ChartErrorBarPanel::NotifyItemUpdate(
+ sal_uInt16 /*nSID*/,
+ SfxItemState /*eState*/,
+ const SfxPoolItem* /*pState*/,
+ const bool )
+{
+}
+
+void ChartErrorBarPanel::modelInvalid()
+{
+}
+
+IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl)
+{
+ OUString aCID = getCID(mxModel);
+ bool bPos = mpRBPosAndNeg->IsChecked() || mpRBPos->IsChecked();
+ bool bNeg = mpRBPosAndNeg->IsChecked() || mpRBNeg->IsChecked();
+
+ setShowPositiveError(mxModel, aCID, bPos);
+ setShowNegativeError(mxModel, aCID, bNeg);
+}
+
+}} // end of namespace ::chart::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
new file mode 100644
index 0000000..7586570
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTERRORBARPANEL_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTERRORBARPANEL_HXX
+
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
+
+#include "ChartSidebarModifyListener.hxx"
+
+#include <com/sun/star/util/XModifyListener.hpp>
+
+class FixedText;
+class ListBox;
+class NumericField;
+
+namespace chart {
+
+class ChartController;
+
+namespace sidebar {
+
+class ChartErrorBarPanel : public PanelLayout,
+ public ::sfx2::sidebar::IContextChangeReceiver,
+ public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public ChartSidebarModifyListenerParent
+{
+public:
+ static VclPtr<vcl::Window> Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ virtual void DataChanged(
+ const DataChangedEvent& rEvent) SAL_OVERRIDE;
+
+ virtual void HandleContextChange(
+ const ::sfx2::sidebar::EnumContext& rContext) SAL_OVERRIDE;
+
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState,
+ const bool bIsEnabled) SAL_OVERRIDE;
+
+ // constructor/destuctor
+ ChartErrorBarPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+ virtual ~ChartErrorBarPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ virtual void updateData() SAL_OVERRIDE;
+ virtual void modelInvalid() SAL_OVERRIDE;
+
+private:
+ //ui controls
+ VclPtr<RadioButton> mpRBPosAndNeg;
+ VclPtr<RadioButton> mpRBPos;
+ VclPtr<RadioButton> mpRBNeg;
+
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
+
+ void Initialize();
+
+ DECL_LINK(RadioBtnHdl, void*);
+};
+
+} } // end of namespace ::chart::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/uiconfig/ui/sidebarerrorbar.ui b/chart2/uiconfig/ui/sidebarerrorbar.ui
new file mode 100644
index 0000000..12a1126
--- /dev/null
+++ b/chart2/uiconfig/ui/sidebarerrorbar.ui
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.12"/>
+ <object class="GtkGrid" id="ChartErrorBarPanel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label_series_name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Type</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="comboboxtext1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes">Constant</item>
+ <item translatable="yes">Percentage</item>
+ <item translatable="yes">Cell Range</item>
+ <item translatable="yes">Standard deviation</item>
+ <item translatable="yes">Standard error</item>
+ <item translatable="yes">Variance</item>
+ <item translatable="yes">Error margin</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Positive (+):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Negative (-):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="radiobutton_positive_negative">
+ <property name="label" translatable="yes">Positive and Negative</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="radiobutton_positive">
+ <property name="label" translatable="yes">Positive</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_positive_negative</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="radiobutton_negative">
+ <property name="label" translatable="yes">Negative</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_positive_negative</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
commit 342c4b21e6acbb7b2e7fc7133549a14323b6c771
Author: Carlos Luque <josecarlos.ruizluque at cib.de>
Date: Fri Jul 17 16:19:25 2015 +0200
cleanup: use SAL_N_ELEMENTS for array size
To be consistent across code in the calculation
of the number of elements of an array.
Change-Id: Iff73e570231caccdece3cf0e925d58bc0925ccc2
Reviewed-on: https://gerrit.libreoffice.org/17168
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index b193887..31565b6 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -485,7 +485,7 @@ OUString SvXMLGraphicHelper::ImplGetGraphicMimeType( const OUString& rFileName )
const OString aExt(OUStringToOString(rFileName.copy(rFileName.getLength() - 3),
RTL_TEXTENCODING_ASCII_US));
- for( long i = 0, nCount = sizeof (aMapper) / sizeof (aMapper[0]); ( i < nCount ) && aMimeType.isEmpty(); i++ )
+ for( long i = 0, nCount = SAL_N_ELEMENTS(aMapper); ( i < nCount ) && aMimeType.isEmpty(); ++i )
if( strcmp(aExt.getStr(), aMapper[ i ].pExt) == 0 )
aMimeType = OUString( aMapper[ i ].pMimeType, strlen( aMapper[ i ].pMimeType ), RTL_TEXTENCODING_ASCII_US );
}
commit aba930219c4c71fd4b8f13e2830a5955e71e3081
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 17 21:29:06 2015 +0200
forgot to add it
Change-Id: I64c770f2a30b69b92e48873385c4d37a56101f07
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index f7f8227..e6fa2e3 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -238,6 +238,9 @@ void ChartAxisPanel::updateData()
SolarMutexGuard aGuard;
mpCBShowLabel->Check(isLabelShown(mxModel, aCID));
+ mpCBReverse->Check(isReverse(mxModel, aCID));
+
+ mpLBLabelPos->SelectEntryPos(getLabelPosition(mxModel, aCID));
}
VclPtr<vcl::Window> ChartAxisPanel::Create (
commit 95b1491daccdc50dd5391b7e5d4d7432217269a6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 17 20:51:37 2015 +0200
add chart sidebar axis panel
Change-Id: Ia0f75c09f11c5751428a19fca33b39a54cdbb249
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index f2d4b28..d66aed0 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -188,6 +188,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/main/UndoCommandDispatch \
chart2/source/controller/main/UndoGuard \
chart2/source/controller/sidebar/Chart2PanelFactory \
+ chart2/source/controller/sidebar/ChartAxisPanel \
chart2/source/controller/sidebar/ChartElementsPanel \
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk
index d2e8408..6a45f9d 100644
--- a/chart2/UIConfig_chart2.mk
+++ b/chart2/UIConfig_chart2.mk
@@ -42,6 +42,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/insertgriddlg \
chart2/uiconfig/ui/inserttitledlg \
chart2/uiconfig/ui/paradialog \
+ chart2/uiconfig/ui/sidebaraxis \
chart2/uiconfig/ui/sidebarelements \
chart2/uiconfig/ui/sidebarseries \
chart2/uiconfig/ui/smoothlinesdlg \
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 056e721..9c51cf5 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -318,6 +318,8 @@ OUString ChartController::GetContextName()
case OBJECTTYPE_DATA_ERRORS_Y:
case OBJECTTYPE_DATA_ERRORS_Z:
return OUString("ErrorBar");
+ case OBJECTTYPE_AXIS:
+ return OUString("Axis");
default:
break;
}
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index be68e6b..6af84f8 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -32,6 +32,7 @@
#include "ChartElementsPanel.hxx"
#include "ChartSeriesPanel.hxx"
#include "ChartController.hxx"
+#include "ChartAxisPanel.hxx"
using namespace css::uno;
using ::rtl::OUString;
@@ -90,6 +91,8 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pController );
else if (rsResourceURL.endsWith("/SeriesPanel"))
pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController);
+ else if (rsResourceURL.endsWith("/AxisPanel"))
+ pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController);
if (pPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
new file mode 100644
index 0000000..f7f8227
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sfx2/sidebar/ResourceDefinitions.hrc>
+#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+
+#include "ChartAxisPanel.hxx"
+#include "ChartController.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/toolbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+using ::sfx2::sidebar::Theme;
+
+namespace chart { namespace sidebar {
+
+namespace {
+
+bool isLabelShown(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return false;
+
+ uno::Any aAny = xAxis->getPropertyValue("DisplayLabels");
+ if (!aAny.hasValue())
+ return false;
+
+ bool bVisible = false;
+ aAny >>= bVisible;
+ return bVisible;
+}
+
+void setLabelShown(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, bool bVisible)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return;
+
+ xAxis->setPropertyValue("DisplayLabels", css::uno::makeAny(bVisible));
+}
+
+struct AxisLabelPosMap
+{
+ sal_Int32 nPos;
+ css::chart::ChartAxisLabelPosition ePos;
+};
+
+AxisLabelPosMap aLabelPosMap[] = {
+ { 0, css::chart::ChartAxisLabelPosition_NEAR_AXIS },
+ { 1, css::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE },
+ { 2, css::chart::ChartAxisLabelPosition_OUTSIDE_START },
+ { 3, css::chart::ChartAxisLabelPosition_OUTSIDE_END }
+};
+
+sal_Int32 getLabelPosition(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return 0;
+
+ uno::Any aAny = xAxis->getPropertyValue("LabelPosition");
+ if (!aAny.hasValue())
+ return 0;
+
+ css::chart::ChartAxisLabelPosition ePos;
+ aAny >>= ePos;
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+ {
+ if (aLabelPosMap[i].ePos == ePos)
+ return aLabelPosMap[i].nPos;
+ }
+
+ return 0;
+}
+
+void setLabelPosition(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, sal_Int32 nPos)
+{
+ css::uno::Reference< css::beans::XPropertySet > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return;
+
+ css::chart::ChartAxisLabelPosition ePos;
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aLabelPosMap); ++i)
+ {
+ if (aLabelPosMap[i].nPos == nPos)
+ ePos = aLabelPosMap[i].ePos;
+ }
+
+ xAxis->setPropertyValue("LabelPosition", css::uno::makeAny(ePos));
+}
+
+bool isReverse(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID)
+{
+ css::uno::Reference< css::chart2::XAxis > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return false;
+
+ css::chart2::ScaleData aData = xAxis->getScaleData();
+
+ return aData.Orientation == css::chart2::AxisOrientation_REVERSE;
+}
+
+void setReverse(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rCID, bool bReverse)
+{
+ css::uno::Reference< css::chart2::XAxis > xAxis(
+ ObjectIdentifier::getAxisForCID(rCID, xModel), uno::UNO_QUERY );
+
+ if (!xAxis.is())
+ return;
+
+ css::chart2::ScaleData aData = xAxis->getScaleData();
+ if (bReverse)
+ aData.Orientation = css::chart2::AxisOrientation_REVERSE;
+ else
+ aData.Orientation = css::chart2::AxisOrientation_MATHEMATICAL;
+
+ xAxis->setScaleData(aData);
+}
+
+OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
+{
+ css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
+ if (!xSelectionSupplier.is())
+ return OUString();
+
+ uno::Any aAny = xSelectionSupplier->getSelection();
+ assert(aAny.hasValue());
+ OUString aCID;
+ aAny >>= aCID;
+#ifdef DBG_UTIL
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ assert(eType == OBJECTTYPE_AXIS);
+#endif
+
+ return aCID;
+}
+
+}
+
+ChartAxisPanel::ChartAxisPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+ : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame),
+ mxFrame(rxFrame),
+ mxModel(pController->getModel()),
+ mxListener(new ChartSidebarModifyListener(this))
+{
+ get(mpCBShowLabel, "checkbutton_show_label");
+ get(mpCBReverse, "checkbutton_reverse");
+
+ get(mpLBLabelPos, "comboboxtext_label_position");
+
+ Initialize();
+}
+
+ChartAxisPanel::~ChartAxisPanel()
+{
+ disposeOnce();
+}
+
+void ChartAxisPanel::dispose()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mpCBShowLabel.clear();
+ mpCBReverse.clear();
+
+ mpLBLabelPos.clear();
+
+ PanelLayout::dispose();
+}
+
+void ChartAxisPanel::Initialize()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+ xBroadcaster->addModifyListener(mxListener);
+
+ updateData();
+
+ Link<> aLink = LINK(this, ChartAxisPanel, CheckBoxHdl);
+ mpCBShowLabel->SetClickHdl(aLink);
+ mpCBReverse->SetClickHdl(aLink);
+
+ mpLBLabelPos->SetSelectHdl(LINK(this, ChartAxisPanel, ListBoxHdl));
+}
+
+void ChartAxisPanel::updateData()
+{
+ OUString aCID = getCID(mxModel);
+ SolarMutexGuard aGuard;
+
+ mpCBShowLabel->Check(isLabelShown(mxModel, aCID));
+}
+
+VclPtr<vcl::Window> ChartAxisPanel::Create (
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+{
+ if (pParent == NULL)
+ throw lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", NULL, 0);
+ if ( ! rxFrame.is())
+ throw lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", NULL, 1);
+
+ return VclPtr<ChartAxisPanel>::Create(
+ pParent, rxFrame, pController);
+}
+
+void ChartAxisPanel::DataChanged(
+ const DataChangedEvent& )
+{
+ updateData();
+}
+
+void ChartAxisPanel::HandleContextChange(
+ const ::sfx2::sidebar::EnumContext& )
+{
+ updateData();
+}
+
+void ChartAxisPanel::NotifyItemUpdate(
+ sal_uInt16 /*nSID*/,
+ SfxItemState /*eState*/,
+ const SfxPoolItem* /*pState*/,
+ const bool )
+{
+}
+
+void ChartAxisPanel::modelInvalid()
+{
+}
+
+IMPL_LINK(ChartAxisPanel, CheckBoxHdl, CheckBox*, pCheckbox)
+{
+ OUString aCID = getCID(mxModel);
+ bool bChecked = pCheckbox->IsChecked();
+
+ if (pCheckbox == mpCBShowLabel.get())
+ setLabelShown(mxModel, aCID, bChecked);
+ else if (pCheckbox == mpCBReverse.get())
+ setReverse(mxModel, aCID, bChecked);
+
+ return 0;
+}
+
+IMPL_LINK_NOARG(ChartAxisPanel, ListBoxHdl)
+{
+ OUString aCID = getCID(mxModel);
+ sal_Int32 nPos = mpLBLabelPos->GetSelectEntryPos();
+
+ setLabelPosition(mxModel, aCID, nPos);
+
+ return 0;
+}
+
+}} // end of namespace ::chart::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
new file mode 100644
index 0000000..8737ab4
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAXISPANEL_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTAXISPANEL_HXX
+
+#include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
+
+#include "ChartSidebarModifyListener.hxx"
+
+#include <com/sun/star/util/XModifyListener.hpp>
+
+class FixedText;
+class ListBox;
+class NumericField;
+
+namespace chart {
+
+class ChartController;
+
+namespace sidebar {
+
+class ChartAxisPanel : public PanelLayout,
+ public ::sfx2::sidebar::IContextChangeReceiver,
+ public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+ public ChartSidebarModifyListenerParent
+{
+public:
+ static VclPtr<vcl::Window> Create(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ virtual void DataChanged(
+ const DataChangedEvent& rEvent) SAL_OVERRIDE;
+
+ virtual void HandleContextChange(
+ const ::sfx2::sidebar::EnumContext& rContext) SAL_OVERRIDE;
+
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState,
+ const bool bIsEnabled) SAL_OVERRIDE;
+
+ // constructor/destuctor
+ ChartAxisPanel(
+ vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+ virtual ~ChartAxisPanel();
+ virtual void dispose() SAL_OVERRIDE;
+
+ virtual void updateData() SAL_OVERRIDE;
+ virtual void modelInvalid() SAL_OVERRIDE;
+
+private:
+ //ui controls
+ VclPtr<CheckBox> mpCBShowLabel;
+ VclPtr<CheckBox> mpCBReverse;
+
+ VclPtr<ListBox> mpLBLabelPos;
+
+ css::uno::Reference<css::frame::XFrame> mxFrame;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
+
+ void Initialize();
+
+ DECL_LINK(CheckBoxHdl, CheckBox*);
+ DECL_LINK(ListBoxHdl, void*);
+};
+
+} } // end of namespace ::chart::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/uiconfig/ui/sidebaraxis.ui b/chart2/uiconfig/ui/sidebaraxis.ui
new file mode 100644
index 0000000..8ceb0512
--- /dev/null
+++ b/chart2/uiconfig/ui/sidebaraxis.ui
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.12"/>
+ <object class="GtkGrid" id="ChartAxisPanel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_show_label">
+ <property name="label" translatable="yes">Show Labels</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_reverse">
+ <property name="label" translatable="yes">Reverse direction</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Label Position</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Text orientation</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="comboboxtext_label_position">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes">Near Axis</item>
+ <item translatable="yes">Near Axis (other side)</item>
+ <item translatable="yes">Outside start</item>
+ <item translatable="yes">Outside end</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
commit 8f9effacd8f7817a0ad2b1d89b96682855583e48
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 17 20:45:31 2015 +0200
basic: try to prevent MSVC from generating copy assignment
Change-Id: I7232f69a465b1acaf069005b3695039bdc96c7a3
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index 66c2d09..a4e9723 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -71,6 +71,9 @@ class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
sal_uInt32 nHelpId;
SbxParams m_Params;
+ SbxInfo(SbxInfo const&) = delete;
+ void operator=(SbxInfo const&) = delete;
+
protected:
bool LoadData( SvStream&, sal_uInt16 );
bool StoreData( SvStream& ) const;
commit 22b23819875eb04ca0bba402fb676c530de97726
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 17 18:20:20 2015 +0200
editeng: pointless code
Change-Id: Ice4f34ce60b0f4af97a985f4203a705523c0626b
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 6e7f52d..cfeea48 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -222,11 +222,6 @@ static CollatorWrapper& GetCollatorWrapper()
return aCollWrp;
}
-static void lcl_ClearTable(std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>>& rLangTable)
-{
- rLangTable.clear();
-}
-
bool SvxAutoCorrect::IsAutoCorrectChar( sal_Unicode cChar )
{
return cChar == '\0' || cChar == '\t' || cChar == 0x0a ||
@@ -316,7 +311,6 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
SvxAutoCorrect::~SvxAutoCorrect()
{
- lcl_ClearTable(*m_pLangTable);
delete m_pLangTable;
delete pCharClass;
}
commit 9b1e55fe02dbdffadf08f6ede88f68b3cabae9fa
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 17 18:19:29 2015 +0200
editeng: replace boost::ptr_map with std::map<std::unique_ptr>
Change-Id: I343071cc29c2041bc98456954b0aa32fff324d82
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 635c751..6e7f52d 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -222,7 +222,7 @@ static CollatorWrapper& GetCollatorWrapper()
return aCollWrp;
}
-static void lcl_ClearTable(boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>& rLangTable)
+static void lcl_ClearTable(std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>>& rLangTable)
{
rLangTable.clear();
}
@@ -281,7 +281,7 @@ SvxAutoCorrect::SvxAutoCorrect( const OUString& rShareAutocorrFile,
const OUString& rUserAutocorrFile )
: sShareAutoCorrFile( rShareAutocorrFile )
, sUserAutoCorrFile( rUserAutocorrFile )
- , pLangTable( new boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists> )
+ , m_pLangTable( new std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> )
, pCharClass( 0 )
, bRunNext( false )
, eCharClassLang( LANGUAGE_DONTKNOW )
@@ -299,7 +299,7 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
: sShareAutoCorrFile( rCpy.sShareAutoCorrFile )
, sUserAutoCorrFile( rCpy.sUserAutoCorrFile )
, aSwFlags( rCpy.aSwFlags )
- , pLangTable( new boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists> )
+ , m_pLangTable( new std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>> )
, pCharClass( 0 )
, bRunNext( false )
, eCharClassLang(rCpy.eCharClassLang)
@@ -316,8 +316,8 @@ SvxAutoCorrect::SvxAutoCorrect( const SvxAutoCorrect& rCpy )
SvxAutoCorrect::~SvxAutoCorrect()
{
- lcl_ClearTable(*pLangTable);
- delete pLangTable;
+ lcl_ClearTable(*m_pLangTable);
+ delete m_pLangTable;
delete pCharClass;
}
@@ -1434,16 +1434,16 @@ SvxAutoCorrectLanguageLists& SvxAutoCorrect::_GetLanguageList(
LanguageType eLang )
{
LanguageTag aLanguageTag( eLang);
- if (pLangTable->find(aLanguageTag) == pLangTable->end())
+ if (m_pLangTable->find(aLanguageTag) == m_pLangTable->end())
(void)CreateLanguageFile(aLanguageTag, true);
- return *(pLangTable->find(aLanguageTag)->second);
+ return *(m_pLangTable->find(aLanguageTag)->second);
}
void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang )
{
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(LanguageTag(eLang));
- if(nTmpVal != pLangTable->end() && nTmpVal->second)
- nTmpVal->second->SaveCplSttExceptList();
+ auto const iter = m_pLangTable->find(LanguageTag(eLang));
+ if (iter != m_pLangTable->end() && iter->second)
+ iter->second->SaveCplSttExceptList();
#ifdef DBG_UTIL
else
{
@@ -1454,9 +1454,9 @@ void SvxAutoCorrect::SaveCplSttExceptList( LanguageType eLang )
void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang)
{
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(LanguageTag(eLang));
- if(nTmpVal != pLangTable->end() && nTmpVal->second)
- nTmpVal->second->SaveWrdSttExceptList();
+ auto const iter = m_pLangTable->find(LanguageTag(eLang));
+ if (iter != m_pLangTable->end() && iter->second)
+ iter->second->SaveWrdSttExceptList();
#ifdef DBG_UTIL
else
{
@@ -1471,17 +1471,17 @@ bool SvxAutoCorrect::AddCplSttException( const OUString& rNew,
{
SvxAutoCorrectLanguageLists* pLists = 0;
// either the right language is present or it will be this in the general list
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(LanguageTag(eLang));
- if(nTmpVal != pLangTable->end())
- pLists = nTmpVal->second;
+ auto iter = m_pLangTable->find(LanguageTag(eLang));
+ if (iter != m_pLangTable->end())
+ pLists = iter->second.get();
else
{
LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
- nTmpVal = pLangTable->find(aLangTagUndetermined);
- if(nTmpVal != pLangTable->end())
- pLists = nTmpVal->second;
+ iter = m_pLangTable->find(aLangTagUndetermined);
+ if (iter != m_pLangTable->end())
+ pLists = iter->second.get();
else if(CreateLanguageFile(aLangTagUndetermined, true))
- pLists = pLangTable->find(aLangTagUndetermined)->second;
+ pLists = m_pLangTable->find(aLangTagUndetermined)->second.get();
}
OSL_ENSURE(pLists, "No auto correction data");
return pLists && pLists->AddToCplSttExceptList(rNew);
@@ -1493,17 +1493,17 @@ bool SvxAutoCorrect::AddWrtSttException( const OUString& rNew,
{
SvxAutoCorrectLanguageLists* pLists = 0;
//either the right language is present or it is set in the general list
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(LanguageTag(eLang));
- if(nTmpVal != pLangTable->end())
- pLists = nTmpVal->second;
+ auto iter = m_pLangTable->find(LanguageTag(eLang));
+ if (iter != m_pLangTable->end())
+ pLists = iter->second.get();
else
{
LanguageTag aLangTagUndetermined( LANGUAGE_UNDETERMINED);
- nTmpVal = pLangTable->find(aLangTagUndetermined);
- if(nTmpVal != pLangTable->end())
- pLists = nTmpVal->second;
+ iter = m_pLangTable->find(aLangTagUndetermined);
+ if (iter != m_pLangTable->end())
+ pLists = iter->second.get();
else if(CreateLanguageFile(aLangTagUndetermined, true))
- pLists = pLangTable->find(aLangTagUndetermined)->second;
+ pLists = m_pLangTable->find(aLangTagUndetermined)->second.get();
}
OSL_ENSURE(pLists, "No auto correction file!");
return pLists && pLists->AddToWrdSttExceptList(rNew);
@@ -1556,7 +1556,7 @@ bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc,
bool SvxAutoCorrect::CreateLanguageFile( const LanguageTag& rLanguageTag, bool bNewFile )
{
- OSL_ENSURE(pLangTable->find(rLanguageTag) == pLangTable->end(), "Language already exists ");
+ OSL_ENSURE(m_pLangTable->find(rLanguageTag) == m_pLangTable->end(), "Language already exists ");
OUString sUserDirFile( GetAutoCorrFileName( rLanguageTag, true, false, false ));
OUString sShareDirFile( sUserDirFile );
@@ -1577,7 +1577,7 @@ bool SvxAutoCorrect::CreateLanguageFile( const LanguageTag& rLanguageTag, bool b
sShareDirFile = sUserDirFile;
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
LanguageTag aTmp(rLanguageTag); // this insert() needs a non-const reference
- pLangTable->insert(aTmp, pLists);
+ m_pLangTable->insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
aLastFileTable.erase(nFndPos);
}
}
@@ -1593,7 +1593,7 @@ bool SvxAutoCorrect::CreateLanguageFile( const LanguageTag& rLanguageTag, bool b
{
pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
LanguageTag aTmp(rLanguageTag); // this insert() needs a non-const reference
- pLangTable->insert(aTmp, pLists);
+ m_pLangTable->insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
if (nFndPos != aLastFileTable.end())
aLastFileTable.erase(nFndPos);
}
@@ -1608,11 +1608,11 @@ bool SvxAutoCorrect::PutText( const OUString& rShort, const OUString& rLong,
LanguageType eLang )
{
LanguageTag aLanguageTag( eLang);
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(aLanguageTag);
- if(nTmpVal != pLangTable->end())
- return nTmpVal->second->PutText(rShort, rLong);
+ auto const iter = m_pLangTable->find(aLanguageTag);
+ if (iter != m_pLangTable->end())
+ return iter->second->PutText(rShort, rLong);
if(CreateLanguageFile(aLanguageTag))
- return pLangTable->find(aLanguageTag)->second->PutText(rShort, rLong);
+ return m_pLangTable->find(aLanguageTag)->second->PutText(rShort, rLong);
return false;
}
@@ -1621,14 +1621,14 @@ bool SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntr
LanguageType eLang )
{
LanguageTag aLanguageTag( eLang);
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>::iterator nTmpVal = pLangTable->find(aLanguageTag);
- if(nTmpVal != pLangTable->end())
+ auto const iter = m_pLangTable->find(aLanguageTag);
+ if (iter != m_pLangTable->end())
{
- return nTmpVal->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
+ return iter->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
}
else if(CreateLanguageFile( aLanguageTag ))
{
- return pLangTable->find( aLanguageTag )->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
+ return m_pLangTable->find( aLanguageTag )->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
}
return false;
@@ -1712,11 +1712,11 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
// First search for eLang, then US-English -> English
// and last in LANGUAGE_UNDETERMINED
- if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
+ if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
- pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos );
+ std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
+ pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
if( pRet )
{
rLang = aLanguageTag;
@@ -1729,12 +1729,12 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
LanguageType eLang = aLanguageTag.getLanguageType();
LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
- if(nTmpKey1 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey1)) != pLangTable->end() ||
+ if(nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
- pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos );
+ std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
+ pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
if( pRet )
{
rLang = aLanguageTag;
@@ -1742,12 +1742,12 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
}
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
+ if (nTmpKey2 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey2)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
- pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos );
+ std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
+ pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
if( pRet )
{
rLang = aLanguageTag;
@@ -1755,12 +1755,12 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
}
}
- if(pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != pLangTable->end() ||
+ if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
- pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos );
+ std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
+ pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
if( pRet )
{
rLang = aLanguageTag;
@@ -1783,39 +1783,39 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
OUString sTemp(sWord);
- if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
+ if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
+ auto const& pList = m_pLangTable->find(aLanguageTag)->second;
OUString _sTemp(sWord);
if(pList->GetWrdSttExceptList()->find(_sTemp) != pList->GetWrdSttExceptList()->end() )
return true;
}
// If it still could not be found here, then keep on searching
- if(nTmpKey1 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey1)) != pLangTable->end() ||
+ if (nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
+ auto const& pList = m_pLangTable->find(aLanguageTag)->second;
if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
return true;
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
+ if (nTmpKey2 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey2)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
+ auto const& pList = m_pLangTable->find(aLanguageTag)->second;
if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
return true;
}
- if(pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != pLangTable->end() ||
+ if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
+ auto const& pList = m_pLangTable->find(aLanguageTag)->second;
if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
return true;
}
@@ -1869,37 +1869,37 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
OUString sTemp( sWord );
- if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
+ if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
+ const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
return true;
}
// If it still could not be found here, then keep on searching
- if(nTmpKey1 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey1)) != pLangTable->end() ||
+ if(nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
- const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
+ const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
return true;
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
+ if(nTmpKey2 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey2)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
- const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
+ const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
return true;
}
- if(pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != pLangTable->end() ||
+ if (m_pLangTable->find(aLanguageTag.reset(LANGUAGE_UNDETERMINED)) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false))
{
//the language is available - so bring it on
- const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
+ const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
return true;
}
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 41c1db3..0f8a467 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -32,7 +32,7 @@
#include <editeng/editengdllapi.h>
#include <map>
-#include <boost/ptr_container/ptr_map.hpp>
+#include <memory>
class CharClass;
class SfxPoolItem;
@@ -233,7 +233,7 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
SvxSwAutoFormatFlags aSwFlags; // StarWriter AutoFormat Flags
// all languages in a table
- boost::ptr_map<LanguageTag, SvxAutoCorrectLanguageLists>* pLangTable;
+ std::map<LanguageTag, std::unique_ptr<SvxAutoCorrectLanguageLists>>* m_pLangTable;
std::map<LanguageTag, long> aLastFileTable;
CharClass* pCharClass;
commit 15f32b5a1ea289159703dd7b118a911c8d0da61d
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 17 17:44:51 2015 +0200
basic: replace boost::ptr_vector with std::vector<std::unique_ptr>>
Change-Id: I96ea97c1df7903a28387d8e1171075be55a80ca7
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 00728c6..a1c9149 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -328,20 +328,20 @@ SbxInfo::~SbxInfo()
void SbxInfo::AddParam(const OUString& rName, SbxDataType eType, SbxFlagBits nFlags)
{
- aParams.push_back(new SbxParamInfo(rName, eType, nFlags));
+ m_Params.push_back(std::unique_ptr<SbxParamInfo>(new SbxParamInfo(rName, eType, nFlags)));
}
const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const
{
- if( n < 1 || n > aParams.size() )
+ if (n < 1 || n > m_Params.size())
return NULL;
else
- return &(aParams[n - 1]);
+ return m_Params[n - 1].get();
}
bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
- aParams.clear();
+ m_Params.clear();
sal_uInt16 nParam;
aComment = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm,
RTL_TEXTENCODING_ASCII_US);
@@ -359,7 +359,7 @@ bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
if( nVer > 1 )
rStrm.ReadUInt32( nUserData );
AddParam( aName, (SbxDataType) nType, nFlags );
- SbxParamInfo& p(aParams.back());
+ SbxParamInfo& p(*m_Params.back());
p.nUserData = nUserData;
}
return true;
@@ -371,8 +371,8 @@ bool SbxInfo::StoreData( SvStream& rStrm ) const
RTL_TEXTENCODING_ASCII_US );
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aHelpFile,
RTL_TEXTENCODING_ASCII_US);
- rStrm.WriteUInt32( nHelpId ).WriteUInt16( aParams.size() );
- for(SbxParams::const_iterator i = aParams.begin(); i != aParams.end(); ++i)
+ rStrm.WriteUInt32( nHelpId ).WriteUInt16( m_Params.size() );
+ for (auto const& i : m_Params)
{
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, i->aName,
RTL_TEXTENCODING_ASCII_US);
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index e01c3d4..2ea23d8 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -228,7 +228,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
// Request parameter-information (not for objects)
const_cast<SbxVariable*>(this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
- if( !pInfo || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ))
+ if (!pInfo || (pInfo->m_Params.empty() && GetClass() == SbxCLASS_PROPERTY))
{
return maName;
}
@@ -249,10 +249,11 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
}
aTmp += "(";
- for(SbxParams::const_iterator i = pInfo->aParams.begin(); i != pInfo->aParams.end(); ++i)
+ for (SbxParams::const_iterator iter = pInfo->m_Params.begin(); iter != pInfo->m_Params.end(); ++iter)
{
+ auto const& i = *iter;
int nt = i->eType & 0x0FFF;
- if( i != pInfo->aParams.begin() )
+ if (iter != pInfo->m_Params.begin())
{
aTmp += ",";
}
@@ -639,11 +640,12 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const
////////////////////////////// SbxInfo
-SbxInfo::SbxInfo() : aHelpFile(), nHelpId( 0 ), aParams()
+SbxInfo::SbxInfo()
+ : aHelpFile(), nHelpId(0)
{}
SbxInfo::SbxInfo( const OUString& r, sal_uInt32 n )
- : aHelpFile( r ), nHelpId( n ), aParams()
+ : aHelpFile( r ), nHelpId( n )
{}
////////////////////////////// SbxAlias
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index e6fb750..66c2d09 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -31,8 +31,8 @@
#include <basic/sbxmeth.hxx>
#include <basic/basicdllapi.h>
-#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
+#include <memory>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list