[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - 231 commits - accessibility/inc basegfx/inc basegfx/qa basegfx/source basic/source bean/com binaryurp/source bin/includebloat.awk bridges/Library_cpp_uno.mk bridges/source bridges/test canvas/source chart2/source comphelper/source compilerplugins/clang config_host/config_dconf.h.in config_host.mk.in configmgr/CppunitTest_configmgr_unit.mk configmgr/Library_configmgr.mk configmgr/qa configmgr/source configure.ac connectivity/source cppcanvas/inc cppcanvas/source cppuhelper/source cppu/source cui/source dbaccess/source desktop/inc desktop/source desktop/test dictionaries distro-configs/LibreOfficeLinux.conf download.lst drawinglayer/source dtrans/source editeng/source embedserv/Library_emser.mk extensions/Library_oleautobridge.mk extensions/Library_so_activex.mk extensions/Library_so_activex_x64.mk extensions/source external/glew external/icu external/lcms2 external/libcmis external/libxml2 external/libxslt filter/source forms/ qa formula/Library_for.mk formula/source fpicker/source framework/inc framework/source helpcontent2 i18nlangtag/qa i18nlangtag/source i18npool/source icon-themes/galaxy idl/inc idl/source include/basegfx include/basic include/canvas include/comphelper include/drawinglayer include/editeng include/formula include/framework include/i18nlangtag include/LibreOfficeKit include/o3tl include/package include/rtl include/sal include/sfx2 include/sot include/svl include/svtools include/svx include/tools include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk io/source jvmfwk/inc jvmfwk/plugins libreofficekit/qa libreofficekit/source lotuswordpro/source odk/examples offapi/com officecfg/registry oox/inc oox/source package/inc package/source qadevOOo/runner qadevOOo/tests readlicense_oo/license registry/inc reportbuilder/java reportdesign/inc reportdesign/source RepositoryExternal.mk sal/osl sal/qa sal/rtl scaddins/Library_analysis.mk scaddins/source sc/inc scp2/source sc/qa scripting/ source sc/sdi sc/source sc/uiconfig sdext/README sdext/source sd/qa sd/sdi sd/source sd/uiconfig sfx2/qa sfx2/source sfx2/uiconfig shell/source slideshow/qa slideshow/source solenv/gbuild sot/source starmath/inc starmath/sdi starmath/source starmath/uiconfig stoc/source svgio/inc svl/source svtools/source svx/Library_svx.mk svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/inc sw/qa sw/source testtools/com testtools/source tools/CppunitTest_tools_test.mk tools/qa tools/source translations ucb/source unoxml/source vcl/CppunitTest_vcl_lifecycle.mk vcl/generic vcl/headless vcl/inc vcl/opengl vcl/osx vcl/qa vcl/quartz vcl/source vcl/unx vcl/win winaccessibility/Library_uacccom.mk winaccessibility/source wizards/com wizards/source writerfilter/source xmlhelp/Library_ucpchelp1.mk xmlhelp/source xmloff/inc xmloff/source xmlsecurity/source
Pranav Kant
pranavk at gnome.org
Sat Jul 11 09:52:04 PDT 2015
Rebased ref, commits from common ancestor:
commit 4600821c60f7692a160140b1e811decccb8a7bbd
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 19415769925900f70f8b98182bdecd0a659c7365
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 6d6706310b4a9016332a9f5722720721986bda99
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 1b4d27a3badddd2648c3f02cd234ca74c5a40e6b
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Sat Jul 11 02:03:01 2015 +0200
tdf#92483 fix initializing JRE on Win 64bit (load java's msvcr100.dll)
problem is that the offsets/sizes are of different type than ptrdiff_t,
and when using without casting, the resulting address is way off...
Change-Id: I7b1cdd611c8c4b317cd33ca8fbbda2e7e8f5f4fc
Reviewed-on: https://gerrit.libreoffice.org/16938
Reviewed-by: David Ostrovsky <david at ostrovsky.org>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index a19b26a..c7a273c 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -588,7 +588,7 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)
if (sections->VirtualAddress <= importsVA &&
importsVA < sections->VirtualAddress + sections->SizeOfRawData)
{
- VAtoPhys = sections->PointerToRawData - sections->VirtualAddress;
+ VAtoPhys = static_cast<size_t>(sections->PointerToRawData) - static_cast<size_t>(sections->VirtualAddress);
break;
}
++sections;
commit 238575424341dedaef9713fcdb988ed39ccbf82c
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Jul 11 12:43:52 2015 +0200
Blind fix for kde
/home/tinderbox/master/vcl/unx/kde/salnativewidgets-kde.cxx:1987:88: error: implicit instantiation of undefined template ´boost::optional<Color>´
aStyleSettings.SetMenuBarTextColor( aStyleSettings.GetPersonaMenuBarTextColor().get_value_or( aMenuFore ) );
/home/tinderbox/master/include/vcl/settings.hxx:38:32: note: template is declared here
template<typename T> class optional;
Change-Id: Ic681d36f376f7433dae56fc1da5f8a2dd0f597ea
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 6ee5600..08102ba 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -35,6 +35,8 @@
#include <config_vclplug.h>
+#include <boost/optional.hpp>
+
#if ENABLE_TDE
#define QPushButton_String "TQPushButton"
#define QRadioButton_String "TQRadioButton"
commit dad6be8af0e670a56d3d399a1b0a35859bd7b093
Author: Eike Rathke <erack at redhat.com>
Date: Sat Jul 11 02:52:42 2015 +0200
write trailing text subformat also to Excel .xls and .xlsx, tdf#92457
... without generating 0;;;@ from 0;@ that has different semantics.
Introduce css::util::NumberFormat::EMPTY to properly flag empty
subformats and distinguish from UNDEFINED, everything else would be an
ugly hack.
SvNumberformat::GetMappedFormatstring() now correctly supports the
trailing text subformat, so exports using it should get that
automatically.
Change-Id: If9a1bcc5ec5dfcf46688035e2b1428ab4747a68d
diff --git a/offapi/com/sun/star/util/NumberFormat.idl b/offapi/com/sun/star/util/NumberFormat.idl
index 927bdf8..2bc297a 100644
--- a/offapi/com/sun/star/util/NumberFormat.idl
+++ b/offapi/com/sun/star/util/NumberFormat.idl
@@ -93,6 +93,12 @@ published constants NumberFormat
*/
const short UNDEFINED = 2048;
+
+ /** @internal is used to flag an empty sub format.
+ @since LibreOffice 5.1
+ */
+ const short EMPTY = 4096;
+
};
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index c645034..03c2078 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -893,7 +893,8 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
if (sStr.isEmpty())
{
- // empty sub format
+ // Empty sub format.
+ NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::EMPTY;
}
else
{
@@ -2202,7 +2203,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
*ppColor = NumFor[nIx].GetColor();
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
const sal_uInt16 nAnz = NumFor[nIx].GetCount();
- if (nAnz == 0 && rInfo.eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (nAnz == 0 && rInfo.eScannedType == css::util::NumberFormat::EMPTY)
{
return false; // Empty => nothing
}
@@ -4722,7 +4723,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 &&
eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 );
// with 3 or more subformats [>0];[<0];[=0] is implied if no condition specified,
- // note that subformats may be empty (;;;) and NumFor[2].GetnAnz()>0 is not checked.
+ // note that subformats may be empty (;;;) and NumFor[2].GetCount()>0 is not checked.
bDefault[2] = ( !bDefault[0] && !bDefault[1] &&
eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 &&
eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 );
@@ -4762,7 +4763,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
int nSub = 0; // subformats delimited so far
for ( int n=0; n<4; n++ )
{
- if ( n > 0 )
+ if ( n > 0 && NumFor[n].Info().eScannedType != css::util::NumberFormat::UNDEFINED )
{
nSem++;
}
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 3ccf074..d0da09b 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1006,9 +1006,6 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// #101606# An empty subformat is a valid number-style resulting in an
// empty display string for the condition of the subformat.
- if ( nFmtType == css::util::NumberFormat::UNDEFINED && rFormat.GetNumForType( nPart,
- 0, false ) == 0 )
- nFmtType = 0;
XMLTokenEnum eType = XML_TOKEN_INVALID;
switch ( nFmtType )
@@ -1016,6 +1013,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// type is 0 if a format contains no recognized elements
// (like text only) - this is handled as a number-style.
case 0:
+ case css::util::NumberFormat::EMPTY:
case css::util::NumberFormat::NUMBER:
case css::util::NumberFormat::SCIENTIFIC:
case css::util::NumberFormat::FRACTION:
commit 934e35c62525a7541e6a5b2d05b557a6fcc35abb
Author: Eike Rathke <erack at redhat.com>
Date: Fri Jul 10 23:49:43 2015 +0200
store trailing text format in ODF, e.g. 0;@ tdf#92457
A clumsy kludge, but since there is no "all others" condition..
Change-Id: Ie89b786585fdee6688f66f5a7af47ec84409eefa
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index f580dfa..3ccf074 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -52,8 +52,6 @@ using namespace ::com::sun::star;
using namespace ::xmloff::token;
using namespace ::svt;
-#define XMLNUM_MAX_PARTS 3
-
struct LessuInt32
{
bool operator() (const sal_uInt32 rValue1, const sal_uInt32 rValue2) const
@@ -1644,11 +1642,23 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
if ( rFormat.HasTextFormat() )
{
// 4th part is for text -> make an "all other numbers" condition for the 3rd part
- // by reversing the 2nd condition
+ // by reversing the 2nd condition.
+ // For a trailing text format like 0;@ that has no conditions
+ // use a "less or equal than biggest" condition for the number
+ // part, ODF can't store subformats (style maps) without
+ // conditions.
SvNumberformatLimitOps eOp3 = NUMBERFORMAT_OP_NO;
double fLimit3 = fLimit2;
- switch ( eOp2 )
+ sal_uInt16 nLastPart = 2;
+ SvNumberformatLimitOps eOpLast = eOp2;
+ if (eOp2 == NUMBERFORMAT_OP_NO)
+ {
+ eOpLast = eOp1;
+ fLimit3 = fLimit1;
+ nLastPart = (eOp1 == NUMBERFORMAT_OP_NO) ? 0 : 1;
+ }
+ switch ( eOpLast )
{
case NUMBERFORMAT_OP_EQ: eOp3 = NUMBERFORMAT_OP_NE; break;
case NUMBERFORMAT_OP_NE: eOp3 = NUMBERFORMAT_OP_EQ; break;
@@ -1656,8 +1666,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
case NUMBERFORMAT_OP_LE: eOp3 = NUMBERFORMAT_OP_GT; break;
case NUMBERFORMAT_OP_GT: eOp3 = NUMBERFORMAT_OP_LE; break;
case NUMBERFORMAT_OP_GE: eOp3 = NUMBERFORMAT_OP_LT; break;
- default:
- break;
+ case NUMBERFORMAT_OP_NO: eOp3 = NUMBERFORMAT_OP_LE;
+ fLimit3 = ::std::numeric_limits<double>::max(); break;
}
if ( fLimit1 == fLimit2 &&
@@ -1670,7 +1680,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
eOp3 = NUMBERFORMAT_OP_EQ;
}
- WriteMapElement_Impl( eOp3, fLimit3, nKey, 2 );
+ WriteMapElement_Impl( eOp3, fLimit3, nKey, nLastPart );
}
}
}
@@ -1679,11 +1689,17 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey )
{
+ const sal_uInt16 XMLNUM_MAX_PARTS = 4;
+ bool bParts[XMLNUM_MAX_PARTS] = { false, false, false, false };
sal_uInt16 nUsedParts = 0;
- sal_uInt16 nPart;
- for (nPart=0; nPart<XMLNUM_MAX_PARTS; nPart++)
- if (rFormat.GetNumForType( nPart, 0, false ) != 0)
- nUsedParts = nPart+1;
+ for (sal_uInt16 nPart=0; nPart<XMLNUM_MAX_PARTS; ++nPart)
+ {
+ if (rFormat.GetNumForInfoScannedType( nPart) != css::util::NumberFormat::UNDEFINED)
+ {
+ bParts[nPart] = true;
+ nUsedParts = nPart + 1;
+ }
+ }
SvNumberformatLimitOps eOp1, eOp2;
double fLimit1, fLimit2;
@@ -1691,17 +1707,32 @@ void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uI
// if conditions are set, even empty formats must be written
- if ( eOp1 != NUMBERFORMAT_OP_NO && nUsedParts < 2 )
- nUsedParts = 2;
- if ( eOp2 != NUMBERFORMAT_OP_NO && nUsedParts < 3 )
- nUsedParts = 3;
- if ( rFormat.HasTextFormat() && nUsedParts < 4 )
- nUsedParts = 4;
+ if ( eOp1 != NUMBERFORMAT_OP_NO )
+ {
+ bParts[1] = true;
+ if (nUsedParts < 2)
+ nUsedParts = 2;
+ }
+ if ( eOp2 != NUMBERFORMAT_OP_NO )
+ {
+ bParts[2] = true;
+ if (nUsedParts < 3)
+ nUsedParts = 3;
+ }
+ if ( rFormat.HasTextFormat() )
+ {
+ bParts[3] = true;
+ if (nUsedParts < 4)
+ nUsedParts = 4;
+ }
- for (nPart=0; nPart<nUsedParts; nPart++)
+ for (sal_uInt16 nPart=0; nPart<XMLNUM_MAX_PARTS; ++nPart)
{
- bool bDefault = ( nPart+1 == nUsedParts ); // last = default
- ExportPart_Impl( rFormat, nKey, nPart, bDefault );
+ if (bParts[nPart])
+ {
+ bool bDefault = ( nPart+1 == nUsedParts ); // last = default
+ ExportPart_Impl( rFormat, nKey, nPart, bDefault );
+ }
}
}
commit f52aa4d13b7f262a4c54f4e554f45d64a545bce7
Author: Eike Rathke <erack at redhat.com>
Date: Fri Jul 10 23:46:30 2015 +0200
fix string access out of bounds
Could happen with a malformed subformat string like "[<0-0".
Change-Id: I8eaab2bcb469d91432a41dc349060c273a6575a4
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index e725d1d..c645034 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -697,7 +697,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
{
fLimit2 = fNumber;
}
- if ( sBuff[nPos] == ']' )
+ if ( nPos < sBuff.getLength() && sBuff[nPos] == ']' )
{
nPos++;
}
commit b3c11e2b3ef4bad8c2b5f92ba00ac805fb68786f
Author: Eike Rathke <erack at redhat.com>
Date: Fri Jul 10 23:20:28 2015 +0200
the last condition is "all other numbers", not the third, tdf#92457
Change-Id: Ic9571d938c4a8837c5712bafbfb2ebf9f32011df
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 0c59c7e..b1a59ae 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -2129,10 +2129,10 @@ void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex )
if ( aConditions.isEmpty() && aMyConditions.size() == 1 && sRealCond == ">=0" )
bDefaultCond = true;
- if ( nType == XML_TOK_STYLES_TEXT_STYLE && nIndex == 2 )
+ if ( nType == XML_TOK_STYLES_TEXT_STYLE && static_cast<size_t>(nIndex) == aMyConditions.size() - 1 )
{
- // The third condition in a number format with a text part can only be
- // "all other numbers", the condition string must be empty.
+ // The last condition in a number format with a text part can only
+ // be "all other numbers", the condition string must be empty.
bDefaultCond = true;
}
commit 728b7f18c989954912a4b2ad2778c9eeba181f2c
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 23:53:47 2015 +0200
rudimentary documentation for the includebloat script
Change-Id: I52209b70b3d93e488e6c9d16fefd179f2ac06afb
diff --git a/bin/includebloat.awk b/bin/includebloat.awk
index 5a1bdaa..3792ef9 100755
--- a/bin/includebloat.awk
+++ b/bin/includebloat.awk
@@ -1,4 +1,19 @@
#!/usr/bin/gawk -f
+# -*- tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+# Generate a list of files included by the C++ compiler during the build
+# sorted by the total bytes an included file contributed to preprocessor input.
+# usage: first do a full build with "make check", then run this from $BUILDDIR
+
+# NOTE: by default gbuild does not generate dependencies for system headers
+# (in particular the C++ standard library), so those will NOT be counted
BEGIN {
cmd = "find workdir/Dep/CxxObject/ -name *.d | xargs cat"
@@ -27,8 +42,10 @@ END {
close(cmd)
}
PROCINFO["sorted_in"] = "@val_num_desc"
- print "sum total bytes included: " totalsize
+ print "sum total bytes included (excluding system headers): " totalsize
for (inc in totals) {
print totals[inc], sizes[inc], includes[inc], inc
}
}
+
+# vim: set noet sw=4 ts=4:
commit 6ee9ca5ae9d33aa10e0b86dc9a44c8d69564d556
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 23:05:36 2015 +0200
svtools: pimplify SvListView
Sadly this saves only 56MB of preprocessor input.
Change-Id: I9ea78306884c5dcb54b61da87b43f700083daf2c
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
index 0d78444..6092bcc 100644
--- a/include/svtools/treelist.hxx
+++ b/include/svtools/treelist.hxx
@@ -30,7 +30,6 @@
#include <limits.h>
#include <vector>
-#include <boost/ptr_container/ptr_map.hpp>
enum class SvListAction
{
@@ -243,23 +242,8 @@ class SVT_DLLPUBLIC SvListView
{
friend class SvTreeList;
- typedef boost::ptr_map<SvTreeListEntry*, SvViewDataEntry> SvDataTable;
-
- sal_uLong nVisibleCount;
- sal_uLong nSelectionCount;
- bool bVisPositionsValid;
-
- SVT_DLLPRIVATE void InitTable();
- SVT_DLLPRIVATE void RemoveViewData( SvTreeListEntry* pParent );
-
- SvDataTable maDataTable; // Mapping SvTreeListEntry -> ViewData
-
- void ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry* pTargetPrnt,sal_uLong nChildPos);
- void ActionMoved( SvTreeListEntry* pEntry,SvTreeListEntry* pTargetPrnt,sal_uLong nChildPos);
- void ActionInserted( SvTreeListEntry* pEntry );
- void ActionInsertedTree( SvTreeListEntry* pEntry );
- void ActionRemoving( SvTreeListEntry* pEntry );
- void ActionClear();
+ struct Impl;
+ std::unique_ptr<Impl> m_pImpl;
protected:
SvTreeList* pModel;
@@ -306,8 +290,7 @@ public:
SvTreeListEntry* PrevVisible( SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const
{ return pModel->PrevVisible(this,pEntry,rDelta); }
- sal_uLong GetSelectionCount() const
- { return nSelectionCount; }
+ sal_uLong GetSelectionCount() const;
SvTreeListEntry* FirstSelected() const
{ return pModel->FirstSelected(this); }
@@ -350,8 +333,7 @@ public:
void SetEntryFocus( SvTreeListEntry* pEntry, bool bFocus );
const SvViewDataEntry* GetViewData( const SvTreeListEntry* pEntry ) const;
SvViewDataEntry* GetViewData( SvTreeListEntry* pEntry );
- bool HasViewData() const
- { return maDataTable.size() > 1; } // There's always a ROOT
+ bool HasViewData() const;
virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* pEntry );
virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index d6ee88f..3d2c798 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -22,6 +22,40 @@
#include <svtools/viewdataentry.hxx>
#include <osl/diagnose.h>
+#include <boost/ptr_container/ptr_map.hpp>
+
+
+typedef boost::ptr_map<SvTreeListEntry*, SvViewDataEntry> SvDataTable;
+
+struct SvListView::Impl
+{
+ SvListView & m_rThis;
+
+ SvDataTable m_DataTable; // Mapping SvTreeListEntry -> ViewData
+
+ sal_uLong m_nVisibleCount;
+ sal_uLong m_nSelectionCount;
+ bool m_bVisPositionsValid;
+
+ Impl(SvListView & rThis)
+ : m_rThis(rThis)
+ , m_nVisibleCount(0)
+ , m_nSelectionCount(0)
+ , m_bVisPositionsValid(false)
+ {}
+
+ void InitTable();
+ void RemoveViewData( SvTreeListEntry* pParent );
+
+ void ActionMoving(SvTreeListEntry* pEntry, SvTreeListEntry* pTargetPrnt, sal_uLong nChildPos);
+ void ActionMoved(SvTreeListEntry* pEntry, SvTreeListEntry* pTargetPrnt, sal_uLong nChildPos);
+ void ActionInserted(SvTreeListEntry* pEntry);
+ void ActionInsertedTree(SvTreeListEntry* pEntry);
+ void ActionRemoving(SvTreeListEntry* pEntry);
+ void ActionClear();
+};
+
+
SvTreeList::SvTreeList() :
mbEnableInvalidate(true)
{
@@ -582,10 +616,10 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry* p
{
DBG_ASSERT(pView&&pEntry,"View/Entry?");
- if ( !pView->bVisPositionsValid )
+ if (!pView->m_pImpl->m_bVisPositionsValid)
{
// to make GetVisibleCount refresh the positions
- const_cast<SvListView*>(pView)->nVisibleCount = 0;
+ const_cast<SvListView*>(pView)->m_pImpl->m_nVisibleCount = 0;
GetVisibleCount( const_cast<SvListView*>(pView) );
}
const SvViewDataEntry* pViewData = pView->GetViewData( pEntry );
@@ -597,8 +631,8 @@ sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const
assert(pView && "GetVisCount:No View");
if( !pView->HasViewData() )
return 0;
- if ( pView->nVisibleCount )
- return pView->nVisibleCount;
+ if (pView->m_pImpl->m_nVisibleCount)
+ return pView->m_pImpl->m_nVisibleCount;
sal_uLong nPos = 0;
SvTreeListEntry* pEntry = First(); // first entry is always visible
@@ -615,8 +649,8 @@ sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const
OSL_FAIL("nVisibleCount bad");
}
#endif
- pView->nVisibleCount = nPos;
- pView->bVisPositionsValid = true;
+ pView->m_pImpl->m_nVisibleCount = nPos;
+ pView->m_pImpl->m_bVisPositionsValid = true;
return nPos;
}
@@ -746,9 +780,9 @@ SvTreeListEntry* SvTreeList::NextVisible(const SvListView* pView,SvTreeListEntry
// nDelta entries existent?
// example: 0,1,2,3,4,5,6,7,8,9 nVisPos=5 nDelta=7
// nNewDelta = 10-nVisPos-1 == 4
- if ( nVisPos+nDelta >= pView->nVisibleCount )
+ if (nVisPos+nDelta >= pView->m_pImpl->m_nVisibleCount)
{
- nDelta = (sal_uInt16)(pView->nVisibleCount-nVisPos);
+ nDelta = static_cast<sal_uInt16>(pView->m_pImpl->m_nVisibleCount-nVisPos);
nDelta--;
}
sal_uInt16 nDeltaTmp = nDelta;
@@ -945,8 +979,8 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry )
// if parent is visible, invalidate status data
if ( pView->IsExpanded( pParent ) )
{
- pView->bVisPositionsValid = false;
- pView->nVisibleCount = 0;
+ pView->m_pImpl->m_bVisPositionsValid = false;
+ pView->m_pImpl->m_nVisibleCount = 0;
}
}
@@ -964,8 +998,8 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry )
SvTreeListEntry* pParent = pEntry->pParent;
if ( pView->IsExpanded(pParent) )
{
- pView->nVisibleCount = 0;
- pView->bVisPositionsValid = false;
+ pView->m_pImpl->m_nVisibleCount = 0;
+ pView->m_pImpl->m_bVisPositionsValid = false;
}
}
@@ -980,7 +1014,7 @@ bool SvTreeList::Select( SvListView* pView, SvTreeListEntry* pEntry, bool bSelec
else
{
pViewData->SetSelected(true);
- pView->nSelectionCount++;
+ pView->m_pImpl->m_nSelectionCount++;
}
}
else
@@ -990,7 +1024,7 @@ bool SvTreeList::Select( SvListView* pView, SvTreeListEntry* pEntry, bool bSelec
else
{
pViewData->SetSelected(false);
- pView->nSelectionCount--;
+ pView->m_pImpl->m_nSelectionCount--;
}
}
return true;
@@ -1058,9 +1092,9 @@ void SvTreeList::SelectAll( SvListView* pView, bool bSelect )
pEntry = Next( pEntry );
}
if ( bSelect )
- pView->nSelectionCount = nEntryCount;
+ pView->m_pImpl->m_nSelectionCount = nEntryCount;
else
- pView->nSelectionCount = 0;
+ pView->m_pImpl->m_nSelectionCount = 0;
}
@@ -1148,50 +1182,55 @@ std::pair<SvTreeListEntries::iterator, SvTreeListEntries::iterator>
SvListView::SvListView()
+ : m_pImpl(new Impl(*this))
+ , pModel(nullptr)
{
- pModel = 0;
- nSelectionCount = 0;
- nVisibleCount = 0;
- bVisPositionsValid = false;
}
-
SvListView::~SvListView()
{
- maDataTable.clear();
+ m_pImpl->m_DataTable.clear();
}
-void SvListView::InitTable()
+sal_uLong SvListView::GetSelectionCount() const
+{ return m_pImpl->m_nSelectionCount; }
+
+bool SvListView::HasViewData() const
+{ return m_pImpl->m_DataTable.size() > 1; } // There's always a ROOT
+
+
+void SvListView::Impl::InitTable()
{
- DBG_ASSERT(pModel,"InitTable:No Model");
- DBG_ASSERT(!nSelectionCount&&!nVisibleCount&&!bVisPositionsValid,"InitTable: Not cleared!");
+ DBG_ASSERT(m_rThis.pModel,"InitTable:No Model");
+ DBG_ASSERT(!m_nSelectionCount && !m_nVisibleCount && !m_bVisPositionsValid,
+ "InitTable: Not cleared!");
- if( maDataTable.size() )
+ if (!m_DataTable.empty())
{
- DBG_ASSERT(maDataTable.size()==1,"InitTable: TableCount != 1");
+ DBG_ASSERT(m_DataTable.size() == 1, "InitTable: TableCount != 1");
// Delete the view data allocated to the Clear in the root.
// Attention: The model belonging to the root entry (and thus the entry
// itself) might already be deleted.
- maDataTable.clear();
+ m_DataTable.clear();
}
SvTreeListEntry* pEntry;
SvViewDataEntry* pViewData;
// insert root entry
- pEntry = pModel->pRootItem;
+ pEntry = m_rThis.pModel->pRootItem;
pViewData = new SvViewDataEntry;
pViewData->SetExpanded(true);
- maDataTable.insert( pEntry, pViewData );
+ m_DataTable.insert( pEntry, pViewData );
// now all the other entries
- pEntry = pModel->First();
+ pEntry = m_rThis.pModel->First();
while( pEntry )
{
- pViewData = CreateViewData( pEntry );
+ pViewData = m_rThis.CreateViewData( pEntry );
DBG_ASSERT(pViewData,"InitTable:No ViewData");
- InitViewData( pViewData, pEntry );
- maDataTable.insert( pEntry, pViewData );
- pEntry = pModel->Next( pEntry );
+ m_rThis.InitViewData( pViewData, pEntry );
+ m_DataTable.insert( pEntry, pViewData );
+ pEntry = m_rThis.pModel->Next( pEntry );
}
}
@@ -1202,17 +1241,17 @@ SvViewDataEntry* SvListView::CreateViewData( SvTreeListEntry* )
void SvListView::Clear()
{
- maDataTable.clear();
- nSelectionCount = 0;
- nVisibleCount = 0;
- bVisPositionsValid = false;
+ m_pImpl->m_DataTable.clear();
+ m_pImpl->m_nSelectionCount = 0;
+ m_pImpl->m_nVisibleCount = 0;
+ m_pImpl->m_bVisPositionsValid = false;
if( pModel )
{
// insert root entry
SvTreeListEntry* pEntry = pModel->pRootItem;
SvViewDataEntry* pViewData = new SvViewDataEntry;
pViewData->SetExpanded(true);
- maDataTable.insert( pEntry, pViewData );
+ m_pImpl->m_DataTable.insert( pEntry, pViewData );
}
}
@@ -1228,7 +1267,7 @@ void SvListView::SetModel( SvTreeList* pNewModel )
delete pModel;
}
pModel = pNewModel;
- InitTable();
+ m_pImpl->InitTable();
pNewModel->InsertView( this );
if( bBroadcastCleared )
ModelNotification( SvListAction::CLEARED,0,0,0 );
@@ -1272,75 +1311,75 @@ void SvListView::ModelHasEntryInvalidated( SvTreeListEntry*)
{
}
-void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLong)
+void SvListView::Impl::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLong)
{
SvTreeListEntry* pParent = pEntry->pParent;
DBG_ASSERT(pParent,"Model not consistent");
- if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1)
+ if (pParent != m_rThis.pModel->pRootItem && pParent->maChildren.size() == 1)
{
- SvViewDataEntry* pViewData = maDataTable.find( pParent )->second;
+ SvViewDataEntry* pViewData = m_DataTable.find( pParent )->second;
pViewData->SetExpanded(false);
}
- // vorlaeufig
- nVisibleCount = 0;
- bVisPositionsValid = false;
+ // preliminary
+ m_nVisibleCount = 0;
+ m_bVisPositionsValid = false;
}
-void SvListView::ActionMoved( SvTreeListEntry* /* pEntry */ ,
+void SvListView::Impl::ActionMoved( SvTreeListEntry* /* pEntry */ ,
SvTreeListEntry* /* pTargetPrnt */ ,
sal_uLong /* nChildPos */ )
{
- nVisibleCount = 0;
- bVisPositionsValid = false;
+ m_nVisibleCount = 0;
+ m_bVisPositionsValid = false;
}
-void SvListView::ActionInserted( SvTreeListEntry* pEntry )
+void SvListView::Impl::ActionInserted( SvTreeListEntry* pEntry )
{
DBG_ASSERT(pEntry,"Insert:No Entry");
- SvViewDataEntry* pData = CreateViewData( pEntry );
- InitViewData( pData, pEntry );
+ SvViewDataEntry* pData = m_rThis.CreateViewData( pEntry );
+ m_rThis.InitViewData( pData, pEntry );
#ifdef DBG_UTIL
std::pair<SvDataTable::iterator, bool> aSuccess =
#endif
- maDataTable.insert( pEntry, pData );
+ m_DataTable.insert( pEntry, pData );
DBG_ASSERT(aSuccess.second,"Entry already in View");
- if ( nVisibleCount && pModel->IsEntryVisible( this, pEntry ))
+ if (m_nVisibleCount && m_rThis.pModel->IsEntryVisible(&m_rThis, pEntry))
{
- nVisibleCount = 0;
- bVisPositionsValid = false;
+ m_nVisibleCount = 0;
+ m_bVisPositionsValid = false;
}
}
-void SvListView::ActionInsertedTree( SvTreeListEntry* pEntry )
+void SvListView::Impl::ActionInsertedTree( SvTreeListEntry* pEntry )
{
- if ( pModel->IsEntryVisible( this, pEntry ))
+ if (m_rThis.pModel->IsEntryVisible(&m_rThis, pEntry))
{
- nVisibleCount = 0;
- bVisPositionsValid = false;
+ m_nVisibleCount = 0;
+ m_bVisPositionsValid = false;
}
// iterate over entry and its children
SvTreeListEntry* pCurEntry = pEntry;
- sal_uInt16 nRefDepth = pModel->GetDepth( pCurEntry );
+ sal_uInt16 nRefDepth = m_rThis.pModel->GetDepth( pCurEntry );
while( pCurEntry )
{
- DBG_ASSERT(maDataTable.find(pCurEntry) != maDataTable.end(),"Entry already in Table");
- SvViewDataEntry* pViewData = CreateViewData( pCurEntry );
+ DBG_ASSERT(m_DataTable.find(pCurEntry) != m_DataTable.end(),"Entry already in Table");
+ SvViewDataEntry* pViewData = m_rThis.CreateViewData( pCurEntry );
DBG_ASSERT(pViewData,"No ViewData");
- InitViewData( pViewData, pEntry );
- maDataTable.insert( pCurEntry, pViewData );
- pCurEntry = pModel->Next( pCurEntry );
- if ( pCurEntry && pModel->GetDepth(pCurEntry) <= nRefDepth)
+ m_rThis.InitViewData( pViewData, pEntry );
+ m_DataTable.insert( pCurEntry, pViewData );
+ pCurEntry = m_rThis.pModel->Next( pCurEntry );
+ if ( pCurEntry && m_rThis.pModel->GetDepth(pCurEntry) <= nRefDepth)
pCurEntry = 0;
}
}
-void SvListView::RemoveViewData( SvTreeListEntry* pParent )
+void SvListView::Impl::RemoveViewData( SvTreeListEntry* pParent )
{
SvTreeListEntries::iterator it = pParent->maChildren.begin(), itEnd = pParent->maChildren.end();
for (; it != itEnd; ++it)
{
SvTreeListEntry& rEntry = *it;
- maDataTable.erase(&rEntry);
+ m_DataTable.erase(&rEntry);
if (rEntry.HasChildren())
RemoveViewData(&rEntry);
}
@@ -1348,44 +1387,44 @@ void SvListView::RemoveViewData( SvTreeListEntry* pParent )
-void SvListView::ActionRemoving( SvTreeListEntry* pEntry )
+void SvListView::Impl::ActionRemoving( SvTreeListEntry* pEntry )
{
DBG_ASSERT(pEntry,"Remove:No Entry");
- SvViewDataEntry* pViewData = maDataTable.find( pEntry )->second;
+ SvViewDataEntry* pViewData = m_DataTable.find( pEntry )->second;
sal_uLong nSelRemoved = 0;
if ( pViewData->IsSelected() )
- nSelRemoved = 1 + pModel->GetChildSelectionCount( this, pEntry );
- nSelectionCount -= nSelRemoved;
+ nSelRemoved = 1 + m_rThis.pModel->GetChildSelectionCount(&m_rThis, pEntry);
+ m_nSelectionCount -= nSelRemoved;
sal_uLong nVisibleRemoved = 0;
- if ( pModel->IsEntryVisible( this, pEntry ) )
- nVisibleRemoved = 1 + pModel->GetVisibleChildCount( this, pEntry );
- if( nVisibleCount )
+ if (m_rThis.pModel->IsEntryVisible(&m_rThis, pEntry))
+ nVisibleRemoved = 1 + m_rThis.pModel->GetVisibleChildCount(&m_rThis, pEntry);
+ if( m_nVisibleCount )
{
#ifdef DBG_UTIL
- if( nVisibleCount < nVisibleRemoved )
+ if (m_nVisibleCount < nVisibleRemoved)
{
OSL_FAIL("nVisibleRemoved bad");
}
#endif
- nVisibleCount -= nVisibleRemoved;
+ m_nVisibleCount -= nVisibleRemoved;
}
- bVisPositionsValid = false;
+ m_bVisPositionsValid = false;
- maDataTable.erase(pEntry);
+ m_DataTable.erase(pEntry);
RemoveViewData( pEntry );
SvTreeListEntry* pCurEntry = pEntry->pParent;
- if (pCurEntry && pCurEntry != pModel->pRootItem && pCurEntry->maChildren.size() == 1)
+ if (pCurEntry && pCurEntry != m_rThis.pModel->pRootItem && pCurEntry->maChildren.size() == 1)
{
- pViewData = maDataTable.find(pCurEntry)->second;
+ pViewData = m_DataTable.find(pCurEntry)->second;
pViewData->SetExpanded(false);
}
}
-void SvListView::ActionClear()
+void SvListView::Impl::ActionClear()
{
- Clear();
+ m_rThis.Clear();
}
void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
@@ -1394,30 +1433,30 @@ void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEn
switch( nActionId )
{
case SvListAction::INSERTED:
- ActionInserted( pEntry1 );
+ m_pImpl->ActionInserted( pEntry1 );
ModelHasInserted( pEntry1 );
break;
case SvListAction::INSERTED_TREE:
- ActionInsertedTree( pEntry1 );
+ m_pImpl->ActionInsertedTree( pEntry1 );
ModelHasInsertedTree( pEntry1 );
break;
case SvListAction::REMOVING:
ModelIsRemoving( pEntry1 );
- ActionRemoving( pEntry1 );
+ m_pImpl->ActionRemoving( pEntry1 );
break;
case SvListAction::REMOVED:
ModelHasRemoved( pEntry1 );
break;
case SvListAction::MOVING:
ModelIsMoving( pEntry1, pEntry2, nPos );
- ActionMoving( pEntry1, pEntry2, nPos );
+ m_pImpl->ActionMoving( pEntry1, pEntry2, nPos );
break;
case SvListAction::MOVED:
- ActionMoved( pEntry1, pEntry2, nPos );
+ m_pImpl->ActionMoved( pEntry1, pEntry2, nPos );
ModelHasMoved( pEntry1 );
break;
case SvListAction::CLEARING:
- ActionClear();
+ m_pImpl->ActionClear();
ModelHasCleared(); // sic! for compatibility reasons!
break;
case SvListAction::CLEARED:
@@ -1427,14 +1466,14 @@ void SvListView::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEn
ModelHasEntryInvalidated( pEntry1 );
break;
case SvListAction::RESORTED:
- bVisPositionsValid = false;
+ m_pImpl->m_bVisPositionsValid = false;
break;
case SvListAction::RESORTING:
break;
case SvListAction::REVERSING:
break;
case SvListAction::REVERSED:
- bVisPositionsValid = false;
+ m_pImpl->m_bVisPositionsValid = false;
break;
default:
OSL_FAIL("unknown ActionId");
@@ -1448,9 +1487,9 @@ void SvListView::InitViewData( SvViewDataEntry*, SvTreeListEntry* )
bool SvListView::IsExpanded( SvTreeListEntry* pEntry ) const
{
DBG_ASSERT(pEntry,"IsExpanded:No Entry");
- SvDataTable::const_iterator itr = maDataTable.find(pEntry);
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
- if (itr == maDataTable.end())
+ SvDataTable::const_iterator itr = m_pImpl->m_DataTable.find(pEntry);
+ DBG_ASSERT(itr != m_pImpl->m_DataTable.end(),"Entry not in Table");
+ if (itr == m_pImpl->m_DataTable.end())
return false;
return itr->second->IsExpanded();
}
@@ -1458,8 +1497,8 @@ bool SvListView::IsExpanded( SvTreeListEntry* pEntry ) const
bool SvListView::IsSelected( SvTreeListEntry* pEntry ) const
{
DBG_ASSERT(pEntry,"IsExpanded:No Entry");
- SvDataTable::const_iterator itr = maDataTable.find(pEntry );
- if (itr == maDataTable.end())
+ SvDataTable::const_iterator itr = m_pImpl->m_DataTable.find(pEntry);
+ if (itr == m_pImpl->m_DataTable.end())
return false;
return itr->second->IsSelected();
}
@@ -1467,23 +1506,24 @@ bool SvListView::IsSelected( SvTreeListEntry* pEntry ) const
void SvListView::SetEntryFocus( SvTreeListEntry* pEntry, bool bFocus )
{
DBG_ASSERT(pEntry,"SetEntryFocus:No Entry");
- SvDataTable::iterator itr = maDataTable.find(pEntry);
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in Table");
+ SvDataTable::iterator itr = m_pImpl->m_DataTable.find(pEntry);
+ DBG_ASSERT(itr != m_pImpl->m_DataTable.end(),"Entry not in Table");
itr->second->SetFocus(bFocus);
}
const SvViewDataEntry* SvListView::GetViewData( const SvTreeListEntry* pEntry ) const
{
- SvDataTable::const_iterator itr = maDataTable.find( const_cast<SvTreeListEntry*>(pEntry) );
- if (itr == maDataTable.end())
+ SvDataTable::const_iterator itr =
+ m_pImpl->m_DataTable.find(const_cast<SvTreeListEntry*>(pEntry));
+ if (itr == m_pImpl->m_DataTable.end())
return NULL;
return itr->second;
}
SvViewDataEntry* SvListView::GetViewData( SvTreeListEntry* pEntry )
{
- SvDataTable::iterator itr = maDataTable.find( pEntry );
- DBG_ASSERT(itr != maDataTable.end(),"Entry not in model or wrong view");
+ SvDataTable::iterator itr = m_pImpl->m_DataTable.find( pEntry );
+ DBG_ASSERT(itr != m_pImpl->m_DataTable.end(),"Entry not in model or wrong view");
return itr->second;
}
commit fafd0b61cc8e3476c0eaaccf42a5ce2e72954295
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 21:25:30 2015 +0200
extensions: convert boost::bind
Change-Id: I7922140eaaeb428da0f268cac41f7a227693c25a
diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx
index d185ee6..71330c0 100644
--- a/extensions/source/logging/logger.cxx
+++ b/extensions/source/logging/logger.cxx
@@ -29,7 +29,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/logging/XLoggerPool.hpp>
-#include <boost/bind.hpp>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -175,9 +174,9 @@ namespace logging
return;
m_aHandlers.forEach< XLogHandler >(
- ::boost::bind( &XLogHandler::publish, _1, ::boost::cref( _rRecord ) ) );
+ [&] (Reference<XLogHandler> const& rxListener) { rxListener->publish(_rRecord); } );
m_aHandlers.forEach< XLogHandler >(
- ::boost::bind( &XLogHandler::flush, _1 ) );
+ [] (Reference<XLogHandler> const& rxListener) { rxListener->flush(); } );
}
OUString SAL_CALL EventLogger::getName() throw (RuntimeException, std::exception)
commit ad94eaf540260296e8aee0b5bff91d22a5fe6b78
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 19:25:24 2015 +0200
vcl: avoid a boost::ptr_map in VclBuilder
This eliminates 638MB of preprocessor input.
Change-Id: Ife434310ec08e408e1f8aaf52d6298f8caa209af
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index b0d8ace..baf523d 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -18,6 +18,8 @@
#include <vcl/dllapi.h>
#include <vcl/window.hxx>
#include <vcl/vclptr.hxx>
+
+#include <memory>
#include <map>
#include <set>
#include <stack>
@@ -26,7 +28,6 @@
# //some problem with MacOSX and a check define
# undef check
#endif
-#include <boost/ptr_container/ptr_map.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -124,7 +125,7 @@ private:
VclBuilder(const VclBuilder&) SAL_DELETED_FUNCTION;
VclBuilder& operator=(const VclBuilder&) SAL_DELETED_FUNCTION;
- typedef boost::ptr_map<OUString, osl::Module> ModuleMap;
+ typedef std::map<OUString, std::unique_ptr<osl::Module>> ModuleMap;
//We store these until the builder is deleted, that way we can use the
//ui-previewer on custom widgets and guarantee the modules they are from
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index dba80c0..9a5a5b5 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1751,7 +1751,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
#else
pModule->loadRelative(&thisModule, sModule);
#endif
- aI = m_aModuleMap.insert(sModule, pModule).first;
+ aI = m_aModuleMap.insert(std::make_pair(sModule, std::unique_ptr<osl::Module>(pModule))).first;
}
customMakeWidget pFunction = reinterpret_cast<customMakeWidget>(aI->second->getFunctionSymbol(sFunction));
#else
commit 72c11ce76abebdbe88a7be793dbf690c54b30500
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 18:55:12 2015 +0200
remove unused ptr_container includes
Change-Id: I55e15669520075f74c3fc730f8c6549d19de5ab3
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx
index 1d3adc6..f423190 100644
--- a/include/sfx2/infobar.hxx
+++ b/include/sfx2/infobar.hxx
@@ -17,8 +17,6 @@
#include <sfx2/dllapi.h>
#include <sfx2/childwin.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
-
/** SfxChildWindow for positioning the InfoBar in the view.
*/
class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 2676905..94ba1ed 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -52,11 +52,11 @@ class NSOpenGLView;
#endif
#include <vcl/dllapi.h>
-#include <boost/ptr_container/ptr_map.hpp>
#include <vcl/window.hxx>
#include <tools/gen.hxx>
#include <vcl/syschild.hxx>
+#include <map>
#include <set>
class OpenGLFramebuffer;
commit ac010423b6e9005896ca73a55a7d65dd698767d3
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 18:44:56 2015 +0200
sw: clean up SwDoc::maPatternNms nonsense
Change-Id: I0a166d1b58b23cac96ae27d446d6d8ed2442df8e
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index b5461ba..706f79d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -263,7 +263,7 @@ class SW_DLLPUBLIC SwDoc :
Idle maOLEModifiedIdle; //< Timer for update modified OLE-Objects
SwDBData maDBData; //< database descriptor
OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
- boost::ptr_vector< boost::nullable<OUString> > maPatternNms; // Array for names of document-templates
+ std::vector<OUString> m_PatternNames; //< Array for names of document-templates
com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
mxXForms; //< container with XForms models
mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
@@ -907,17 +907,10 @@ public:
static bool IsUsed( const SwNumRule& );
// Set name of newly loaded document template.
- sal_uInt16 SetDocPattern( const OUString& rPatternName );
+ size_t SetDocPattern(const OUString& rPatternName);
// @return name of document template. Can be 0!
- const OUString* GetDocPattern( sal_uInt16 nPos ) const
- {
- if(nPos >= maPatternNms.size())
- return NULL;
- if(boost::is_null(maPatternNms.begin() + nPos))
- return NULL;
- return &(maPatternNms[nPos]);
- }
+ const OUString* GetDocPattern(size_t nPos) const;
// Query / connect current document with glossary document.
void SetGlossaryDoc( SwDoc* pDoc ) { mpGlossaryDoc = pDoc; }
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index f290b05..3244fb7 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -131,28 +131,31 @@ bool SwDoc::IsUsed( const SwNumRule& rRule )
return bUsed;
}
+const OUString* SwDoc::GetDocPattern(size_t const nPos) const
+{
+ if (nPos >= m_PatternNames.size())
+ return nullptr;
+ return &m_PatternNames[nPos];
+}
+
// Look for the style name's position. If it doesn't exist,
// insert a anew
-sal_uInt16 SwDoc::SetDocPattern( const OUString& rPatternName )
+size_t SwDoc::SetDocPattern(const OUString& rPatternName)
{
OSL_ENSURE( !rPatternName.isEmpty(), "no Document style name" );
- size_t nNewPos = maPatternNms.size();
- for(size_t n = 0; n < maPatternNms.size(); ++n)
- if( boost::is_null(maPatternNms.begin() + n) )
- {
- if( nNewPos == maPatternNms.size() )
- nNewPos = n;
- }
- else if( rPatternName == maPatternNms[n] )
- return n;
-
- if( nNewPos < maPatternNms.size() )
- maPatternNms.erase(maPatternNms.begin() + nNewPos); // Free space again
-
- maPatternNms.insert(maPatternNms.begin() + nNewPos, new OUString(rPatternName));
- getIDocumentState().SetModified();
- return nNewPos;
+ auto const iter(
+ std::find(m_PatternNames.begin(), m_PatternNames.end(), rPatternName));
+ if (iter != m_PatternNames.end())
+ {
+ return std::distance(m_PatternNames.begin(), iter);
+ }
+ else
+ {
+ m_PatternNames.push_back(rPatternName);
+ getIDocumentState().SetModified();
+ return m_PatternNames.size() - 1;
+ }
}
sal_uInt16 GetPoolParent( sal_uInt16 nId )
commit 20bd0a2ee9ed899ea542c2de08efda243dbef446
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 14:22:25 2015 +0200
vcl: remove boost/signal2/signal.hpp from header
The most relevant signal member function appears to be connect(),
so let's create a wrapper function for that now, without the more
esoteric ordering features for now.
Move the signal member itself to a new pImpl.
The benefits are worth it: preprocessor input reduced by 2.8GB,
that's 9% of the total (excluding system headers which are not counted
because they don't generate dependencies).
Change-Id: I0aaeda51a5630a348bb12c81a83f67afbd508a14
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 45c8bbb..f44456c 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -51,6 +51,8 @@
#include "optHeaderTabListbox.hxx"
#include <vcl/help.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
index 142ea65..a886975 100644
--- a/cui/source/options/tsaurls.cxx
+++ b/cui/source/options/tsaurls.cxx
@@ -15,6 +15,8 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index e44c37d..b3a56df 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -50,6 +50,8 @@
#include "svgfilter.hxx"
#include "svgwriter.hxx"
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
namespace
diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx
index b803b6d..1d3daaf 100644
--- a/filter/source/svg/svgimport.cxx
+++ b/filter/source/svg/svgimport.cxx
@@ -43,6 +43,8 @@
#include <unotools/mediadescriptor.hxx>
#include <tools/zcodec.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
using namespace ::svgi;
diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx
index 9eba310..6cd4fc8 100644
--- a/include/svtools/DocumentInfoPreview.hxx
+++ b/include/svtools/DocumentInfoPreview.hxx
@@ -29,6 +29,8 @@
#include <tools/wintypes.hxx>
#include <vcl/window.hxx>
+#include <boost/scoped_ptr.hpp>
+
class SvtDocInfoTable_Impl;
namespace com { namespace sun { namespace star {
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index c134780..a245985 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -20,17 +20,23 @@
#ifndef INCLUDED_VCL_EDIT_HXX
#define INCLUDED_VCL_EDIT_HXX
-#include <boost/signals2/signal.hpp>
+#include <vcl/ctrl.hxx>
+
+#include <functional>
+#include <memory>
+
#include <tools/solar.h>
#include <vcl/dllapi.h>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
-#include <vcl/ctrl.hxx>
#include <vcl/menu.hxx>
#include <vcl/dndhelp.hxx>
#include <vcl/vclptr.hxx>
#include <com/sun/star/uno/Reference.h>
+// forward declare signals stuff - those headers are staggeringly expensive
+namespace boost { namespace signals2 { class connection; } }
+
namespace com {
namespace sun {
namespace star {
@@ -68,6 +74,9 @@ enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOM
class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
{
private:
+ struct Impl;
+ ::std::unique_ptr<Impl> m_pImpl;
+
VclPtr<Edit> mpSubEdit;
Timer* mpUpdateDataTimer;
TextFilter* mpFilterText;
@@ -244,7 +253,8 @@ public:
void SetSubEdit( Edit* pEdit );
Edit* GetSubEdit() const { return mpSubEdit; }
- boost::signals2::signal< void ( Edit* ) > autocompleteSignal;
+ void SignalConnectAutocomplete(::boost::signals2::connection * pConnection,
+ ::std::function<void (Edit *)>);
AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; }
virtual Size CalcMinimumSize() const;
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index d5ed372..f1e8b22 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -65,6 +65,9 @@
#include <pptatom.hxx>
#include "pptin.hxx"
#include "randomnode.hxx"
+
+#include <boost/scoped_ptr.hpp>
+
#include <algorithm>
using ::std::map;
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
index 79c13a1..b7fbe74 100644
--- a/sd/source/ui/func/fuoltext.cxx
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -35,6 +35,8 @@
#include "ViewShell.hxx"
#include "OutlineViewShell.hxx"
+#include <boost/scoped_ptr.hpp>
+
#include <stdio.h>
namespace sd {
diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
index 5bec93d..21b47c2 100644
--- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
@@ -27,6 +27,9 @@
#include <osl/mutex.hxx>
#include <svx/sdrpageuser.hxx>
+#include <boost/scoped_ptr.hpp>
+
+
namespace sd { namespace slidesorter { namespace cache {
class RequestData;
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 316189f..1aaae26 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -83,6 +83,8 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::sd::slidesorter::model;
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 62818dc..6923b11 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -30,6 +30,8 @@
#include <tools/link.hxx>
#include <tools/gen.hxx>
+#include <boost/scoped_ptr.hpp>
+
namespace sd { namespace slidesorter {
class SlideSorter;
} }
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index 6603263..4cf2694 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -36,6 +36,8 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index d4e01ca..5b91be9 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -18,6 +18,7 @@
*/
#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index ca19d1b..1167db3 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -53,6 +53,8 @@
#include "graphhelp.hxx"
#include "doc.hrc"
+#include <boost/scoped_ptr.hpp>
+
using namespace css;
SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 4f34198..7579687 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -893,7 +893,8 @@ void SvtURLBox::Init(bool bSetDefaultHelpID)
SetText( OUString() );
- GetSubEdit()->autocompleteSignal.connect( boost::bind( &SvtURLBox::AutoCompleteHandler, this, _1 ) );
+ GetSubEdit()->SignalConnectAutocomplete(nullptr,
+ [this] (Edit *const pEdit) { this->AutoCompleteHandler(pEdit); } );
UpdatePicklistForSmartProtocol_Impl();
EnableAutoSize(GetStyle() & WB_AUTOSIZE);
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 4595b42..0d6c6ab 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -29,6 +29,8 @@
#include <svtools/svtools.hrc>
#include <svtools/colorcfg.hxx>
+#include <boost/scoped_ptr.hpp>
+
#include <vector>
using namespace std;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index cdb3302..3607211 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -56,6 +56,8 @@
#include <comphelper/property.hxx>
+#include <boost/scoped_ptr.hpp>
+
#include <algorithm>
#include <cstdlib>
#include <map>
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index fab7097..62a07c8 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -63,6 +63,8 @@
#include <vcl/outdev.hxx>
#include <osl/mutex.hxx>
+#include <boost/scoped_ptr.hpp>
+
namespace svx
{
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index f577522..dc7f4f6 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -60,6 +60,9 @@
#include <sdr/overlay/overlaytools.hxx>
#include <svx/sdr/table/tablecontroller.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
#include <memory>
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index ca60bae..d66702e 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -50,6 +50,8 @@
#include <swtable.hxx>
#include <fmtfsize.hxx>
+#include <boost/scoped_ptr.hpp>
+
using namespace ::com::sun::star;
// A SwMultiPortion is not a simple portion,
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 60510da..1142f35 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -15,6 +15,8 @@
#include <comphelper/sequenceashashmap.hxx>
#include <o3tl/make_unique.hxx>
+#include <boost/optional.hpp>
+
using namespace com::sun::star;
using namespace oox;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 15a3c09..9249acb 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -284,8 +284,12 @@ void ComboBox::EnableAutocomplete( bool bEnable, bool bMatchCase )
if ( bEnable )
{
if( !m_pImpl->m_AutocompleteConnection.connected())
- m_pImpl->m_AutocompleteConnection = m_pImpl->m_pSubEdit->autocompleteSignal.connect(
- boost::bind( &ComboBox::Impl::ImplAutocompleteHandler, m_pImpl.get(), _1 ) );
+ {
+ m_pImpl->m_pSubEdit->SignalConnectAutocomplete(
+ &m_pImpl->m_AutocompleteConnection,
+ [this] (Edit *const pEdit) { m_pImpl->ImplAutocompleteHandler(pEdit); }
+ );
+ }
}
else
m_pImpl->m_AutocompleteConnection.disconnect();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index ce1d9bb..43ba36c 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -65,6 +65,9 @@
#include <vcl/unohelp2.hxx>
#include <officecfg/Office/Common.hxx>
+
+#include <boost/signals2/signal.hpp>
+
#include <memory>
using namespace ::com::sun::star;
@@ -154,21 +157,29 @@ void Impl_IMEInfos::DestroyAttribs()
nLen = 0;
}
-Edit::Edit( WindowType nType ) :
- Control( nType )
+struct Edit::Impl
+{
+ boost::signals2::signal< void (Edit *) > m_AutocompleteSignal;
+};
+
+Edit::Edit( WindowType nType )
+ : Control( nType )
+ , m_pImpl(new Impl)
{
ImplInitEditData();
}
-Edit::Edit( vcl::Window* pParent, WinBits nStyle ) :
- Control( WINDOW_EDIT )
+Edit::Edit( vcl::Window* pParent, WinBits nStyle )
+ : Control( WINDOW_EDIT )
+ , m_pImpl(new Impl)
{
ImplInitEditData();
ImplInit( pParent, nStyle );
}
-Edit::Edit( vcl::Window* pParent, const ResId& rResId ) :
- Control( WINDOW_EDIT )
+Edit::Edit( vcl::Window* pParent, const ResId& rResId )
+ : Control( WINDOW_EDIT )
+ , m_pImpl(new Impl)
{
rResId.SetRT( RSC_EDIT );
WinBits nStyle = ImplInitRes( rResId );
@@ -1639,12 +1650,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
ImplCopyToSelectionClipboard();
}
- if ( bGoEnd && !autocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier() )
+ if (bGoEnd && !m_pImpl->m_AutocompleteSignal.empty() && !rKEvt.GetKeyCode().GetModifier())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
- autocompleteSignal( this );
+ m_pImpl->m_AutocompleteSignal( this );
}
}
@@ -1739,12 +1750,12 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
if ( !mbReadOnly )
{
ImplInsertText(OUString(rKEvt.GetCharCode()), 0, true);
- if ( !autocompleteSignal.empty() )
+ if (!m_pImpl->m_AutocompleteSignal.empty())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
- autocompleteSignal( this );
+ m_pImpl->m_AutocompleteSignal( this );
}
}
}
@@ -2103,12 +2114,12 @@ void Edit::Command( const CommandEvent& rCEvt )
Invalidate();
// #i25161# call auto complete handler for ext text commit also
- if ( autocompleteSignal.empty() )
+ if (m_pImpl->m_AutocompleteSignal.empty())
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.getLength()) )
{
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
- autocompleteSignal( this );
+ m_pImpl->m_AutocompleteSignal( this );
}
}
}
@@ -2720,7 +2731,7 @@ void Edit::SetSubEdit(Edit* pEdit)
mpSubEdit->mbIsSubEdit = true;
mpSubEdit->SetReadOnly(mbReadOnly);
- mpSubEdit->autocompleteSignal.connect(autocompleteSignal);
+ mpSubEdit->m_pImpl->m_AutocompleteSignal.connect(m_pImpl->m_AutocompleteSignal);
}
}
@@ -3047,4 +3058,14 @@ Selection Edit::GetSurroundingTextSelection() const
return GetSelection();
}
+void Edit::SignalConnectAutocomplete(
+ boost::signals2::connection *const pConnection,
+ std::function<void (Edit *)> slot)
+{
+ boost::signals2::connection const& rConnection(
+ m_pImpl->m_AutocompleteSignal.connect(slot));
+ if (pConnection)
+ *pConnection = rConnection;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index 21ab4a4..c566bc3 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -24,6 +24,8 @@
#include <vcl/gdimetafiletools.hxx>
#include <comphelper/scopeguard.hxx>
+#include <boost/bind.hpp>
+
bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_EXTERNALHEADER *pExtHeader )
{
sal_uInt32 nMetaType;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 4ce6f75..d11e520 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -70,6 +70,8 @@
#include "svids.hrc"
#include "impbmp.hxx"
+#include <boost/optional.hpp>
+
#include <algorithm>
#ifndef Button6
commit ece8699f8f22f6bae137c601bc29b83b75dc3bf3
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 10 12:05:48 2015 +0200
vcl: pImplify ComboBox
The boost::signal stuff is quite heavy (33 kloc), so try to hide it
from the header.
Change-Id: I87826ccfd2a151aff274ffa6b7159a988f751808
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 87e2b92..d0189d5 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -20,9 +20,7 @@
#ifndef INCLUDED_VCL_COMBOBOX_HXX
#define INCLUDED_VCL_COMBOBOX_HXX
-#include <boost/signals2/connection.hpp>
#include <vcl/dllapi.h>
-#include <vcl/ctrl.hxx>
#include <vcl/combobox.h>
#include <vcl/edit.hxx>
@@ -35,45 +33,8 @@ class ImplBtn;
class VCL_DLLPUBLIC ComboBox : public Edit
{
private:
- VclPtr<Edit> mpSubEdit;
- VclPtr<ImplListBox> mpImplLB;
- VclPtr<ImplBtn> mpBtn;
- VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
- sal_uInt16 mnDDHeight;
- sal_Unicode mcMultiSep;
- bool mbDDAutoSize : 1;
- bool mbSyntheticModify : 1;
- bool mbMatchCase : 1;
- sal_Int32 m_nMaxWidthChars;
- Link<> maSelectHdl;
- Link<> maDoubleClickHdl;
- boost::signals2::scoped_connection mAutocompleteConnection;
-
- struct ComboBoxBounds
- {
- Point aSubEditPos;
- Size aSubEditSize;
-
- Point aButtonPos;
- Size aButtonSize;
- };
-
-private:
- SAL_DLLPRIVATE void ImplInitComboBoxData();
- SAL_DLLPRIVATE void ImplUpdateFloatSelection();
- SAL_DLLPRIVATE ComboBoxBounds calcComboBoxDropDownComponentBounds(
- const Size &rOutSize, const Size &rBorderOutSize) const;
-
- DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplCancelHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
-
- SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
- SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
- SAL_DLLPRIVATE void ImplAutocompleteHandler( Edit* );
+ struct Impl;
+ std::unique_ptr<Impl> m_pImpl;
protected:
using Window::ImplInit;
@@ -84,7 +45,7 @@ protected:
SAL_DLLPRIVATE long getMaxWidthScrollBarAndDownButton() const;
protected:
- bool IsDropDownBox() const { return mpFloatWin != nullptr; }
+ bool IsDropDownBox() const;
virtual void FillLayoutData() const SAL_OVERRIDE;
@@ -120,7 +81,7 @@ public:
sal_uInt16 GetDropDownLineCount() const;
void EnableAutoSize( bool bAuto );
- bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
+ bool IsAutoSizeEnabled() const;
void EnableDDAutoWidth( bool b );
@@ -160,13 +121,13 @@ public:
void EnableMultiSelection( bool bMulti );
bool IsMultiSelectionEnabled() const;
- void SetMultiSelectionSeparator( sal_Unicode cSep ) { mcMultiSep = cSep; }
- sal_Unicode GetMultiSelectionSeparator() const { return mcMultiSep; }
+ void SetMultiSelectionSeparator( sal_Unicode cSep );
+ sal_Unicode GetMultiSelectionSeparator() const;
- void SetSelectHdl( const Link<>& rLink ) { maSelectHdl = rLink; }
- const Link<>& GetSelectHdl() const { return maSelectHdl; }
- void SetDoubleClickHdl( const Link<>& rLink ) { maDoubleClickHdl = rLink; }
- const Link<>& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetSelectHdl(const Link<>& rLink);
+ const Link<>& GetSelectHdl() const;
+ void SetDoubleClickHdl(const Link<>& rLink);
+ const Link<>& GetDoubleClickHdl() const;
Size CalcMinimumSize() const SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -216,7 +177,7 @@ public:
using Control::GetIndexForPoint;
long GetIndexForPoint( const Point& rPoint, sal_Int32 & rPos ) const;
- sal_Int32 getMaxWidthChars() const { return m_nMaxWidthChars; }
+ sal_Int32 getMaxWidthChars() const;
void setMaxWidthChars(sal_Int32 nWidth);
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 4f41c31..15a3c09 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -17,7 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <vcl/combobox.hxx>
+
#include <set>
+
+#include <boost/signals2/connection.hpp>
+
#include <comphelper/string.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
@@ -25,13 +30,59 @@
#include <vcl/lstbox.h>
#include <vcl/button.hxx>
#include <vcl/event.hxx>
-#include <vcl/combobox.hxx>
#include <vcl/settings.hxx>
#include <svdata.hxx>
#include <ilstbox.hxx>
#include <controldata.hxx>
+
+struct ComboBoxBounds
+{
+ Point aSubEditPos;
+ Size aSubEditSize;
+
+ Point aButtonPos;
+ Size aButtonSize;
+};
+
+struct ComboBox::Impl
+{
+ ComboBox & m_rThis;
+ VclPtr<Edit> m_pSubEdit;
+ VclPtr<ImplListBox> m_pImplLB;
+ VclPtr<ImplBtn> m_pBtn;
+ VclPtr<ImplListBoxFloatingWindow> m_pFloatWin;
+ sal_uInt16 m_nDDHeight;
+ sal_Unicode m_cMultiSep;
+ bool m_isDDAutoSize : 1;
+ bool m_isSyntheticModify : 1;
+ bool m_isMatchCase : 1;
+ sal_Int32 m_nMaxWidthChars;
+ Link<> m_SelectHdl;
+ Link<> m_DoubleClickHdl;
+ boost::signals2::scoped_connection m_AutocompleteConnection;
+
+ Impl(ComboBox & rThis) : m_rThis(rThis) {}
+
+ void ImplInitComboBoxData();
+ void ImplUpdateFloatSelection();
+ ComboBoxBounds calcComboBoxDropDownComponentBounds(
+ const Size &rOutSize, const Size &rBorderOutSize) const;
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplCancelHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
+
+ void ImplClickButtonHandler( ImplBtn* );
+ void ImplUserDrawHandler( UserDrawEvent* );
+ void ImplAutocompleteHandler( Edit* );
+};
+
+
static void lcl_GetSelectedEntries( ::std::set< sal_Int32 >& rSelectedPos, const OUString& rText, sal_Unicode cTokenSep, const ImplEntryList* pEntryList )
{
for (sal_Int32 n = comphelper::string::getTokenCount(rText, cTokenSep); n;)
@@ -44,18 +95,20 @@ static void lcl_GetSelectedEntries( ::std::set< sal_Int32 >& rSelectedPos, const
}
}
-ComboBox::ComboBox( vcl::Window* pParent, WinBits nStyle ) :
- Edit( WINDOW_COMBOBOX )
+ComboBox::ComboBox(vcl::Window *const pParent, WinBits const nStyle)
+ : Edit( WINDOW_COMBOBOX )
+ , m_pImpl(new Impl(*this))
{
- ImplInitComboBoxData();
+ m_pImpl->ImplInitComboBoxData();
ImplInit( pParent, nStyle );
SetWidthInChars(-1);
}
-ComboBox::ComboBox( vcl::Window* pParent, const ResId& rResId ) :
- Edit( WINDOW_COMBOBOX )
+ComboBox::ComboBox(vcl::Window *const pParent, const ResId& rResId)
+ : Edit( WINDOW_COMBOBOX )
+ , m_pImpl(new Impl(*this))
{
- ImplInitComboBoxData();
+ m_pImpl->ImplInitComboBoxData();
rResId.SetRT( RSC_COMBOBOX );
WinBits nStyle = ImplInitRes( rResId );
ImplInit( pParent, nStyle );
@@ -73,29 +126,29 @@ ComboBox::~ComboBox()
void ComboBox::dispose()
{
- mpSubEdit.disposeAndClear();
+ m_pImpl->m_pSubEdit.disposeAndClear();
- VclPtr< ImplListBox > pImplLB = mpImplLB;
- mpImplLB.clear();
+ VclPtr< ImplListBox > pImplLB = m_pImpl->m_pImplLB;
+ m_pImpl->m_pImplLB.clear();
pImplLB.disposeAndClear();
- mpFloatWin.disposeAndClear();
- mpBtn.disposeAndClear();
+ m_pImpl->m_pFloatWin.disposeAndClear();
+ m_pImpl->m_pBtn.disposeAndClear();
Edit::dispose();
}
-void ComboBox::ImplInitComboBoxData()
+void ComboBox::Impl::ImplInitComboBoxData()
{
- mpSubEdit.disposeAndClear();
- mpBtn = NULL;
- mpImplLB = NULL;
- mpFloatWin = NULL;
+ m_pSubEdit.disposeAndClear();
+ m_pBtn = nullptr;
+ m_pImplLB = nullptr;
+ m_pFloatWin = nullptr;
- mnDDHeight = 0;
- mbDDAutoSize = true;
- mbSyntheticModify = false;
- mbMatchCase = false;
- mcMultiSep = ';';
+ m_nDDHeight = 0;
+ m_isDDAutoSize = true;
+ m_isSyntheticModify = false;
+ m_isMatchCase = false;
+ m_cMultiSep = ';';
m_nMaxWidthChars = -1;
}
@@ -103,9 +156,9 @@ void ComboBox::ImplCalcEditHeight()
{
sal_Int32 nLeft, nTop, nRight, nBottom;
GetBorder( nLeft, nTop, nRight, nBottom );
- mnDDHeight = (sal_uInt16)(mpSubEdit->GetTextHeight() + nTop + nBottom + 4);
+ m_pImpl->m_nDDHeight = (sal_uInt16)(m_pImpl->m_pSubEdit->GetTextHeight() + nTop + nBottom + 4);
if ( !IsDropDownBox() )
- mnDDHeight += 4;
+ m_pImpl->m_nDDHeight += 4;
Rectangle aCtrlRegion( Point( 0, 0 ), Size( 10, 10 ) );
Rectangle aBoundRegion, aContentRegion;
@@ -118,8 +171,8 @@ void ComboBox::ImplCalcEditHeight()
aBoundRegion, aContentRegion ) )
{
const long nNCHeight = aBoundRegion.GetHeight();
- if( mnDDHeight < nNCHeight )
- mnDDHeight = sal::static_int_cast<sal_uInt16>( nNCHeight );
+ if (m_pImpl->m_nDDHeight < nNCHeight)
+ m_pImpl->m_nDDHeight = sal::static_int_cast<sal_uInt16>(nNCHeight);
}
}
@@ -147,14 +200,14 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
WinBits nListStyle = nStyle;
if( nStyle & WB_DROPDOWN )
{
- mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
- mpFloatWin->SetAutoWidth( true );
- mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) );
+ m_pImpl->m_pFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this );
+ m_pImpl->m_pFloatWin->SetAutoWidth( true );
+ m_pImpl->m_pFloatWin->SetPopupModeEndHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplPopupModeEndHdl) );
- mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
- ImplInitDropDownButton( mpBtn );
- mpBtn->buttonDownSignal.connect( boost::bind( &ComboBox::ImplClickButtonHandler, this, _1 ));
- mpBtn->Show();
+ m_pImpl->m_pBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
+ ImplInitDropDownButton( m_pImpl->m_pBtn );
+ m_pImpl->m_pBtn->buttonDownSignal.connect( boost::bind( &ComboBox::Impl::ImplClickButtonHandler, m_pImpl.get(), _1 ));
+ m_pImpl->m_pBtn->Show();
nEditStyle |= WB_NOBORDER;
nListStyle &= ~WB_BORDER;
@@ -170,30 +223,30 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
}
}
- mpSubEdit.set( VclPtr<Edit>::Create( this, nEditStyle ) );
- mpSubEdit->EnableRTL( false );
- SetSubEdit( mpSubEdit );
- mpSubEdit->SetPosPixel( Point() );
+ m_pImpl->m_pSubEdit.set( VclPtr<Edit>::Create( this, nEditStyle ) );
+ m_pImpl->m_pSubEdit->EnableRTL( false );
+ SetSubEdit( m_pImpl->m_pSubEdit );
+ m_pImpl->m_pSubEdit->SetPosPixel( Point() );
EnableAutocomplete( true );
- mpSubEdit->Show();
+ m_pImpl->m_pSubEdit->Show();
vcl::Window* pLBParent = this;
- if ( mpFloatWin )
- pLBParent = mpFloatWin;
- mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
- mpImplLB->SetPosPixel( Point() );
- mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
- mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
- mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) );
- mpImplLB->userDrawSignal.connect( boost::bind( &ComboBox::ImplUserDrawHandler, this, _1 ) );
- mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) );
- mpImplLB->SetListItemSelectHdl( LINK( this, ComboBox, ImplListItemSelectHdl ) );
- mpImplLB->Show();
-
- if ( mpFloatWin )
- mpFloatWin->SetImplListBox( mpImplLB );
+ if (m_pImpl->m_pFloatWin)
+ pLBParent = m_pImpl->m_pFloatWin;
+ m_pImpl->m_pImplLB = VclPtr<ImplListBox>::Create( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
+ m_pImpl->m_pImplLB->SetPosPixel( Point() );
+ m_pImpl->m_pImplLB->SetSelectHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplSelectHdl) );
+ m_pImpl->m_pImplLB->SetCancelHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplCancelHdl) );
+ m_pImpl->m_pImplLB->SetDoubleClickHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplDoubleClickHdl) );
+ m_pImpl->m_pImplLB->userDrawSignal.connect( boost::bind( &ComboBox::Impl::ImplUserDrawHandler, m_pImpl.get(), _1 ) );
+ m_pImpl->m_pImplLB->SetSelectionChangedHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplSelectionChangedHdl) );
+ m_pImpl->m_pImplLB->SetListItemSelectHdl( LINK(m_pImpl.get(), ComboBox::Impl, ImplListItemSelectHdl) );
+ m_pImpl->m_pImplLB->Show();
+
+ if (m_pImpl->m_pFloatWin)
+ m_pImpl->m_pFloatWin->SetImplListBox( m_pImpl->m_pImplLB );
else
- mpImplLB->GetMainWindow()->AllowGrabFocus( true );
+ m_pImpl->m_pImplLB->GetMainWindow()->AllowGrabFocus( true );
ImplCalcEditHeight();
@@ -226,65 +279,66 @@ void ComboBox::ImplLoadRes( const ResId& rResId )
void ComboBox::EnableAutocomplete( bool bEnable, bool bMatchCase )
{
- mbMatchCase = bMatchCase;
+ m_pImpl->m_isMatchCase = bMatchCase;
if ( bEnable )
{
- if( !mAutocompleteConnection.connected())
- mAutocompleteConnection = mpSubEdit->autocompleteSignal.connect(
- boost::bind( &ComboBox::ImplAutocompleteHandler, this, _1 ) );
+ if( !m_pImpl->m_AutocompleteConnection.connected())
+ m_pImpl->m_AutocompleteConnection = m_pImpl->m_pSubEdit->autocompleteSignal.connect(
+ boost::bind( &ComboBox::Impl::ImplAutocompleteHandler, m_pImpl.get(), _1 ) );
}
else
- mAutocompleteConnection.disconnect();
+ m_pImpl->m_AutocompleteConnection.disconnect();
}
bool ComboBox::IsAutocompleteEnabled() const
{
- return mAutocompleteConnection.connected();
+ return m_pImpl->m_AutocompleteConnection.connected();
}
-void ComboBox::ImplClickButtonHandler( ImplBtn* )
+void ComboBox::Impl::ImplClickButtonHandler( ImplBtn* )
{
- CallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
- mpSubEdit->GrabFocus();
- if ( !mpImplLB->GetEntryList()->GetMRUCount() )
+ m_rThis.CallEventListeners( VCLEVENT_DROPDOWN_PRE_OPEN );
+ m_pSubEdit->GrabFocus();
+ if (!m_pImplLB->GetEntryList()->GetMRUCount())
ImplUpdateFloatSelection();
else
- mpImplLB->SelectEntry( 0 , true );
- mpBtn->SetPressed( true );
- SetSelection( Selection( 0, SELECTION_MAX ) );
- mpFloatWin->StartFloat( true );
- CallEventListeners( VCLEVENT_DROPDOWN_OPEN );
+ m_pImplLB->SelectEntry( 0 , true );
+ m_pBtn->SetPressed( true );
+ m_rThis.SetSelection( Selection( 0, SELECTION_MAX ) );
+ m_pFloatWin->StartFloat( true );
+ m_rThis.CallEventListeners( VCLEVENT_DROPDOWN_OPEN );
- ImplClearLayoutData();
- if( mpImplLB )
- mpImplLB->GetMainWindow()->ImplClearLayoutData();
+ m_rThis.ImplClearLayoutData();
+ if (m_pImplLB)
+ m_pImplLB->GetMainWindow()->ImplClearLayoutData();
}
-IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
+IMPL_LINK_NOARG(ComboBox::Impl, ImplPopupModeEndHdl)
{
- if( mpFloatWin->IsPopupModeCanceled() )
+ if (m_pFloatWin->IsPopupModeCanceled())
{
- if ( !mpImplLB->GetEntryList()->IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) )
+ if (!m_pImplLB->GetEntryList()->IsEntryPosSelected(
+ m_pFloatWin->GetPopupModeStartSaveSelection()))
{
- mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), true );
- bool bTravelSelect = mpImplLB->IsTravelSelect();
- mpImplLB->SetTravelSelect( true );
- Select();
- mpImplLB->SetTravelSelect( bTravelSelect );
+ m_pImplLB->SelectEntry(m_pFloatWin->GetPopupModeStartSaveSelection(), true);
+ bool bTravelSelect = m_pImplLB->IsTravelSelect();
+ m_pImplLB->SetTravelSelect( true );
+ m_rThis.Select();
+ m_pImplLB->SetTravelSelect( bTravelSelect );
}
}
- ImplClearLayoutData();
- if( mpImplLB )
- mpImplLB->GetMainWindow()->ImplClearLayoutData();
+ m_rThis.ImplClearLayoutData();
+ if (m_pImplLB)
+ m_pImplLB->GetMainWindow()->ImplClearLayoutData();
- mpBtn->SetPressed( false );
- CallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
+ m_pBtn->SetPressed( false );
+ m_rThis.CallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
return 0;
}
-void ComboBox::ImplAutocompleteHandler( Edit* pEdit )
+void ComboBox::Impl::ImplAutocompleteHandler( Edit* pEdit )
{
Selection aSel = pEdit->GetSelection();
AutocompleteAction eAction = pEdit->GetAutocompleteAction();
@@ -297,7 +351,7 @@ void ComboBox::ImplAutocompleteHandler( Edit* pEdit )
{
OUString aFullText = pEdit->GetText();
OUString aStartText = aFullText.copy( 0, (sal_Int32)aSel.Max() );
- sal_Int32 nStart = mpImplLB->GetCurrentPos();
+ sal_Int32 nStart = m_pImplLB->GetCurrentPos();
if ( nStart == LISTBOX_ENTRY_NOTFOUND )
nStart = 0;
@@ -310,62 +364,66 @@ void ComboBox::ImplAutocompleteHandler( Edit* pEdit )
bForward = false;
if (nStart)
nStart = nStart - 1;
- else if (mpImplLB->GetEntryList()->GetEntryCount())
- nStart = mpImplLB->GetEntryList()->GetEntryCount()-1;
+ else if (m_pImplLB->GetEntryList()->GetEntryCount())
+ nStart = m_pImplLB->GetEntryList()->GetEntryCount()-1;
}
sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND;
- if( ! mbMatchCase )
+ if (!m_isMatchCase)
{
// Try match case insensitive from current position
- nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, true );
+ nPos = m_pImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, true );
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
// Try match case insensitive, but from start
- nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward, true );
+ nPos = m_pImplLB->GetEntryList()->FindMatchingEntry( aStartText,
+ bForward ? 0 : (m_pImplLB->GetEntryList()->GetEntryCount()-1),
+ bForward, true );
}
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
// Try match full from current position
- nPos = mpImplLB->GetEntryList()->FindMatchingEntry( aStartText, nStart, bForward, false );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list