[glom/c++11] C++11: Replace Glom::sharedptr with std::shared_ptr.



commit 740dadd8159260944522610a3f344af2bc7915a9
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jul 4 11:59:27 2013 +0200

    C++11: Replace Glom::sharedptr with std::shared_ptr.

 Makefile_tests.am                                  |    1 -
 glom/appwindow.cc                                  |   40 +-
 glom/appwindow.h                                   |    4 +-
 glom/base_db.cc                                    |  174 +++---
 glom/base_db.h                                     |   76 ++--
 glom/base_db_table_data.cc                         |   42 +-
 glom/base_db_table_data.h                          |   10 +-
 glom/base_db_table_data_readonly.h                 |    2 +-
 glom/box_reports.cc                                |   10 +-
 glom/box_reports.h                                 |    2 +-
 glom/dialog_connection.cc                          |    4 +-
 glom/dialog_connection.h                           |    2 +-
 glom/dialog_existing_or_new.cc                     |   10 +-
 glom/dialog_existing_or_new.h                      |   12 +-
 glom/frame_glom.cc                                 |   44 +-
 glom/glom_test_connection.cc                       |    2 +-
 glom/import_csv/csv_parser.cc                      |    4 +-
 glom/import_csv/csv_parser.h                       |    2 +-
 glom/import_csv/dialog_import_csv.cc               |   18 +-
 glom/import_csv/dialog_import_csv.h                |    8 +-
 glom/import_csv/dialog_import_csv_progress.cc      |   12 +-
 glom/import_csv/dialog_import_csv_progress.h       |    8 +-
 glom/libglom/calcinprogress.h                      |    2 +-
 glom/libglom/connectionpool.cc                     |   48 +-
 glom/libglom/connectionpool.h                      |   16 +-
 glom/libglom/connectionpool_backends/backend.cc    |    2 +-
 glom/libglom/connectionpool_backends/backend.h     |    4 +-
 glom/libglom/connectionpool_backends/mysql.cc      |    4 +-
 glom/libglom/connectionpool_backends/postgres.cc   |    4 +-
 glom/libglom/connectionpool_backends/sqlite.cc     |    6 +-
 glom/libglom/connectionpool_backends/sqlite.h      |    8 +-
 glom/libglom/data_structure/database_title.h       |    2 +-
 glom/libglom/data_structure/field.cc               |    4 +-
 glom/libglom/data_structure/field.h                |   10 +-
 glom/libglom/data_structure/foundset.h             |    4 +-
 glom/libglom/data_structure/has_title_singular.cc  |    2 +-
 glom/libglom/data_structure/has_title_singular.h   |    2 +-
 glom/libglom/data_structure/layout/formatting.cc   |   16 +-
 glom/libglom/data_structure/layout/formatting.h    |   16 +-
 glom/libglom/data_structure/layout/layoutgroup.cc  |   74 ++--
 glom/libglom/data_structure/layout/layoutgroup.h   |   12 +-
 .../layout/layoutitem_calendarportal.cc            |    8 +-
 .../layout/layoutitem_calendarportal.h             |    8 +-
 .../data_structure/layout/layoutitem_field.cc      |   16 +-
 .../data_structure/layout/layoutitem_field.h       |   24 +-
 .../data_structure/layout/layoutitem_portal.cc     |   60 +-
 .../data_structure/layout/layoutitem_portal.h      |   16 +-
 .../data_structure/layout/layoutitem_text.cc       |    8 +-
 .../data_structure/layout/layoutitem_text.h        |    2 +-
 .../layout/report_parts/layoutitem_fieldsummary.cc |    2 +-
 .../layout/report_parts/layoutitem_fieldsummary.h  |    2 +-
 .../layout/report_parts/layoutitem_groupby.cc      |   12 +-
 .../layout/report_parts/layoutitem_groupby.h       |   14 +-
 .../data_structure/layout/usesrelationship.cc      |   10 +-
 .../data_structure/layout/usesrelationship.h       |   20 +-
 glom/libglom/data_structure/print_layout.cc        |    6 +-
 glom/libglom/data_structure/print_layout.h         |    6 +-
 glom/libglom/data_structure/report.cc              |    6 +-
 glom/libglom/data_structure/report.h               |    6 +-
 glom/libglom/data_structure/translatable_item.h    |    2 +-
 glom/libglom/db_utils.cc                           |   78 ++--
 glom/libglom/db_utils.h                            |   20 +-
 glom/libglom/document/document.cc                  |  564 ++++++++++----------
 glom/libglom/document/document.h                   |   98 ++--
 glom/libglom/example_document_load.cc              |   12 +-
 glom/libglom/filelist.am                           |    2 +-
 glom/libglom/privs.cc                              |    4 +-
 glom/libglom/python_embed/py_glom_record.cc        |    4 +-
 glom/libglom/python_embed/py_glom_record.h         |    4 +-
 glom/libglom/python_embed/py_glom_related.cc       |    4 +-
 glom/libglom/python_embed/py_glom_related.h        |    2 +-
 glom/libglom/python_embed/py_glom_relatedrecord.cc |   10 +-
 glom/libglom/python_embed/py_glom_relatedrecord.h  |    4 +-
 glom/libglom/report_builder.cc                     |  110 ++--
 glom/libglom/report_builder.h                      |   32 +-
 glom/libglom/sharedptr.h                           |  467 ----------------
 glom/libglom/spawn_with_feedback.cc                |   18 +-
 glom/libglom/test_connectionpool.cc                |    4 +-
 glom/libglom/test_sharedptr_layoutitem.cc          |   81 ---
 glom/libglom/translations_po.cc                    |    6 +-
 glom/libglom/translations_po.h                     |    2 +-
 glom/libglom/utils.cc                              |   91 ++--
 glom/libglom/utils.h                               |   24 +-
 glom/libglom/xsl_utils.h                           |    2 +-
 glom/mode_data/box_data.cc                         |   22 +-
 glom/mode_data/box_data.h                          |    4 +-
 glom/mode_data/box_data_calendar_related.cc        |   44 +-
 glom/mode_data/box_data_calendar_related.h         |    2 +-
 glom/mode_data/box_data_details.cc                 |   48 +-
 glom/mode_data/box_data_details.h                  |   18 +-
 glom/mode_data/box_data_list.cc                    |   28 +-
 glom/mode_data/box_data_list.h                     |   12 +-
 glom/mode_data/box_data_list_related.cc            |   28 +-
 glom/mode_data/box_data_list_related.h             |    8 +-
 glom/mode_data/box_data_manyrecords.cc             |    4 +-
 glom/mode_data/box_data_manyrecords.h              |    4 +-
 glom/mode_data/box_data_portal.cc                  |   24 +-
 glom/mode_data/box_data_portal.h                   |   12 +-
 glom/mode_data/buttonglom.cc                       |    4 +-
 glom/mode_data/datawidget/cellcreation.cc          |   26 +-
 glom/mode_data/datawidget/cellcreation.h           |    2 +-
 glom/mode_data/datawidget/cellrenderer_dblist.cc   |   10 +-
 glom/mode_data/datawidget/cellrenderer_dblist.h    |    2 +-
 glom/mode_data/datawidget/combo.cc                 |   14 +-
 glom/mode_data/datawidget/combo.h                  |    2 +-
 .../mode_data/datawidget/combo_as_radio_buttons.cc |   26 +-
 glom/mode_data/datawidget/combo_as_radio_buttons.h |    2 +-
 glom/mode_data/datawidget/combochoices.cc          |   12 +-
 glom/mode_data/datawidget/combochoices.h           |    4 +-
 .../datawidget/combochoiceswithtreemodel.cc        |   38 +-
 .../datawidget/combochoiceswithtreemodel.h         |    6 +-
 glom/mode_data/datawidget/datawidget.cc            |   42 +-
 glom/mode_data/datawidget/datawidget.h             |   14 +-
 glom/mode_data/datawidget/entry.cc                 |   12 +-
 glom/mode_data/datawidget/entry.h                  |    2 +-
 glom/mode_data/datawidget/label.cc                 |    2 +-
 glom/mode_data/datawidget/textview.cc              |    6 +-
 glom/mode_data/datawidget/treemodel_db.cc          |   10 +-
 glom/mode_data/datawidget/treemodel_db.h           |    6 +-
 .../datawidget/treemodel_db_withextratext.cc       |    4 +-
 .../datawidget/treemodel_db_withextratext.h        |    2 +-
 glom/mode_data/db_adddel/db_adddel.cc              |  124 +++---
 glom/mode_data/db_adddel/db_adddel.h               |   40 +-
 glom/mode_data/flowtablewithfields.cc              |  138 +++---
 glom/mode_data/flowtablewithfields.h               |   70 ++--
 glom/mode_data/notebook_data.cc                    |    4 +-
 glom/mode_data/test_flowtablewithfields.cc         |   22 +-
 glom/mode_design/box_db_table_relationships.cc     |   12 +-
 glom/mode_design/dialog_add_related_table.cc       |    2 +-
 glom/mode_design/dialog_database_preferences.cc    |    6 +-
 glom/mode_design/dialog_database_preferences.h     |    2 +-
 glom/mode_design/fields/box_db_table_definition.cc |   40 +-
 glom/mode_design/fields/box_db_table_definition.h  |   14 +-
 glom/mode_design/fields/dialog_fieldcalculation.cc |   16 +-
 glom/mode_design/fields/dialog_fieldcalculation.h  |    6 +-
 glom/mode_design/fields/dialog_fielddefinition.cc  |   18 +-
 glom/mode_design/fields/dialog_fielddefinition.h   |    6 +-
 glom/mode_design/layout/combobox_fields.cc         |   20 +-
 glom/mode_design/layout/combobox_fields.h          |    8 +-
 glom/mode_design/layout/combobox_relationship.cc   |   34 +-
 glom/mode_design/layout/combobox_relationship.h    |   12 +-
 glom/mode_design/layout/dialog_choose_field.cc     |   28 +-
 glom/mode_design/layout/dialog_choose_field.h      |   12 +-
 .../layout/dialog_choose_relationship.cc           |   10 +-
 .../layout/dialog_choose_relationship.h            |    6 +-
 .../layout/dialog_layout_calendar_related.cc       |   48 +-
 .../layout/dialog_layout_calendar_related.h        |    8 +-
 glom/mode_design/layout/dialog_layout_details.cc   |  188 ++++----
 glom/mode_design/layout/dialog_layout_details.h    |   10 +-
 glom/mode_design/layout/dialog_layout_export.cc    |   16 +-
 glom/mode_design/layout/dialog_layout_export.h     |    2 +-
 .../layout/dialog_layout_list_related.cc           |   50 +-
 .../layout/dialog_layout_list_related.h            |    8 +-
 .../layout/layout_item_dialogs/box_formatting.cc   |   22 +-
 .../layout/layout_item_dialogs/box_formatting.h    |    4 +-
 .../layout_item_dialogs/dialog_buttonscript.cc     |   14 +-
 .../layout_item_dialogs/dialog_buttonscript.h      |    8 +-
 .../layout_item_dialogs/dialog_field_layout.cc     |    8 +-
 .../layout_item_dialogs/dialog_field_layout.h      |    6 +-
 .../layout_item_dialogs/dialog_field_summary.cc    |    8 +-
 .../layout_item_dialogs/dialog_field_summary.h     |    6 +-
 .../layout_item_dialogs/dialog_fieldslist.cc       |   16 +-
 .../layout/layout_item_dialogs/dialog_fieldslist.h |    2 +-
 .../layout_item_dialogs/dialog_formatting.cc       |    4 +-
 .../layout/layout_item_dialogs/dialog_formatting.h |    4 +-
 .../layout/layout_item_dialogs/dialog_group_by.cc  |    8 +-
 .../layout/layout_item_dialogs/dialog_group_by.h   |    6 +-
 .../layout_item_dialogs/dialog_imageobject.cc      |    6 +-
 .../layout_item_dialogs/dialog_imageobject.h       |    6 +-
 .../layout/layout_item_dialogs/dialog_line.cc      |    6 +-
 .../layout/layout_item_dialogs/dialog_line.h       |    6 +-
 .../layout/layout_item_dialogs/dialog_notebook.cc  |   14 +-
 .../layout/layout_item_dialogs/dialog_notebook.h   |    8 +-
 .../layout_item_dialogs/dialog_sortfields.cc       |   14 +-
 .../layout/layout_item_dialogs/dialog_sortfields.h |    2 +-
 .../layout_item_dialogs/dialog_textobject.cc       |    8 +-
 .../layout/layout_item_dialogs/dialog_textobject.h |    8 +-
 glom/mode_design/layout/treestore_layout.cc        |   12 +-
 glom/mode_design/layout/treestore_layout.h         |    2 +-
 .../mode_design/print_layouts/box_print_layouts.cc |   10 +-
 glom/mode_design/print_layouts/box_print_layouts.h |    2 +-
 .../print_layouts/window_print_layout_edit.cc      |   58 +-
 .../print_layouts/window_print_layout_edit.h       |   12 +-
 .../relationships_overview/canvas_group_dbtable.cc |    2 +-
 .../dialog_relationships_overview.cc               |    6 +-
 .../report_layout/dialog_layout_report.cc          |  136 +++---
 .../report_layout/dialog_layout_report.h           |   18 +-
 .../report_layout/treestore_report_layout.cc       |   24 +-
 .../report_layout/treestore_report_layout.h        |    4 +-
 .../mode_design/translation/window_translations.cc |   12 +-
 glom/mode_design/translation/window_translations.h |    2 +-
 glom/mode_design/users/dialog_groups_list.cc       |    2 +-
 glom/mode_find/box_data_details_find.cc            |    2 +-
 glom/mode_find/box_data_details_find.h             |    2 +-
 glom/navigation/box_tables.cc                      |   14 +-
 glom/navigation/box_tables.h                       |    2 +-
 glom/print_layout/canvas_layout_item.cc            |   34 +-
 glom/print_layout/canvas_layout_item.h             |   16 +-
 glom/print_layout/canvas_print_layout.cc           |  109 ++--
 glom/print_layout/canvas_print_layout.h            |   20 +-
 glom/print_layout/print_layout_utils.cc            |   34 +-
 glom/print_layout/print_layout_utils.h             |    4 +-
 glom/python_embed/glom_python.cc                   |    4 +-
 glom/python_embed/glom_python.h                    |    4 +-
 glom/utility_widgets/dialog_flowtable.cc           |    2 +-
 glom/utility_widgets/dialog_flowtable.h            |    2 +-
 glom/utility_widgets/dialog_image_load_progress.cc |    2 +-
 glom/utility_widgets/dialog_image_load_progress.h  |    4 +-
 glom/utility_widgets/imageglom.cc                  |    8 +-
 glom/utility_widgets/imageglom.h                   |    2 +-
 glom/utility_widgets/layoutwidgetbase.cc           |    8 +-
 glom/utility_widgets/layoutwidgetbase.h            |   10 +-
 glom/utility_widgets/layoutwidgetmenu.cc           |    4 +-
 glom/utility_widgets/layoutwidgetutils.cc          |    4 +-
 glom/utility_widgets/notebooklabelglom.cc          |    4 +-
 glom/utils_ui.cc                                   |    2 +-
 glom/utils_ui.h                                    |    2 +-
 tests/python/test_python_execute_func.cc           |    2 +-
 .../python/test_python_execute_func_bad_syntax.cc  |    2 +-
 .../test_python_execute_func_change_result_type.cc |    2 +-
 tests/python/test_python_execute_func_date.cc      |    6 +-
 .../python/test_python_execute_func_with_record.cc |    4 +-
 tests/python/test_python_execute_script.cc         |    2 +-
 tests/test_document_change.cc                      |    4 +-
 tests/test_document_load.cc                        |   40 +-
 tests/test_document_load_and_change.cc             |    8 +-
 tests/test_document_load_image.cc                  |    8 +-
 tests/test_document_load_translations.cc           |   36 +-
 tests/test_fake_connection.cc                      |    8 +-
 tests/test_field_file_format.cc                    |    4 +-
 tests/test_selfhosting_new_from_example_float.cc   |    6 +-
 tests/test_selfhosting_new_then_change_columns.cc  |    6 +-
 tests/test_selfhosting_new_then_choices.cc         |    2 +-
 tests/test_selfhosting_new_then_image.cc           |    6 +-
 tests/test_selfhosting_new_then_lookup.cc          |   24 +-
 tests/test_selfhosting_new_then_report.cc          |    2 +-
 tests/test_selfhosting_new_then_report_summary.cc  |    2 +-
 tests/test_selfhosting_sqlinjection.cc             |   32 +-
 tests/test_selfhosting_utils.cc                    |   22 +-
 tests/test_utils.cc                                |   12 +-
 tests/test_utils.h                                 |    2 +-
 tests/translations_po/test_document_import_po.cc   |    4 +-
 242 files changed, 2286 insertions(+), 2835 deletions(-)
---
diff --git a/Makefile_tests.am b/Makefile_tests.am
index d48c3a2..9a99e62 100644
--- a/Makefile_tests.am
+++ b/Makefile_tests.am
@@ -18,7 +18,6 @@
 check_PROGRAMS =                                               \
        glom/libglom/test_connectionpool                        \
        glom/libglom/example_document_load \
-       glom/libglom/test_sharedptr_layoutitem          \
        tests/test_document_load                        \
        tests/test_document_load_and_change             \
        tests/test_document_load_and_save               \
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index d973f4a..bd9efdb 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -43,7 +43,7 @@
 #include <gtkmm/main.h>
 
 #include <cstdio>
-#include <memory> //For std::auto_ptr<>
+#include <memory> //For std::shared_ptr<>
 #include <giomm/file.h>
 #include <glibmm/spawn.h>
 #include <glibmm/convert.h>
@@ -1246,13 +1246,13 @@ bool AppWindow::on_document_load()
   {
     Glib::ustring error_message; //TODO: Check this and tell the user.
     ConnectionPool* connection_pool = ConnectionPool::get_instance();
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
     AppPythonUICallbacks callbacks;
     glom_execute_python_function_implementation(script,
       type_map_fields(), //only used when there is a current table and record.
       pDocument,
       Glib::ustring() /* table_name */,
-      sharedptr<Field>(), Gnome::Gda::Value(), // primary key - only used when there is a current table and 
record.
+      std::shared_ptr<Field>(), Gnome::Gda::Value(), // primary key - only used when there is a current 
table and record.
       sharedconnection->get_gda_connection(),
       callbacks,
       error_message);
@@ -1393,7 +1393,7 @@ void AppWindow::update_userlevel_ui()
   {
     if(ConnectionPool::get_instance_is_ready())
     {
-      sharedptr<SharedConnection> connection = ConnectionPool::get_and_connect();
+      std::shared_ptr<SharedConnection> connection = ConnectionPool::get_and_connect();
       if(connection && 
!connection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
         m_action_developer_users->set_sensitive(false);
     }
@@ -1426,7 +1426,7 @@ bool AppWindow::offer_new_or_existing()
   //Offer to load an existing document, or start a new one.
   Dialog_ExistingOrNew* dialog_raw = 0;
   Utils::get_glade_widget_derived_with_warning(dialog_raw);
-  std::auto_ptr<Dialog_ExistingOrNew> dialog(dialog_raw);
+  std::shared_ptr<Dialog_ExistingOrNew> dialog(dialog_raw);
   dialog->set_transient_for(*this);
 /*
   dialog->signal_new().connect(sigc::mem_fun(*this, &AppWindow::on_existing_or_new_new));
@@ -1637,14 +1637,14 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
 #else
-  std::auto_ptr<std::exception> error;
+  std::shared_ptr<std::exception> error;
 #endif // GLIBMM_EXCEPTIONS_ENABLED
   {
     connection_pool->set_ready_to_connect(); //This has succeeded already.
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
 #else
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect(error);
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect(error);
     if(!error.get())
     {
 #endif // GLIBMM_EXCEPTIONS_ENABLED
@@ -1700,7 +1700,7 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
   pulse_progress_message();
   BusyCursor busy_cursor(this);
 
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
 #endif // GLIBMM_EXCEPTIONS_ENABLED
@@ -1741,7 +1741,7 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
   Document::type_listTableInfo tables = pDocument->get_tables();
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<const TableInfo> table_info = *iter;
+    std::shared_ptr<const TableInfo> table_info = *iter;
 
     //Create SQL to describe all fields in this table:
     Glib::ustring sql_fields;
@@ -1768,7 +1768,7 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
 
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<const TableInfo> table_info = *iter;
+    std::shared_ptr<const TableInfo> table_info = *iter;
 
     //Add any example data to the table:
     pulse_progress_message();
@@ -1816,14 +1816,14 @@ bool AppWindow::recreate_database_from_backup(const Glib::ustring& backup_uri, b
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
 #else
-  std::auto_ptr<std::exception> error;
+  std::shared_ptr<std::exception> error;
 #endif // GLIBMM_EXCEPTIONS_ENABLED
   {
     connection_pool->set_ready_to_connect(); //This has succeeded already.
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
 #else
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect(error);
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect(error);
     if(!error.get())
     {
 #endif // GLIBMM_EXCEPTIONS_ENABLED
@@ -2007,7 +2007,7 @@ void AppWindow::fill_menu_tables()
   const Document::type_listTableInfo tables = document->get_tables();
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<const TableInfo> table_info = *iter;
+    std::shared_ptr<const TableInfo> table_info = *iter;
     if(!table_info->get_hidden())
     {
       const Glib::ustring action_name = "NavTableAction_" + table_info->get_name();
@@ -2073,7 +2073,7 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
   const std::vector<Glib::ustring> reports = document->get_report_names(table_name);
   for(std::vector<Glib::ustring>::const_iterator iter = reports.begin(); iter != reports.end(); ++iter)
   {
-    sharedptr<Report> report = document->get_report(table_name, *iter);
+    std::shared_ptr<Report> report = document->get_report(table_name, *iter);
     if(report)
     {
       const Glib::ustring report_name = report->get_name();
@@ -2155,7 +2155,7 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   for(std::vector<Glib::ustring>::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<PrintLayout> print_layout = document->get_print_layout(table_name, *iter);
+    std::shared_ptr<PrintLayout> print_layout = document->get_print_layout(table_name, *iter);
     if(print_layout)
     {
       const Glib::ustring name = print_layout->get_name();
@@ -2307,7 +2307,7 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
   //Reimplement this whole function, just so we can use our custom FileChooserDialog class:
   AppWindow& app = *this;
 
-  std::auto_ptr<Gtk::FileChooserDialog> fileChooser_Save;
+  std::shared_ptr<Gtk::FileChooserDialog> fileChooser_Save;
   Glom::FileChooserDialog_SaveExtras* fileChooser_SaveExtras = 0;
 
   //Create the appropriate dialog, depending on how the caller set m_ui_save_extra_showextras:
@@ -2916,7 +2916,7 @@ Glib::ustring AppWindow::get_current_locale()
     return "C";
 }
 
-Glib::ustring item_get_title(const sharedptr<const TranslatableItem>& item)
+Glib::ustring item_get_title(const std::shared_ptr<const TranslatableItem>& item)
 {
   if(!item)
     return Glib::ustring();
@@ -2924,7 +2924,7 @@ Glib::ustring item_get_title(const sharedptr<const TranslatableItem>& item)
   return item->get_title(AppWindow::get_current_locale());
 }
 
-Glib::ustring item_get_title_or_name(const sharedptr<const TranslatableItem>& item)
+Glib::ustring item_get_title_or_name(const std::shared_ptr<const TranslatableItem>& item)
 {
   if(!item)
     return Glib::ustring();
diff --git a/glom/appwindow.h b/glom/appwindow.h
index 9d21fd3..ea32ad8 100644
--- a/glom/appwindow.h
+++ b/glom/appwindow.h
@@ -296,9 +296,9 @@ private:
   static Glib::ustring m_current_locale, m_original_locale;
 };
 
-Glib::ustring item_get_title(const sharedptr<const TranslatableItem>& item);
+Glib::ustring item_get_title(const std::shared_ptr<const TranslatableItem>& item);
 
-Glib::ustring item_get_title_or_name(const sharedptr<const TranslatableItem>& item);
+Glib::ustring item_get_title_or_name(const std::shared_ptr<const TranslatableItem>& item);
 
 } //namespace Glom
 
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 174ded9..f47439d 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -61,12 +61,12 @@ template<class T_Element>
 class predicate_LayoutItemIsEqual
 {
 public:
-  predicate_LayoutItemIsEqual(const sharedptr<const T_Element>& layout_item)
+  predicate_LayoutItemIsEqual(const std::shared_ptr<const T_Element>& layout_item)
   : m_layout_item(layout_item)
   {
   }
 
-  bool operator() (const sharedptr<const T_Element>& layout_item) const
+  bool operator() (const std::shared_ptr<const T_Element>& layout_item) const
   {
     if(!m_layout_item && !layout_item)
       return true;
@@ -82,7 +82,7 @@ public:
   }
 
 private:
-  sharedptr<const T_Element> m_layout_item;
+  std::shared_ptr<const T_Element> m_layout_item;
 };
 
 
@@ -108,7 +108,7 @@ bool Base_DB::fill_from_database()
 }
 
 //static:
-sharedptr<SharedConnection> Base_DB::connect_to_server(Gtk::Window* parent_window)
+std::shared_ptr<SharedConnection> Base_DB::connect_to_server(Gtk::Window* parent_window)
 {
   BusyCursor busy_cursor(parent_window);
 
@@ -220,9 +220,9 @@ Base_DB::type_vec_strings Base_DB::util_vecStrings_from_Fields(const type_vec_fi
 namespace
 {
   // Check primary key and uniqueness constraints when changing a column
-  sharedptr<Field> check_field_change_constraints(const sharedptr<const Field>& field_old, const 
sharedptr<const Field>& field)
+  std::shared_ptr<Field> check_field_change_constraints(const std::shared_ptr<const Field>& field_old, const 
std::shared_ptr<const Field>& field)
   {
-    sharedptr<Field> result = glom_sharedptr_clone(field);
+    std::shared_ptr<Field> result = glom_sharedptr_clone(field);
     bool primary_key_was_unset = false;
     if(field_old->get_primary_key() != field->get_primary_key())
     {
@@ -256,10 +256,10 @@ namespace
   }
 }
 
-sharedptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const sharedptr<const Field>& 
field_old, const sharedptr<const Field>& field, Gtk::Window* /* parent_window */) const
+std::shared_ptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const std::shared_ptr<const 
Field>& field_old, const std::shared_ptr<const Field>& field, Gtk::Window* /* parent_window */) const
 {
   ConnectionPool* connection_pool = ConnectionPool::get_instance();
-  sharedptr<Field> result = check_field_change_constraints(field_old, field);
+  std::shared_ptr<Field> result = check_field_change_constraints(field_old, field);
 
   try
   {
@@ -270,7 +270,7 @@ sharedptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const s
     handle_error(ex);
 //    Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, 
Gtk::BUTTONS_OK);
 //    window.run();
-    return sharedptr<Field>();
+    return std::shared_ptr<Field>();
   }
 
   return result;
@@ -308,7 +308,7 @@ bool Base_DB::change_columns(const Glib::ustring& table_name, const type_vec_con
 
 Glib::RefPtr<Gnome::Gda::Connection> Base_DB::get_connection()
 {
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
      sharedconnection = connect_to_server();
@@ -331,14 +331,14 @@ Glib::RefPtr<Gnome::Gda::Connection> Base_DB::get_connection()
 
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-sharedptr<LayoutItem_Field> Base_DB::offer_field_list_select_one_field(const Glib::ustring& table_name, 
Gtk::Window* transient_for)
+std::shared_ptr<LayoutItem_Field> Base_DB::offer_field_list_select_one_field(const Glib::ustring& 
table_name, Gtk::Window* transient_for)
 {
-  return offer_field_list_select_one_field(sharedptr<LayoutItem_Field>(), table_name, transient_for);
+  return offer_field_list_select_one_field(std::shared_ptr<LayoutItem_Field>(), table_name, transient_for);
 }
 
-sharedptr<LayoutItem_Field> Base_DB::offer_field_list_select_one_field(const sharedptr<const 
LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for)
+std::shared_ptr<LayoutItem_Field> Base_DB::offer_field_list_select_one_field(const std::shared_ptr<const 
LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for)
 {
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   Dialog_ChooseField* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -394,7 +394,7 @@ Base_DB::type_list_field_items Base_DB::offer_field_list(const Glib::ustring& ta
   return result;
 }
 
-bool Base_DB::offer_non_field_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, 
Gtk::Window* transient_for)
+bool Base_DB::offer_non_field_item_formatting(const std::shared_ptr<LayoutItem_WithFormatting>& layout_item, 
Gtk::Window* transient_for)
 {
   bool result = false;
 
@@ -420,9 +420,9 @@ bool Base_DB::offer_non_field_item_formatting(const sharedptr<LayoutItem_WithFor
   return result;
 }
 
-sharedptr<LayoutItem_Field> Base_DB::offer_field_formatting(const sharedptr<const LayoutItem_Field>& 
start_field, const Glib::ustring& table_name, Gtk::Window* transient_for, bool show_editable_options)
+std::shared_ptr<LayoutItem_Field> Base_DB::offer_field_formatting(const std::shared_ptr<const 
LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for, bool 
show_editable_options)
 {
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   Dialog_FieldLayout* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -451,9 +451,9 @@ sharedptr<LayoutItem_Field> Base_DB::offer_field_formatting(const sharedptr<cons
   return result;
 }
 
-sharedptr<LayoutItem_Text> Base_DB::offer_textobject(const sharedptr<LayoutItem_Text>& start_textobject, 
Gtk::Window* transient_for, bool show_title)
+std::shared_ptr<LayoutItem_Text> Base_DB::offer_textobject(const std::shared_ptr<LayoutItem_Text>& 
start_textobject, Gtk::Window* transient_for, bool show_title)
 {
-  sharedptr<LayoutItem_Text> result = start_textobject;
+  std::shared_ptr<LayoutItem_Text> result = start_textobject;
 
   Dialog_TextObject* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -477,9 +477,9 @@ sharedptr<LayoutItem_Text> Base_DB::offer_textobject(const sharedptr<LayoutItem_
   return result;
 }
 
-sharedptr<LayoutItem_Image> Base_DB::offer_imageobject(const sharedptr<LayoutItem_Image>& start_imageobject, 
Gtk::Window* transient_for, bool show_title)
+std::shared_ptr<LayoutItem_Image> Base_DB::offer_imageobject(const std::shared_ptr<LayoutItem_Image>& 
start_imageobject, Gtk::Window* transient_for, bool show_title)
 {
-  sharedptr<LayoutItem_Image> result = start_imageobject;
+  std::shared_ptr<LayoutItem_Image> result = start_imageobject;
 
   Dialog_ImageObject* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -503,9 +503,9 @@ sharedptr<LayoutItem_Image> Base_DB::offer_imageobject(const sharedptr<LayoutIte
   return result;
 }
 
-sharedptr<LayoutItem_Notebook> Base_DB::offer_notebook(const sharedptr<LayoutItem_Notebook>& start_notebook, 
Gtk::Window* transient_for)
+std::shared_ptr<LayoutItem_Notebook> Base_DB::offer_notebook(const std::shared_ptr<LayoutItem_Notebook>& 
start_notebook, Gtk::Window* transient_for)
 {
-  sharedptr<LayoutItem_Notebook> result = start_notebook;
+  std::shared_ptr<LayoutItem_Notebook> result = start_notebook;
 
   Dialog_Notebook* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -581,7 +581,7 @@ bool Base_DB::get_field_primary_key_index_for_fields(const type_vecLayoutFields&
   return false; //Not found.
 }
 
-sharedptr<Field> Base_DB::get_field_primary_key_for_table(const Glib::ustring& table_name) const
+std::shared_ptr<Field> Base_DB::get_field_primary_key_for_table(const Glib::ustring& table_name) const
 {
   const Document* document = get_document();
   if(document)
@@ -591,7 +591,7 @@ sharedptr<Field> Base_DB::get_field_primary_key_for_table(const Glib::ustring& t
     //std::cout << "debug: " << G_STRFUNC << ": table=" << table_name << ", fields count=" << fields.size() 
<< std::endl;
     for(Document::type_vec_fields::iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       if(!field)
         continue;
 
@@ -602,10 +602,10 @@ sharedptr<Field> Base_DB::get_field_primary_key_for_table(const Glib::ustring& t
     }
   }
 
-  return sharedptr<Field>();
+  return std::shared_ptr<Field>();
 }
 
-void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustring& table_name, const 
Privileges& table_privs, const type_vec_fields& all_db_fields, const sharedptr<LayoutGroup>& group, 
Base_DB::type_vecConstLayoutFields& vecFields) const
+void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustring& table_name, const 
Privileges& table_privs, const type_vec_fields& all_db_fields, const std::shared_ptr<LayoutGroup>& group, 
Base_DB::type_vecConstLayoutFields& vecFields) const
 {
   const Document* document = dynamic_cast<const Document*>(get_document());
 
@@ -614,9 +614,9 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
   LayoutGroup::type_list_items items = group->get_items();
   for(LayoutGroup::type_list_items::iterator iterItems = items.begin(); iterItems != items.end(); 
++iterItems)
   {
-    sharedptr<LayoutItem> item = *iterItems;
+    std::shared_ptr<LayoutItem> item = *iterItems;
 
-    sharedptr<LayoutItem_Field> item_field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_Field> item_field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(item_field)
     {
       //Get the field info:
@@ -625,10 +625,10 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
       if(item_field->get_has_relationship_name()) //If it's a field in a related table.
       {
         //TODO_Performance: get_fields_for_table_one_field() is probably very inefficient
-        sharedptr<Field> field = DbUtils::get_fields_for_table_one_field(document, 
item_field->get_table_used(table_name), item->get_name());
+        std::shared_ptr<Field> field = DbUtils::get_fields_for_table_one_field(document, 
item_field->get_table_used(table_name), item->get_name());
         if(field)
         {
-          sharedptr<LayoutItem_Field> layout_item = item_field;
+          std::shared_ptr<LayoutItem_Field> layout_item = item_field;
           layout_item->set_full_field_details(field); //Fill in the full field information for later.
 
 
@@ -651,7 +651,7 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
         //If the field does not exist anymore then we won't try to show it:
         if(iterFind != all_db_fields.end() )
         {
-          sharedptr<LayoutItem_Field> layout_item = item_field;
+          std::shared_ptr<LayoutItem_Field> layout_item = item_field;
           layout_item->set_full_field_details(*iterFind); //Fill the LayoutItem with the full field 
information.
 
           //std::cout << "debug: " << G_STRFUNC << ": name=" << layout_item->get_name() << std::endl;
@@ -666,10 +666,10 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
     }
     else
     {
-      sharedptr<LayoutGroup> item_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> item_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(item_group)
       {
-        sharedptr<LayoutItem_Portal> item_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(item);
+        std::shared_ptr<LayoutItem_Portal> item_portal = std::dynamic_pointer_cast<LayoutItem_Portal>(item);
         if(!item_portal) //Do not recurse into portals. They are filled by means of a separate SQL query.
         {
           //Recurse:
@@ -708,7 +708,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
       Glib::ustring primary_key_field_name;
       if(bPrimaryKeyFound)
       {
-        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layout_item->set_full_field_details(all_fields[iPrimaryKey]);
 
         //Don't use thousands separators with ID numbers:
@@ -726,11 +726,11 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
       //Add the rest:
       for(type_vec_fields::const_iterator iter = all_fields.begin(); iter != all_fields.end(); ++iter)
       {
-        sharedptr<Field> field_info = *iter;
+        std::shared_ptr<Field> field_info = *iter;
 
         if((*iter)->get_name() != primary_key_field_name) //We already added the primary key.
         {
-          sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item->set_full_field_details(field_info);
 
           layout_item->set_editable(true); //A sensible default.
@@ -750,7 +750,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
       //We will show the fields that the document says we should:
       for(Document::type_list_layout_groups::const_iterator iter = mapGroupSequence.begin(); iter != 
mapGroupSequence.end(); ++iter)
       {
-        sharedptr<LayoutGroup> group = *iter;
+        std::shared_ptr<LayoutGroup> group = *iter;
 
         if(true) //!group->get_hidden())
         {
@@ -769,13 +769,13 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
   return result;
 }
 
-void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, const sharedptr<const Field>& 
field)
+void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, const std::shared_ptr<const 
Field>& field)
 {
-  sharedptr<const Field> primary_key = get_field_primary_key_for_table(table_name);
+  std::shared_ptr<const Field> primary_key = get_field_primary_key_for_table(table_name);
   calculate_field_in_all_records(table_name, field, primary_key);
 }
 
-void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, const sharedptr<const Field>& 
field, const sharedptr<const Field>& primary_key)
+void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, const std::shared_ptr<const 
Field>& field, const std::shared_ptr<const Field>& primary_key)
 {
 
   //Get primary key values for every record:
@@ -793,7 +793,7 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
   LayoutFieldInRecord field_in_record;
   field_in_record.m_table_name = table_name;
 
-  sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layoutitem_field = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
   layoutitem_field->set_full_field_details(field);
   field_in_record.m_field = layoutitem_field;
   field_in_record.m_key = primary_key;
@@ -851,7 +851,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
 
     refCalcProgress.m_calc_in_progress = true; //Let the recursive calls to calculate_field() check this.
 
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_full_field_details(refCalcProgress.m_field);
 
     //Calculate dependencies first:
@@ -859,7 +859,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
     const type_list_const_field_items fields_needed = get_calculation_fields(field_in_record.m_table_name, 
field_in_record.m_field);
     for(type_list_const_field_items::const_iterator iterNeeded = fields_needed.begin(); iterNeeded != 
fields_needed.end(); ++iterNeeded)
     {
-      sharedptr<const LayoutItem_Field> field_item_needed = *iterNeeded;
+      std::shared_ptr<const LayoutItem_Field> field_item_needed = *iterNeeded;
 
       if(field_item_needed->get_has_relationship_name())
       {
@@ -867,7 +867,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
       }
       else
       {
-        sharedptr<const Field> field_needed = field_item_needed->get_full_field_details();
+        std::shared_ptr<const Field> field_needed = field_item_needed->get_full_field_details();
         if(field_needed)
         {
           if(field_needed->get_has_calculation())
@@ -903,11 +903,11 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
       const type_map_fields field_values = 
get_record_field_values_for_calculation(field_in_record.m_table_name, field_in_record.m_key, 
field_in_record.m_key_value);
       if(!field_values.empty())
       {
-        sharedptr<const Field> field = refCalcProgress.m_field;
+        std::shared_ptr<const Field> field = refCalcProgress.m_field;
         if(field)
         {
           //We need the connection when we run the script, so that the script may use it.
-          sharedptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
+          std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
 
           g_assert(sharedconnection);
 
@@ -925,7 +925,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
           refCalcProgress.m_calc_finished = true;
           refCalcProgress.m_calc_in_progress = false;
 
-          sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item->set_full_field_details(field);
 
           //show it:
@@ -948,7 +948,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
 
 }
 
-Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const Glib::ustring& table_name, 
const sharedptr<const Field> primary_key, const Gnome::Gda::Value& primary_key_value)
+Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const Glib::ustring& table_name, 
const std::shared_ptr<const Field> primary_key, const Gnome::Gda::Value& primary_key_value)
 {
   type_map_fields field_values;
 
@@ -962,7 +962,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
     type_vecLayoutFields fieldsToGet;
     for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layout_item->set_full_field_details(*iter);
 
       fieldsToGet.push_back(layout_item);
@@ -970,7 +970,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
 
     if(!Conversions::value_is_empty(primary_key_value))
     {
-      //sharedptr<const Field> fieldPrimaryKey = get_field_primary_key();
+      //std::shared_ptr<const Field> fieldPrimaryKey = get_field_primary_key();
 
       Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(table_name, fieldsToGet, 
primary_key, primary_key_value);
 
@@ -991,7 +991,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
         for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
         {
           //There should be only 1 row. Well, there could be more but we will ignore them.
-          sharedptr<const Field> field = *iter;
+          std::shared_ptr<const Field> field = *iter;
           Gnome::Gda::Value value = data_model->get_value_at(col_index, 0);
           //Never give a NULL-type value to the python calculation for types that don't use them:
           //to prevent errors:
@@ -1015,7 +1015,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
       //Create appropriate empty values:
       for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
       {
-        sharedptr<const Field> field = *iter;
+        std::shared_ptr<const Field> field = *iter;
         field_values[field->get_name()] = Conversions::get_empty_value(field->get_glom_type());
       }
     }
@@ -1024,13 +1024,13 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
   return field_values;
 }
 
-void Base_DB::set_entered_field_data(const sharedptr<const LayoutItem_Field>& /* field */, const 
Gnome::Gda::Value& /* value */)
+void Base_DB::set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& /* field */, const 
Gnome::Gda::Value& /* value */)
 {
   //Override this.
 }
 
 
-void Base_DB::set_entered_field_data(const Gtk::TreeModel::iterator& /* row */, const sharedptr<const 
LayoutItem_Field>& /* field */, const Gnome::Gda::Value& /* value */)
+void Base_DB::set_entered_field_data(const Gtk::TreeModel::iterator& /* row */, const std::shared_ptr<const 
LayoutItem_Field>& /* field */, const Gnome::Gda::Value& /* value */)
 {
   //Override this.
 }
@@ -1141,7 +1141,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
   
 
   type_vecConstLayoutFields list_fields;
-  sharedptr<const LayoutItem_Field> layout_item = field_in_record.m_field;
+  std::shared_ptr<const LayoutItem_Field> layout_item = field_in_record.m_field;
   list_fields.push_back(layout_item);
   Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = 
Utils::build_sql_select_with_key(field_in_record.m_table_name,
     list_fields, field_in_record.m_key, field_in_record.m_key_value, type_sort_clause(), 1);
@@ -1162,7 +1162,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
   return result;
 }
 
-Gnome::Gda::Value Base_DB::get_field_value_in_database(const sharedptr<Field>& field, const FoundSet& 
found_set, Gtk::Window* /* parent_window */)
+Gnome::Gda::Value Base_DB::get_field_value_in_database(const std::shared_ptr<Field>& field, const FoundSet& 
found_set, Gtk::Window* /* parent_window */)
 {
   Gnome::Gda::Value result;  //TODO: Return suitable empty value for the field when failing?
 
@@ -1180,13 +1180,13 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const sharedptr<Field>& f
   }
 
   type_vecConstLayoutFields list_fields;
-  sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
   layout_item->set_full_field_details(field);
   list_fields.push_back(layout_item);
   Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = 
Utils::build_sql_select_with_where_clause(found_set.m_table_name,
     list_fields,
     found_set.m_where_clause,
-    sharedptr<const Relationship>() /* extra_join */, type_sort_clause(),
+    std::shared_ptr<const Relationship>() /* extra_join */, type_sort_clause(),
     1 /* limit */);
 
   Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(sql_query);
@@ -1222,7 +1222,7 @@ void Base_DB::do_calculations(const LayoutFieldInRecord& field_changed, bool fir
   //std::cout << "  debug: calculated_field.size()=" << calculated_fields.size() << std::endl;
   for(type_list_const_field_items::const_iterator iter = calculated_fields.begin(); iter != 
calculated_fields.end(); ++iter)
   {
-    sharedptr<const LayoutItem_Field> field = *iter;
+    std::shared_ptr<const LayoutItem_Field> field = *iter;
     if(field)
     {
       //std::cout << "debug: recalcing field: " << field->get_name() << std::endl;
@@ -1239,7 +1239,7 @@ void Base_DB::do_calculations(const LayoutFieldInRecord& field_changed, bool fir
     m_FieldsCalculationInProgress.clear();
 }
 
-Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& field)
+Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& field)
 {
   //std::cout << "debug: Base_DB::get_calculated_fields field=" << field->get_name() << std::endl;
 
@@ -1256,8 +1256,8 @@ Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::
     //TODO: How do we trigger relcalculation of related fields if necessary?
     for(type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end();  ++iter)
     {
-      sharedptr<Field> field_to_examine = *iter;
-      sharedptr<LayoutItem_Field> layoutitem_field_to_examine = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<Field> field_to_examine = *iter;
+      std::shared_ptr<LayoutItem_Field> layoutitem_field_to_examine = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layoutitem_field_to_examine->set_full_field_details(field_to_examine);
 
       //std::cout << "  debug: examining field=" << field_to_examine->get_name() << std::endl;
@@ -1280,7 +1280,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::
   return result;
 }
 
-Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& layoutitem_field)
+Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& layoutitem_field)
 {
   //TODO: Use regex, for instance with pcre here?
   //TODO: Better?: Run the calculation on some example data, and record the touched fields? But this could 
not exercise every code path.
@@ -1288,7 +1288,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
 
   type_list_const_field_items result;
 
-  sharedptr<const Field> field = layoutitem_field->get_full_field_details();
+  std::shared_ptr<const Field> field = layoutitem_field->get_full_field_details();
   if(!field)
     return result;
 
@@ -1316,10 +1316,10 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
         Glib::ustring::size_type pos_start = pos_find + prefix_size;
         const Glib::ustring field_name = calculation.substr(pos_start, pos_find_end - pos_start);
 
-        sharedptr<Field> field_found = document->get_field(table_name, field_name);
+        std::shared_ptr<Field> field_found = document->get_field(table_name, field_name);
         if(field)
         {
-          sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item->set_full_field_details(field_found);
 
           result.push_back(layout_item);
@@ -1336,15 +1336,15 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
   const Field::type_list_strings relationships_used = field->get_calculation_relationships();
   for(Field::type_list_strings::const_iterator iter = relationships_used.begin(); iter != 
relationships_used.end(); ++iter)
   {
-    sharedptr<Relationship> relationship = document->get_relationship(table_name, *iter);
+    std::shared_ptr<Relationship> relationship = document->get_relationship(table_name, *iter);
     if(relationship)
     {
       //If the field uses this relationship then it should be triggered by a change in the key that 
specifies which record the relationship points to:
       const Glib::ustring field_from_name = relationship->get_from_field();
-      sharedptr<Field> field_from = document->get_field(table_name, field_from_name);
+      std::shared_ptr<Field> field_from = document->get_field(table_name, field_from_name);
       if(field_from)
       {
-        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layout_item->set_full_field_details(field_from);
 
         result.push_back(layout_item);
@@ -1369,15 +1369,15 @@ void Base_DB::do_lookups(const LayoutFieldInRecord& field_in_record, const Gtk::
    //std::cout << "debug: " << G_STRFUNC << ": lookups size=" << lookups.size() << std::endl;
    for(Document::type_list_lookups::const_iterator iter = lookups.begin(); iter != lookups.end(); ++iter)
    {
-     sharedptr<const LayoutItem_Field> layout_item = iter->first;
+     std::shared_ptr<const LayoutItem_Field> layout_item = iter->first;
 
      //std::cout << "debug: " << G_STRFUNC << ": item=" << layout_item->get_name() << std::endl;
 
-     sharedptr<const Relationship> relationship = iter->second;
-     const sharedptr<const Field> field_lookup = layout_item->get_full_field_details();
+     std::shared_ptr<const Relationship> relationship = iter->second;
+     const std::shared_ptr<const Field> field_lookup = layout_item->get_full_field_details();
      if(field_lookup)
      {
-      sharedptr<const Field> field_source = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), field_lookup->get_lookup_field());
+      std::shared_ptr<const Field> field_source = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), field_lookup->get_lookup_field());
       if(field_source)
       {
         const Gnome::Gda::Value value = DbUtils::get_lookup_value(document, field_in_record.m_table_name, 
iter->second /* relationship */,  field_source /* the field to look in to get the value */, field_value /* 
Value of to and from fields */);
@@ -1404,7 +1404,7 @@ void Base_DB::refresh_related_fields(const LayoutFieldInRecord& /* field_in_reco
   //overridden in Box_Data.
 }
 
-bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   bool result = true;  //Arbitrarily default to saying it's unique if we can't get any result.
 
@@ -1435,15 +1435,15 @@ bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const s
   return result;
 }
 
-bool Base_DB::check_entered_value_for_uniqueness(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& field_value, Gtk::Window* parent_window)
+bool Base_DB::check_entered_value_for_uniqueness(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& layout_field, const Gnome::Gda::Value& field_value, Gtk::Window* 
parent_window)
 {
   return check_entered_value_for_uniqueness(table_name, Gtk::TreeModel::iterator(), layout_field, 
field_value, parent_window);
 }
 
-bool Base_DB::check_entered_value_for_uniqueness(const Glib::ustring& table_name, const 
Gtk::TreeModel::iterator& /* row */,  const sharedptr<const LayoutItem_Field>& layout_field, const 
Gnome::Gda::Value& field_value, Gtk::Window* parent_window)
+bool Base_DB::check_entered_value_for_uniqueness(const Glib::ustring& table_name, const 
Gtk::TreeModel::iterator& /* row */,  const std::shared_ptr<const LayoutItem_Field>& layout_field, const 
Gnome::Gda::Value& field_value, Gtk::Window* parent_window)
 {
   //Check whether the value meets uniqueness constraints, if any:
-  const sharedptr<const Field>& field = layout_field->get_full_field_details();
+  const std::shared_ptr<const Field>& field = layout_field->get_full_field_details();
   if(field && (field->get_primary_key() || field->get_unique_key()))
   {
     if(!get_field_value_is_unique(table_name, layout_field, field_value))
@@ -1468,7 +1468,7 @@ bool Base_DB::get_relationship_exists(const Glib::ustring& table_name, const Gli
   Document* document = get_document();
   if(document)
   {
-    sharedptr<Relationship> relationship = document->get_relationship(table_name, relationship_name);
+    std::shared_ptr<Relationship> relationship = document->get_relationship(table_name, relationship_name);
     if(relationship)
       return true;
   }
@@ -1479,7 +1479,7 @@ bool Base_DB::get_relationship_exists(const Glib::ustring& table_name, const Gli
 bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gnome::Gda::Value& 
primary_key_value)
 {
   //TODO_Performance: This is probably called too often, when we should know that the key is in the found 
set.
-  sharedptr<const Field> primary_key = get_field_primary_key_for_table(found_set.m_table_name);
+  std::shared_ptr<const Field> primary_key = get_field_primary_key_for_table(found_set.m_table_name);
   if(!primary_key)
   {
     std::cerr << G_STRFUNC << ": No primary key found for table: " << found_set.m_table_name << std::endl;
@@ -1488,7 +1488,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
 
   type_vecLayoutFields fieldsToGet;
 
-  sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
   layout_item->set_full_field_details(primary_key);
   fieldsToGet.push_back(layout_item);
 
@@ -1527,11 +1527,11 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
     return false;
 }
 
-void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const sharedptr<LayoutItem_Portal>& 
portal, const Gnome::Gda::Value& foreign_key_value)
+void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const 
std::shared_ptr<LayoutItem_Portal>& portal, const Gnome::Gda::Value& foreign_key_value)
 {
   found_set.m_table_name = Glib::ustring();
   found_set.m_where_clause = Gnome::Gda::SqlExpr();
-  found_set.m_extra_join = sharedptr<const Relationship>();
+  found_set.m_extra_join = std::shared_ptr<const Relationship>();
 
   if( !portal
       || Conversions::value_is_empty(foreign_key_value) )
@@ -1540,7 +1540,7 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
   }
 
 
-  sharedptr<const Relationship> relationship = portal->get_relationship();
+  std::shared_ptr<const Relationship> relationship = portal->get_relationship();
 
   // Notice that, in the case that this is a portal to doubly-related records,
   // The WHERE clause mentions the first-related table (though by the alias defined in extra_join)
@@ -1549,15 +1549,15 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
   Document* document = get_document();
 
   Glib::ustring where_clause_to_table_name = relationship->get_to_table();
-  sharedptr<Field> where_clause_to_key_field = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), relationship->get_to_field());
+  std::shared_ptr<Field> where_clause_to_key_field = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), relationship->get_to_field());
 
   found_set.m_table_name = portal->get_table_used(Glib::ustring() /* parent table - not relevant */);
 
-  sharedptr<const Relationship> relationship_related = portal->get_related_relationship();
+  std::shared_ptr<const Relationship> relationship_related = portal->get_related_relationship();
   if(relationship_related)
   {
     //Add the extra JOIN:
-    sharedptr<UsesRelationship> uses_rel_temp = sharedptr<UsesRelationship>::create();
+    std::shared_ptr<UsesRelationship> uses_rel_temp = std::shared_ptr<UsesRelationship>(new 
UsesRelationship());
     uses_rel_temp->set_relationship(relationship);
     found_set.m_extra_join = relationship;
 
diff --git a/glom/base_db.h b/glom/base_db.h
index 177c8c0..295dbbf 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -64,15 +64,15 @@ public:
   virtual AppState::userlevels get_userlevel() const;
   virtual void set_userlevel(AppState::userlevels value);
 
-  static sharedptr<SharedConnection> connect_to_server(Gtk::Window* parent_window = 0);
+  static std::shared_ptr<SharedConnection> connect_to_server(Gtk::Window* parent_window = 0);
 
   virtual void set_document(Document* pDocument); //View override
   virtual void load_from_document(); //View override
 
-  sharedptr<Field> change_column(const Glib::ustring& table_name, const sharedptr<const Field>& field_old, 
const sharedptr<const Field>& field, Gtk::Window* parent_window) const;
+  std::shared_ptr<Field> change_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& 
field_old, const std::shared_ptr<const Field>& field, Gtk::Window* parent_window) const;
 
-  typedef std::vector< sharedptr<Field> > type_vec_fields;
-  typedef std::vector< sharedptr<const Field> > type_vec_const_fields;
+  typedef std::vector< std::shared_ptr<Field> > type_vec_fields;
+  typedef std::vector< std::shared_ptr<const Field> > type_vec_const_fields;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   bool change_columns(const Glib::ustring& table_name, const type_vec_const_fields& old_fields, 
type_vec_fields& fields, Gtk::Window* parent_window) const;
@@ -82,23 +82,23 @@ public:
   /// Get the active layout platform for the document, or get a suitable default.
   static Glib::ustring get_active_layout_platform(Document* document);
 
-  typedef std::vector< sharedptr<LayoutItem_Field> > type_vecLayoutFields;
-  typedef std::vector< sharedptr<const LayoutItem_Field> > type_vecConstLayoutFields;
+  typedef std::vector< std::shared_ptr<LayoutItem_Field> > type_vecLayoutFields;
+  typedef std::vector< std::shared_ptr<const LayoutItem_Field> > type_vecConstLayoutFields;
 
 protected:
 
-  typedef std::list< sharedptr<LayoutItem_Field> > type_list_field_items;
-  typedef std::list< sharedptr<const LayoutItem_Field> > type_list_const_field_items;
+  typedef std::list< std::shared_ptr<LayoutItem_Field> > type_list_field_items;
+  typedef std::list< std::shared_ptr<const LayoutItem_Field> > type_list_const_field_items;
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   /** Allow the user to select a field from the list of fields for the table.
    */
-  sharedptr<LayoutItem_Field> offer_field_list_select_one_field(const Glib::ustring& table_name, 
Gtk::Window* transient_for = 0);
+  std::shared_ptr<LayoutItem_Field> offer_field_list_select_one_field(const Glib::ustring& table_name, 
Gtk::Window* transient_for = 0);
 
   /** Allow the user to select a field from the list of fields for the table,
    * with @a start_field selected by default.
    */
-  sharedptr<LayoutItem_Field> offer_field_list_select_one_field(const sharedptr<const LayoutItem_Field>& 
start_field, const Glib::ustring& table_name, Gtk::Window* transient_for = 0);
+  std::shared_ptr<LayoutItem_Field> offer_field_list_select_one_field(const std::shared_ptr<const 
LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for = 0);
 
 
   /** Allow the user to select fields from the list of fields for the table.
@@ -106,25 +106,25 @@ protected:
   type_list_field_items offer_field_list(const Glib::ustring& table_name, Gtk::Window* transient_for = 0);
 
 
-  sharedptr<LayoutItem_Field> offer_field_formatting(const sharedptr<const LayoutItem_Field>& start_field, 
const Glib::ustring& table_name, Gtk::Window* transient_for, bool show_editable_options = true);
+  std::shared_ptr<LayoutItem_Field> offer_field_formatting(const std::shared_ptr<const LayoutItem_Field>& 
start_field, const Glib::ustring& table_name, Gtk::Window* transient_for, bool show_editable_options = true);
 
   /** Offer generic formatting for a @a layout_item, starting with its current options.
    * @result true if the user changed some formatting for the items.
    */
-  bool offer_non_field_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, Gtk::Window* 
transient_for = 0);
+  bool offer_non_field_item_formatting(const std::shared_ptr<LayoutItem_WithFormatting>& layout_item, 
Gtk::Window* transient_for = 0);
 
-  sharedptr<LayoutItem_Text> offer_textobject(const sharedptr<LayoutItem_Text>& start_textobject, 
Gtk::Window* transient_for = 0, bool show_title = true);
-  sharedptr<LayoutItem_Image> offer_imageobject(const sharedptr<LayoutItem_Image>& start_imageobject, 
Gtk::Window* transient_for = 0, bool show_title = true);
-  sharedptr<LayoutItem_Notebook> offer_notebook(const sharedptr<LayoutItem_Notebook>& start_notebook, 
Gtk::Window* transient_for = 0);
+  std::shared_ptr<LayoutItem_Text> offer_textobject(const std::shared_ptr<LayoutItem_Text>& 
start_textobject, Gtk::Window* transient_for = 0, bool show_title = true);
+  std::shared_ptr<LayoutItem_Image> offer_imageobject(const std::shared_ptr<LayoutItem_Image>& 
start_imageobject, Gtk::Window* transient_for = 0, bool show_title = true);
+  std::shared_ptr<LayoutItem_Notebook> offer_notebook(const std::shared_ptr<LayoutItem_Notebook>& 
start_notebook, Gtk::Window* transient_for = 0);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   bool get_relationship_exists(const Glib::ustring& table_name, const Glib::ustring& relationship_name);
 
-  sharedptr<Field> get_field_primary_key_for_table(const Glib::ustring& table_name) const;
+  std::shared_ptr<Field> get_field_primary_key_for_table(const Glib::ustring& table_name) const;
 
   //Methods to be overridden by derived classes:
-  virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value&  value);
-  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  virtual void set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value&  value);
+  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
 
 
   class FieldInRecord
@@ -133,12 +133,12 @@ protected:
     FieldInRecord()
     {}
 
-    FieldInRecord(const Glib::ustring& table_name, const sharedptr<const Field>& field, const 
sharedptr<const Field>& key, const Gnome::Gda::Value& key_value)
+    FieldInRecord(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field, const 
std::shared_ptr<const Field>& key, const Gnome::Gda::Value& key_value)
     : m_table_name(table_name), m_field(field), m_key(key), m_key_value(key_value)
     {
     }
 
-    FieldInRecord(const sharedptr<const LayoutItem_Field>& layout_item, const Glib::ustring& 
parent_table_name, const sharedptr<const Field>& parent_key, const Gnome::Gda::Value& key_value, const 
Document& document)
+    FieldInRecord(const std::shared_ptr<const LayoutItem_Field>& layout_item, const Glib::ustring& 
parent_table_name, const std::shared_ptr<const Field>& parent_key, const Gnome::Gda::Value& key_value, const 
Document& document)
     : m_key_value(key_value)
     {
       m_field = layout_item->get_full_field_details();
@@ -148,12 +148,12 @@ protected:
       if(layout_item->get_has_relationship_name())
       {
         //The field is in a related table.
-        sharedptr<const Relationship> rel = layout_item->get_relationship();
+        std::shared_ptr<const Relationship> rel = layout_item->get_relationship();
         if(rel)
         {
           if(layout_item->get_has_related_relationship_name()) //For doubly-related fields
           {
-            sharedptr<const Relationship> rel = layout_item->get_related_relationship();
+            std::shared_ptr<const Relationship> rel = layout_item->get_related_relationship();
             if(rel)
             {
               //Actually a foreign key in a doubly-related table:
@@ -175,10 +175,10 @@ protected:
 
     //Identify the field:
     Glib::ustring m_table_name;
-    sharedptr<const Field> m_field;
+    std::shared_ptr<const Field> m_field;
 
     //Identify the record:
-    sharedptr<const Field> m_key;
+    std::shared_ptr<const Field> m_key;
     Gnome::Gda::Value m_key_value;
   };
 
@@ -189,7 +189,7 @@ protected:
     LayoutFieldInRecord()
     {}
 
-    LayoutFieldInRecord(const sharedptr<const LayoutItem_Field>& layout_item, const Glib::ustring& 
parent_table_name, const sharedptr<const Field>& parent_key, const Gnome::Gda::Value& key_value)
+    LayoutFieldInRecord(const std::shared_ptr<const LayoutItem_Field>& layout_item, const Glib::ustring& 
parent_table_name, const std::shared_ptr<const Field>& parent_key, const Gnome::Gda::Value& key_value)
     : m_key_value(key_value)
     {
       m_field = layout_item;
@@ -204,10 +204,10 @@ protected:
 
     //Identify the field:
     Glib::ustring m_table_name;
-    sharedptr<const LayoutItem_Field> m_field;
+    std::shared_ptr<const LayoutItem_Field> m_field;
 
     //Identify the record:
-    sharedptr<const Field> m_key;
+    std::shared_ptr<const Field> m_key;
     Gnome::Gda::Value m_key_value;
   };
 
@@ -224,20 +224,20 @@ protected:
 
   /** Get the fields whose values should be recalculated when @a field_name changes.
    */
-  type_list_const_field_items get_calculated_fields(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& field);
+  type_list_const_field_items get_calculated_fields(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& field);
 
   /** Get the fields used, if any, in the calculation of this field.
    */
-  type_list_const_field_items get_calculation_fields(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& field);
+  type_list_const_field_items get_calculation_fields(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& field);
 
   void calculate_field(const LayoutFieldInRecord& field_in_record);
 
-  void calculate_field_in_all_records(const Glib::ustring& table_name, const sharedptr<const Field>& field);
-  void calculate_field_in_all_records(const Glib::ustring& table_name, const sharedptr<const Field>& field, 
const sharedptr<const Field>& primary_key);
+  void calculate_field_in_all_records(const Glib::ustring& table_name, const std::shared_ptr<const Field>& 
field);
+  void calculate_field_in_all_records(const Glib::ustring& table_name, const std::shared_ptr<const Field>& 
field, const std::shared_ptr<const Field>& primary_key);
 
   typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_fields;
   //TODO: Performance: This is massively inefficient:
-  type_map_fields get_record_field_values_for_calculation(const Glib::ustring& table_name, const 
sharedptr<const Field> primary_key, const Gnome::Gda::Value& primary_key_value);
+  type_map_fields get_record_field_values_for_calculation(const Glib::ustring& table_name, const 
std::shared_ptr<const Field> primary_key, const Gnome::Gda::Value& primary_key_value);
 
 
   void do_lookups(const LayoutFieldInRecord& field_in_record, const Gtk::TreeModel::iterator& row, const 
Gnome::Gda::Value& field_value);
@@ -254,12 +254,12 @@ protected:
   Gnome::Gda::Value get_field_value_in_database(const LayoutFieldInRecord& field_in_record, Gtk::Window* 
parent_window);
 
   ///Get a single field value from the database.
-  Gnome::Gda::Value get_field_value_in_database(const sharedptr<Field>& field, const FoundSet& found_set, 
Gtk::Window* parent_window);
+  Gnome::Gda::Value get_field_value_in_database(const std::shared_ptr<Field>& field, const FoundSet& 
found_set, Gtk::Window* parent_window);
 
-  bool get_field_value_is_unique(const Glib::ustring& table_name, const sharedptr<const LayoutItem_Field>& 
field, const Gnome::Gda::Value& value);
+  bool get_field_value_is_unique(const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
 
-  bool check_entered_value_for_uniqueness(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value, Gtk::Window* parent_window);
-  bool check_entered_value_for_uniqueness(const Glib::ustring& table_name, const Gtk::TreeModel::iterator& 
/* row */,  const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value, Gtk::Window* 
parent_window);
+  bool check_entered_value_for_uniqueness(const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value, Gtk::Window* parent_window);
+  bool check_entered_value_for_uniqueness(const Glib::ustring& table_name, const Gtk::TreeModel::iterator& 
/* row */,  const std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value, 
Gtk::Window* parent_window);
 
   //TODO: Make this private?
   /** Fill the UI with information (data or structure, depending on the widget).
@@ -270,7 +270,7 @@ protected:
   virtual void on_userlevel_changed(AppState::userlevels userlevel);
 
   type_vecConstLayoutFields get_table_fields_to_show_for_sequence(const Glib::ustring& table_name, const 
Document::type_list_layout_groups& mapGroupSequence) const;
-  void get_table_fields_to_show_for_sequence_add_group(const Glib::ustring& table_name, const Privileges& 
table_privs, const type_vec_fields& all_db_fields, const sharedptr<LayoutGroup>& group, 
type_vecConstLayoutFields& vecFields) const;
+  void get_table_fields_to_show_for_sequence_add_group(const Glib::ustring& table_name, const Privileges& 
table_privs, const type_vec_fields& all_db_fields, const std::shared_ptr<LayoutGroup>& group, 
type_vecConstLayoutFields& vecFields) const;
 
   bool get_primary_key_is_in_foundset(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value);
 
@@ -281,7 +281,7 @@ protected:
    * @param portal The related records portal whose records should be selected by the SQL query.
    * @param foreign_key_value The value of the from field in the parent table.
    */
-  void set_found_set_where_clause_for_portal(FoundSet& found_set, const sharedptr<LayoutItem_Portal>& 
portal, const Gnome::Gda::Value& foreign_key_value);
+  void set_found_set_where_clause_for_portal(FoundSet& found_set, const std::shared_ptr<LayoutItem_Portal>& 
portal, const Gnome::Gda::Value& foreign_key_value);
 
   static Glib::RefPtr<Gnome::Gda::Connection> get_connection();
 
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index 568a77d..a2a11e8 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -41,15 +41,15 @@ Base_DB_Table_Data::~Base_DB_Table_Data()
 {
 }
 
-Gnome::Gda::Value Base_DB_Table_Data::get_entered_field_data_field_only(const sharedptr<const Field>& field) 
const
+Gnome::Gda::Value Base_DB_Table_Data::get_entered_field_data_field_only(const std::shared_ptr<const Field>& 
field) const
 {
-  sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
   layout_item->set_full_field_details(field);
 
   return get_entered_field_data(layout_item);
 }
 
-Gnome::Gda::Value Base_DB_Table_Data::get_entered_field_data(const sharedptr<const LayoutItem_Field>& /* 
field */) const
+Gnome::Gda::Value Base_DB_Table_Data::get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& 
/* field */) const
 {
   //Override this to use Field::set_data() too.
 
@@ -71,7 +71,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
 
   Document* document = get_document();
 
-  sharedptr<const Field> fieldPrimaryKey = get_field_primary_key();
+  std::shared_ptr<const Field> fieldPrimaryKey = get_field_primary_key();
 
   const Glib::ustring primary_key_name = fieldPrimaryKey->get_name();
 
@@ -87,7 +87,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
     type_vecConstLayoutFields::const_iterator iterFind = std::find_if(fieldsToAdd.begin(), 
fieldsToAdd.end(), predicate_FieldHasName<LayoutItem_Field>((*iter)->get_name()));
     if(iterFind == fieldsToAdd.end())
     {
-      sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layout_item->set_full_field_details(*iter);
 
       fieldsToAdd.push_back(layout_item);
@@ -105,7 +105,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
 
   for(type_vecConstLayoutFields::const_iterator iter = fieldsToAdd.begin(); iter != fieldsToAdd.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> layout_item = *iter;
+    std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
     const Glib::ustring field_name = layout_item->get_name();
     if(!layout_item->get_has_relationship_name()) //TODO: Allow people to add a related record also by 
entering new data in a related field of the related record.
     {
@@ -114,7 +114,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
       {
         Gnome::Gda::Value value;
 
-        const sharedptr<const Field>& field = layout_item->get_full_field_details();
+        const std::shared_ptr<const Field>& field = layout_item->get_full_field_details();
         if(!field)
           continue;
         
@@ -139,7 +139,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
 
             //We need the connection when we run the script, so that the script may use it.
             // TODO: Is this function supposed to throw an exception?
-            sharedptr<SharedConnection> sharedconnection = connect_to_server(AppWindow::get_appwindow());
+            std::shared_ptr<SharedConnection> sharedconnection = 
connect_to_server(AppWindow::get_appwindow());
 
             Glib::ustring error_message; //TODO: Check this.
             value =
@@ -207,7 +207,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
       //Update any lookups, related fields, or calculations:
       for(type_vecConstLayoutFields::const_iterator iter = fieldsToAdd.begin(); iter != fieldsToAdd.end(); 
++iter)
       {
-        sharedptr<const LayoutItem_Field> layout_item = *iter;
+        std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
 
         //TODO_Performance: We just set this with set_entered_field_data() above. Maybe we could just 
remember it.
         const Gnome::Gda::Value field_value = get_entered_field_data(layout_item);
@@ -232,9 +232,9 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
   return false; //Failed.
 }
 
-bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const LayoutItem_Field>& 
layout_item_parent,
-  const sharedptr<const Relationship>& relationship,
-  const sharedptr<const Field>& primary_key_field,
+bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<const LayoutItem_Field>& 
layout_item_parent,
+  const std::shared_ptr<const Relationship>& relationship,
+  const std::shared_ptr<const Field>& primary_key_field,
   const Gnome::Gda::Value& primary_key_value_provided,
   Gnome::Gda::Value& primary_key_value_used)
 {
@@ -312,7 +312,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
       if(key_is_auto_increment)
       {
         //Set the key in the parent table
-        sharedptr<LayoutItem_Field> item_from_key = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> item_from_key = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         item_from_key->set_name(relationship->get_from_field());
 
         //Show the new from key in the parent table's layout:
@@ -320,7 +320,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
 
         //Set it in the database too:
         Document* document = get_document();
-        sharedptr<Field> field_from_key = DbUtils::get_fields_for_table_one_field(document,
+        std::shared_ptr<Field> field_from_key = DbUtils::get_fields_for_table_one_field(document,
           relationship->get_from_table(), relationship->get_from_field()); //TODO_Performance.
         if(!field_from_key)
         {
@@ -328,7 +328,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
           return false;
         }
 
-        sharedptr<Field> parent_primary_key_field = get_field_primary_key();
+        std::shared_ptr<Field> parent_primary_key_field = get_field_primary_key();
         if(!parent_primary_key_field)
         {
           std::cerr << G_STRFUNC << ": get_field_primary_key() failed. table = " << get_table_name() << 
std::endl;
@@ -400,7 +400,7 @@ bool Base_DB_Table_Data::confirm_delete_record()
 
 bool Base_DB_Table_Data::record_delete(const Gnome::Gda::Value& primary_key_value)
 {
-  sharedptr<Field> field_primary_key = get_field_primary_key();
+  std::shared_ptr<Field> field_primary_key = get_field_primary_key();
   if(field_primary_key && !Conversions::value_is_empty(primary_key_value))
   {
     Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
@@ -424,7 +424,7 @@ Base_DB_Table_Data::type_signal_record_changed Base_DB_Table_Data::signal_record
 }
 
 
-bool Base_DB_Table_Data::get_related_record_exists(const sharedptr<const Relationship>& relationship, const 
Gnome::Gda::Value& key_value)
+bool Base_DB_Table_Data::get_related_record_exists(const std::shared_ptr<const Relationship>& relationship, 
const Gnome::Gda::Value& key_value)
 {
   BusyCursor cursor(AppWindow::get_appwindow());
 
@@ -465,7 +465,7 @@ bool Base_DB_Table_Data::get_related_record_exists(const sharedptr<const Relatio
 
 /** Get the shown fields that are in related tables, via a relationship using @a field_name changes.
  */
-Base_DB_Table_Data::type_vecConstLayoutFields Base_DB_Table_Data::get_related_fields(const sharedptr<const 
LayoutItem_Field>& field) const
+Base_DB_Table_Data::type_vecConstLayoutFields Base_DB_Table_Data::get_related_fields(const 
std::shared_ptr<const LayoutItem_Field>& field) const
 {
   type_vecConstLayoutFields result;
 
@@ -475,12 +475,12 @@ Base_DB_Table_Data::type_vecConstLayoutFields Base_DB_Table_Data::get_related_fi
     const Glib::ustring field_name = field->get_name(); //At the moment, relationships can not be based on 
related fields on the from side.
     for(type_vecConstLayoutFields::const_iterator iter = m_FieldsShown.begin(); iter != m_FieldsShown.end(); 
 ++iter)
     {
-      const sharedptr<const LayoutItem_Field> layout_field = *iter;
+      const std::shared_ptr<const LayoutItem_Field> layout_field = *iter;
       //Examine each field that looks up its data from a relationship:
       if(layout_field->get_has_relationship_name())
       {
         //Get the relationship information:
-        sharedptr<const Relationship> relationship = document->get_relationship(m_table_name, 
layout_field->get_relationship_name());
+        std::shared_ptr<const Relationship> relationship = document->get_relationship(m_table_name, 
layout_field->get_relationship_name());
         if(relationship)
         {
           //If the relationship uses the specified field:
@@ -536,7 +536,7 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
         for(guint uiCol = 0; uiCol < cols_count; ++uiCol)
         {
           const Gnome::Gda::Value value = result->get_value_at(uiCol, 0 /* row */);
-          sharedptr<const LayoutItem_Field> layout_item = *iterFields;
+          std::shared_ptr<const LayoutItem_Field> layout_item = *iterFields;
           if(!layout_item)
             std::cerr << G_STRFUNC << ": The layout_item was null." << std::endl;
           else
diff --git a/glom/base_db_table_data.h b/glom/base_db_table_data.h
index 6370bbe..351cc4f 100644
--- a/glom/base_db_table_data.h
+++ b/glom/base_db_table_data.h
@@ -52,8 +52,8 @@ protected:
    */
   bool record_new(bool use_entered_data = true, const Gnome::Gda::Value& primary_key_value = 
Gnome::Gda::Value());
 
-  Gnome::Gda::Value get_entered_field_data_field_only(const sharedptr<const Field>& field) const;
-  virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const;
+  Gnome::Gda::Value get_entered_field_data_field_only(const std::shared_ptr<const Field>& field) const;
+  virtual Gnome::Gda::Value get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const;
 
   //Gets the row being edited, for derived classes that have rows.
   virtual Gtk::TreeModel::iterator get_row_selected();
@@ -64,7 +64,7 @@ protected:
 
   /** Get the fields that are in related tables, via a relationship using @a field_name changes.
    */
-  type_vecConstLayoutFields get_related_fields(const sharedptr<const LayoutItem_Field>& field) const;
+  type_vecConstLayoutFields get_related_fields(const std::shared_ptr<const LayoutItem_Field>& field) const;
 
   /** Ask the user if he really wants to delete the record.
    */
@@ -75,7 +75,7 @@ protected:
    */
   bool record_delete(const Gnome::Gda::Value& primary_key_value);
 
-  bool add_related_record_for_field(const sharedptr<const LayoutItem_Field>& layout_item_parent, const 
sharedptr<const Relationship>& relationship, const sharedptr<const Field>& primary_key_field, const 
Gnome::Gda::Value& primary_key_value_provided, Gnome::Gda::Value& primary_key_value_used);
+  bool add_related_record_for_field(const std::shared_ptr<const LayoutItem_Field>& layout_item_parent, const 
std::shared_ptr<const Relationship>& relationship, const std::shared_ptr<const Field>& primary_key_field, 
const Gnome::Gda::Value& primary_key_value_provided, Gnome::Gda::Value& primary_key_value_used);
 
   virtual void on_record_added(const Gnome::Gda::Value& primary_key_value, const Gtk::TreeModel::iterator& 
row); //Overridden by derived classes.
   virtual void on_record_deleted(const Gnome::Gda::Value& primary_key_value); //Overridden by derived 
classes.
@@ -83,7 +83,7 @@ protected:
   type_signal_record_changed m_signal_record_changed;
 
 private:
-  bool get_related_record_exists(const sharedptr<const Relationship>& relationship, const Gnome::Gda::Value& 
key_value);
+  bool get_related_record_exists(const std::shared_ptr<const Relationship>& relationship, const 
Gnome::Gda::Value& key_value);
 };
 
 } //namespace Glom
diff --git a/glom/base_db_table_data_readonly.h b/glom/base_db_table_data_readonly.h
index b85bb65..f0f698f 100644
--- a/glom/base_db_table_data_readonly.h
+++ b/glom/base_db_table_data_readonly.h
@@ -43,7 +43,7 @@ public:
 protected:
 
   //TODO: Move these to Base_DB_Table_Data too?
-  virtual sharedptr<Field> get_field_primary_key() const = 0;
+  virtual std::shared_ptr<Field> get_field_primary_key() const = 0;
 
   //TODO: Document whether these get the primary key in an existing record,
   //or the primary key value as it is entered in the UI, even before a record exists,
diff --git a/glom/box_reports.cc b/glom/box_reports.cc
index b282d9e..0b22e15 100644
--- a/glom/box_reports.cc
+++ b/glom/box_reports.cc
@@ -60,7 +60,7 @@ Box_Reports::~Box_Reports()
 {
 }
 
-void Box_Reports::fill_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const Report>& report)
+void Box_Reports::fill_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const Report>& report)
 {
   if(iter)
   {
@@ -106,7 +106,7 @@ bool Box_Reports::fill_from_database()
     listTableReports = document->get_report_names(m_table_name);
     for(std::vector<Glib::ustring>::const_iterator iter = listTableReports.begin(); iter != 
listTableReports.end(); ++iter)
     {
-      sharedptr<Report> report = document->get_report(m_table_name, *iter);
+      std::shared_ptr<Report> report = document->get_report(m_table_name, *iter);
       if(report)
       {
         Gtk::TreeModel::iterator row = m_AddDel.add_item(report->get_name());
@@ -127,7 +127,7 @@ bool Box_Reports::fill_from_database()
 
 void Box_Reports::on_adddel_Add(const Gtk::TreeModel::iterator& row)
 {
-  sharedptr<Report> report = sharedptr<Report>::create();
+  std::shared_ptr<Report> report = std::shared_ptr<Report>(new Report());
 
   const Glib::ustring report_name = m_AddDel.get_value(row, m_colReportName);
   if(!report_name.empty())
@@ -188,7 +188,7 @@ void Box_Reports::save_to_document()
 
       if(!report_name.empty() && std::find(listReports.begin(), listReports.end(), report_name) == 
listReports.end())
       {
-        sharedptr<Report> report(new Report());
+        std::shared_ptr<Report> report(new Report());
         report->set_name(report_name);
 
         report->set_title( m_AddDel.get_value(iter, m_colTitle) , AppWindow::get_current_locale()); //TODO: 
Translations: Store the original in the TreeView.
@@ -211,7 +211,7 @@ void Box_Reports::on_adddel_changed(const Gtk::TreeModel::iterator& row, guint c
     const Glib::ustring report_name = m_AddDel.get_value_key(row);
     Document* document = get_document();
 
-    sharedptr<Report> report = document->get_report(m_table_name, report_name);
+    std::shared_ptr<Report> report = document->get_report(m_table_name, report_name);
     if(report)
     {
       if(column == m_colTitle)
diff --git a/glom/box_reports.h b/glom/box_reports.h
index 3e2314a..07d2cf5 100644
--- a/glom/box_reports.h
+++ b/glom/box_reports.h
@@ -39,7 +39,7 @@ public:
 private:
   virtual bool fill_from_database(); //override
 
-  virtual void fill_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const Report>& report);
+  virtual void fill_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const Report>& report);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   virtual void save_to_document();
diff --git a/glom/dialog_connection.cc b/glom/dialog_connection.cc
index 61b0e7f..0a969d3 100644
--- a/glom/dialog_connection.cc
+++ b/glom/dialog_connection.cc
@@ -57,13 +57,13 @@ Dialog_Connection::~Dialog_Connection()
 {
 }
 
-sharedptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection_settings() const
+std::shared_ptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection_settings() const
 {
   //std::cout << "debug: Dialog_Connection::connect_to_server_with_connection_settings()" << std::endl;
 
   //TODO: BusyCursor busy_cursor(get_app_window());
 
-  sharedptr<SharedConnection> result(0);
+  std::shared_ptr<SharedConnection> result(0);
 
   ConnectionPool* connection_pool = ConnectionPool::get_instance();
   g_assert(connection_pool);
diff --git a/glom/dialog_connection.h b/glom/dialog_connection.h
index 066ee25..cfcc192 100644
--- a/glom/dialog_connection.h
+++ b/glom/dialog_connection.h
@@ -42,7 +42,7 @@ public:
   Dialog_Connection(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_Connection();
 
-  sharedptr<SharedConnection> connect_to_server_with_connection_settings() const;
+  std::shared_ptr<SharedConnection> connect_to_server_with_connection_settings() const;
 
   ///Disable irrelevant fields:
   void set_connect_to_browsed();
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 7f0c3e2..0d36b6b 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -276,7 +276,7 @@ bool Dialog_ExistingOrNew::list_examples_at_path(const std::string& path)
 
   try
   {
-    Glib::RefPtr<Gio::FileEnumerator> examples = 
examples_dir->enumerate_children(G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","G_FILE_ATTRIBUTE_STANDARD_NAME);
+    Glib::RefPtr<Gio::FileEnumerator> examples = 
examples_dir->enumerate_children(G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE "," 
G_FILE_ATTRIBUTE_STANDARD_NAME);
     bool example_found = false;
     while( (info = examples->next_file()) )
     {
@@ -448,19 +448,19 @@ Glib::ustring Dialog_ExistingOrNew::get_service_name() const
 }
 #endif
 
-std::auto_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_existing(const 
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
+std::shared_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_existing(const 
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
 {
   Gtk::TreeModel::iterator iter = m_existing_model->append(parent->children());
   (*iter)[m_existing_columns.m_col_title] = text;
-  return std::auto_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
+  return std::shared_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-std::auto_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_new(const 
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
+std::shared_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_new(const 
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
 {
   Gtk::TreeModel::iterator iter = m_new_model->append(parent->children());
   (*iter)[m_new_columns.m_col_title] = text;
-  return std::auto_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
+  return std::shared_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
 }
 #endif //GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/dialog_existing_or_new.h b/glom/dialog_existing_or_new.h
index 812af21..2b98e56 100644
--- a/glom/dialog_existing_or_new.h
+++ b/glom/dialog_existing_or_new.h
@@ -70,7 +70,7 @@ public:
 private:
   Action get_action_impl(Gtk::TreeModel::iterator& iter) const;
 
-  std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_existing(const Gtk::TreeModel::iterator& parent, 
const Glib::ustring& text);
+  std::shared_ptr<Gtk::TreeModel::iterator> create_dummy_item_existing(const Gtk::TreeModel::iterator& 
parent, const Glib::ustring& text);
 
 
   void existing_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
@@ -85,7 +85,7 @@ private:
   void update_ui_sensitivity();
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_new(const Gtk::TreeModel::iterator& parent, 
const Glib::ustring& text);
+  std::shared_ptr<Gtk::TreeModel::iterator> create_dummy_item_new(const Gtk::TreeModel::iterator& parent, 
const Glib::ustring& text);
   void on_new_selection_changed();
   void new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
   void new_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
@@ -172,7 +172,7 @@ private:
   Gtk::CellRendererText m_new_title_renderer;
   Gtk::TreeModel::iterator m_iter_new_empty;
   Gtk::TreeModel::iterator m_iter_new_template;
-  std::auto_ptr<Gtk::TreeModel::iterator> m_iter_new_template_dummy;
+  std::shared_ptr<Gtk::TreeModel::iterator> m_iter_new_template_dummy;
 #endif //GLOM_ENABLE_CLIENT_ONLY
 
   Gtk::TreeViewColumn m_existing_column_title;
@@ -189,14 +189,14 @@ private:
  
   // Dummy children to indicate that a parent item has no (real) children
 #ifndef G_OS_WIN32
-  std::auto_ptr<Gtk::TreeModel::iterator> m_iter_existing_network_dummy;
+  std::shared_ptr<Gtk::TreeModel::iterator> m_iter_existing_network_dummy;
 #endif
-  std::auto_ptr<Gtk::TreeModel::iterator> m_iter_existing_recent_dummy;
+  std::shared_ptr<Gtk::TreeModel::iterator> m_iter_existing_recent_dummy;
 
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   struct buffer { static const guint SIZE = 1024; char buf[SIZE]; };
-  std::auto_ptr<buffer> m_current_buffer;
+  std::shared_ptr<buffer> m_current_buffer;
 #endif /* !GLOM_ENABLE_CLIENT_ONLY */
     
 #ifndef G_OS_WIN32
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index bf97262..aa44d28 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -377,10 +377,10 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
       //then sort by the ID, just so we sort by something, so that the order is predictable:
       if(found_set.m_sort_clause.empty())
       {
-        sharedptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
+        std::shared_ptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
         if(field_primary_key)
       {
-          sharedptr<LayoutItem_Field> layout_item_sort = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item_sort = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item_sort->set_full_field_details(field_primary_key);
 
           found_set.m_sort_clause.clear();
@@ -389,7 +389,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
           //because that would be too slow.
           //The user can explicitly request a sort later, by clicking on a column header.
           //TODO_Performance: This causes an almost-duplicate COUNT query (we do it in the treemodel too), 
but it's not that slow.
-          sharedptr<LayoutItem_Field> layout_item_temp = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item_temp = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item_temp->set_full_field_details(field_primary_key);
           type_vecLayoutFields layout_fields;
           layout_fields.push_back(layout_item_temp);
@@ -464,7 +464,7 @@ void Frame_Glom::on_menu_developer_developer(const Glib::RefPtr<Gtk::RadioAction
     {
       //Check whether the current user has developer privileges:
       ConnectionPool* connection_pool = ConnectionPool::get_instance();
-      sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+      std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
 
       // Default to true; if we don't support users, we always have
       // priviliges to change things in developer mode.
@@ -633,7 +633,7 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
         {
           const Gnome::Gda::Value value = result->get_value_at(col_index, row_index);
 
-          sharedptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
+          std::shared_ptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
           //if(layout_item->m_field.get_glom_type() != Field::TYPE_IMAGE) //This is too much data.
           //{
 
@@ -683,14 +683,14 @@ void Frame_Glom::export_data_to_stream(std::ostream& the_stream, const FoundSet&
         {
           const Gnome::Gda::Value value = result->get_value_at(col_index, row_index);
 
-          sharedptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
+          std::shared_ptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
           //if(layout_item->m_field.get_glom_type() != Field::TYPE_IMAGE) //This is too much data.
           //{
             if(!row_string.empty())
               row_string += ",";
 
             //Output data in canonical SQL format, ignoring the user's locale, and ignoring the layout 
formatting:
-            sharedptr<const Field> field = layout_item->get_full_field_details();
+            std::shared_ptr<const Field> field = layout_item->get_full_field_details();
             if(!field)
             {
               std::cerr << G_STRFUNC << ": A field was null." << std::endl;
@@ -984,11 +984,11 @@ void Frame_Glom::on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>
   if(change)
   {
     ConnectionPool* connectionpool = ConnectionPool::get_instance();
-    sharedptr<SharedConnection> sharedconnection = connectionpool->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = connectionpool->connect();
     if(sharedconnection)
     {
       sharedconnection->close();
-      sharedconnection.clear();
+      sharedconnection.reset();
     }
 
     ShowProgressMessage cleanup_message(_("Stopping Database Server"));
@@ -1181,7 +1181,7 @@ void Frame_Glom::on_dialog_add_related_table_response(int response)
       }
 
       //Create the new relationship:
-      sharedptr<Relationship> relationship = sharedptr<Relationship>::create();
+      std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new Relationship());
 
       relationship->set_name(relationship_name);
       relationship->set_title(Utils::title_from_string(relationship_name), AppWindow::get_current_locale());
@@ -1189,7 +1189,7 @@ void Frame_Glom::on_dialog_add_related_table_response(int response)
       relationship->set_from_field(from_key_name);
       relationship->set_to_table(table_name);
 
-      sharedptr<Field> related_primary_key = get_field_primary_key_for_table(table_name); //This field was 
created by create_table_with_default_fields().
+      std::shared_ptr<Field> related_primary_key = get_field_primary_key_for_table(table_name); //This field 
was created by create_table_with_default_fields().
       if(!related_primary_key)
       {
         std::cerr << G_STRFUNC << ": get_field_primary_key_for_table() failed." << std::endl;
@@ -1439,7 +1439,7 @@ void Frame_Glom::update_table_in_document_from_database()
 
     for(Base_DB::type_vec_fields::const_iterator iter = fieldsDatabase.begin(); iter != 
fieldsDatabase.end(); ++iter)
     {
-      sharedptr<Field> field_database = *iter;
+      std::shared_ptr<Field> field_database = *iter;
       if(field_database)
       {
         //Is the field already in the document?
@@ -1454,7 +1454,7 @@ void Frame_Glom::update_table_in_document_from_database()
         {
           //Compare the information:
           Glib::RefPtr<Gnome::Gda::Column> field_info_db = field_database->get_field_info();
-          sharedptr<Field> field_document =  *iterFindDoc;
+          std::shared_ptr<Field> field_document =  *iterFindDoc;
           if(field_document)
           {
             if(!field_document->field_info_from_database_is_equal( field_info_db )) //ignores auto_increment 
because libgda does not report it from the database properly.
@@ -1487,7 +1487,7 @@ void Frame_Glom::update_table_in_document_from_database()
       type_vec_fields fieldsActual;
       for(type_vec_fields::const_iterator iter = fieldsDocument.begin(); iter != fieldsDocument.end(); 
++iter)
       {
-        sharedptr<Field> field = *iter;
+        std::shared_ptr<Field> field = *iter;
 
         //Check whether it's in the database:
         type_vec_fields::iterator iterFindDatabase = std::find_if( fieldsDatabase.begin(), 
fieldsDatabase.end(), predicate_FieldHasName<Field>( field->get_name() ) );
@@ -1752,7 +1752,7 @@ void Frame_Glom::on_box_reports_selected(const Glib::ustring& report_name)
 {
   m_pDialog_Reports->hide();
 
-  sharedptr<Report> report = get_document()->get_report(m_table_name, report_name);
+  std::shared_ptr<Report> report = get_document()->get_report(m_table_name, report_name);
   if(report)
   {
     m_pDialogLayoutReport->set_transient_for(*get_app_window());
@@ -1775,7 +1775,7 @@ void Frame_Glom::on_box_print_layouts_selected(const Glib::ustring& print_layout
 
   m_pDialog_PrintLayouts->hide();
 
-  sharedptr<PrintLayout> print_layout = get_document()->get_print_layout(m_table_name, print_layout_name);
+  std::shared_ptr<PrintLayout> print_layout = get_document()->get_print_layout(m_table_name, 
print_layout_name);
   if(print_layout)
   {
     m_pDialogLayoutPrint->set_transient_for(*get_app_window());
@@ -2061,7 +2061,7 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
     try
     {
       g_assert(m_pDialogConnection);
-      sharedptr<SharedConnection> sharedconnection = 
m_pDialogConnection->connect_to_server_with_connection_settings();
+      std::shared_ptr<SharedConnection> sharedconnection = 
m_pDialogConnection->connect_to_server_with_connection_settings();
       //If no exception was thrown then the database exists.
       //But we are looking for an unused database name, so we will try again.
     }
@@ -2236,7 +2236,7 @@ bool Frame_Glom::connection_request_password_and_attempt(bool& database_not_foun
     //Try to use the entered username/password:
     if(response == Gtk::RESPONSE_OK)
     {
-      sharedptr<SharedConnection> sharedconnection;
+      std::shared_ptr<SharedConnection> sharedconnection;
 
       //Ask for the user/password if necessary:
       //TODO: Remove any previous database setting?
@@ -2326,7 +2326,7 @@ void Frame_Glom::on_menu_report_selected(const Glib::ustring& report_name)
   }
 
   Document* document = get_document();
-  sharedptr<Report> report = document->get_report(m_table_name, report_name);
+  std::shared_ptr<Report> report = document->get_report(m_table_name, report_name);
   if(!report)
     return;
 
@@ -2349,7 +2349,7 @@ void Frame_Glom::on_menu_print_layout_selected(const Glib::ustring& print_layout
 void Frame_Glom::do_print_layout(const Glib::ustring& print_layout_name, bool preview, Gtk::Window* 
transient_for)
 {
   const Document* document = get_document();
-  sharedptr<const PrintLayout> print_layout = document->get_print_layout(m_table_name, print_layout_name);
+  std::shared_ptr<const PrintLayout> print_layout = document->get_print_layout(m_table_name, 
print_layout_name);
     
   const Privileges table_privs = Privs::get_current_privs(m_table_name);
 
@@ -2380,7 +2380,7 @@ void Frame_Glom::on_dialog_layout_report_hide()
   if(document && true) //m_pDialogLayoutReport->get_modified())
   {
     const Glib::ustring original_name = m_pDialogLayoutReport->get_original_report_name();
-    sharedptr<Report> report = m_pDialogLayoutReport->get_report();
+    std::shared_ptr<Report> report = m_pDialogLayoutReport->get_report();
     if(report && (original_name != report->get_name()))
       document->remove_report(m_table_name, original_name);
 
@@ -2400,7 +2400,7 @@ void Frame_Glom::on_dialog_layout_print_hide()
   if(document && true) //m_pDialogLayoutReport->get_modified())
   {
     const Glib::ustring original_name = m_pDialogLayoutPrint->get_original_name();
-    sharedptr<PrintLayout> print_layout = m_pDialogLayoutPrint->get_print_layout();
+    std::shared_ptr<PrintLayout> print_layout = m_pDialogLayoutPrint->get_print_layout();
     if(print_layout && (original_name != print_layout->get_name()))
       document->remove_report(m_table_name, original_name);
 
diff --git a/glom/glom_test_connection.cc b/glom/glom_test_connection.cc
index 69f5312..c82dac8 100644
--- a/glom/glom_test_connection.cc
+++ b/glom/glom_test_connection.cc
@@ -238,7 +238,7 @@ int main(int argc, char* argv[])
 
   connection_pool->set_user(group.m_arg_server_username);
   connection_pool->set_password(password);
-  connection_pool->set_backend(std::auto_ptr<Glom::ConnectionPool::Backend>(backend));
+  connection_pool->set_backend(std::shared_ptr<Glom::ConnectionPool::Backend>(backend));
 
   if(group.m_arg_server_database.empty())
   {
diff --git a/glom/import_csv/csv_parser.cc b/glom/import_csv/csv_parser.cc
index e33210b..e0a33aa 100644
--- a/glom/import_csv/csv_parser.cc
+++ b/glom/import_csv/csv_parser.cc
@@ -266,7 +266,7 @@ Glib::ustring::const_iterator CsvParser::advance_field(const Glib::ustring::cons
 
 void CsvParser::clear()
 {
-  m_buffer.reset(0);
+  m_buffer.reset();
 
   //m_stream.reset();
   //m_raw.clear();
@@ -538,7 +538,7 @@ void CsvParser::copy_buffer_and_continue_reading(gssize size)
   else // When size == 0 we finished reading.
   {
     //TODO: put in proper data reset method?
-    m_buffer.reset(0);
+    m_buffer.reset();
     m_stream.reset();
   }
 
diff --git a/glom/import_csv/csv_parser.h b/glom/import_csv/csv_parser.h
index d36eb52..5dd55c7 100644
--- a/glom/import_csv/csv_parser.h
+++ b/glom/import_csv/csv_parser.h
@@ -215,7 +215,7 @@ private:
   {
     char buf[1024];
   };
-  std::auto_ptr<Buffer> m_buffer;
+  std::shared_ptr<Buffer> m_buffer;
 };
 
 } //namespace Glom
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index fe0b1f5..d336f39 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -124,7 +124,7 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
   m_encoding_combo->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Import_CSV::on_combo_encoding_changed));
 
   // TODO: Reset parser encoding on selection changed.
-  m_parser = std::auto_ptr<CsvParser>(new CsvParser(get_current_encoding().c_str()));
+  m_parser = std::shared_ptr<CsvParser>(new CsvParser(get_current_encoding().c_str()));
   m_parser->signal_file_read_error().connect(sigc::mem_fun(*this, 
&Dialog_Import_CSV::on_parser_file_read_error));
   m_parser->signal_have_display_name().connect(sigc::mem_fun(*this, 
&Dialog_Import_CSV::on_parser_have_display_name));
   m_parser->signal_encoding_error().connect(sigc::mem_fun(*this, 
&Dialog_Import_CSV::on_parser_encoding_error));
@@ -201,7 +201,7 @@ void Dialog_Import_CSV::import(const Glib::ustring& uri, const Glib::ustring& in
     const Document::type_vec_fields fields(document->get_table_fields(into_table));
     for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++ iter)
     {
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       if(!field)
         continue;
 
@@ -226,10 +226,10 @@ void Dialog_Import_CSV::import(const Glib::ustring& uri, const Glib::ustring& in
   }
 }
 
-sharedptr<const Field> Dialog_Import_CSV::get_field_for_column(guint col) const
+std::shared_ptr<const Field> Dialog_Import_CSV::get_field_for_column(guint col) const
 {
   if(col >= m_fields.size())
-    return sharedptr<const Field>();
+    return std::shared_ptr<const Field>();
 
   return m_fields[col];
 }
@@ -569,7 +569,7 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
 
   if(row == -1)
   {
-    sharedptr<Field> field = m_fields[column_number];
+    std::shared_ptr<Field> field = m_fields[column_number];
     if(field)
       text = field->get_name();
     else
@@ -584,7 +584,7 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
 
     if(column_number < m_fields.size())
     {
-      sharedptr<Field> field = m_fields[column_number];
+      std::shared_ptr<Field> field = m_fields[column_number];
 
       if(row != -1) // && static_cast<unsigned int>(row) < m_parser->get_rows_count())
       {
@@ -647,11 +647,11 @@ void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::u
   {
     if( (*field_iter)[m_field_columns.m_col_field_name] == new_text)
     {
-      sharedptr<Field> field = (*field_iter)[m_field_columns.m_col_field];
+      std::shared_ptr<Field> field = (*field_iter)[m_field_columns.m_col_field];
       // Check whether another column is already using that field
       type_vec_fields::iterator vec_field_iter = std::find(m_fields.begin(), m_fields.end(), field);
       // Reset the old column since two different columns cannot be imported into the same field
-      if(vec_field_iter != m_fields.end()) *vec_field_iter = sharedptr<Field>();
+      if(vec_field_iter != m_fields.end()) *vec_field_iter = std::shared_ptr<Field>();
 
       m_fields[column_number] = field;
 
@@ -685,7 +685,7 @@ void Dialog_Import_CSV::validate_primary_key()
   {
     // Allow the import button to be pressed when the value for the primary key
     // has been chosen:
-    sharedptr<Field> primary_key = get_field_primary_key_for_table(get_target_table_name());
+    std::shared_ptr<Field> primary_key = get_field_primary_key_for_table(get_target_table_name());
     bool primary_key_selected = false;
 
     if(primary_key && !primary_key->get_auto_increment())
diff --git a/glom/import_csv/dialog_import_csv.h b/glom/import_csv/dialog_import_csv.h
index 74948d6..786ee08 100644
--- a/glom/import_csv/dialog_import_csv.h
+++ b/glom/import_csv/dialog_import_csv.h
@@ -59,7 +59,7 @@ public:
   const Glib::ustring& get_file_uri() const;
 
 
-  sharedptr<const Field> get_field_for_column(unsigned int col) const;
+  std::shared_ptr<const Field> get_field_for_column(unsigned int col) const;
   const Glib::ustring& get_data(unsigned int row, unsigned int col);
 
   // TODO: perhaps it would be safer to just wrap the needed parser API here.
@@ -118,7 +118,7 @@ private:
     FieldColumns() { add(m_col_field_name); add(m_col_field); }
 
     Gtk::TreeModelColumn<Glib::ustring> m_col_field_name;
-    Gtk::TreeModelColumn<sharedptr<Field> > m_col_field;
+    Gtk::TreeModelColumn<std::shared_ptr<Field> > m_col_field;
   };
 
   class SampleColumns: public Gtk::TreeModelColumnRecord
@@ -129,7 +129,7 @@ private:
     Gtk::TreeModelColumn<int> m_col_row;
   };
 
-  std::auto_ptr<CsvParser> m_parser;
+  std::shared_ptr<CsvParser> m_parser;
 
   EncodingColumns m_encoding_columns;
   Glib::RefPtr<Gtk::ListStore> m_encoding_model;
@@ -162,7 +162,7 @@ private:
   guint m_cols_count;
 
   // The fields into which to import the data:
-  typedef std::vector< sharedptr<Field> > type_vec_fields;
+  typedef std::vector< std::shared_ptr<Field> > type_vec_fields;
   type_vec_fields m_fields;
 
   type_signal_state_changed m_signal_state_changed;
diff --git a/glom/import_csv/dialog_import_csv_progress.cc b/glom/import_csv/dialog_import_csv_progress.cc
index 7e8de21..07c9cd2 100644
--- a/glom/import_csv/dialog_import_csv_progress.cc
+++ b/glom/import_csv/dialog_import_csv_progress.cc
@@ -182,7 +182,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
       iter != row.end();
       ++iter)
   {
-    sharedptr<const Field> field = m_data_source->get_field_for_column(col_index++);
+    std::shared_ptr<const Field> field = m_data_source->get_field_for_column(col_index++);
     if(field)
     {
       // We always assume exported data is in standard CSV format, since
@@ -195,7 +195,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
         // Make the value empty if the value is not unique.
         if(field->get_unique_key())
         {
-          sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item->set_full_field_details(field);
           if(!get_field_value_is_unique(m_table_name, layout_item, value))
           {
@@ -226,7 +226,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
   {
     // No auto-increment primary key: Check for uniqueness
     Gnome::Gda::Value primary_key_value = m_current_row_values[m_field_primary_key->get_name()];
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_full_field_details(m_field_primary_key);
 
     if(!get_field_value_is_unique(m_table_name, layout_item, primary_key_value))
@@ -258,7 +258,7 @@ void Dialog_Import_CSV_Progress::on_response(int /* response_id */)
   clear();
 }
 
-Gnome::Gda::Value Dialog_Import_CSV_Progress::get_entered_field_data(const sharedptr<const 
LayoutItem_Field>& field) const
+Gnome::Gda::Value Dialog_Import_CSV_Progress::get_entered_field_data(const std::shared_ptr<const 
LayoutItem_Field>& field) const
 {
   type_mapValues::const_iterator iter = m_current_row_values.find(field->get_name());
   if(iter == m_current_row_values.end())
@@ -267,12 +267,12 @@ Gnome::Gda::Value Dialog_Import_CSV_Progress::get_entered_field_data(const share
   return iter->second;
 }
 
-void Dialog_Import_CSV_Progress::set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, 
const Gnome::Gda::Value&  value)
+void Dialog_Import_CSV_Progress::set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& 
field, const Gnome::Gda::Value&  value)
 {
   m_current_row_values[field->get_name()] = value;
 }
 
-sharedptr<Field> Dialog_Import_CSV_Progress::get_field_primary_key() const
+std::shared_ptr<Field> Dialog_Import_CSV_Progress::get_field_primary_key() const
 {
   return m_field_primary_key;
 }
diff --git a/glom/import_csv/dialog_import_csv_progress.h b/glom/import_csv/dialog_import_csv_progress.h
index 0d3dae9..17beaa0 100644
--- a/glom/import_csv/dialog_import_csv_progress.h
+++ b/glom/import_csv/dialog_import_csv_progress.h
@@ -57,15 +57,15 @@ private:
 
   virtual void on_response(int response_id); // Override from Gtk::Dialog
 
-  virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const; // 
Override from Base_DB_Table_Data
-  virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value&  value); // Override from Base_DB
+  virtual Gnome::Gda::Value get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const; // Override from Base_DB_Table_Data
+  virtual void set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value&  value); // Override from Base_DB
 
-  virtual sharedptr<Field> get_field_primary_key() const; // Override from Base_DB_Table_Data
+  virtual std::shared_ptr<Field> get_field_primary_key() const; // Override from Base_DB_Table_Data
   virtual Gnome::Gda::Value get_primary_key_value_selected() const; // Override from Base_DB_Table_Data
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value); 
// Override from Base_DB_Table_Data
   virtual Gnome::Gda::Value get_primary_key_value(const Gtk::TreeModel::iterator& row) const; // Override 
from Base_DB_Table_Data
 
-  sharedptr<Field> m_field_primary_key;
+  std::shared_ptr<Field> m_field_primary_key;
   Dialog_Import_CSV* m_data_source;
   unsigned int m_current_row;
 
diff --git a/glom/libglom/calcinprogress.h b/glom/libglom/calcinprogress.h
index e3b27ee..524d0e4 100644
--- a/glom/libglom/calcinprogress.h
+++ b/glom/libglom/calcinprogress.h
@@ -31,7 +31,7 @@ class CalcInProgress
 public:
   CalcInProgress();
 
-  sharedptr<const Field> m_field; 
+  std::shared_ptr<const Field> m_field; 
   Gnome::Gda::Value m_value; //If it's been calculated.
   bool m_calc_in_progress;
   bool m_calc_finished;
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 9224433..963bc97 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -147,7 +147,7 @@ void ConnectionPool::setup_from_document(const Document* document)
     {
       ConnectionPoolBackends::PostgresSelfHosted* backend = new ConnectionPoolBackends::PostgresSelfHosted;
       backend->set_database_directory_uri(document->get_connection_self_hosted_directory_uri());
-      set_backend(std::auto_ptr<ConnectionPool::Backend>(backend));
+      set_backend(std::shared_ptr<ConnectionPool::Backend>(backend));
     }
     break;
   case Document::HOSTING_MODE_POSTGRES_CENTRAL:
@@ -156,21 +156,21 @@ void ConnectionPool::setup_from_document(const Document* document)
       backend->set_host(document->get_connection_server());
       backend->set_port(document->get_connection_port());
       backend->set_try_other_ports(document->get_connection_try_other_ports());
-      set_backend(std::auto_ptr<ConnectionPool::Backend>(backend));
+      set_backend(std::shared_ptr<ConnectionPool::Backend>(backend));
     }
     break;
   case Document::HOSTING_MODE_SQLITE:
     {
       ConnectionPoolBackends::Sqlite* backend = new ConnectionPoolBackends::Sqlite;
       backend->set_database_directory_uri(document->get_connection_self_hosted_directory_uri());
-      set_backend(std::auto_ptr<ConnectionPool::Backend>(backend));
+      set_backend(std::shared_ptr<ConnectionPool::Backend>(backend));
     }
     break;
   case Document::HOSTING_MODE_MYSQL_SELF:
     {
       ConnectionPoolBackends::MySQLSelfHosted* backend = new ConnectionPoolBackends::MySQLSelfHosted;
       backend->set_database_directory_uri(document->get_connection_self_hosted_directory_uri());
-      set_backend(std::auto_ptr<ConnectionPool::Backend>(backend));
+      set_backend(std::shared_ptr<ConnectionPool::Backend>(backend));
     }
     break;
   case Document::HOSTING_MODE_MYSQL_CENTRAL:
@@ -179,7 +179,7 @@ void ConnectionPool::setup_from_document(const Document* document)
       backend->set_host(document->get_connection_server());
       backend->set_port(document->get_connection_port());
       backend->set_try_other_ports(document->get_connection_try_other_ports());
-      set_backend(std::auto_ptr<ConnectionPool::Backend>(backend));
+      set_backend(std::shared_ptr<ConnectionPool::Backend>(backend));
     }
     break;
 
@@ -213,7 +213,7 @@ void ConnectionPool::set_ready_to_connect(bool val)
   m_ready_to_connect = val;
 }
 
-void ConnectionPool::set_backend(std::auto_ptr<Backend> backend)
+void ConnectionPool::set_backend(std::shared_ptr<Backend> backend)
 {
   m_backend = backend;
 }
@@ -237,9 +237,9 @@ bool ConnectionPool::get_backend_supports_cursor() const
 }
 
 //static:
-sharedptr<SharedConnection> ConnectionPool::get_and_connect()
+std::shared_ptr<SharedConnection> ConnectionPool::get_and_connect()
 {
-  sharedptr<SharedConnection> result(0);
+  std::shared_ptr<SharedConnection> result(0);
 
   ConnectionPool* connection_pool = ConnectionPool::get_instance();
   if(!connection_pool)
@@ -270,7 +270,7 @@ bool ConnectionPool::get_instance_is_ready()
 // is immediately requested again, to avoid making a new connection
 // and introspecting again, which is slow.
 // TODO: Why aren't these member variables?
-static sharedptr<SharedConnection> connection_cached;
+static std::shared_ptr<SharedConnection> connection_cached;
 static sigc::connection connection_cached_timeout_connection;
 static sigc::connection connection_cached_finished_connection;
 
@@ -279,18 +279,18 @@ static bool on_connection_pool_cache_timeout()
   //std::cout << "DEBUG: Clearing connection cache." << std::endl;
 
   //Forget the cached connection after a few seconds:
-  connection_cached.clear();
+  connection_cached.reset();
 
   return false; //Don't call this again.
 }
 
 
-sharedptr<SharedConnection> ConnectionPool::connect()
+std::shared_ptr<SharedConnection> ConnectionPool::connect()
 {
   //std::cout << G_STRFUNC << ": debug" << std::endl;
 
   //Don't try to connect if we don't have a backend to connect to.
-  g_return_val_if_fail(m_backend.get(), sharedptr<SharedConnection>(0));
+  g_return_val_if_fail(m_backend.get(), std::shared_ptr<SharedConnection>(0));
 
   if(get_ready_to_connect() || m_fake_connection)
   {
@@ -302,7 +302,7 @@ sharedptr<SharedConnection> ConnectionPool::connect()
     //If the connection is already open (because it is being used by somebody):
     else if(m_refGdaConnection)
     {
-      sharedptr<SharedConnection> sharedConnection( new SharedConnection(m_refGdaConnection) );
+      std::shared_ptr<SharedConnection> sharedConnection( new SharedConnection(m_refGdaConnection) );
 
       //Ask for notification when the SharedConnection has been finished with:
       //TODO: Note that we are overwriting the connection to a signal of a
@@ -405,7 +405,7 @@ sharedptr<SharedConnection> ConnectionPool::connect()
     //std::cerr << G_STRFUNC << ": not ready to connect." << std::endl;
   }
 
-  return sharedptr<SharedConnection>(0);
+  return std::shared_ptr<SharedConnection>(0);
 }
 
 void ConnectionPool::create_database(const SlotProgress& slot_progress, const Glib::ustring& database_name)
@@ -540,7 +540,7 @@ Gnome::Gda::SqlOperatorType ConnectionPool::get_string_find_operator() const
 void ConnectionPool::invalidate_connection()
 {
   //std::cerr << G_STRFUNC << ": debug" << std::endl;
-  connection_cached.clear();
+  connection_cached.reset();
   connection_cached_timeout_connection.disconnect();
   connection_cached_finished_connection.disconnect();
 
@@ -583,7 +583,7 @@ void ConnectionPool::on_sharedconnection_finished()
 //static
 bool ConnectionPool::handle_error_cerr_only()
 {
-  sharedptr<SharedConnection> sharedconnection = get_and_connect();
+  std::shared_ptr<SharedConnection> sharedconnection = get_and_connect();
 
   if(sharedconnection)
   {
@@ -712,9 +712,9 @@ bool ConnectionPool::set_network_shared(const SlotProgress& slot_progress, bool
     return false;
 }
 
-bool ConnectionPool::add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field) throw()
+bool ConnectionPool::add_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field) 
throw()
 {
-  sharedptr<SharedConnection> conn;
+  std::shared_ptr<SharedConnection> conn;
   if(!m_refGdaConnection)
   {
     conn = connect();
@@ -739,7 +739,7 @@ bool ConnectionPool::add_column(const Glib::ustring& table_name, const sharedptr
 
 bool ConnectionPool::drop_column(const Glib::ustring& table_name, const Glib::ustring& field_name) throw()
 {
-  sharedptr<SharedConnection> conn;
+  std::shared_ptr<SharedConnection> conn;
   if(!m_refGdaConnection)
   {
     conn = connect();
@@ -762,7 +762,7 @@ bool ConnectionPool::drop_column(const Glib::ustring& table_name, const Glib::us
   return false;
 }
 
-bool ConnectionPool::change_column(const Glib::ustring& table_name, const sharedptr<const Field>& field_old, 
const sharedptr<const Field>& field) throw()
+bool ConnectionPool::change_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& 
field_old, const std::shared_ptr<const Field>& field) throw()
 {
   type_vec_const_fields old_fields(1, field_old);
   type_vec_const_fields new_fields(1, field);
@@ -772,7 +772,7 @@ bool ConnectionPool::change_column(const Glib::ustring& table_name, const shared
 
 bool ConnectionPool::change_columns(const Glib::ustring& table_name, const type_vec_const_fields& 
old_fields, const type_vec_const_fields& new_fields) throw()
 {
-  sharedptr<SharedConnection> conn;
+  std::shared_ptr<SharedConnection> conn;
   if(!m_refGdaConnection)
   {
     conn = connect();
@@ -803,8 +803,8 @@ bool ConnectionPool::change_columns(const Glib::ustring& table_name, const type_
   type_vec_const_fields::const_iterator iter_new = new_fields.begin();
   while( (iter_old != old_fields.end()) && (iter_new != new_fields.end()) )
   {
-    const sharedptr<const Field> field_old = *iter_old;
-    const sharedptr<const Field> field_new = *iter_new;
+    const std::shared_ptr<const Field> field_old = *iter_old;
+    const std::shared_ptr<const Field> field_new = *iter_new;
     if(field_old && field_new
       && field_old->get_auto_increment() != field_new->get_auto_increment())
     {
@@ -879,7 +879,7 @@ gboolean ConnectionPool::on_publisher_document_authentication(EpcAuthContext* co
   g_return_val_if_fail(connection_pool->m_backend.get(), false);
 
   //Attempt a connection with this username/password:
-  std::auto_ptr<ExceptionConnection> error;
+  std::shared_ptr<ExceptionConnection> error;
   Glib::RefPtr<Gnome::Gda::Connection> connection = 
connection_pool->m_backend->connect(connection_pool->get_database(), user_name, password);
 
   if(connection)
diff --git a/glom/libglom/connectionpool.h b/glom/libglom/connectionpool.h
index b485a78..6d27aea 100644
--- a/glom/libglom/connectionpool.h
+++ b/glom/libglom/connectionpool.h
@@ -29,7 +29,7 @@
 #include <libglom/data_structure/field.h>
 #include <libglom/connectionpool_backends/backend.h>
 
-#include <memory> // For std::auto_ptr
+#include <memory> // For std::shared_ptr
 
 //Avoid including the header here:
 extern "C"
@@ -134,7 +134,7 @@ public:
    */
   void set_fake_connection();
 
-  void set_backend(std::auto_ptr<Backend> backend);
+  void set_backend(std::shared_ptr<Backend> backend);
 
   Backend* get_backend();
   const Backend* get_backend() const;
@@ -149,13 +149,13 @@ public:
    * When that SharedConnection is destroyed, or when SharedConnection::close() is called, then the 
ConnectionPool will be informed.
    * The connection will only be closed when all SharedConnections have finished with their connections.
    *
-   * @result a sharedptr to a SharedConnection. This sharedptr will be null if the connection failed.
+   * @result a std::shared_ptr to a SharedConnection. This std::shared_ptr will be null if the connection 
failed.
    *
    * @throws an ExceptionConnection when the connection fails.
    */
-  sharedptr<SharedConnection> connect();
+  std::shared_ptr<SharedConnection> connect();
 
-  static sharedptr<SharedConnection> get_and_connect();
+  static std::shared_ptr<SharedConnection> get_and_connect();
 
   /** This callback should show UI to indicate that work is still happening.
    * For instance, a pulsing ProgressBar.
@@ -248,7 +248,7 @@ public:
    * @param table_name The parent table of the fields to be changed.
    * @param field The field to be added.
    */
-  bool add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field) throw();
+  bool add_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field) throw();
 
   /** Remove a field from the database.
    * The caller should then update the document's list of fields,
@@ -267,7 +267,7 @@ public:
    * @param field_old The old field information.
    * @param field The new field information. 
    */
-  bool change_column(const Glib::ustring& table_name, const sharedptr<const Field>& field_old, const 
sharedptr<const Field>& field) throw();
+  bool change_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field_old, const 
std::shared_ptr<const Field>& field) throw();
 
   /** Change some detail about some fields in the database.
    * The caller should then update the document's list of fields,
@@ -329,7 +329,7 @@ private:
   EpcPublisher* m_epc_publisher;
   Gtk::Dialog* m_dialog_epc_progress; //For progress while generating certificates.
 
-  std::auto_ptr<Backend> m_backend;
+  std::shared_ptr<Backend> m_backend;
   Glib::RefPtr<Gnome::Gda::Connection> m_refGdaConnection;
   guint m_sharedconnection_refcount;
   bool m_ready_to_connect;
diff --git a/glom/libglom/connectionpool_backends/backend.cc b/glom/libglom/connectionpool_backends/backend.cc
index 4cf583e..f41446f 100644
--- a/glom/libglom/connectionpool_backends/backend.cc
+++ b/glom/libglom/connectionpool_backends/backend.cc
@@ -65,7 +65,7 @@ bool Backend::set_network_shared(const SlotProgress& /* slot_progress */, bool /
   return true; //Success at doing nothing.
 }
 
-bool Backend::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const sharedptr<const Field>& field)
+bool Backend::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const std::shared_ptr<const Field>& field)
 {
   Glib::RefPtr<Gnome::Gda::ServerProvider> provider = connection->get_provider();
   Glib::RefPtr<Gnome::Gda::ServerOperation> operation = provider->create_operation(connection, 
Gnome::Gda::SERVER_OPERATION_ADD_COLUMN);
diff --git a/glom/libglom/connectionpool_backends/backend.h b/glom/libglom/connectionpool_backends/backend.h
index 9d7e554..66716ff 100644
--- a/glom/libglom/connectionpool_backends/backend.h
+++ b/glom/libglom/connectionpool_backends/backend.h
@@ -66,7 +66,7 @@ class Backend
   friend class Glom::ConnectionPool;
 public:
   virtual ~Backend() {}
-  typedef std::vector<sharedptr<const Field> > type_vec_const_fields;
+  typedef std::vector<std::shared_ptr<const Field> > type_vec_const_fields;
 
   enum InitErrors
   {
@@ -171,7 +171,7 @@ protected:
 
   /** @throws Glib::Error (from libgdamm)
    */
-  virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const sharedptr<const Field>& field);
+  virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const std::shared_ptr<const Field>& field);
 
   /** @throws Glib::Error (from libgdamm)
    */
diff --git a/glom/libglom/connectionpool_backends/mysql.cc b/glom/libglom/connectionpool_backends/mysql.cc
index 6f162d6..1036f8e 100644
--- a/glom/libglom/connectionpool_backends/mysql.cc
+++ b/glom/libglom/connectionpool_backends/mysql.cc
@@ -200,7 +200,7 @@ bool MySQL::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connectio
                  if(old_fields[i]->get_field_info()->get_g_type() != 
new_fields[i]->get_field_info()->get_g_type())
                  {
                    // Create a temporary column
-                   sharedptr<Field> temp_field = glom_sharedptr_clone(new_fields[i]);
+                   std::shared_ptr<Field> temp_field = glom_sharedptr_clone(new_fields[i]);
                    temp_field->set_name(TEMP_COLUMN_NAME);
                    // The temporary column must not be primary key as long as the original
                    // (primary key) column is still present, because there cannot be two
@@ -801,7 +801,7 @@ bool MySQL::create_text_file(const std::string& file_uri, const std::string& con
   catch(const Gio::Error& ex)
   {
 #else
-  std::auto_ptr<Gio::Error> error;
+  std::shared_ptr<Gio::Error> error;
   stream.create(error);
   if(error.get())
   {
diff --git a/glom/libglom/connectionpool_backends/postgres.cc 
b/glom/libglom/connectionpool_backends/postgres.cc
index d306c59..47e0ebd 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -187,7 +187,7 @@ bool Postgres::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connec
                  if(old_fields[i]->get_field_info()->get_g_type() != 
new_fields[i]->get_field_info()->get_g_type())
                  {
                    // Create a temporary column
-                   sharedptr<Field> temp_field = glom_sharedptr_clone(new_fields[i]);
+                   std::shared_ptr<Field> temp_field = glom_sharedptr_clone(new_fields[i]);
                    temp_field->set_name(TEMP_COLUMN_NAME);
                    // The temporary column must not be primary key as long as the original
                    // (primary key) column is still present, because there cannot be two
@@ -889,7 +889,7 @@ bool Postgres::create_text_file(const std::string& file_uri, const std::string&
   catch(const Gio::Error& ex)
   {
 #else
-  std::auto_ptr<Gio::Error> error;
+  std::shared_ptr<Gio::Error> error;
   stream.create(error);
   if(error.get())
   {
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 683789a..18feec4 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -156,7 +156,7 @@ bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::Serve
   return true;
 }
 
-bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, 
const sharedptr<const Field>& column, unsigned int i)
+bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, 
const std::shared_ptr<const Field>& column, unsigned int i)
 {
   //TODO: Quote column name?
   const Glib::ustring name_path = Glib::ustring::compose("/FIELDS_A/@COLUMN_NAME/%1", i);
@@ -297,7 +297,7 @@ bool Sqlite::recreate_table(const Glib::RefPtr<Gnome::Gda::Connection>& connecti
   {
     // Add new fields to the table. Fields that have changed have already
     // been handled above.
-    const sharedptr<const Field>& field = *iter;
+    const std::shared_ptr<const Field>& field = *iter;
     type_vec_strings::const_iterator removed_iter = std::find(fields_removed.begin(), fields_removed.end(), 
field->get_name());
     if(removed_iter == fields_removed.end())
     {
@@ -376,7 +376,7 @@ bool Sqlite::recreate_table(const Glib::RefPtr<Gnome::Gda::Connection>& connecti
   return false;
 }
 
-bool Sqlite::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const sharedptr<const Field>& field)
+bool Sqlite::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const std::shared_ptr<const Field>& field)
 {
   // Sqlite does not support adding primary key columns. So recreate the table
   // in that case.
diff --git a/glom/libglom/connectionpool_backends/sqlite.h b/glom/libglom/connectionpool_backends/sqlite.h
index 6726743..e071e5a 100644
--- a/glom/libglom/connectionpool_backends/sqlite.h
+++ b/glom/libglom/connectionpool_backends/sqlite.h
@@ -43,15 +43,15 @@ private:
   virtual const char* get_public_schema_name() const;
 
   bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, 
GdaMetaTableColumn* column, unsigned int i);
-  bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, const 
sharedptr<const Field>& column, unsigned int i);
+  bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, const 
std::shared_ptr<const Field>& column, unsigned int i);
 
   typedef std::vector<Glib::ustring> type_vec_strings;
-  //typedef std::vector<sharedptr<const Field> > type_vec_fields;
-  typedef std::map<Glib::ustring, sharedptr<const Field> > type_mapFieldChanges;
+  //typedef std::vector<std::shared_ptr<const Field> > type_vec_fields;
+  typedef std::map<Glib::ustring, std::shared_ptr<const Field> > type_mapFieldChanges;
 
   bool recreate_table(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const type_vec_strings& fields_removed, const type_vec_const_fields& fields_added, const 
type_mapFieldChanges& fields_changed) throw();
 
-  virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const sharedptr<const Field>& field);
+  virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const std::shared_ptr<const Field>& field);
   virtual bool drop_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const Glib::ustring& field_name);
   virtual bool change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& 
table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields) throw();
 
diff --git a/glom/libglom/data_structure/database_title.h b/glom/libglom/data_structure/database_title.h
index afa4410..46175b2 100644
--- a/glom/libglom/data_structure/database_title.h
+++ b/glom/libglom/data_structure/database_title.h
@@ -27,7 +27,7 @@ namespace Glom
 {
 
 /** This is a separate class, instead of just deriving Document from 
- * TranslatableItem, to avoid the need to use Document via sharedptr.
+ * TranslatableItem, to avoid the need to use Document via std::shared_ptr.
  */
 class DatabaseTitle
  : public TranslatableItem
diff --git a/glom/libglom/data_structure/field.cc b/glom/libglom/data_structure/field.cc
index 927fb6f..2547843 100644
--- a/glom/libglom/data_structure/field.cc
+++ b/glom/libglom/data_structure/field.cc
@@ -200,12 +200,12 @@ void Field::set_field_info(const Glib::RefPtr<Gnome::Gda::Column>& fieldinfo)
   }
 }
 
-sharedptr<Relationship> Field::get_lookup_relationship() const
+std::shared_ptr<Relationship> Field::get_lookup_relationship() const
 {
   return m_lookup_relationship;
 }
 
-void Field::set_lookup_relationship(const sharedptr<Relationship>& relationship)
+void Field::set_lookup_relationship(const std::shared_ptr<Relationship>& relationship)
 {
   m_lookup_relationship = relationship;
 }
diff --git a/glom/libglom/data_structure/field.h b/glom/libglom/data_structure/field.h
index e734a2c..890c030 100644
--- a/glom/libglom/data_structure/field.h
+++ b/glom/libglom/data_structure/field.h
@@ -54,12 +54,12 @@ public:
     return (element.get_name() == m_strName);
   }
 
-  bool operator() (const sharedptr<T_Element>& element)
+  bool operator() (const std::shared_ptr<T_Element>& element)
   {
     return (element->get_name() == m_strName);
   }
 
-  bool operator() (const sharedptr<const T_Element>& element)
+  bool operator() (const std::shared_ptr<const T_Element>& element)
   {
     return (element->get_name() == m_strName);
   }
@@ -150,8 +150,8 @@ public:
   //Lookup stuff:
   bool get_is_lookup() const;
 
-  sharedptr<Relationship> get_lookup_relationship() const;
-  void set_lookup_relationship(const sharedptr<Relationship>& strRelationship);
+  std::shared_ptr<Relationship> get_lookup_relationship() const;
+  void set_lookup_relationship(const std::shared_ptr<Relationship>& strRelationship);
 
   Glib::ustring get_lookup_field() const;
   void set_lookup_field(const Glib::ustring& strField);
@@ -251,7 +251,7 @@ private:
   glom_field_type m_glom_type;
   Glib::RefPtr<Gnome::Gda::Column> m_field_info;
 
-  sharedptr<Relationship> m_lookup_relationship;
+  std::shared_ptr<Relationship> m_lookup_relationship;
   Glib::ustring m_strLookupField;
   Glib::ustring m_calculation;
   bool m_visible; //Whether it will be shown to the user.
diff --git a/glom/libglom/data_structure/foundset.h b/glom/libglom/data_structure/foundset.h
index e2b3f62..56e995c 100644
--- a/glom/libglom/data_structure/foundset.h
+++ b/glom/libglom/data_structure/foundset.h
@@ -44,12 +44,12 @@ public:
   bool operator==(const FoundSet& src) const;
 
   Glib::ustring m_table_name;
-  sharedptr<const Relationship> m_extra_join; // Only used for doubly-related related records (portals), in 
which case the WHERE clause is also slightly different.
+  std::shared_ptr<const Relationship> m_extra_join; // Only used for doubly-related related records 
(portals), in which case the WHERE clause is also slightly different.
   Gnome::Gda::SqlExpr m_where_clause;
 
   //TODO: Avoid duplication with types in Formatting.
   ///field, ascending
-  typedef std::pair< sharedptr<const LayoutItem_Field>, bool> type_pair_sort_field;
+  typedef std::pair< std::shared_ptr<const LayoutItem_Field>, bool> type_pair_sort_field;
   typedef std::vector<type_pair_sort_field> type_sort_clause;
   type_sort_clause m_sort_clause;
 };
diff --git a/glom/libglom/data_structure/has_title_singular.cc 
b/glom/libglom/data_structure/has_title_singular.cc
index 34acfda..6a0b430 100644
--- a/glom/libglom/data_structure/has_title_singular.cc
+++ b/glom/libglom/data_structure/has_title_singular.cc
@@ -96,7 +96,7 @@ Glib::ustring HasTitleSingular::get_title_singular_with_fallback(const Glib::ust
 void HasTitleSingular::set_title_singular(const Glib::ustring& title, const Glib::ustring& locale)
 {
   if(!m_title_singular)
-    m_title_singular = sharedptr<TranslatableItem>::create();
+    m_title_singular = std::shared_ptr<TranslatableItem>(new TranslatableItem());
 
   m_title_singular->set_title(title, locale);
 }
diff --git a/glom/libglom/data_structure/has_title_singular.h 
b/glom/libglom/data_structure/has_title_singular.h
index 9076ea0..a9f722b 100644
--- a/glom/libglom/data_structure/has_title_singular.h
+++ b/glom/libglom/data_structure/has_title_singular.h
@@ -64,7 +64,7 @@ public:
   /** For instance, "Customer" if the table is titled "Customers".
    * This is useful in some UI strings.
    */
-  sharedptr<TranslatableItem> m_title_singular;
+  std::shared_ptr<TranslatableItem> m_title_singular;
 };
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/layout/formatting.cc 
b/glom/libglom/data_structure/layout/formatting.cc
index ad7f488..3841268 100644
--- a/glom/libglom/data_structure/layout/formatting.cc
+++ b/glom/libglom/data_structure/layout/formatting.cc
@@ -210,7 +210,7 @@ Glib::ustring Formatting::get_custom_choice_original_for_translated_text(const G
 {
   for(Formatting::type_list_values::const_iterator iter = m_choices_custom_list.begin(); iter != 
m_choices_custom_list.end(); ++iter)
   {
-    const sharedptr<const ChoiceValue> value = *iter;
+    const std::shared_ptr<const ChoiceValue> value = *iter;
     if(!value)
       continue;
 
@@ -225,7 +225,7 @@ Glib::ustring Formatting::get_custom_choice_translated(const Glib::ustring& orig
 {
   for(Formatting::type_list_values::const_iterator iter = m_choices_custom_list.begin(); iter != 
m_choices_custom_list.end(); ++iter)
   {
-    const sharedptr<const ChoiceValue> value = *iter;
+    const std::shared_ptr<const ChoiceValue> value = *iter;
     if(!value)
       continue;
 
@@ -267,7 +267,7 @@ bool Formatting::get_has_related_choices() const
 bool Formatting::get_has_related_choices(bool& show_all, bool& with_second) const
 {
   show_all = m_choices_related_show_all;
-  with_second = m_choices_extra_layout_group;
+  with_second = (bool)m_choices_extra_layout_group;
   return m_choices_related;
 }
 
@@ -276,7 +276,7 @@ void Formatting::set_has_related_choices(bool val)
   m_choices_related = val;
 }
 
-void Formatting::set_choices_related(const sharedptr<const Relationship>& relationship, const 
sharedptr<LayoutItem_Field>& field, const sharedptr<LayoutGroup>& extra_layout, const type_list_sort_fields& 
sort_fields, bool show_all)
+void Formatting::set_choices_related(const std::shared_ptr<const Relationship>& relationship, const 
std::shared_ptr<LayoutItem_Field>& field, const std::shared_ptr<LayoutGroup>& extra_layout, const 
type_list_sort_fields& sort_fields, bool show_all)
 {
   set_relationship(relationship);
 
@@ -286,7 +286,7 @@ void Formatting::set_choices_related(const sharedptr<const Relationship>& relati
   m_choices_related_show_all = show_all;
 }
 
-void Formatting::get_choices_related(sharedptr<const Relationship>& relationship, sharedptr<const 
LayoutItem_Field>& field, sharedptr<const LayoutGroup>& extra_layout, type_list_sort_fields& sort_fields, 
bool& show_all) const
+void Formatting::get_choices_related(std::shared_ptr<const Relationship>& relationship, 
std::shared_ptr<const LayoutItem_Field>& field, std::shared_ptr<const LayoutGroup>& extra_layout, 
type_list_sort_fields& sort_fields, bool& show_all) const
 {
   relationship = get_relationship();
 
@@ -297,7 +297,7 @@ void Formatting::get_choices_related(sharedptr<const Relationship>& relationship
 }
 
 
-void Formatting::get_choices_related(sharedptr<const Relationship>& relationship, 
sharedptr<LayoutItem_Field>& field, sharedptr<LayoutGroup>& extra_layout, type_list_sort_fields& sort_fields, 
bool& show_all)
+void Formatting::get_choices_related(std::shared_ptr<const Relationship>& relationship, 
std::shared_ptr<LayoutItem_Field>& field, std::shared_ptr<LayoutGroup>& extra_layout, type_list_sort_fields& 
sort_fields, bool& show_all)
 {
   relationship = get_relationship();
 
@@ -307,7 +307,7 @@ void Formatting::get_choices_related(sharedptr<const Relationship>& relationship
   show_all = m_choices_related_show_all;
 }
 
-sharedptr<const Relationship> Formatting::get_choices_related_relationship(bool& show_all) const
+std::shared_ptr<const Relationship> Formatting::get_choices_related_relationship(bool& show_all) const
 {
   show_all = m_choices_related_show_all;
   return get_relationship();
@@ -318,7 +318,7 @@ bool Formatting::change_field_item_name(const Glib::ustring& table_name, const G
   if(!m_choices_related_field)
     return false; //Nothing changed.
 
-  sharedptr<const Relationship> relationship = get_relationship();
+  std::shared_ptr<const Relationship> relationship = get_relationship();
   
   const Glib::ustring field_table = 
     m_choices_related_field->get_table_used( relationship->get_to_table() );
diff --git a/glom/libglom/data_structure/layout/formatting.h b/glom/libglom/data_structure/layout/formatting.h
index d672e27..e0e805a 100644
--- a/glom/libglom/data_structure/layout/formatting.h
+++ b/glom/libglom/data_structure/layout/formatting.h
@@ -56,7 +56,7 @@ public:
   bool get_has_custom_choices() const;
   void set_has_custom_choices(bool val = true);
 
-  typedef std::vector< sharedptr<ChoiceValue> > type_list_values;
+  typedef std::vector< std::shared_ptr<ChoiceValue> > type_list_values;
   virtual type_list_values get_choices_custom() const;
   virtual void set_choices_custom(const type_list_values& choices);
 
@@ -70,7 +70,7 @@ public:
    */
   Glib::ustring get_custom_choice_translated(const Glib::ustring& original_text, const Glib::ustring& locale 
= Glib::ustring()) const;
 
-  typedef std::pair< sharedptr<const LayoutItem_Field>, bool /* is_ascending */> type_pair_sort_field;
+  typedef std::pair< std::shared_ptr<const LayoutItem_Field>, bool /* is_ascending */> type_pair_sort_field;
   typedef std::vector<type_pair_sort_field> type_list_sort_fields;
 
   /** Discover whether the entered data should only be one of the available
@@ -87,12 +87,12 @@ public:
   //TODO: Add a ChoicesRelated class?
 
   
-  void get_choices_related(sharedptr<const Relationship>& relationship, sharedptr<LayoutItem_Field>& field, 
sharedptr<LayoutGroup>& extra_layout, type_list_sort_fields& sort_fields, bool& show_all);
-  void get_choices_related(sharedptr<const Relationship>& relationship, sharedptr<const LayoutItem_Field>& 
field, sharedptr<const LayoutGroup>& extra_layout, type_list_sort_fields& sort_fields, bool& show_all) const;
-  void set_choices_related(const sharedptr<const Relationship>& relationship_name, const 
sharedptr<LayoutItem_Field>& field, const sharedptr<LayoutGroup>& extra_layout, const type_list_sort_fields& 
sort_fields, bool show_all);
+  void get_choices_related(std::shared_ptr<const Relationship>& relationship, 
std::shared_ptr<LayoutItem_Field>& field, std::shared_ptr<LayoutGroup>& extra_layout, type_list_sort_fields& 
sort_fields, bool& show_all);
+  void get_choices_related(std::shared_ptr<const Relationship>& relationship, std::shared_ptr<const 
LayoutItem_Field>& field, std::shared_ptr<const LayoutGroup>& extra_layout, type_list_sort_fields& 
sort_fields, bool& show_all) const;
+  void set_choices_related(const std::shared_ptr<const Relationship>& relationship_name, const 
std::shared_ptr<LayoutItem_Field>& field, const std::shared_ptr<LayoutGroup>& extra_layout, const 
type_list_sort_fields& sort_fields, bool show_all);
 
   //Just for convenience:
-  sharedptr<const Relationship> get_choices_related_relationship(bool& show_all) const;
+  std::shared_ptr<const Relationship> get_choices_related_relationship(bool& show_all) const;
 
 
 
@@ -195,8 +195,8 @@ private:
   Glib::ustring m_text_color_foreground, m_text_color_background;
   HorizontalAlignment m_horizontal_alignment;
 
-  sharedptr<LayoutItem_Field> m_choices_related_field;
-  sharedptr<LayoutGroup> m_choices_extra_layout_group;
+  std::shared_ptr<LayoutItem_Field> m_choices_related_field;
+  std::shared_ptr<LayoutGroup> m_choices_extra_layout_group;
   type_list_sort_fields m_choices_related_sort_fields;
   bool m_choices_related_show_all;
 };
diff --git a/glom/libglom/data_structure/layout/layoutgroup.cc 
b/glom/libglom/data_structure/layout/layoutgroup.cc
index 8e107b9..ca7a643 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.cc
+++ b/glom/libglom/data_structure/layout/layoutgroup.cc
@@ -89,8 +89,8 @@ bool LayoutGroup::has_field(const Glib::ustring& parent_table_name, const Glib::
 {
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> item = *iter;
-    sharedptr<LayoutItem_Field> field_item = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iter;
+    std::shared_ptr<LayoutItem_Field> field_item = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(field_item)
     {
       if( (field_item->get_name() == field_name) &&
@@ -102,7 +102,7 @@ bool LayoutGroup::has_field(const Glib::ustring& parent_table_name, const Glib::
     else
     {
       //Recurse into the child groups:
-      sharedptr<LayoutGroup> group_item = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> group_item = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(group_item)
       {
         if(group_item->has_field(parent_table_name, table_name, field_name))
@@ -118,8 +118,8 @@ bool LayoutGroup::has_any_fields() const
 {
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> item = *iter;
-    sharedptr<LayoutItem_Field> field_item = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iter;
+    std::shared_ptr<LayoutItem_Field> field_item = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(field_item)
     {
       return true;
@@ -127,7 +127,7 @@ bool LayoutGroup::has_any_fields() const
     else
     {
       //Recurse into the child groups:
-      sharedptr<LayoutGroup> group_item = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> group_item = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(group_item)
       {
         if(group_item->has_any_fields())
@@ -139,15 +139,15 @@ bool LayoutGroup::has_any_fields() const
   return false;
 }
 
-void LayoutGroup::add_item(const sharedptr<LayoutItem>& item)
+void LayoutGroup::add_item(const std::shared_ptr<LayoutItem>& item)
 {
   m_list_items.push_back(item);
 }
 
-void LayoutGroup::add_item(const sharedptr<LayoutItem>& item, const sharedptr<const LayoutItem>& position)
+void LayoutGroup::add_item(const std::shared_ptr<LayoutItem>& item, const std::shared_ptr<const LayoutItem>& 
position)
 {
   //Find the position of the item.
-  sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(position);
+  std::shared_ptr<LayoutItem> unconst = std::const_pointer_cast<LayoutItem>(position);
   type_list_items::iterator iter = std::find(m_list_items.begin(), m_list_items.end(), unconst);
 
   //std::vector::insert() adds before rather than after:
@@ -157,9 +157,9 @@ void LayoutGroup::add_item(const sharedptr<LayoutItem>& item, const sharedptr<co
   m_list_items.insert(iter, item);
 }
 
-void LayoutGroup::remove_item (const sharedptr<LayoutItem>& item)
+void LayoutGroup::remove_item (const std::shared_ptr<LayoutItem>& item)
 {
-  sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(item);
+  std::shared_ptr<LayoutItem> unconst = std::const_pointer_cast<LayoutItem>(item);
   type_list_items::iterator iter = std::find(m_list_items.begin(), m_list_items.end(), unconst);
   m_list_items.erase(iter);
 }
@@ -189,9 +189,9 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive() const
 
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> item = *iter;
+    const std::shared_ptr<const LayoutItem> item = *iter;
     
-    sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
     if(group)
     {
       const type_list_const_items sub_result = group->get_items_recursive();
@@ -210,9 +210,9 @@ LayoutGroup::type_list_items LayoutGroup::get_items_recursive()
 
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    const sharedptr<LayoutItem> item = *iter;
+    const std::shared_ptr<LayoutItem> item = *iter;
     
-    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(item);
     if(group)
     {
       const type_list_items sub_result = group->get_items_recursive();
@@ -231,12 +231,12 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive_with_groups(
 
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> item = *iter;
+    const std::shared_ptr<const LayoutItem> item = *iter;
     
     //Add the item itself:
     result.push_back(item);
     
-    sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
     if(group)
     {
       const type_list_const_items sub_result = group->get_items_recursive_with_groups();
@@ -247,13 +247,13 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive_with_groups(
   return result;
 }
 
-void LayoutGroup::remove_relationship(const sharedptr<const Relationship>& relationship)
+void LayoutGroup::remove_relationship(const std::shared_ptr<const Relationship>& relationship)
 {
   LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin();
   while(iterItem != m_list_items.end())
   {
-    sharedptr<LayoutItem> item = *iterItem;
-    sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iterItem;
+    std::shared_ptr<UsesRelationship> uses_rel = std::dynamic_pointer_cast<UsesRelationship>(item);
     if(uses_rel)
     {
       if(uses_rel->get_has_relationship_name())
@@ -267,7 +267,7 @@ void LayoutGroup::remove_relationship(const sharedptr<const Relationship>& relat
       }
     }
 
-    sharedptr<LayoutGroup> sub_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutGroup> sub_group = std::dynamic_pointer_cast<LayoutGroup>(item);
     if(sub_group)
       sub_group->remove_relationship(relationship);
 
@@ -281,8 +281,8 @@ void LayoutGroup::remove_field(const Glib::ustring& parent_table_name, const Gli
   LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin();
   while(iterItem != m_list_items.end())
   {
-    sharedptr<LayoutItem> item = *iterItem;
-    sharedptr<LayoutItem_Field> field_item = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iterItem;
+    std::shared_ptr<LayoutItem_Field> field_item = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(field_item)
     {
       if(field_item->get_table_used(parent_table_name) == table_name)
@@ -297,7 +297,7 @@ void LayoutGroup::remove_field(const Glib::ustring& parent_table_name, const Gli
     }
     else
     {
-      sharedptr<LayoutGroup> sub_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> sub_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(sub_group)
         sub_group->remove_field(parent_table_name, table_name, field_name);
     }
@@ -311,13 +311,13 @@ void LayoutGroup::change_related_field_item_name(const Glib::ustring& table_name
   //Look at each item:
   for(LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin(); iterItem != 
m_list_items.end(); ++iterItem)
   {
-    sharedptr<LayoutItem> item = *iterItem;
-    sharedptr<LayoutItem_Field> field_item = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iterItem;
+    std::shared_ptr<LayoutItem_Field> field_item = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(field_item)
     {
       if(field_item->get_has_relationship_name()) //If it's related table.
       {
-        sharedptr<const Relationship> relationship = field_item->get_relationship();
+        std::shared_ptr<const Relationship> relationship = field_item->get_relationship();
         if(relationship)
         {
           if(relationship->get_to_table() == table_name)
@@ -330,7 +330,7 @@ void LayoutGroup::change_related_field_item_name(const Glib::ustring& table_name
     }
     else
     {
-      sharedptr<LayoutGroup> sub_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> sub_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(sub_group)
         sub_group->change_field_item_name(table_name, field_name, field_name_new);
     }
@@ -342,16 +342,16 @@ void LayoutGroup::change_field_item_name(const Glib::ustring& table_name, const
   //Look at each item:
   for(LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin(); iterItem != 
m_list_items.end(); ++iterItem)
   {
-    sharedptr<LayoutItem> item = *iterItem;
-    sharedptr<LayoutItem_Field> field_item = 
-      sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iterItem;
+    std::shared_ptr<LayoutItem_Field> field_item = 
+      std::dynamic_pointer_cast<LayoutItem_Field>(item);
     
     //Field layout items:
     if(field_item)
     {
       if(field_item->get_has_relationship_name()) //If it's a related table (this would be a 
self-relationship)
       {
-        sharedptr<const Relationship> rel = field_item->get_relationship();
+        std::shared_ptr<const Relationship> rel = field_item->get_relationship();
         if(rel)
         {
           if(rel->get_to_table() == table_name)
@@ -370,8 +370,8 @@ void LayoutGroup::change_field_item_name(const Glib::ustring& table_name, const
     else
     {
       //Formatting:
-      sharedptr<LayoutItem_WithFormatting> with_formatting = 
-        sharedptr<LayoutItem_WithFormatting>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_WithFormatting> with_formatting = 
+        std::dynamic_pointer_cast<LayoutItem_WithFormatting>(item);
       if(with_formatting)
       {
         Formatting& formatting = with_formatting->m_formatting;
@@ -379,7 +379,7 @@ void LayoutGroup::change_field_item_name(const Glib::ustring& table_name, const
       }
    
       //Recurse into sub-groups:
-      sharedptr<LayoutGroup> sub_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> sub_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(sub_group)
         sub_group->change_field_item_name(table_name, field_name, field_name_new);
     }
@@ -442,12 +442,12 @@ void LayoutGroup::debug(guint level) const
 
   for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(*iter);
+    std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(*iter);
     if(group)
       group->debug(level + 1);
     else
     {
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(*iter);
+      std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(*iter);
       if(field)
       {
         for(int i = 0; i < level; ++i)
diff --git a/glom/libglom/data_structure/layout/layoutgroup.h 
b/glom/libglom/data_structure/layout/layoutgroup.h
index 3d91fff..35ec332 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.h
+++ b/glom/libglom/data_structure/layout/layoutgroup.h
@@ -57,18 +57,18 @@ public:
   /** Add the item to the end of the list.
    * @param item The item to add.
    */
-  void add_item(const sharedptr<LayoutItem>& item);
+  void add_item(const std::shared_ptr<LayoutItem>& item);
 
   /** Add the item after the specified existing item.
    * @param item The item to add.
    * @param position The item after which the item should be added.
    */
-  void add_item(const sharedptr<LayoutItem>& item, const sharedptr<const LayoutItem>& position);
+  void add_item(const std::shared_ptr<LayoutItem>& item, const std::shared_ptr<const LayoutItem>& position);
 
   /** Remove a layout item from the group
    * @param item The item to remove.
    */
-  void remove_item(const sharedptr<LayoutItem>& item);
+  void remove_item(const std::shared_ptr<LayoutItem>& item);
   
   /** Remove any instance of the field from the layout.
    *
@@ -84,7 +84,7 @@ public:
 
   /** Remove any use of the relationship from the layout.
    */
-  virtual void remove_relationship(const sharedptr<const Relationship>& relationship);
+  virtual void remove_relationship(const std::shared_ptr<const Relationship>& relationship);
 
 
   void remove_all_items();
@@ -99,10 +99,10 @@ public:
   guint get_columns_count() const;
   void set_columns_count(guint columns_count);
 
-  typedef std::vector< sharedptr<LayoutItem> > type_list_items;
+  typedef std::vector< std::shared_ptr<LayoutItem> > type_list_items;
   type_list_items get_items();
 
-  typedef std::vector< sharedptr<const LayoutItem> > type_list_const_items;
+  typedef std::vector< std::shared_ptr<const LayoutItem> > type_list_const_items;
   type_list_const_items get_items() const;
 
   /** Get the items recursively, depth-first, not returning any groups.
diff --git a/glom/libglom/data_structure/layout/layoutitem_calendarportal.cc 
b/glom/libglom/data_structure/layout/layoutitem_calendarportal.cc
index a3ca61e..9de76a3 100644
--- a/glom/libglom/data_structure/layout/layoutitem_calendarportal.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_calendarportal.cc
@@ -68,23 +68,23 @@ void LayoutItem_CalendarPortal::change_field_item_name(const Glib::ustring& tabl
 {
   LayoutItem_Portal::change_field_item_name(table_name, field_name, field_name_new);
   
-  sharedptr<const Relationship> relationship = get_relationship();
+  std::shared_ptr<const Relationship> relationship = get_relationship();
         
   if(relationship && (relationship->get_to_table() == table_name) && (m_date_field->get_name() == 
field_name))
       m_date_field->set_name(field_name_new); //Change it.
 }
 
-sharedptr<Field> LayoutItem_CalendarPortal::get_date_field()
+std::shared_ptr<Field> LayoutItem_CalendarPortal::get_date_field()
 {
   return m_date_field;
 }
 
-sharedptr<const Field> LayoutItem_CalendarPortal::get_date_field() const
+std::shared_ptr<const Field> LayoutItem_CalendarPortal::get_date_field() const
 {
   return m_date_field;
 }
 
-void LayoutItem_CalendarPortal::set_date_field(const sharedptr<Field>& field)
+void LayoutItem_CalendarPortal::set_date_field(const std::shared_ptr<Field>& field)
 {
   m_date_field = field;
 }
diff --git a/glom/libglom/data_structure/layout/layoutitem_calendarportal.h 
b/glom/libglom/data_structure/layout/layoutitem_calendarportal.h
index e5280b5..766636d 100644
--- a/glom/libglom/data_structure/layout/layoutitem_calendarportal.h
+++ b/glom/libglom/data_structure/layout/layoutitem_calendarportal.h
@@ -39,17 +39,17 @@ public:
 
   virtual Glib::ustring get_part_type_name() const;
 
-  sharedptr<Field> get_date_field();
-  sharedptr<const Field> get_date_field() const;
+  std::shared_ptr<Field> get_date_field();
+  std::shared_ptr<const Field> get_date_field() const;
     
-  void set_date_field(const sharedptr<Field>& field);
+  void set_date_field(const std::shared_ptr<Field>& field);
     
   virtual void change_field_item_name(const Glib::ustring& table_name, const Glib::ustring& field_name, 
const Glib::ustring& field_name_new);
   virtual void change_related_field_item_name(const Glib::ustring& table_name, const Glib::ustring& 
field_name, const Glib::ustring& field_name_new);
 
 
 private:
-  sharedptr<Field> m_date_field;
+  std::shared_ptr<Field> m_date_field;
 };
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/layout/layoutitem_field.cc 
b/glom/libglom/data_structure/layout/layoutitem_field.cc
index e466feb..b8272c8 100644
--- a/glom/libglom/data_structure/layout/layoutitem_field.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_field.cc
@@ -179,7 +179,7 @@ bool LayoutItem_Field::get_editable_and_allowed() const
   //The relationship might forbid editing of any fields through itself:
   if(get_has_relationship_name())
   {
-    sharedptr<const Relationship> rel = get_relationship();
+    std::shared_ptr<const Relationship> rel = get_relationship();
     if(rel)
     {
       if(!(rel->get_allow_edit()))
@@ -288,7 +288,7 @@ bool LayoutItem_Field::get_formatting_used_has_translatable_choices() const
 }
 
 
-void LayoutItem_Field::set_full_field_details(const sharedptr<const Field>& field)
+void LayoutItem_Field::set_full_field_details(const std::shared_ptr<const Field>& field)
 {
 
   if(field)
@@ -303,12 +303,12 @@ void LayoutItem_Field::set_full_field_details(const sharedptr<const Field>& fiel
   else
   {
     //std::cout << "LayoutItem_Field::set_full_field_details(null): previous name=" << m_name << std::endl;
-    m_field = sharedptr<const Field>();
+    m_field = std::shared_ptr<const Field>();
     m_field_cache_valid = false;
   }
 }
 
-sharedptr<const Field> LayoutItem_Field::get_full_field_details() const
+std::shared_ptr<const Field> LayoutItem_Field::get_full_field_details() const
 {
   return m_field;
 }
@@ -322,22 +322,22 @@ Field::glom_field_type LayoutItem_Field::get_glom_type() const
 }
 
 
-sharedptr<const CustomTitle> LayoutItem_Field::get_title_custom() const
+std::shared_ptr<const CustomTitle> LayoutItem_Field::get_title_custom() const
 {
   return m_title_custom;
 }
 
-sharedptr<CustomTitle> LayoutItem_Field::get_title_custom()
+std::shared_ptr<CustomTitle> LayoutItem_Field::get_title_custom()
 {
   return m_title_custom;
 }
 
-void LayoutItem_Field::set_title_custom(const sharedptr<CustomTitle>& title)
+void LayoutItem_Field::set_title_custom(const std::shared_ptr<CustomTitle>& title)
 {
   m_title_custom = title;
 }
 
-bool LayoutItem_Field::is_same_field(const sharedptr<const LayoutItem_Field>& field) const
+bool LayoutItem_Field::is_same_field(const std::shared_ptr<const LayoutItem_Field>& field) const
 {
   const UsesRelationship* uses_a = this;
   const UsesRelationship* uses_b = &(*field);
diff --git a/glom/libglom/data_structure/layout/layoutitem_field.h 
b/glom/libglom/data_structure/layout/layoutitem_field.h
index c4d3a63..2d0a5ee 100644
--- a/glom/libglom/data_structure/layout/layoutitem_field.h
+++ b/glom/libglom/data_structure/layout/layoutitem_field.h
@@ -38,19 +38,19 @@ template<class T_ElementField, class T_Element = T_ElementField>
 class predicate_LayoutItem_Field_IsSameField
 {
 public:
-  predicate_LayoutItem_Field_IsSameField(const sharedptr<const T_ElementField>& layout_item)
+  predicate_LayoutItem_Field_IsSameField(const std::shared_ptr<const T_ElementField>& layout_item)
   {
     m_layout_item = layout_item;
   }
 
-  bool operator() (const sharedptr<const T_Element>& element)
+  bool operator() (const std::shared_ptr<const T_Element>& element)
   {
     if(!m_layout_item && !element)
       return true;
 
     //Allow this to be used on a container of LayoutItems,
     //as well as just of LayoutItem_Fields.
-    sharedptr<const T_ElementField> element_field = sharedptr<const T_ElementField>::cast_dynamic(element);
+    std::shared_ptr<const T_ElementField> element_field = std::dynamic_pointer_cast<const 
T_ElementField>(element);
     if(!element_field)
       return false;
        
@@ -58,7 +58,7 @@ public:
   }
     
 private:
-  sharedptr<const T_ElementField> m_layout_item;
+  std::shared_ptr<const T_ElementField> m_layout_item;
 };
 
 /** A LayoutItem that shows the data from a table field.
@@ -104,9 +104,9 @@ public:
 
   Glib::ustring get_title_or_name_no_custom(const Glib::ustring& locale) const;
 
-  sharedptr<const CustomTitle> get_title_custom() const;
-  sharedptr<CustomTitle> get_title_custom();
-  void set_title_custom(const sharedptr<CustomTitle>& title);
+  std::shared_ptr<const CustomTitle> get_title_custom() const;
+  std::shared_ptr<CustomTitle> get_title_custom();
+  void set_title_custom(const std::shared_ptr<CustomTitle>& title);
 
   //virtual Glib::ustring get_table_name() const;
   //virtual void set_table_name(const Glib::ustring& table_name);
@@ -119,8 +119,8 @@ public:
 
   virtual Glib::ustring get_report_part_id() const;
 
-  void set_full_field_details(const sharedptr<const Field>& field);
-  sharedptr<const Field> get_full_field_details() const;
+  void set_full_field_details(const std::shared_ptr<const Field>& field);
+  std::shared_ptr<const Field> get_full_field_details() const;
 
   ///Convenience function, to avoid use of get_full_field_details().
   Field::glom_field_type get_glom_type() const;
@@ -169,7 +169,7 @@ public:
 
   /** Compare the name, relationship, and related_relationship.
    */
-  bool is_same_field(const sharedptr<const LayoutItem_Field>& field) const;
+  bool is_same_field(const std::shared_ptr<const LayoutItem_Field>& field) const;
 
 private:
 
@@ -179,12 +179,12 @@ private:
 
 
   //This is just a cache, filled in by looking at the database structure:
-  sharedptr<const Field> m_field;
+  std::shared_ptr<const Field> m_field;
   bool m_field_cache_valid; //Whetehr m_field is up-to-date.
 
   bool m_hidden;
   bool m_formatting_use_default;
-  sharedptr<CustomTitle> m_title_custom; //translatable.
+  std::shared_ptr<CustomTitle> m_title_custom; //translatable.
 };
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.cc 
b/glom/libglom/data_structure/layout/layoutitem_portal.cc
index 4c4e9b9..f0a2b37 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.cc
@@ -89,8 +89,8 @@ void LayoutItem_Portal::change_field_item_name(const Glib::ustring& table_name,
   //Look at each item:
   for(LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin(); iterItem != 
m_list_items.end(); ++iterItem)
   {
-    sharedptr<LayoutItem> item = *iterItem;
-    sharedptr<LayoutItem_Field> field_item = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iterItem;
+    std::shared_ptr<LayoutItem_Field> field_item = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(field_item)
     {
       if(field_item->get_table_used(Glib::ustring()) == table_name) //If it's a related table (this would be 
a self-relationship)
@@ -100,37 +100,37 @@ void LayoutItem_Portal::change_field_item_name(const Glib::ustring& table_name,
       }
       else
       {
-        sharedptr<const Relationship> relationship = get_relationship();
+        std::shared_ptr<const Relationship> relationship = get_relationship();
         if(relationship && (relationship->get_to_table() == table_name) && (field_item->get_name() == 
field_name))
           field_item->set_name(field_name_new); //Change it.
       }
     }
     else
     {
-      sharedptr<LayoutGroup> sub_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> sub_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(sub_group)
         sub_group->change_field_item_name(table_name, field_name, field_name_new);
     }
   }
 }
 
-sharedptr<UsesRelationship> LayoutItem_Portal::get_navigation_relationship_specific()
+std::shared_ptr<UsesRelationship> LayoutItem_Portal::get_navigation_relationship_specific()
 {
   if(get_navigation_type() == LayoutItem_Portal::NAVIGATION_SPECIFIC)
     return m_navigation_relationship_specific;
   else
-    return sharedptr<UsesRelationship>();
+    return std::shared_ptr<UsesRelationship>();
 }
 
-sharedptr<const UsesRelationship> LayoutItem_Portal::get_navigation_relationship_specific() const
+std::shared_ptr<const UsesRelationship> LayoutItem_Portal::get_navigation_relationship_specific() const
 {
   if(get_navigation_type() == LayoutItem_Portal::NAVIGATION_SPECIFIC)
     return m_navigation_relationship_specific;
   else
-    return sharedptr<UsesRelationship>();
+    return std::shared_ptr<UsesRelationship>();
 }
 
-void LayoutItem_Portal::set_navigation_relationship_specific(const sharedptr<UsesRelationship>& relationship)
+void LayoutItem_Portal::set_navigation_relationship_specific(const std::shared_ptr<UsesRelationship>& 
relationship)
 {
   m_navigation_relationship_specific = relationship;
   m_navigation_type = LayoutItem_Portal::NAVIGATION_SPECIFIC;
@@ -138,7 +138,7 @@ void LayoutItem_Portal::set_navigation_relationship_specific(const sharedptr<Use
 
 void LayoutItem_Portal::reset_navigation_relationship()
 {
-    m_navigation_relationship_specific = sharedptr<UsesRelationship>();
+    m_navigation_relationship_specific = std::shared_ptr<UsesRelationship>();
     m_navigation_type = LayoutItem_Portal::NAVIGATION_AUTOMATIC;
 }
 
@@ -146,7 +146,7 @@ Glib::ustring LayoutItem_Portal::get_from_table() const
 {
   Glib::ustring from_table;
 
-  sharedptr<const Relationship> relationship = get_relationship();
+  std::shared_ptr<const Relationship> relationship = get_relationship();
   if(relationship)
     from_table = relationship->get_from_table();
 
@@ -219,12 +219,12 @@ void LayoutItem_Portal::set_print_layout_line_color(const Glib::ustring& color)
   m_print_layout_line_color = color;
 }
 
-void LayoutItem_Portal::get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const 
UsesRelationship>& relationship, const Document* document) const
+void LayoutItem_Portal::get_suitable_table_to_view_details(Glib::ustring& table_name, std::shared_ptr<const 
UsesRelationship>& relationship, const Document* document) const
 {
   //Initialize output parameters:
   table_name = Glib::ustring();
 
-  sharedptr<const UsesRelationship> navigation_relationship;
+  std::shared_ptr<const UsesRelationship> navigation_relationship;
 
   //Check whether a relationship was specified:
   if(get_navigation_type() == LayoutItem_Portal::NAVIGATION_AUTOMATIC)
@@ -283,12 +283,12 @@ void LayoutItem_Portal::get_suitable_table_to_view_details(Glib::ustring& table_
   relationship = navigation_relationship;
 }
 
-sharedptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation_relationship_automatic(const 
Document* document) const
+std::shared_ptr<const UsesRelationship> 
LayoutItem_Portal::get_portal_navigation_relationship_automatic(const Document* document) const
 {
   if(!document)
   {
     std::cerr << G_STRFUNC << ": document was null" << std::endl;
-    return sharedptr<const UsesRelationship>();
+    return std::shared_ptr<const UsesRelationship>();
   }
 
   //If the related table is not hidden then we can just navigate to that:
@@ -296,17 +296,17 @@ sharedptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation_relat
   if(!(document->get_table_is_hidden(direct_related_table_name)))
   {
     //Non-hidden tables can just be shown directly. Navigate to it:
-    return sharedptr<const UsesRelationship>();
+    return std::shared_ptr<const UsesRelationship>();
   }
   else
   {
     //If the related table is hidden,
     //then find a suitable related non-hidden table by finding the first layout field that mentions one:
-    sharedptr<const LayoutItem_Field> field = get_field_is_from_non_hidden_related_record(document);
+    std::shared_ptr<const LayoutItem_Field> field = get_field_is_from_non_hidden_related_record(document);
     if(field)
     {
       return field; //Returns the UsesRelationship base part. (A relationship belonging to the portal's 
related table.)
-      //sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
+      //std::shared_ptr<UsesRelationship> result = std::shared_ptr<UsesRelationship>(new UsesRelationship());
       //result->set_relationship( get_relationship() );
       //result->set_related_relationship( field->get_relationship() );
 
@@ -316,13 +316,13 @@ sharedptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation_relat
     {
       //Instead, find a key field that's used in a relationship,
       //and pretend that we are showing the to field as a related field:
-      sharedptr<const Relationship> used_in_relationship;
-      sharedptr<const LayoutItem_Field> field_identifies = 
get_field_identifies_non_hidden_related_record(used_in_relationship, document);
+      std::shared_ptr<const Relationship> used_in_relationship;
+      std::shared_ptr<const LayoutItem_Field> field_identifies = 
get_field_identifies_non_hidden_related_record(used_in_relationship, document);
       if(field_identifies)
       {
-        sharedptr<UsesRelationship> result = sharedptr<UsesRelationship>::create();
+        std::shared_ptr<UsesRelationship> result = std::shared_ptr<UsesRelationship>(new UsesRelationship());
 
-        sharedptr<Relationship> rel_nonconst = sharedptr<Relationship>::cast_const(used_in_relationship);
+        std::shared_ptr<Relationship> rel_nonconst = 
std::const_pointer_cast<Relationship>(used_in_relationship);
         result->set_relationship(rel_nonconst);
 
         return result;
@@ -331,13 +331,13 @@ sharedptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation_relat
   }
 
   //There was no suitable related table to show:
-  return sharedptr<const UsesRelationship>();
+  return std::shared_ptr<const UsesRelationship>();
 }
 
-sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_is_from_non_hidden_related_record(const 
Document* document) const
+std::shared_ptr<const LayoutItem_Field> LayoutItem_Portal::get_field_is_from_non_hidden_related_record(const 
Document* document) const
 {
   //Find the first field that is from a non-hidden related table.
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   if(!document)
   {
@@ -350,7 +350,7 @@ sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_is_from_non_hidde
   LayoutItem_Portal::type_list_const_items items = get_items();
   for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const LayoutItem_Field>(*iter);
     if(field)
     {
       if(field->get_has_relationship_name())
@@ -366,10 +366,10 @@ sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_is_from_non_hidde
   return result;
 }
 
-sharedptr<const LayoutItem_Field> 
LayoutItem_Portal::get_field_identifies_non_hidden_related_record(sharedptr<const Relationship>& 
used_in_relationship, const Document* document) const
+std::shared_ptr<const LayoutItem_Field> 
LayoutItem_Portal::get_field_identifies_non_hidden_related_record(std::shared_ptr<const Relationship>& 
used_in_relationship, const Document* document) const
 {
   //Find the first field that is from a non-hidden related table.
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   if(!document)
   {
@@ -382,10 +382,10 @@ sharedptr<const LayoutItem_Field> LayoutItem_Portal::get_field_identifies_non_hi
   LayoutItem_Portal::type_list_const_items items = get_items();
   for(LayoutItem_Portal::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const LayoutItem_Field>(*iter);
     if(field && !(field->get_has_relationship_name()))
     {
-      sharedptr<const Relationship> relationship = 
document->get_field_used_in_relationship_to_one(parent_table_name, field);
+      std::shared_ptr<const Relationship> relationship = 
document->get_field_used_in_relationship_to_one(parent_table_name, field);
       if(relationship)
       {
         const Glib::ustring table_name = relationship->get_to_table();
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.h 
b/glom/libglom/data_structure/layout/layoutitem_portal.h
index c29f10c..fcb936c 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.h
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.h
@@ -70,17 +70,17 @@ public:
   /** Gets the relationship to use for navigation if get_navigation_type() is 
    * NAVIGATION_NONE.
    */
-  sharedptr<UsesRelationship> get_navigation_relationship_specific();
+  std::shared_ptr<UsesRelationship> get_navigation_relationship_specific();
 
   /** Get the @a relationship to use for navigation if get_navigation_type() is 
    * NAVIGATION_NONE.
    */
-  sharedptr<const UsesRelationship> get_navigation_relationship_specific() const;
+  std::shared_ptr<const UsesRelationship> get_navigation_relationship_specific() const;
 
   /** Set the @a relationship to use for navigation if get_navigation_type() is 
    * NAVIGATION_NONE.
    */
-  void set_navigation_relationship_specific(const sharedptr<UsesRelationship>& relationship);
+  void set_navigation_relationship_specific(const std::shared_ptr<UsesRelationship>& relationship);
 
   void reset_navigation_relationship();
 
@@ -111,13 +111,13 @@ public:
    * @param table_name The table that should be shown.
    * @param relationship The relationship in the directly related table that should be used to get to that 
table. If this is empty then we should just show the table directly.
    */
-  void get_suitable_table_to_view_details(Glib::ustring& table_name, sharedptr<const UsesRelationship>& 
relationship, const Document* document) const;
+  void get_suitable_table_to_view_details(Glib::ustring& table_name, std::shared_ptr<const 
UsesRelationship>& relationship, const Document* document) const;
 
   /** Get the relationship (from the related table) into which the row button should navigate,
    * or none if it should use the portal's directly related table itself.
    * (If that should be chosen automatically, by looking at the fields in the portal.)
    */
-  sharedptr<const UsesRelationship> get_portal_navigation_relationship_automatic(const Document* document) 
const;
+  std::shared_ptr<const UsesRelationship> get_portal_navigation_relationship_automatic(const Document* 
document) const;
 
   /// This is used only for the print layouts.
   double get_print_layout_row_height() const;
@@ -155,11 +155,11 @@ public:
 
 private:
 
-  sharedptr<const LayoutItem_Field> get_field_is_from_non_hidden_related_record(const Document* document) 
const;
-  sharedptr<const LayoutItem_Field> get_field_identifies_non_hidden_related_record(sharedptr<const 
Relationship>& used_in_relationship, const Document* document) const;
+  std::shared_ptr<const LayoutItem_Field> get_field_is_from_non_hidden_related_record(const Document* 
document) const;
+  std::shared_ptr<const LayoutItem_Field> 
get_field_identifies_non_hidden_related_record(std::shared_ptr<const Relationship>& used_in_relationship, 
const Document* document) const;
 
 
-  sharedptr<UsesRelationship> m_navigation_relationship_specific;
+  std::shared_ptr<UsesRelationship> m_navigation_relationship_specific;
 
   // This is used only for the print layouts.
   double m_print_layout_row_height;
diff --git a/glom/libglom/data_structure/layout/layoutitem_text.cc 
b/glom/libglom/data_structure/layout/layoutitem_text.cc
index 1fab274..50c95f3 100644
--- a/glom/libglom/data_structure/layout/layoutitem_text.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_text.cc
@@ -27,15 +27,15 @@ namespace Glom
 LayoutItem_Text::LayoutItem_Text()
 {
   m_translatable_item_type = TRANSLATABLE_TYPE_TEXTOBJECT;
-  m_text = sharedptr<StaticText>::create(); //TODO: Why use a smartpointer?
+  m_text = std::shared_ptr<StaticText>(new StaticText()); //TODO: Why use a smartpointer?
 }
 
 LayoutItem_Text::LayoutItem_Text(const LayoutItem_Text& src)
 : LayoutItem_WithFormatting(src)
 {
-  //Copy the underlying TranslatableItem, not the sharedptr to it:
+  //Copy the underlying TranslatableItem, not the std::shared_ptr to it:
   const StaticText& src_item = *(src.m_text);
-  m_text = sharedptr<StaticText>(new StaticText(src_item));
+  m_text = std::shared_ptr<StaticText>(new StaticText(src_item));
 }
 
 LayoutItem_Text::~LayoutItem_Text()
@@ -62,7 +62,7 @@ LayoutItem_Text& LayoutItem_Text::operator=(const LayoutItem_Text& src)
 
   //Copy the underlying TranslatableItem, not the shardptr to it:
   const StaticText& src_item = *(src.m_text);
-  m_text = sharedptr<StaticText>(new StaticText(src_item));
+  m_text = std::shared_ptr<StaticText>(new StaticText(src_item));
 
   return *this;
 }
diff --git a/glom/libglom/data_structure/layout/layoutitem_text.h 
b/glom/libglom/data_structure/layout/layoutitem_text.h
index 3319310..7479f62 100644
--- a/glom/libglom/data_structure/layout/layoutitem_text.h
+++ b/glom/libglom/data_structure/layout/layoutitem_text.h
@@ -62,7 +62,7 @@ public:
    */
   void set_text_original(const Glib::ustring& text);
 
-  sharedptr<StaticText> m_text; //Reuse the title concept of the TranslatableItem base class to give us 
translatable text.
+  std::shared_ptr<StaticText> m_text; //Reuse the title concept of the TranslatableItem base class to give 
us translatable text.
 };
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.cc 
b/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.cc
index 0755545..510e0cd 100644
--- a/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.cc
+++ b/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.cc
@@ -120,7 +120,7 @@ void LayoutItem_FieldSummary::set_summary_type_from_sql(const Glib::ustring& sum
     m_summary_type = TYPE_INVALID;
 }
 
-void LayoutItem_FieldSummary::set_field(const sharedptr<LayoutItem_Field>& field)
+void LayoutItem_FieldSummary::set_field(const std::shared_ptr<LayoutItem_Field>& field)
 {
   if(field)
     LayoutItem_Field::operator=(*field);
diff --git a/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h 
b/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h
index d39de7a..fc304a6 100644
--- a/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h
+++ b/glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h
@@ -59,7 +59,7 @@ public:
   /// This is used when loading the XML document, because we use get_summary_type_sql() when writing it.
   void set_summary_type_from_sql(const Glib::ustring& summary_type);
 
-  void set_field(const sharedptr<LayoutItem_Field>& field);
+  void set_field(const std::shared_ptr<LayoutItem_Field>& field);
 
   virtual Glib::ustring get_title(const Glib::ustring& locale) const;
   virtual Glib::ustring get_title_or_name(const Glib::ustring& locale) const;
diff --git a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc 
b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
index 356e0cd..026b887 100644
--- a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
+++ b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
@@ -27,7 +27,7 @@ namespace Glom
 
 LayoutItem_GroupBy::LayoutItem_GroupBy()
 {
-  m_group_secondary_fields = sharedptr<LayoutGroup>::create(); //So that we dont need to create it from 
outside.
+  m_group_secondary_fields = std::shared_ptr<LayoutGroup>(new LayoutGroup()); //So that we dont need to 
create it from outside.
 }
 
 LayoutItem_GroupBy::LayoutItem_GroupBy(const LayoutItem_GroupBy& src)
@@ -64,12 +64,12 @@ LayoutItem_GroupBy& LayoutItem_GroupBy::operator=(const LayoutItem_GroupBy& src)
   return *this;
 }
 
-sharedptr<LayoutItem_Field> LayoutItem_GroupBy::get_field_group_by()
+std::shared_ptr<LayoutItem_Field> LayoutItem_GroupBy::get_field_group_by()
 {
   return m_field_group_by;
 }
 
-sharedptr<const LayoutItem_Field> LayoutItem_GroupBy::get_field_group_by() const
+std::shared_ptr<const LayoutItem_Field> LayoutItem_GroupBy::get_field_group_by() const
 {
   return m_field_group_by;
 }
@@ -103,7 +103,7 @@ Glib::ustring LayoutItem_GroupBy::get_part_type_name() const
   return _("Group By");
 }
 
-void LayoutItem_GroupBy::set_field_group_by(const sharedptr<LayoutItem_Field>& field)
+void LayoutItem_GroupBy::set_field_group_by(const std::shared_ptr<LayoutItem_Field>& field)
 {
   m_field_group_by = field;
 }
@@ -147,12 +147,12 @@ Glib::ustring LayoutItem_GroupBy::get_report_part_id() const
   return "group_by";
 }
 
-sharedptr<LayoutGroup> LayoutItem_GroupBy::get_secondary_fields()
+std::shared_ptr<LayoutGroup> LayoutItem_GroupBy::get_secondary_fields()
 {
   return m_group_secondary_fields;
 }
 
-sharedptr<const LayoutGroup> LayoutItem_GroupBy::get_secondary_fields() const
+std::shared_ptr<const LayoutGroup> LayoutItem_GroupBy::get_secondary_fields() const
 {
   return m_group_secondary_fields;
 }
diff --git a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.h 
b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.h
index 850d2c2..62a5829 100644
--- a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.h
+++ b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.h
@@ -48,11 +48,11 @@ public:
   typedef Formatting::type_pair_sort_field type_pair_sort_field;
   typedef Formatting::type_list_sort_fields type_list_sort_fields;
 
-  sharedptr<LayoutItem_Field> get_field_group_by();
-  sharedptr<const LayoutItem_Field> get_field_group_by() const;
+  std::shared_ptr<LayoutItem_Field> get_field_group_by();
+  std::shared_ptr<const LayoutItem_Field> get_field_group_by() const;
   bool get_has_field_group_by() const;
 
-  void set_field_group_by(const sharedptr<LayoutItem_Field>& field);
+  void set_field_group_by(const std::shared_ptr<LayoutItem_Field>& field);
 
   //How to sort the records in this group:
   type_list_sort_fields get_fields_sort_by();
@@ -68,16 +68,16 @@ public:
   virtual Glib::ustring get_part_type_name() const;
   virtual Glib::ustring get_report_part_id() const;
 
-  sharedptr<LayoutGroup> get_secondary_fields();
-  sharedptr<const LayoutGroup> get_secondary_fields() const;
+  std::shared_ptr<LayoutGroup> get_secondary_fields();
+  std::shared_ptr<const LayoutGroup> get_secondary_fields() const;
 
   type_list_sort_fields get_sort_by() const;
   void set_sort_by(const type_list_sort_fields& sort_by);
   
 private:
 
-  sharedptr<LayoutItem_Field> m_field_group_by;
-  sharedptr<LayoutGroup> m_group_secondary_fields; //For instance, show a contact name as well as the 
contact ID that we group by.
+  std::shared_ptr<LayoutItem_Field> m_field_group_by;
+  std::shared_ptr<LayoutGroup> m_group_secondary_fields; //For instance, show a contact name as well as the 
contact ID that we group by.
   type_list_sort_fields m_fields_sort_by;
 };
 
diff --git a/glom/libglom/data_structure/layout/usesrelationship.cc 
b/glom/libglom/data_structure/layout/usesrelationship.cc
index a31d1a6..58372fa 100644
--- a/glom/libglom/data_structure/layout/usesrelationship.cc
+++ b/glom/libglom/data_structure/layout/usesrelationship.cc
@@ -86,22 +86,22 @@ Glib::ustring UsesRelationship::get_related_relationship_name() const
     return Glib::ustring();
 }
 
-sharedptr<const Relationship> UsesRelationship::get_relationship() const
+std::shared_ptr<const Relationship> UsesRelationship::get_relationship() const
 {
   return m_relationship;
 }
 
-void UsesRelationship::set_relationship(const sharedptr<const Relationship>& relationship)
+void UsesRelationship::set_relationship(const std::shared_ptr<const Relationship>& relationship)
 {
   m_relationship = relationship;
 }
 
-sharedptr<const Relationship> UsesRelationship::get_related_relationship() const
+std::shared_ptr<const Relationship> UsesRelationship::get_related_relationship() const
 {
   return m_related_relationship;
 }
 
-void UsesRelationship::set_related_relationship(const sharedptr<const Relationship>& relationship)
+void UsesRelationship::set_related_relationship(const std::shared_ptr<const Relationship>& relationship)
 {
   m_related_relationship = relationship;
 }
@@ -147,7 +147,7 @@ Glib::ustring UsesRelationship::get_title_used(const Glib::ustring& parent_table
 
 Glib::ustring UsesRelationship::get_title_singular_used(const Glib::ustring& parent_table_title, const 
Glib::ustring& locale) const
 {
-  sharedptr<const Relationship> used = m_related_relationship;
+  std::shared_ptr<const Relationship> used = m_related_relationship;
   if(!used)
     used = m_relationship;
 
diff --git a/glom/libglom/data_structure/layout/usesrelationship.h 
b/glom/libglom/data_structure/layout/usesrelationship.h
index ffe2657..5382d4f 100644
--- a/glom/libglom/data_structure/layout/usesrelationship.h
+++ b/glom/libglom/data_structure/layout/usesrelationship.h
@@ -55,21 +55,21 @@ public:
    */
   Glib::ustring get_related_relationship_name() const;
 
-  /** Return the relationship used by this item, if any, or a null sharedptr.
+  /** Return the relationship used by this item, if any, or a null std::shared_ptr.
    * See also get_has_relationship_name() which can prevent the need for your  
-   * own null sharedptr check.
+   * own null std::shared_ptr check.
    */ 
-  sharedptr<const Relationship> get_relationship() const;
+  std::shared_ptr<const Relationship> get_relationship() const;
 
-  void set_relationship(const sharedptr<const Relationship>& relationship);
+  void set_relationship(const std::shared_ptr<const Relationship>& relationship);
 
-  /** Return the related relationship used by this item, if any, or a null sharedptr.
+  /** Return the related relationship used by this item, if any, or a null std::shared_ptr.
    * See also get_has_related_relationship_name() which can prevent the need for your  
-   * own null sharedptr check.
+   * own null std::shared_ptr check.
    */ 
-  sharedptr<const Relationship> get_related_relationship() const;
+  std::shared_ptr<const Relationship> get_related_relationship() const;
 
-  void set_related_relationship(const sharedptr<const Relationship>& relationship);
+  void set_related_relationship(const std::shared_ptr<const Relationship>& relationship);
 
   /** Returns either the @a parent_table, related to table, or doubly-related to-table.
    */
@@ -119,8 +119,8 @@ public:
 private:
 
   //This is just cached data, so we don't need to always lookup the relationship details from the document, 
from the name.
-  sharedptr<const Relationship> m_relationship;
-  sharedptr<const Relationship> m_related_relationship; //Rarely used. It is for showing fields from the 
(related) relationships of related tables.
+  std::shared_ptr<const Relationship> m_relationship;
+  std::shared_ptr<const Relationship> m_related_relationship; //Rarely used. It is for showing fields from 
the (related) relationships of related tables.
 };
 
 } //namespace Glom
diff --git a/glom/libglom/data_structure/print_layout.cc b/glom/libglom/data_structure/print_layout.cc
index 6355f0f..728741b 100644
--- a/glom/libglom/data_structure/print_layout.cc
+++ b/glom/libglom/data_structure/print_layout.cc
@@ -31,7 +31,7 @@ PrintLayout::PrintLayout()
   m_page_count(1) //A sensible default
 {
   m_translatable_item_type = TRANSLATABLE_TYPE_PRINT_LAYOUT;
-  m_layout_group = sharedptr<LayoutGroup>::create();
+  m_layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
 }
 
 PrintLayout::PrintLayout(const PrintLayout& src)
@@ -75,12 +75,12 @@ void PrintLayout::set_show_table_title(bool show_table_title)
   m_show_table_title = show_table_title;
 }
 
-sharedptr<LayoutGroup> PrintLayout::get_layout_group()
+std::shared_ptr<LayoutGroup> PrintLayout::get_layout_group()
 {
   return m_layout_group;
 }
 
-sharedptr<const LayoutGroup> PrintLayout::get_layout_group() const
+std::shared_ptr<const LayoutGroup> PrintLayout::get_layout_group() const
 {
   return m_layout_group;
 }
diff --git a/glom/libglom/data_structure/print_layout.h b/glom/libglom/data_structure/print_layout.h
index 343e88e..75acc97 100644
--- a/glom/libglom/data_structure/print_layout.h
+++ b/glom/libglom/data_structure/print_layout.h
@@ -38,8 +38,8 @@ public:
   bool get_show_table_title() const;
   void set_show_table_title(bool show_table_title = true);
 
-  sharedptr<LayoutGroup> get_layout_group();
-  sharedptr<const LayoutGroup> get_layout_group() const;
+  std::shared_ptr<LayoutGroup> get_layout_group();
+  std::shared_ptr<const LayoutGroup> get_layout_group() const;
 
   /** Sets the Page Setup as it would be created by a Gtk::PageSetup.
    */
@@ -74,7 +74,7 @@ public:
   void set_vertical_rules(const type_vec_doubles& rules);
 
 private:
-  sharedptr<LayoutGroup> m_layout_group;
+  std::shared_ptr<LayoutGroup> m_layout_group;
   bool m_show_table_title;
 
   bool m_show_grid;
diff --git a/glom/libglom/data_structure/report.cc b/glom/libglom/data_structure/report.cc
index 1e8dc4f..f36b126 100644
--- a/glom/libglom/data_structure/report.cc
+++ b/glom/libglom/data_structure/report.cc
@@ -27,7 +27,7 @@ Report::Report()
 : m_show_table_title(true)
 {
   m_translatable_item_type = TRANSLATABLE_TYPE_REPORT;
-  m_layout_group = sharedptr<LayoutGroup>::create();
+  m_layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
 }
 
 Report::Report(const Report& src)
@@ -58,12 +58,12 @@ void Report::set_show_table_title(bool show_table_title)
 }
 
 
-sharedptr<LayoutGroup> Report::get_layout_group()
+std::shared_ptr<LayoutGroup> Report::get_layout_group()
 {
   return m_layout_group;
 }
 
-sharedptr<const LayoutGroup> Report::get_layout_group() const
+std::shared_ptr<const LayoutGroup> Report::get_layout_group() const
 {
   return m_layout_group;
 }
diff --git a/glom/libglom/data_structure/report.h b/glom/libglom/data_structure/report.h
index c780bf6..e40317f 100644
--- a/glom/libglom/data_structure/report.h
+++ b/glom/libglom/data_structure/report.h
@@ -38,11 +38,11 @@ public:
   bool get_show_table_title() const;
   void set_show_table_title(bool show_table_title = true);
 
-  sharedptr<LayoutGroup> get_layout_group();
-  sharedptr<const LayoutGroup> get_layout_group() const;
+  std::shared_ptr<LayoutGroup> get_layout_group();
+  std::shared_ptr<const LayoutGroup> get_layout_group() const;
 
 private:
-  sharedptr<LayoutGroup> m_layout_group;
+  std::shared_ptr<LayoutGroup> m_layout_group;
   bool m_show_table_title;
 };
 
diff --git a/glom/libglom/data_structure/translatable_item.h b/glom/libglom/data_structure/translatable_item.h
index 4a0599b..8ae9159 100644
--- a/glom/libglom/data_structure/translatable_item.h
+++ b/glom/libglom/data_structure/translatable_item.h
@@ -145,7 +145,7 @@ private:
 };
 
 template <class T_object>
-Glib::ustring glom_get_sharedptr_name(const sharedptr<T_object>& item)
+Glib::ustring glom_get_sharedptr_name(const std::shared_ptr<T_object>& item)
 {
   if(item)
     return item->get_name();
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index f7b0508..2fc5990 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -42,7 +42,7 @@ namespace DbUtils
 
 static Glib::RefPtr<Gnome::Gda::Connection> get_connection()
 {
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
      sharedconnection = ConnectionPool::get_and_connect();
@@ -132,7 +132,7 @@ bool create_database(Document* document, const Glib::ustring& database_name, con
 
   progress();
 
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
     sharedconnection = connection_pool->connect();
@@ -222,7 +222,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
   try
   {
     connection_pool->set_ready_to_connect(); //This has succeeded already.
-    sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
     std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
 
     return false; //Connection to the database succeeded, because no exception was thrown. so the database 
exists already.
@@ -253,7 +253,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
 
   progress();
 
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
     //Check that we can connect:
@@ -271,7 +271,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
   Document::type_listTableInfo tables = document->get_tables();
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<const TableInfo> table_info = *iter;
+    std::shared_ptr<const TableInfo> table_info = *iter;
 
     //Create SQL to describe all fields in this table:
     Glib::ustring sql_fields;
@@ -307,7 +307,7 @@ bool recreate_database_from_document(Document* document, const sigc::slot<void>&
     
   for(Document::type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<const TableInfo> table_info = *iter;
+    std::shared_ptr<const TableInfo> table_info = *iter;
 
     //Add any example data to the table:
     progress();
@@ -460,7 +460,7 @@ bool add_standard_tables(const Document* document)
   try
   {
     Document::type_vec_fields pref_fields;
-    sharedptr<TableInfo> prefs_table_info = Document::create_table_system_preferences(pref_fields);
+    std::shared_ptr<TableInfo> prefs_table_info = Document::create_table_system_preferences(pref_fields);
 
     //Name, address, etc:
     if(!get_table_exists_in_database(GLOM_STANDARD_TABLE_PREFS_TABLE_NAME))
@@ -508,29 +508,29 @@ bool add_standard_tables(const Document* document)
     //Auto-increment next values:
     if(!get_table_exists_in_database(GLOM_STANDARD_TABLE_AUTOINCREMENTS_TABLE_NAME))
     {
-      sharedptr<TableInfo> table_info(new TableInfo());
+      std::shared_ptr<TableInfo> table_info(new TableInfo());
       table_info->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_TABLE_NAME);
       table_info->set_title_original(_("System: Auto Increments"));
       table_info->set_hidden(true);
 
       Document::type_vec_fields fields;
 
-      sharedptr<Field> primary_key(new Field()); //It's not used, because there's only one record, but we 
must have one.
+      std::shared_ptr<Field> primary_key(new Field()); //It's not used, because there's only one record, but 
we must have one.
       primary_key->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_ID);
       primary_key->set_glom_type(Field::TYPE_NUMERIC);
       fields.push_back(primary_key);
 
-      sharedptr<Field> field_table_name(new Field());
+      std::shared_ptr<Field> field_table_name(new Field());
       field_table_name->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_TABLE_NAME);
       field_table_name->set_glom_type(Field::TYPE_TEXT);
       fields.push_back(field_table_name);
 
-      sharedptr<Field> field_field_name(new Field());
+      std::shared_ptr<Field> field_field_name(new Field());
       field_field_name->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_FIELD_NAME);
       field_field_name->set_glom_type(Field::TYPE_TEXT);
       fields.push_back(field_field_name);
 
-      sharedptr<Field> field_next_value(new Field());
+      std::shared_ptr<Field> field_next_value(new Field());
       field_next_value->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_NEXT_VALUE);
       field_next_value->set_glom_type(Field::TYPE_TEXT);
       fields.push_back(field_next_value);
@@ -613,7 +613,7 @@ bool add_standard_groups(Document* document)
 
       for(Document::type_listTableInfo::const_iterator iter = table_list.begin(); iter != table_list.end(); 
++iter)
       {
-        sharedptr<const TableInfo> table_info = *iter;
+        std::shared_ptr<const TableInfo> table_info = *iter;
         if(table_info)
         {
           const Glib::ustring table_name = table_info->get_name();
@@ -941,7 +941,7 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
           field_info->set_allow_null(value_notnull.get_boolean());
 
 
-        sharedptr<Field> field = sharedptr<Field>::create(); //TODO: Get glom-specific information from the 
document?
+        std::shared_ptr<Field> field = std::shared_ptr<Field>(new Field()); //TODO: Get glom-specific 
information from the document?
         field->set_field_info(field_info);
 
 
@@ -990,7 +990,7 @@ type_vec_fields get_fields_for_table(const Document* document, const Glib::ustri
   /*
   for(type_vec_fields::iterator iter = fieldsDocument.begin(); iter != fieldsDocument.end(); ++iter)
   {
-    sharedptr<Field> field = *iter;
+    std::shared_ptr<Field> field = *iter;
     const Glib::ustring field_name = field->get_name();
 
     //Get the field info from the database:
@@ -1037,10 +1037,10 @@ type_vec_fields get_fields_for_table(const Document* document, const Glib::ustri
   return result;
 }
 
-sharedptr<Field> get_fields_for_table_one_field(const Document* document, const Glib::ustring& table_name, 
const Glib::ustring& field_name)
+std::shared_ptr<Field> get_fields_for_table_one_field(const Document* document, const Glib::ustring& 
table_name, const Glib::ustring& field_name)
 {
   //Initialize output parameter:
-  sharedptr<Field> result;
+  std::shared_ptr<Field> result;
 
   if(field_name.empty() || table_name.empty())
     return result;
@@ -1052,7 +1052,7 @@ sharedptr<Field> get_fields_for_table_one_field(const Document* document, const
     return *iter;
   }
 
-  return sharedptr<Field>();
+  return std::shared_ptr<Field>();
 }
 
 //TODO_Performance: Avoid calling this so often.
@@ -1164,7 +1164,7 @@ bool create_table_with_default_fields(Document* document, const Glib::ustring& t
   bool created = false;
 
   //Primary key:
-  sharedptr<Field> field_primary_key(new Field());
+  std::shared_ptr<Field> field_primary_key(new Field());
   field_primary_key->set_name(table_name + "_id");
   field_primary_key->set_title_original( Glib::ustring::compose("%1 ID", table_name) );
   field_primary_key->set_primary_key();
@@ -1181,21 +1181,21 @@ bool create_table_with_default_fields(Document* document, const Glib::ustring& t
   fields.push_back(field_primary_key);
 
   //Description:
-  sharedptr<Field> field_description(new Field());
+  std::shared_ptr<Field> field_description(new Field());
   field_description->set_name("description");
   field_description->set_title_original(_("Description")); //Use a translation, because the original locale 
will be marked as non-English if the current locale is non-English.
   field_description->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_description);
 
   //Comments:
-  sharedptr<Field> field_comments(new Field());
+  std::shared_ptr<Field> field_comments(new Field());
   field_comments->set_name("comments");
   field_comments->set_title_original(_("Comments"));
   field_comments->set_glom_type(Field::TYPE_TEXT);
   field_comments->m_default_formatting.set_text_format_multiline();
   fields.push_back(field_comments);
 
-  sharedptr<TableInfo> table_info(new TableInfo());
+  std::shared_ptr<TableInfo> table_info(new TableInfo());
   table_info->set_name(table_name);
   table_info->set_title_original( Utils::title_from_string( table_name ) ); //Start with a title that might 
be appropriate.
 
@@ -1215,7 +1215,7 @@ bool create_table_with_default_fields(Document* document, const Glib::ustring& t
 
   return created;
 }
-bool create_table(Document::HostingMode hosting_mode, const sharedptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields_in)
+bool create_table(Document::HostingMode hosting_mode, const std::shared_ptr<const TableInfo>& table_info, 
const Document::type_vec_fields& fields_in)
 {
   //std::cout << "debug: " << G_STRFUNC << ": " << table_info->get_name() << ", title=" << 
table_info->get_title() << std::endl;
 
@@ -1228,7 +1228,7 @@ bool create_table(Document::HostingMode hosting_mode, const sharedptr<const Tabl
   //(We don't actually use this yet)
   if(std::find_if(fields.begin(), fields.end(), predicate_FieldHasName<Field>(GLOM_STANDARD_FIELD_LOCK)) == 
fields.end())
   {
-    sharedptr<Field> field = sharedptr<Field>::create();
+    std::shared_ptr<Field> field = std::shared_ptr<Field>(new Field());
     field->set_name(GLOM_STANDARD_FIELD_LOCK);
     field->set_glom_type(Field::TYPE_TEXT);
     fields.push_back(field);
@@ -1239,7 +1239,7 @@ bool create_table(Document::HostingMode hosting_mode, const sharedptr<const Tabl
   for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
     //Create SQL to describe this field:
-    sharedptr<Field> field = *iter;
+    std::shared_ptr<Field> field = *iter;
 
     //The field has no gda type, so we set that:
     //This usually comes from the database, but that's a bit strange.
@@ -1311,13 +1311,13 @@ bool create_table(Document::HostingMode hosting_mode, const sharedptr<const Tabl
   return table_creation_succeeded;
 }
 
-bool create_table_add_missing_fields(const sharedptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields)
+bool create_table_add_missing_fields(const std::shared_ptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields)
 {
   const Glib::ustring table_name = table_info->get_name();
 
   for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
-    sharedptr<const Field> field = *iter;
+    std::shared_ptr<const Field> field = *iter;
     if(!get_field_exists_in_database(table_name, field->get_name()))
     {
       const bool test = add_column(table_name, field, 0); /* TODO: parent_window */
@@ -1330,7 +1330,7 @@ bool create_table_add_missing_fields(const sharedptr<const TableInfo>& table_inf
 }
 
 
-bool add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field, Gtk::Window* /* 
parent_window */)
+bool add_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field, Gtk::Window* /* 
parent_window */)
 {
   ConnectionPool* connection_pool = ConnectionPool::get_instance();
 
@@ -1623,7 +1623,7 @@ bool insert_example_data(const Document* document, const Glib::ustring& table_na
     {
       //std::cout << "  DEBUG: i=" << i << ", row_data.size()=" << row_data.size() << std::endl;
 
-      sharedptr<Field> field = vec_fields[i];
+      std::shared_ptr<Field> field = vec_fields[i];
       if(!field)
       {
         std::cerr << G_STRFUNC << ": field was null for field num=" << i << std::endl;
@@ -1852,7 +1852,7 @@ bool query_execute(const Glib::RefPtr<const Gnome::Gda::SqlBuilder>& builder)
   return (exec_retval >= 0);
 }
 
-void layout_item_fill_field_details(const Document* document, const Glib::ustring& parent_table_name, 
sharedptr<LayoutItem_Field>& layout_item)
+void layout_item_fill_field_details(const Document* document, const Glib::ustring& parent_table_name, 
std::shared_ptr<LayoutItem_Field>& layout_item)
 {
   if(!document)
   {
@@ -1869,10 +1869,10 @@ void layout_item_fill_field_details(const Document* document, const Glib::ustrin
   layout_item->set_full_field_details( document->get_field(table_name, layout_item->get_name()) );
 }
 
-bool layout_field_should_have_navigation(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& layout_item, const Document* document, sharedptr<Relationship>& 
field_used_in_relationship_to_one)
+bool layout_field_should_have_navigation(const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& layout_item, const Document* document, std::shared_ptr<Relationship>& 
field_used_in_relationship_to_one)
 {
   //Initialize output parameter:
-  field_used_in_relationship_to_one = sharedptr<Relationship>();
+  field_used_in_relationship_to_one = std::shared_ptr<Relationship>();
   
   if(!document)
   {
@@ -1894,14 +1894,14 @@ bool layout_field_should_have_navigation(const Glib::ustring& table_name, const
 
   //Check whether the field controls a relationship,
   //meaning it identifies a record in another table.
-  sharedptr<const Relationship> const_relationship =
+  std::shared_ptr<const Relationship> const_relationship =
     document->get_field_used_in_relationship_to_one(table_name, layout_item);
-  field_used_in_relationship_to_one = sharedptr<Relationship>::cast_const(const_relationship); //This is 
just because we can't seem to have a sharedptr<const Relationship>& output parameter.
+  field_used_in_relationship_to_one = std::const_pointer_cast<Relationship>(const_relationship); //This is 
just because we can't seem to have a std::shared_ptr<const Relationship>& output parameter.
   // std::cout << "DEBUG: table_name=" << table_name << ", table_used=" << 
layout_item->get_table_used(table_name) << ", layout_item=" << layout_item->get_name() << ", 
field_used_in_relationship_to_one=" << field_used_in_relationship_to_one << std::endl;
 
   //Check whether the field identifies a record in another table
   //just because it is a primary key in that table:
-  const sharedptr<const Field> field_info = layout_item->get_full_field_details();
+  const std::shared_ptr<const Field> field_info = layout_item->get_full_field_details();
   const bool field_is_related_primary_key =
     layout_item->get_has_relationship_name() &&
     field_info && field_info->get_primary_key();
@@ -1942,7 +1942,7 @@ Glib::ustring get_unused_database_name(const Glib::ustring& base_name)
     connection_pool->set_database(database_name_possible);
     connection_pool->set_ready_to_connect();
 
-    Glom::sharedptr<Glom::SharedConnection> connection;
+    std::shared_ptr<Glom::SharedConnection> connection;
 
     try
     {
@@ -2249,15 +2249,15 @@ void set_fake_connection()
   Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
   Glom::ConnectionPoolBackends::Backend* backend = 
     new Glom::ConnectionPoolBackends::PostgresCentralHosted();
-  connection_pool->set_backend(std::auto_ptr<Glom::ConnectionPool::Backend>(backend));
+  connection_pool->set_backend(std::shared_ptr<Glom::ConnectionPool::Backend>(backend));
   connection_pool->set_fake_connection();
 }
 
-Gnome::Gda::Value get_lookup_value(const Document* document, const Glib::ustring& /* table_name */, const 
sharedptr<const Relationship>& relationship, const sharedptr<const Field>& source_field, const 
Gnome::Gda::Value& key_value)
+Gnome::Gda::Value get_lookup_value(const Document* document, const Glib::ustring& /* table_name */, const 
std::shared_ptr<const Relationship>& relationship, const std::shared_ptr<const Field>& source_field, const 
Gnome::Gda::Value& key_value)
 {
   Gnome::Gda::Value result;
 
-  sharedptr<Field> to_key_field = get_fields_for_table_one_field(document, relationship->get_to_table(), 
relationship->get_to_field());
+  std::shared_ptr<Field> to_key_field = get_fields_for_table_one_field(document, 
relationship->get_to_table(), relationship->get_to_field());
   if(to_key_field)
   {
     //Convert the value, in case the from and to fields have different types:
diff --git a/glom/libglom/db_utils.h b/glom/libglom/db_utils.h
index f3b5fab..d59ab74 100644
--- a/glom/libglom/db_utils.h
+++ b/glom/libglom/db_utils.h
@@ -61,7 +61,7 @@ bool add_standard_groups(Document* document);
 bool add_groups_from_document(const Document* document);
 bool set_table_privileges_groups_from_document(const Document* document);
 
-typedef std::vector< sharedptr<Field> > type_vec_fields;
+typedef std::vector< std::shared_ptr<Field> > type_vec_fields;
 type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_name, bool 
including_system_fields = false);
 bool get_field_exists_in_database(const Glib::ustring& table_name, const Glib::ustring& field_name);
 
@@ -79,7 +79,7 @@ type_vec_fields get_fields_for_table(const Document* document, const Glib::ustri
  * @param field_name The name of the field for which to get the definition.
  * @result The field definition.
  */
-sharedptr<Field> get_fields_for_table_one_field(const Document* document, const Glib::ustring& table_name, 
const Glib::ustring& field_name);
+std::shared_ptr<Field> get_fields_for_table_one_field(const Document* document, const Glib::ustring& 
table_name, const Glib::ustring& field_name);
 
 typedef std::vector<Glib::ustring> type_vec_strings;
 
@@ -90,16 +90,16 @@ type_vec_strings get_table_names_from_database(bool ignore_system_tables = false
 
 bool get_table_exists_in_database(const Glib::ustring& table_name);
 
-bool create_table(Document::HostingMode hosting_mode, const sharedptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields);
+bool create_table(Document::HostingMode hosting_mode, const std::shared_ptr<const TableInfo>& table_info, 
const Document::type_vec_fields& fields);
 
 /// Also saves the table information in the document:
 bool create_table_with_default_fields(Document* document, const Glib::ustring& table_name);
 
-bool create_table_add_missing_fields(const sharedptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields);
+bool create_table_add_missing_fields(const std::shared_ptr<const TableInfo>& table_info, const 
Document::type_vec_fields& fields);
 
 // TODO: Should these functions update the document, so callers don't need
 // to do it?
-bool add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field, Gtk::Window* 
parent_window);
+bool add_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field, Gtk::Window* 
parent_window);
 
 bool drop_column(const Glib::ustring& table_name, const Glib::ustring& field_name);
 
@@ -144,11 +144,11 @@ Gnome::Gda::Value get_next_auto_increment_value(const Glib::ustring& table_name,
  */
 void remove_auto_increment(const Glib::ustring& table_name, const Glib::ustring& field_name);
 
-void layout_item_fill_field_details(const Document* document, const Glib::ustring& parent_table_name, 
sharedptr<LayoutItem_Field>& layout_item);
+void layout_item_fill_field_details(const Document* document, const Glib::ustring& parent_table_name, 
std::shared_ptr<LayoutItem_Field>& layout_item);
 
 
-//TODO: It would be nice to use sharedptr<const Relationship>& instead of sharedptr<Relationship>&,
-//but it does not seem possible to pass a sharedptr<const Relationship> for a sharedptr<const Relationship>&.
+//TODO: It would be nice to use std::shared_ptr<const Relationship>& instead of 
std::shared_ptr<Relationship>&,
+//but it does not seem possible to pass a std::shared_ptr<const Relationship> for a std::shared_ptr<const 
Relationship>&.
 
 /** Decides whether a field should have an Open button next to it,
  * allowing the user to navigate to a related record.
@@ -156,7 +156,7 @@ void layout_item_fill_field_details(const Document* document, const Glib::ustrin
  * @param layout_item A field on a layout. This must have full field details.
  * @param field_used_in_relationship_to_one A relationship, if the field identifies a single record, so a 
Find button would also make sense, to choose the ID, in editing mode.
  */
-bool layout_field_should_have_navigation(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& layout_item, const Document* document, sharedptr<Relationship>& 
field_used_in_relationship_to_one);
+bool layout_field_should_have_navigation(const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& layout_item, const Document* document, std::shared_ptr<Relationship>& 
field_used_in_relationship_to_one);
 
 /** Discover a database name that is not yet used.
  * This assumes that all other connection details are correctly set.
@@ -217,7 +217,7 @@ bool remove_user_from_group(const Glib::ustring& user, const Glib::ustring& grou
 
 /** Get the value of the @a source_field from the @a relationship, using the @a key_value.
  */
-Gnome::Gda::Value get_lookup_value(const Document* document, const Glib::ustring& table_name, const 
sharedptr<const Relationship>& relationship, const sharedptr<const Field>& source_field, const 
Gnome::Gda::Value & key_value);
+Gnome::Gda::Value get_lookup_value(const Document* document, const Glib::ustring& table_name, const 
std::shared_ptr<const Relationship>& relationship, const std::shared_ptr<const Field>& source_field, const 
Gnome::Gda::Value & key_value);
   
 /** Allow a fake connection, so sqlbuilder_get_full_query() can work.
  */
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 092bd43..a785b39 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -282,7 +282,7 @@ Document::Document()
   m_is_backup(false),
   m_opened_from_browse(false)
 {
-  m_database_title = sharedptr<DatabaseTitle>::create();
+  m_database_title = std::shared_ptr<DatabaseTitle>(new DatabaseTitle());
 
   //Prevent autosaving during the constructor:
   set_allow_autosave(false); //Prevent saving while we modify the document.
@@ -481,10 +481,10 @@ void Document::set_connection_try_other_ports(bool val)
 }
 
 
-void Document::set_relationship(const Glib::ustring& table_name, const sharedptr<Relationship>& relationship)
+void Document::set_relationship(const Glib::ustring& table_name, const std::shared_ptr<Relationship>& 
relationship)
 {
   //Find the existing relationship:
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(!info)
     return;
    
@@ -497,7 +497,7 @@ void Document::set_relationship(const Glib::ustring& table_name, const sharedptr
   {
     if((*iter)->get_name() == relationship_name)
     {
-      *iter = relationship; //Changes the relationship. All references (sharedptrs) to the relationship will 
get the informatin too, because it is shared.
+      *iter = relationship; //Changes the relationship. All references (std::shared_ptrs) to the 
relationship will get the informatin too, because it is shared.
       existing = true;
     }
   }
@@ -509,9 +509,9 @@ void Document::set_relationship(const Glib::ustring& table_name, const sharedptr
   }
 }
 
-sharedptr<Relationship> Document::create_relationship_system_preferences(const Glib::ustring& table_name)
+std::shared_ptr<Relationship> Document::create_relationship_system_preferences(const Glib::ustring& 
table_name)
 {
-  sharedptr<Relationship> relationship = sharedptr<Relationship>::create();
+  std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new Relationship());
   relationship->set_name(GLOM_RELATIONSHIP_NAME_SYSTEM_PROPERTIES);
   relationship->set_title_original(_("System Preferences"));
   relationship->set_from_table(table_name);
@@ -521,15 +521,15 @@ sharedptr<Relationship> Document::create_relationship_system_preferences(const G
   return relationship;
 }
 
-sharedptr<TableInfo> Document::create_table_system_preferences()
+std::shared_ptr<TableInfo> Document::create_table_system_preferences()
 {
   type_vec_fields fields_ignored;
   return create_table_system_preferences(fields_ignored);
 }
 
-sharedptr<TableInfo> Document::create_table_system_preferences(type_vec_fields& fields)
+std::shared_ptr<TableInfo> Document::create_table_system_preferences(type_vec_fields& fields)
 {
-  sharedptr<TableInfo> prefs_table_info = sharedptr<TableInfo>::create();
+  std::shared_ptr<TableInfo> prefs_table_info = std::shared_ptr<TableInfo>(new TableInfo());
   prefs_table_info->set_name(GLOM_STANDARD_TABLE_PREFS_TABLE_NAME);
   prefs_table_info->set_title_original(_("System Preferences"));
   prefs_table_info->set_hidden(true);
@@ -537,60 +537,60 @@ sharedptr<TableInfo> Document::create_table_system_preferences(type_vec_fields&
 
   fields.clear();
 
-  sharedptr<Field> primary_key(new Field()); //It's not used, because there's only one record, but we must 
have one.
+  std::shared_ptr<Field> primary_key(new Field()); //It's not used, because there's only one record, but we 
must have one.
   primary_key->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ID);
   primary_key->set_glom_type(Field::TYPE_NUMERIC);
   fields.push_back(primary_key);
 
-  sharedptr<Field> field_name(new Field());
+  std::shared_ptr<Field> field_name(new Field());
   field_name->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_NAME);
   field_name->set_title_original(_("System Name"));
   field_name->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_name);
 
-  sharedptr<Field> field_org_name(new Field());
+  std::shared_ptr<Field> field_org_name(new Field());
   field_org_name->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_NAME);
   field_org_name->set_title_original(_("Organisation Name"));
   field_org_name->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_name);
 
-  sharedptr<Field> field_org_logo(new Field());
+  std::shared_ptr<Field> field_org_logo(new Field());
   field_org_logo->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_LOGO);
   field_org_logo->set_title_original(_("Organisation Logo"));
   field_org_logo->set_glom_type(Field::TYPE_IMAGE);
   fields.push_back(field_org_logo);
 
-  sharedptr<Field> field_org_address_street(new Field());
+  std::shared_ptr<Field> field_org_address_street(new Field());
   field_org_address_street->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_STREET);
   field_org_address_street->set_title_original(_("Street"));
   field_org_address_street->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_address_street);
 
-  sharedptr<Field> field_org_address_street2(new Field());
+  std::shared_ptr<Field> field_org_address_street2(new Field());
   field_org_address_street2->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_STREET2);
   field_org_address_street2->set_title_original(_("Street (line 2)"));
   field_org_address_street2->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_address_street2);
 
-  sharedptr<Field> field_org_address_town(new Field());
+  std::shared_ptr<Field> field_org_address_town(new Field());
   field_org_address_town->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_TOWN);
   field_org_address_town->set_title_original(_("City"));
   field_org_address_town->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_address_town);
 
-  sharedptr<Field> field_org_address_county(new Field());
+  std::shared_ptr<Field> field_org_address_county(new Field());
   field_org_address_county->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_COUNTY);
   field_org_address_county->set_title_original(_("State"));
   field_org_address_county->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_address_county);
 
-  sharedptr<Field> field_org_address_country(new Field());
+  std::shared_ptr<Field> field_org_address_country(new Field());
   field_org_address_country->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_COUNTRY);
   field_org_address_country->set_title_original(_("Country"));
   field_org_address_country->set_glom_type(Field::TYPE_TEXT);
   fields.push_back(field_org_address_country);
 
-  sharedptr<Field> field_org_address_postcode(new Field());
+  std::shared_ptr<Field> field_org_address_postcode(new Field());
   field_org_address_postcode->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_POSTCODE);
   field_org_address_postcode->set_title_original(_("Zip Code"));
   field_org_address_postcode->set_glom_type(Field::TYPE_TEXT);
@@ -599,21 +599,21 @@ sharedptr<TableInfo> Document::create_table_system_preferences(type_vec_fields&
   return prefs_table_info;
 }
 
-bool Document::get_relationship_is_system_properties(const sharedptr<const Relationship>& relationship)
+bool Document::get_relationship_is_system_properties(const std::shared_ptr<const Relationship>& relationship)
 {
   return relationship && (relationship->get_name() == GLOM_RELATIONSHIP_NAME_SYSTEM_PROPERTIES);
 }
 
-sharedptr<Relationship> Document::get_relationship(const Glib::ustring& table_name, const Glib::ustring& 
relationship_name) const
+std::shared_ptr<Relationship> Document::get_relationship(const Glib::ustring& table_name, const 
Glib::ustring& relationship_name) const
 {
-  sharedptr<Relationship> result;
+  std::shared_ptr<Relationship> result;
 
   if(relationship_name == GLOM_RELATIONSHIP_NAME_SYSTEM_PROPERTIES)
   {
     return create_relationship_system_preferences(table_name);
   }
 
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     //Look for the relationship with this name:
@@ -632,7 +632,7 @@ sharedptr<Relationship> Document::get_relationship(const Glib::ustring& table_na
 
 Document::type_vec_relationships Document::get_relationships(const Glib::ustring& table_name, bool 
plus_system_prefs) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     type_vec_relationships result = info->m_relationships;
@@ -654,7 +654,7 @@ void Document::set_relationships(const Glib::ustring& table_name, const type_vec
 {
   if(!table_name.empty())
   {
-    const sharedptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
+    const std::shared_ptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
     if(info)
       info->m_relationships = vecRelationships;
 
@@ -662,10 +662,10 @@ void Document::set_relationships(const Glib::ustring& table_name, const type_vec
   }
 }
 
-void Document::remove_relationship(const sharedptr<const Relationship>& relationship)
+void Document::remove_relationship(const std::shared_ptr<const Relationship>& relationship)
 {
   //Get the table that this relationship is part of:
-  const sharedptr<DocumentTableInfo> info = get_table_info(relationship->get_from_table());
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(relationship->get_from_table());
   if(!info)
     return;
 
@@ -692,8 +692,8 @@ void Document::remove_relationship(const sharedptr<const Relationship>& relation
     while(iterGroups != layout_info.m_layout_groups.end())
     {
       //Remove any layout parts that use this relationship:
-      sharedptr<LayoutGroup> group = *iterGroups;
-      sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::cast_dynamic(group);
+      std::shared_ptr<LayoutGroup> group = *iterGroups;
+      std::shared_ptr<UsesRelationship> uses_rel = std::dynamic_pointer_cast<UsesRelationship>(group);
       if(uses_rel && uses_rel->get_has_relationship_name())
       {
         if(*(uses_rel->get_relationship()) == *relationship) //TODO_Performance: Slow when there are many 
translations.
@@ -717,8 +717,8 @@ void Document::remove_relationship(const sharedptr<const Relationship>& relation
   DocumentTableInfo::type_reports reports = info->m_reports;
   for(DocumentTableInfo::type_reports::iterator iterReports = reports.begin(); iterReports != reports.end(); 
++iterReports)
   {
-    sharedptr<Report> report = iterReports->second;
-    sharedptr<LayoutGroup> group = report->get_layout_group();
+    std::shared_ptr<Report> report = iterReports->second;
+    std::shared_ptr<LayoutGroup> group = report->get_layout_group();
 
     //Remove the field wherever it is a related field:
     group->remove_relationship(relationship);
@@ -728,7 +728,7 @@ void Document::remove_relationship(const sharedptr<const Relationship>& relation
 void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring& field_name)
 {
   //Remove the field itself:
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     type_vec_fields& vecFields = info->m_fields;
@@ -745,7 +745,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
   //Remove any relationships that use this field:
   for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<DocumentTableInfo> info = iter->second;
+    const std::shared_ptr<DocumentTableInfo> info = iter->second;
     if(!info)
       continue;
 
@@ -755,7 +755,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
       bool something_changed = true;
       while(something_changed && !info->m_relationships.empty())
       {
-        sharedptr<Relationship> relationship = *iterRel;
+        std::shared_ptr<Relationship> relationship = *iterRel;
 
         if( ((relationship->get_from_table() == table_name) && (relationship->get_from_field() == 
field_name))
           || ((relationship->get_to_table() == table_name) && (relationship->get_to_field() == field_name)) )
@@ -783,7 +783,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
       LayoutInfo& layout_info = *iterLayouts;
       for(type_list_layout_groups::iterator iter = layout_info.m_layout_groups.begin(); iter != 
layout_info.m_layout_groups.end(); ++iter)
       {
-        sharedptr<LayoutGroup> group = *iter;
+        std::shared_ptr<LayoutGroup> group = *iter;
         if(!group)
           continue;
 
@@ -801,8 +801,8 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
     DocumentTableInfo::type_reports reports = info->m_reports;
     for(DocumentTableInfo::type_reports::iterator iterReports = reports.begin(); iterReports != 
reports.end(); ++iterReports)
     {
-      sharedptr<Report> report = iterReports->second;
-      sharedptr<LayoutGroup> group = report->get_layout_group();
+      std::shared_ptr<Report> report = iterReports->second;
+      std::shared_ptr<LayoutGroup> group = report->get_layout_group();
 
       //Remove regular fields if the field is in this layout's table:
       if(info->m_info)
@@ -826,7 +826,7 @@ void Document::remove_table(const Glib::ustring& table_name)
   //Remove any relationships that use this table:
   for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<DocumentTableInfo> info = iter->second;
+    const std::shared_ptr<DocumentTableInfo> info = iter->second;
     if(!info)
       continue;
 
@@ -836,7 +836,7 @@ void Document::remove_table(const Glib::ustring& table_name)
       bool something_changed = true;
       while(something_changed && !info->m_relationships.empty())
       {
-        sharedptr<Relationship> relationship = *iterRel;
+        std::shared_ptr<Relationship> relationship = *iterRel;
 
         if(relationship->get_to_table() == table_name)
         {
@@ -866,7 +866,7 @@ Document::type_vec_fields Document::get_table_fields(const Glib::ustring& table_
 
   if(!table_name.empty())
   {
-    const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+    const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
     if(info)
     {
       if(info->m_fields.empty())
@@ -913,7 +913,7 @@ void Document::set_table_fields(const Glib::ustring& table_name, const type_vec_
       std::cerr << ": vecFields is empty: table_name=" << table_name << std::endl;
     }
 
-    const sharedptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
+    const std::shared_ptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
     if(!info)
       return;
 
@@ -924,7 +924,7 @@ void Document::set_table_fields(const Glib::ustring& table_name, const type_vec_
   }
 }
 
-sharedptr<Field> Document::get_field(const Glib::ustring& table_name, const Glib::ustring& strFieldName) 
const
+std::shared_ptr<Field> Document::get_field(const Glib::ustring& table_name, const Glib::ustring& 
strFieldName) const
 {
   type_vec_fields vecFields = get_table_fields(table_name);
   type_vec_fields::iterator iterFind = std::find_if( vecFields.begin(), vecFields.end(), 
predicate_FieldHasName<Field>(strFieldName) );
@@ -933,25 +933,25 @@ sharedptr<Field> Document::get_field(const Glib::ustring& table_name, const Glib
     return  *iterFind; //A reference, not a copy.
   }
 
-  return sharedptr<Field>();
+  return std::shared_ptr<Field>();
 }
 
-sharedptr<Field> Document::get_field_primary_key(const Glib::ustring& table_name) const
+std::shared_ptr<Field> Document::get_field_primary_key(const Glib::ustring& table_name) const
 {
   type_vec_fields vecFields = get_table_fields(table_name);
   for(type_vec_fields::const_iterator iter = vecFields.begin(); iter != vecFields.end(); ++iter)
   {
-    sharedptr<Field> field = *iter;
+    std::shared_ptr<Field> field = *iter;
     if(field && field->get_primary_key())
       return field;
   }
 
-  return sharedptr<Field>();
+  return std::shared_ptr<Field>();
 }
 
 void Document::change_field_name(const Glib::ustring& table_name, const Glib::ustring& strFieldNameOld, 
const Glib::ustring& strFieldNameNew)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     //Fields:
@@ -967,7 +967,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
     //Look at each table:
     for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
     {
-      const sharedptr<DocumentTableInfo> infoInner = iter->second;
+      const std::shared_ptr<DocumentTableInfo> infoInner = iter->second;
       if(!infoInner)
         continue;
 
@@ -975,7 +975,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
       type_vec_fields& vecFields = infoInner->m_fields;
       for(type_vec_fields::iterator iterField = vecFields.begin(); iterField != vecFields.end(); ++iterField)
       {
-        sharedptr<Field> field = *iterField;
+        std::shared_ptr<Field> field = *iterField;
         if(!field)
           continue;
 
@@ -987,7 +987,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
       //Look at each relationship in the table:
       for(type_vec_relationships::iterator iterRels = infoInner->m_relationships.begin(); iterRels != 
infoInner->m_relationships.end(); ++iterRels)
       {
-        sharedptr<Relationship> relationship = *iterRels;
+        std::shared_ptr<Relationship> relationship = *iterRels;
 
         if(relationship->get_from_table() == table_name)
         {
@@ -1016,7 +1016,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
         //Look at each group:
         for(type_list_layout_groups::iterator iterGroup = iterLayouts->m_layout_groups.begin(); iterGroup != 
iterLayouts->m_layout_groups.end(); ++iterGroup)
         {
-          sharedptr<LayoutGroup> group = *iterGroup;
+          std::shared_ptr<LayoutGroup> group = *iterGroup;
           if(group)
           {
             //Change the field if it is in this group:
@@ -1033,7 +1033,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
       for(DocumentTableInfo::type_reports::iterator iterReports = infoInner->m_reports.begin(); iterReports 
!= infoInner->m_reports.end(); ++iterReports)
       {
         //Change the field if it is in this group:
-        sharedptr<Report> report = iterReports->second;
+        std::shared_ptr<Report> report = iterReports->second;
         if(report)
         {
           if(is_parent_table)
@@ -1059,7 +1059,7 @@ void Document::change_table_name(const Glib::ustring& table_name_old, const Glib
     //so we copy the whole thing and put it back in the map under a different key:
 
     //iterFindTable->first = table_name_new;
-    const sharedptr<DocumentTableInfo> doctableinfo = iterFindTable->second;
+    const std::shared_ptr<DocumentTableInfo> doctableinfo = iterFindTable->second;
     m_tables.erase(iterFindTable);
 
     if(doctableinfo && doctableinfo->m_info)
@@ -1072,14 +1072,14 @@ void Document::change_table_name(const Glib::ustring& table_name_old, const Glib
     for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
     {
       //Look at each relationship in the table:
-      const sharedptr<DocumentTableInfo> doctableinfo = iter->second;
+      const std::shared_ptr<DocumentTableInfo> doctableinfo = iter->second;
       if(!doctableinfo)
         continue;
 
       type_vec_relationships relationships = doctableinfo->m_relationships;
       for(type_vec_relationships::iterator iterRels = relationships.begin(); iterRels != 
relationships.end(); ++iterRels)
       {
-        sharedptr<Relationship> relationship = *iterRels;
+        std::shared_ptr<Relationship> relationship = *iterRels;
 
         if(relationship->get_from_table() == table_name_old)
         {
@@ -1103,7 +1103,7 @@ void Document::change_table_name(const Glib::ustring& table_name_old, const Glib
 
 void Document::change_relationship_name(const Glib::ustring& table_name, const Glib::ustring& name, const 
Glib::ustring& name_new)
 {
-  const sharedptr<DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo)
   {
     type_vec_relationships relationships = doctableinfo->m_relationships;
@@ -1114,7 +1114,7 @@ void Document::change_relationship_name(const Glib::ustring& table_name, const G
       (*iterRelFind)->set_name(name_new);
 
 
-    //Any layouts, reports, etc that use this relationship will already have the new name via the 
sharedptr<Relationship>.
+    //Any layouts, reports, etc that use this relationship will already have the new name via the 
std::shared_ptr<Relationship>.
 
 
     //Look at each table:
@@ -1172,7 +1172,7 @@ Document::type_listConstTableInfo Document::get_tables(bool plus_system_prefs) c
 
   for(type_tables::const_iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<const DocumentTableInfo> doctableinfo = iter->second;
+    const std::shared_ptr<const DocumentTableInfo> doctableinfo = iter->second;
     if(doctableinfo)
       result.push_back(doctableinfo->m_info);
 
@@ -1195,7 +1195,7 @@ Document::type_listTableInfo Document::get_tables(bool plus_system_prefs)
 
   for(type_tables::const_iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<DocumentTableInfo> doctableinfo = iter->second;
+    const std::shared_ptr<DocumentTableInfo> doctableinfo = iter->second;
     if(doctableinfo)
       result.push_back(doctableinfo->m_info);
 
@@ -1218,7 +1218,7 @@ std::vector<Glib::ustring> Document::get_table_names(bool plus_system_prefs) con
   std::vector<Glib::ustring> result;
   for(type_listConstTableInfo::const_iterator iter = list_full.begin(); iter != list_full.end(); ++iter)
   {
-    const sharedptr<const TableInfo> info = *iter;
+    const std::shared_ptr<const TableInfo> info = *iter;
     if(info)
       result.push_back(info->get_name());
   }
@@ -1226,16 +1226,16 @@ std::vector<Glib::ustring> Document::get_table_names(bool plus_system_prefs) con
   return result;
 }
 
-sharedptr<TableInfo> Document::get_table(const Glib::ustring& table_name) const
+std::shared_ptr<TableInfo> Document::get_table(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo)
     return doctableinfo->m_info;
 
-  return sharedptr<TableInfo>();
+  return std::shared_ptr<TableInfo>();
 }
 
-void Document::add_table(const sharedptr<TableInfo>& table_info)
+void Document::add_table(const std::shared_ptr<TableInfo>& table_info)
 {
   if(!table_info)
     return;
@@ -1243,7 +1243,7 @@ void Document::add_table(const sharedptr<TableInfo>& table_info)
   type_tables::const_iterator iterfind = m_tables.find(table_info->get_name());
   if(iterfind == m_tables.end())
   {
-    const sharedptr<DocumentTableInfo> item = sharedptr<DocumentTableInfo>::create();
+    const std::shared_ptr<DocumentTableInfo> item = std::shared_ptr<DocumentTableInfo>(new 
DocumentTableInfo());
     item->m_info = table_info;
     m_tables[table_info->get_name()] = item;
     set_modified();
@@ -1252,7 +1252,7 @@ void Document::add_table(const sharedptr<TableInfo>& table_info)
 
 bool Document::get_table_overview_position(const Glib::ustring& table_name, float& x, float& y) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo)
   {
     if( doctableinfo->m_overviewx == std::numeric_limits<float>::infinity() ||
@@ -1273,7 +1273,7 @@ bool Document::get_table_overview_position(const Glib::ustring& table_name, floa
 
 void Document::set_table_overview_position(const Glib::ustring& table_name, float x, float y)
 {
-  const sharedptr<DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo)
   {
     doctableinfo->m_overviewx = x;
@@ -1289,11 +1289,11 @@ void Document::set_tables(const type_listTableInfo& tables)
   bool something_changed = false;
   for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<DocumentTableInfo> doctableinfo = iter->second;
+    const std::shared_ptr<DocumentTableInfo> doctableinfo = iter->second;
     if(!doctableinfo)
       continue;
 
-    sharedptr<TableInfo> info = doctableinfo->m_info;
+    std::shared_ptr<TableInfo> info = doctableinfo->m_info;
     if(!info)
       continue;
 
@@ -1303,7 +1303,7 @@ void Document::set_tables(const type_listTableInfo& tables)
     type_listTableInfo::const_iterator iterfind = std::find_if(tables.begin(), tables.end(), 
predicate_FieldHasName<TableInfo>(table_name));
     if(iterfind != tables.end())
     {
-      sharedptr<TableInfo> infoFound = *iterfind;
+      std::shared_ptr<TableInfo> infoFound = *iterfind;
       *info = *infoFound; //TODO: Check that it has really changed, to avoid calling set_modified() 
unnecessarily?
 
       something_changed = true;
@@ -1318,18 +1318,18 @@ void Document::fill_sort_field_details(const Glib::ustring& parent_table_name, F
 {
   for(Formatting::type_list_sort_fields::iterator iter = sort_fields.begin(); iter != sort_fields.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> sort_field = iter->first;
+    std::shared_ptr<const LayoutItem_Field> sort_field = iter->first;
     if(!sort_field)
      continue;
  
     //TODO: Avoid this unconst?
-    sharedptr<LayoutItem_Field> unconst_sort_field = sharedptr<LayoutItem_Field>::cast_const(sort_field);
-    sharedptr<Field> field = get_field( sort_field->get_table_used(parent_table_name), 
sort_field->get_name() );
+    std::shared_ptr<LayoutItem_Field> unconst_sort_field = 
std::const_pointer_cast<LayoutItem_Field>(sort_field);
+    std::shared_ptr<Field> field = get_field( sort_field->get_table_used(parent_table_name), 
sort_field->get_name() );
     unconst_sort_field->set_full_field_details(field);
   }
 }
 
-void Document::fill_layout_field_details(const Glib::ustring& parent_table_name, const 
sharedptr<LayoutGroup>& layout_group) const
+void Document::fill_layout_field_details(const Glib::ustring& parent_table_name, const 
std::shared_ptr<LayoutGroup>& layout_group) const
 {
   if(!layout_group)
     return;
@@ -1338,16 +1338,16 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
 
   for(LayoutGroup::type_list_items::iterator iter = layout_group->m_list_items.begin(); iter != 
layout_group->m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> layout_item = *iter;
+    std::shared_ptr<LayoutItem> layout_item = *iter;
 
     //Check custom Field Formatting:
-    sharedptr<LayoutItem_WithFormatting> layout_withformatting = 
-      sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_WithFormatting> layout_withformatting = 
+      std::dynamic_pointer_cast<LayoutItem_WithFormatting>(layout_item);
     if(layout_withformatting)
     {
-      sharedptr<const Relationship> choice_relationship;
-      sharedptr<LayoutItem_Field> choice_layout_first;
-      sharedptr<LayoutGroup> choice_extra_layouts;
+      std::shared_ptr<const Relationship> choice_relationship;
+      std::shared_ptr<LayoutItem_Field> choice_layout_first;
+      std::shared_ptr<LayoutGroup> choice_extra_layouts;
       Formatting::type_list_sort_fields choice_sort_fields;
       bool choice_show_all = false;
       layout_withformatting->m_formatting.get_choices_related(choice_relationship, choice_layout_first, 
choice_extra_layouts, choice_sort_fields, choice_show_all);
@@ -1360,17 +1360,17 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
       fill_sort_field_details(table_name, choice_sort_fields);
     }
 
-    sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Field> layout_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
     if(layout_field)
     {
-      const sharedptr<Field> field = get_field(layout_field->get_table_used(parent_table_name), 
layout_field->get_name());
+      const std::shared_ptr<Field> field = get_field(layout_field->get_table_used(parent_table_name), 
layout_field->get_name());
       layout_field->set_full_field_details(field);
       if(field)
       {
         //Check default Field Formatting:
-        sharedptr<const Relationship> choice_relationship;
-        sharedptr<LayoutItem_Field> choice_layout_first;
-        sharedptr<LayoutGroup> choice_extra_layouts;
+        std::shared_ptr<const Relationship> choice_relationship;
+        std::shared_ptr<LayoutItem_Field> choice_layout_first;
+        std::shared_ptr<LayoutGroup> choice_extra_layouts;
         Formatting::type_list_sort_fields choice_sort_fields;
         bool choice_show_all = false;
         field->m_default_formatting.get_choices_related(choice_relationship, choice_layout_first, 
choice_extra_layouts, choice_sort_fields, choice_show_all);
@@ -1385,12 +1385,12 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
     }
     else
     {
-      sharedptr<LayoutItem_Portal> layout_portal_child = 
sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal_child = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layout_portal_child)
         fill_layout_field_details(layout_portal_child->get_table_used(parent_table_name), 
layout_portal_child); //recurse
       else
       {
-        sharedptr<LayoutGroup> layout_group_child = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutGroup> layout_group_child = 
std::dynamic_pointer_cast<LayoutGroup>(layout_item);
         if(layout_group_child)
           fill_layout_field_details(parent_table_name, layout_group_child); //recurse
       }
@@ -1402,7 +1402,7 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
 {
   for(type_list_layout_groups::iterator iterGroups = groups.begin(); iterGroups != groups.end(); 
++iterGroups)
   {
-    sharedptr<LayoutGroup> group = *iterGroups;
+    std::shared_ptr<LayoutGroup> group = *iterGroups;
     if(group)
       fill_layout_field_details(parent_table_name, group);
   }
@@ -1413,18 +1413,18 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
   type_list_layout_groups result;
 
   //Add one if necessary:
-  sharedptr<LayoutGroup> overview;
-  sharedptr<LayoutGroup> details;
+  std::shared_ptr<LayoutGroup> overview;
+  std::shared_ptr<LayoutGroup> details;
 
   if(layout_name == "details") //The Details default layout is a bit more complicated.
   {
-    overview = sharedptr<LayoutGroup>::create();;
+    overview = std::shared_ptr<LayoutGroup>(new LayoutGroup());;
     overview->set_name("overview");
     overview->set_title_original(_("Overview"));
     overview->set_columns_count(2);
     result.push_back(overview);
 
-    details = sharedptr<LayoutGroup>::create();
+    details = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     details->set_name("details");
     details->set_title_original(_("Details"));
     details->set_columns_count(2);
@@ -1434,7 +1434,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
   //If, for some reason, we didn't create the-subgroups, add everything to a top level group:
   if(!overview && !details)
   {
-    overview = sharedptr<LayoutGroup>::create();
+    overview = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     overview->set_name("main");
     overview->set_columns_count(1);
     result.push_back(overview);
@@ -1455,7 +1455,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
       bool found = false; //TODO: This is horrible.
       for(type_list_layout_groups::const_iterator iterFind = result.begin(); iterFind != result.end(); 
++iterFind)
       {
-        sharedptr<const LayoutGroup> group = *iterFind;
+        std::shared_ptr<const LayoutGroup> group = *iterFind;
         if(group && group->has_field(parent_table_name, parent_table_name, field_name))
         {
           found = true;
@@ -1465,7 +1465,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
 
       if(!found)
       {
-        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layout_item->set_full_field_details(*iter);
         //layout_item.set_table_name(child_table_name); //TODO: Allow viewing of fields through 
relationships.
         //layout_item.m_sequence = sequence;  add_item() will fill this.
@@ -1511,7 +1511,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_plus_new_fiel
     {
       for(type_list_layout_groups::iterator iter = result.begin(); iter != result.end(); ++iter)
       {
-        sharedptr<LayoutGroup> layout_group = *iter;
+        std::shared_ptr<LayoutGroup> layout_group = *iter;
         if(!layout_group)
           continue;
 
@@ -1540,7 +1540,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups(const Glib::u
 {
   //std::cout << "debug: " << G_STRFUNC << ": layout_name=" << layout_name << ", parent_table_name=" << 
parent_table_name << ", layout_platform=" << layout_platform << std::endl;
 
-  const sharedptr<const DocumentTableInfo> info = get_table_info(parent_table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(parent_table_name);
   if(info)
   {
     const DocumentTableInfo::type_layouts layouts = info->m_layouts;
@@ -1562,7 +1562,7 @@ bool Document::get_data_layout_groups_have_any_fields(const Glib::ustring& layou
   type_list_layout_groups layout_groups = get_data_layout_groups(layout_name, parent_table_name, 
layout_platform);
   for(type_list_layout_groups::iterator iter = layout_groups.begin(); iter != layout_groups.end(); ++iter)
   {
-    sharedptr<LayoutGroup> layout_group = *iter;
+    std::shared_ptr<LayoutGroup> layout_group = *iter;
     if(layout_group && layout_group->has_any_fields())
       return true;
   }
@@ -1578,7 +1578,7 @@ void Document::set_data_layout_groups(const Glib::ustring& layout_name, const Gl
 
   if(!parent_table_name.empty())
   {
-    const sharedptr<DocumentTableInfo> info = get_table_info_with_add(parent_table_name);
+    const std::shared_ptr<DocumentTableInfo> info = get_table_info_with_add(parent_table_name);
     if(!info)
       return;
 
@@ -1597,34 +1597,34 @@ void Document::set_data_layout_groups(const Glib::ustring& layout_name, const Gl
   }
 }
 
-sharedptr<Document::DocumentTableInfo> Document::get_table_info(const Glib::ustring& table_name)
+std::shared_ptr<Document::DocumentTableInfo> Document::get_table_info(const Glib::ustring& table_name)
 {
   type_tables::iterator iterFind = m_tables.find(table_name);
   if(iterFind != m_tables.end())
     return iterFind->second;
 
-  return sharedptr<DocumentTableInfo>();
+  return std::shared_ptr<DocumentTableInfo>();
 }
 
-sharedptr<const Document::DocumentTableInfo> Document::get_table_info(const Glib::ustring& table_name) const
+std::shared_ptr<const Document::DocumentTableInfo> Document::get_table_info(const Glib::ustring& table_name) 
const
 {
   type_tables::const_iterator iterFind = m_tables.find(table_name);
   if(iterFind != m_tables.end())
     return iterFind->second;
 
-  return sharedptr<const DocumentTableInfo>();
+  return std::shared_ptr<const DocumentTableInfo>();
 }
 
-sharedptr<Document::DocumentTableInfo> Document::get_table_info_with_add(const Glib::ustring& table_name)
+std::shared_ptr<Document::DocumentTableInfo> Document::get_table_info_with_add(const Glib::ustring& 
table_name)
 {
-  sharedptr<DocumentTableInfo>  doctableinfo = get_table_info(table_name);
+  std::shared_ptr<DocumentTableInfo>  doctableinfo = get_table_info(table_name);
   if(doctableinfo)
   {
     return doctableinfo;
   }
   else
   {
-    doctableinfo = sharedptr<DocumentTableInfo>::create();
+    doctableinfo = std::shared_ptr<DocumentTableInfo>(new DocumentTableInfo());
     doctableinfo->m_info->set_name(table_name);
     m_tables[table_name] = doctableinfo;
     return doctableinfo;
@@ -1633,7 +1633,7 @@ sharedptr<Document::DocumentTableInfo> Document::get_table_info_with_add(const G
 
 Glib::ustring Document::get_table_title(const Glib::ustring& table_name, const Glib::ustring& locale) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo && doctableinfo->m_info)
     return doctableinfo->m_info->get_title(locale);
 
@@ -1642,7 +1642,7 @@ Glib::ustring Document::get_table_title(const Glib::ustring& table_name, const G
 
 Glib::ustring Document::get_table_title_original(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo && doctableinfo->m_info)
     return doctableinfo->m_info->get_title_original();
 
@@ -1651,7 +1651,7 @@ Glib::ustring Document::get_table_title_original(const Glib::ustring& table_name
 
 Glib::ustring Document::get_table_title_singular(const Glib::ustring& table_name, const Glib::ustring& 
locale) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo && doctableinfo->m_info)
     return doctableinfo->m_info->get_title_singular_with_fallback(locale);
 
@@ -1660,7 +1660,7 @@ Glib::ustring Document::get_table_title_singular(const Glib::ustring& table_name
 
 Glib::ustring Document::get_table_title_singular_original(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo && doctableinfo->m_info)
     return doctableinfo->m_info->get_title_singular_original();
 
@@ -1672,7 +1672,7 @@ void Document::set_table_title(const Glib::ustring& table_name, const Glib::ustr
   //std::cout << "debug: " << G_STRFUNC << ": table_name=" << table_name << ", value=" << value << std::endl;
   if(!table_name.empty())
   {
-    const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+    const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
     if(info && info->m_info && info->m_info->get_title(locale) != value)
     {
       info->m_info->set_title(value, locale);
@@ -1685,7 +1685,7 @@ void Document::set_table_example_data(const Glib::ustring& table_name, const typ
 {
   if(!table_name.empty())
   {
-    const sharedptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
+    const std::shared_ptr<DocumentTableInfo> info = get_table_info_with_add(table_name);
     if(info && info->m_example_rows != rows)
     {
       info->m_example_rows = rows;
@@ -1696,7 +1696,7 @@ void Document::set_table_example_data(const Glib::ustring& table_name, const typ
 
 Document::type_example_rows Document::get_table_example_data(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo)
    return doctableinfo->m_example_rows;
 
@@ -1711,7 +1711,7 @@ bool Document::get_table_is_known(const Glib::ustring& table_name) const
 
 bool Document::get_table_is_hidden(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = get_table_info(table_name);
   if(doctableinfo && doctableinfo->m_info)
       return doctableinfo->m_info->get_hidden();
 
@@ -1802,11 +1802,11 @@ Glib::ustring Document::get_default_table() const
 {
   for(type_tables::const_iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
   {
-    const sharedptr<const DocumentTableInfo> doctableinfo = iter->second;
+    const std::shared_ptr<const DocumentTableInfo> doctableinfo = iter->second;
     if(!doctableinfo)
       continue;
 
-    const sharedptr<const TableInfo> info = doctableinfo->m_info;
+    const std::shared_ptr<const TableInfo> info = doctableinfo->m_info;
     if(info && info->get_default())
       return info->get_name();
   }
@@ -1816,7 +1816,7 @@ Glib::ustring Document::get_default_table() const
   {
     type_tables::const_iterator iter = m_tables.begin();
 
-    const sharedptr<const DocumentTableInfo> doctableinfo = iter->second;
+    const std::shared_ptr<const DocumentTableInfo> doctableinfo = iter->second;
     if(doctableinfo && doctableinfo->m_info)
       return doctableinfo->m_info->get_name();
   }
@@ -1830,7 +1830,7 @@ Glib::ustring Document::get_first_table() const
     return Glib::ustring();
 
   type_tables::const_iterator iter = m_tables.begin();
-  const sharedptr<const DocumentTableInfo> doctableinfo = iter->second;
+  const std::shared_ptr<const DocumentTableInfo> doctableinfo = iter->second;
   if(doctableinfo && doctableinfo->m_info)
     return doctableinfo->m_info->get_name();
 
@@ -1915,14 +1915,14 @@ void Document::set_modified(bool value)
   //}
 }
 
-void Document::load_after_layout_item_formatting(const xmlpp::Element* element, const 
sharedptr<LayoutItem_WithFormatting>& layout_item, const Glib::ustring& table_name)
+void Document::load_after_layout_item_formatting(const xmlpp::Element* element, const 
std::shared_ptr<LayoutItem_WithFormatting>& layout_item, const Glib::ustring& table_name)
 {
   if(!layout_item)
     return;
 
   Formatting& format = layout_item->m_formatting;
 
-  sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
 
   Field::glom_field_type field_type = Field::TYPE_INVALID;
   if(field)
@@ -1996,12 +1996,12 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
               //Discover the field type, so we can interpret the text as a value.
               //Not all calling functions know this, so they don't all supply the correct value.
               //TODO_Performance.
-              const sharedptr<const Field> field_temp = get_field(table_name, field_name);
+              const std::shared_ptr<const Field> field_temp = get_field(table_name, field_name);
               if(field_temp)
                 field_type = field_temp->get_glom_type();
             }
 
-            sharedptr<ChoiceValue> value = sharedptr<ChoiceValue>::create();
+            std::shared_ptr<ChoiceValue> value = std::shared_ptr<ChoiceValue>(new ChoiceValue());
             load_after_choicevalue(element, value, field_type);
             list_values.push_back(value);
           }
@@ -2016,7 +2016,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
     const Glib::ustring relationship_name = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_RELATIONSHIP);
     if(!relationship_name.empty())
     {
-      sharedptr<const Relationship> relationship = get_relationship(table_name, relationship_name);
+      std::shared_ptr<const Relationship> relationship = get_relationship(table_name, relationship_name);
 
       bool show_all = XmlUtils::get_node_attribute_value_as_bool(element, 
GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_SHOW_ALL);
       if(get_document_format_version() < 6)
@@ -2025,10 +2025,10 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
       }
 
       const Glib::ustring field_first = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_FIELD);
-      sharedptr<LayoutItem_Field> layout_field_first = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> layout_field_first = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layout_field_first->set_name(field_first);
 
-      sharedptr<LayoutGroup> extra_layouts;
+      std::shared_ptr<LayoutGroup> extra_layouts;
 
       //Previous versions just saved a single extra field name, instead of a whole set of layoutgroups:
       if(m_document_format_version < 6)
@@ -2037,8 +2037,8 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
         const Glib::ustring field_second = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_SECOND);
         if(!field_second.empty())
         {
-          extra_layouts = sharedptr<LayoutGroup>::create();
-          sharedptr<LayoutItem_Field> item = sharedptr<LayoutItem_Field>::create();
+          extra_layouts = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+          std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
           item->set_name(field_second);
           extra_layouts->add_item(item);
         }
@@ -2053,12 +2053,12 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
           if(nodeGroups)
           {
 
-            sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::create();
+            std::shared_ptr<LayoutGroup> layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
             load_after_layout_group(nodeGroups, relationship->get_to_table(), layout_group);
             if(layout_group && !(layout_group->m_list_items.empty()))
             {
               //We actually want the sub-group:
-              extra_layouts = sharedptr<LayoutGroup>::cast_dynamic( layout_group->m_list_items[0] );
+              extra_layouts = std::dynamic_pointer_cast<LayoutGroup>( layout_group->m_list_items[0] );
             }
           }
         }
@@ -2081,13 +2081,13 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
   }
 }
 
-void Document::load_after_layout_item_usesrelationship(const xmlpp::Element* element, const Glib::ustring& 
table_name, const sharedptr<UsesRelationship>& item)
+void Document::load_after_layout_item_usesrelationship(const xmlpp::Element* element, const Glib::ustring& 
table_name, const std::shared_ptr<UsesRelationship>& item)
 {
   if(!element || !item)
     return;
 
   const Glib::ustring relationship_name = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_RELATIONSHIP_NAME);
-  sharedptr<Relationship> relationship;
+  std::shared_ptr<Relationship> relationship;
   if(!relationship_name.empty())
   {
     //std::cout << "  debug in : table_name=" << table_name << ", relationship_name=" << relationship_name 
<< std::endl;
@@ -2103,7 +2103,7 @@ void Document::load_after_layout_item_usesrelationship(const xmlpp::Element* ele
   const Glib::ustring related_relationship_name = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_RELATED_RELATIONSHIP_NAME);
   if(!related_relationship_name.empty() && relationship)
   {
-    sharedptr<Relationship> related_relationship = get_relationship(relationship->get_to_table(), 
related_relationship_name);
+    std::shared_ptr<Relationship> related_relationship = get_relationship(relationship->get_to_table(), 
related_relationship_name);
     if(!related_relationship)
       std::cerr << G_STRFUNC << ": related relationship not found in table=" << relationship->get_to_table() 
<< ",  name=" << related_relationship_name << std::endl;
 
@@ -2111,7 +2111,7 @@ void Document::load_after_layout_item_usesrelationship(const xmlpp::Element* ele
   }
 }
 
-void Document::load_after_layout_item_field(const xmlpp::Element* element, const Glib::ustring& table_name, 
const sharedptr<LayoutItem_Field>& item)
+void Document::load_after_layout_item_field(const xmlpp::Element* element, const Glib::ustring& table_name, 
const std::shared_ptr<LayoutItem_Field>& item)
 {
   const Glib::ustring name = XmlUtils::get_node_attribute_value(element, GLOM_ATTRIBUTE_NAME);
   item->set_name(name);
@@ -2119,7 +2119,7 @@ void Document::load_after_layout_item_field(const xmlpp::Element* element, const
   load_after_layout_item_usesrelationship(element, table_name, item);
 
   //Needed to decide what formatting to load/save:
-  const sharedptr<const Field> field = get_field(item->get_table_used(table_name), name);
+  const std::shared_ptr<const Field> field = get_field(item->get_table_used(table_name), name);
   
   // This is not unusual, because tables often refer to tables that have not been loaded yet.
   // Code should sometimes check this before returning the layout items.
@@ -2138,7 +2138,7 @@ void Document::load_after_layout_item_field(const xmlpp::Element* element, const
   const xmlpp::Element* nodeCustomTitle = XmlUtils::get_node_child_named(element, 
GLOM_NODE_LAYOUT_ITEM_CUSTOM_TITLE);
   if(nodeCustomTitle)
   {
-    sharedptr<CustomTitle> custom_title = sharedptr<CustomTitle>::create();
+    std::shared_ptr<CustomTitle> custom_title = std::shared_ptr<CustomTitle>(new CustomTitle());
     custom_title->set_use_custom_title( XmlUtils::get_node_attribute_value_as_bool(nodeCustomTitle, 
GLOM_ATTRIBUTE_LAYOUT_ITEM_CUSTOM_TITLE_USE) );
 
     load_after_translations(nodeCustomTitle, custom_title);
@@ -2159,7 +2159,7 @@ void Document::load_after_sort_by(const xmlpp::Element* node, const Glib::ustrin
     const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(*iter);
     if(element)
     {
-      sharedptr<LayoutItem_Field> item = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
       //item.set_full_field_details_empty();
       load_after_layout_item_field(element, table_name, item);
       item->set_full_field_details( get_field(item->get_table_used(table_name), item->get_name()) );
@@ -2171,7 +2171,7 @@ void Document::load_after_sort_by(const xmlpp::Element* node, const Glib::ustrin
   }
 }
 
-void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::ustring& table_name, const 
sharedptr<LayoutGroup>& group, bool with_print_layout_positions)
+void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::ustring& table_name, const 
std::shared_ptr<LayoutGroup>& group, bool with_print_layout_positions)
 {
   if(!node || !group)
   {
@@ -2187,14 +2187,14 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
   group->set_border_width( XmlUtils::get_node_attribute_value_as_decimal_double(node, 
GLOM_ATTRIBUTE_BORDER_WIDTH) );
 
   //Translations:
-  sharedptr<LayoutGroup> temp = group;
+  std::shared_ptr<LayoutGroup> temp = group;
   load_after_translations(node, temp);
 
   //Get the child items:
   xmlpp::Node::NodeList listNodes = node->get_children();
   for(xmlpp::Node::NodeList::iterator iter = listNodes.begin(); iter != listNodes.end(); ++iter)
   {
-    sharedptr<LayoutItem> item_added;
+    std::shared_ptr<LayoutItem> item_added;
 
     //Create the layout item:
     const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(*iter);
@@ -2202,7 +2202,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
     {
       if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM) //TODO: Rename this to 
GLOM_NODE_DATA_LAYOUT_ITEM_FIELD
       {
-        sharedptr<LayoutItem_Field> item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
         //item.set_full_field_details_empty();
         load_after_layout_item_field(element, table_name, item);
 
@@ -2210,7 +2210,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_BUTTON)
       {
-        sharedptr<LayoutItem_Button> item = sharedptr<LayoutItem_Button>::create();
+        std::shared_ptr<LayoutItem_Button> item = std::shared_ptr<LayoutItem_Button>(new 
LayoutItem_Button());
 
         item->set_script( XmlUtils::get_child_text_node(element, GLOM_NODE_BUTTON_SCRIPT) );
         if(!(item->get_has_script())) //Try the deprecated attribute instead
@@ -2222,14 +2222,14 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_TEXTOBJECT)
       {
-        sharedptr<LayoutItem_Text> item = sharedptr<LayoutItem_Text>::create();
+        std::shared_ptr<LayoutItem_Text> item = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
         load_after_translations(element, item);
 
         //The text can be translated too, so it has its own node:
         const xmlpp::Element* element_text = XmlUtils::get_node_child_named(element, 
GLOM_NODE_DATA_LAYOUT_TEXTOBJECT_TEXT);
         if(element_text)
         {
-          sharedptr<StaticText> translatable_text = sharedptr<StaticText>::create();
+          std::shared_ptr<StaticText> translatable_text = std::shared_ptr<StaticText>(new StaticText());
           load_after_translations(element_text, translatable_text);
           item->m_text = translatable_text;
           //std::cout << "  DEBUG: text: " << item->m_text->get_title_or_name() << std::endl;
@@ -2239,7 +2239,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_IMAGEOBJECT)
       {
-        sharedptr<LayoutItem_Image> item = sharedptr<LayoutItem_Image>::create();
+        std::shared_ptr<LayoutItem_Image> item = std::shared_ptr<LayoutItem_Image>(new LayoutItem_Image());
         load_after_translations(element, item);
 
         Gnome::Gda::Value value_image;
@@ -2261,7 +2261,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_LINE)
       {
-        sharedptr<LayoutItem_Line> item = sharedptr<LayoutItem_Line>::create();
+        std::shared_ptr<LayoutItem_Line> item = std::shared_ptr<LayoutItem_Line>(new LayoutItem_Line());
         //Has no translations: load_after_translations(element, item);
 
         item->set_coordinates(
@@ -2280,7 +2280,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_FIELDSUMMARY)
       {
-        sharedptr<LayoutItem_FieldSummary> item = sharedptr<LayoutItem_FieldSummary>::create();
+        std::shared_ptr<LayoutItem_FieldSummary> item = std::shared_ptr<LayoutItem_FieldSummary>(new 
LayoutItem_FieldSummary());
         //item.set_full_field_details_empty();
         load_after_layout_item_field(element, table_name, item);
         item->set_full_field_details( get_field(item->get_table_used(table_name), item->get_name()) );
@@ -2290,41 +2290,41 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_HEADER)
       {
-        sharedptr<LayoutItem_Header> child_group = sharedptr<LayoutItem_Header>::create();
+        std::shared_ptr<LayoutItem_Header> child_group = std::shared_ptr<LayoutItem_Header>(new 
LayoutItem_Header());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
         item_added = child_group;
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_FOOTER)
       {
-        sharedptr<LayoutItem_Footer> child_group = sharedptr<LayoutItem_Footer>::create();
+        std::shared_ptr<LayoutItem_Footer> child_group = std::shared_ptr<LayoutItem_Footer>(new 
LayoutItem_Footer());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
         item_added = child_group;
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_GROUP)
       {
-        sharedptr<LayoutGroup> child_group = sharedptr<LayoutGroup>::create();
+        std::shared_ptr<LayoutGroup> child_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
         item_added = child_group;
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_NOTEBOOK)
       {
-        sharedptr<LayoutItem_Notebook> notebook = sharedptr<LayoutItem_Notebook>::create();
+        std::shared_ptr<LayoutItem_Notebook> notebook = std::shared_ptr<LayoutItem_Notebook>(new 
LayoutItem_Notebook());
         load_after_layout_group(element, table_name, notebook, with_print_layout_positions);
         item_added = notebook;
       }
       else if( (element->get_name() == GLOM_NODE_DATA_LAYOUT_PORTAL) || (element->get_name() == 
GLOM_NODE_DATA_LAYOUT_CALENDAR_PORTAL) )
       {
-        sharedptr<LayoutItem_Portal> portal;
-        sharedptr<LayoutItem_CalendarPortal> calendar_portal;
+        std::shared_ptr<LayoutItem_Portal> portal;
+        std::shared_ptr<LayoutItem_CalendarPortal> calendar_portal;
 
         if(element->get_name() == GLOM_NODE_DATA_LAYOUT_PORTAL)
-          portal = sharedptr<LayoutItem_Portal>::create();
+          portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal());
         else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_CALENDAR_PORTAL)
         {
-          calendar_portal = sharedptr<LayoutItem_CalendarPortal>::create();
+          calendar_portal = std::shared_ptr<LayoutItem_CalendarPortal>(new LayoutItem_CalendarPortal());
           portal = calendar_portal;
         }
 
@@ -2348,7 +2348,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
           else if(navigation_type_as_string == GLOM_ATTRIBUTE_PORTAL_NAVIGATION_TYPE_SPECIFIC)
           {
             //Read the specified relationship name:
-            sharedptr<UsesRelationship> relationship_navigation_specific = 
sharedptr<UsesRelationship>::create();
+            std::shared_ptr<UsesRelationship> relationship_navigation_specific = 
std::shared_ptr<UsesRelationship>(new UsesRelationship());
             load_after_layout_item_usesrelationship(elementNavigationRelationshipSpecific, 
portal->get_table_used(table_name), relationship_navigation_specific);
             portal->set_navigation_relationship_specific(relationship_navigation_specific);
           }
@@ -2360,7 +2360,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
         if(calendar_portal)
         {
           const Glib::ustring date_field_name = XmlUtils::get_node_attribute_value(element, 
GLOM_ATTRIBUTE_PORTAL_CALENDAR_DATE_FIELD);
-          sharedptr<Field> date_field = get_field(calendar_portal->get_table_used(table_name), 
date_field_name);
+          std::shared_ptr<Field> date_field = get_field(calendar_portal->get_table_used(table_name), 
date_field_name);
           calendar_portal->set_date_field(date_field);
         }
 
@@ -2395,12 +2395,12 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_GROUPBY)
       {
-        sharedptr<LayoutItem_GroupBy> child_group = sharedptr<LayoutItem_GroupBy>::create();
+        std::shared_ptr<LayoutItem_GroupBy> child_group = std::shared_ptr<LayoutItem_GroupBy>(new 
LayoutItem_GroupBy());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
 
         //Group-By field:
-        sharedptr<LayoutItem_Field> field_groupby = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> field_groupby = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         xmlpp::Element* elementGroupBy = XmlUtils::get_node_child_named(element, 
GLOM_NODE_REPORT_ITEM_GROUPBY_GROUPBY);
         if(elementGroupBy)
         {
@@ -2437,7 +2437,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_VERTICALGROUP)
       {
-        sharedptr<LayoutItem_VerticalGroup> child_group = sharedptr<LayoutItem_VerticalGroup>::create();
+        std::shared_ptr<LayoutItem_VerticalGroup> child_group = 
std::shared_ptr<LayoutItem_VerticalGroup>(new LayoutItem_VerticalGroup());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
 
@@ -2445,7 +2445,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
       }
       else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_SUMMARY)
       {
-        sharedptr<LayoutItem_Summary> child_group = sharedptr<LayoutItem_Summary>::create();
+        std::shared_ptr<LayoutItem_Summary> child_group = std::shared_ptr<LayoutItem_Summary>(new 
LayoutItem_Summary());
         //Recurse:
         load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
 
@@ -2454,7 +2454,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
     }
 
     //Load formatting for any layout type that uses it:
-    sharedptr<LayoutItem_WithFormatting> withformatting = 
sharedptr<LayoutItem_WithFormatting>::cast_dynamic(item_added);
+    std::shared_ptr<LayoutItem_WithFormatting> withformatting = 
std::dynamic_pointer_cast<LayoutItem_WithFormatting>(item_added);
     if(withformatting)
     {
        const xmlpp::Element* elementFormatting = XmlUtils::get_node_child_named(element, GLOM_NODE_FORMAT);
@@ -2479,12 +2479,12 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
   } //for
 }
 
-void Document::load_after_translations(const xmlpp::Element* element, const sharedptr<TranslatableItem>& 
item)
+void Document::load_after_translations(const xmlpp::Element* element, const 
std::shared_ptr<TranslatableItem>& item)
 {
   if(!element)
     return;
 
-  const sharedptr<ChoiceValue> choicevalue = sharedptr<ChoiceValue>::cast_dynamic(item);
+  const std::shared_ptr<ChoiceValue> choicevalue = std::dynamic_pointer_cast<ChoiceValue>(item);
   if(!choicevalue) //This item does not use the title, but uses the title translations to translate its 
value, if it is of type text.
   {
     item->set_title_original( XmlUtils::get_node_attribute_value(element, GLOM_ATTRIBUTE_TITLE));
@@ -2514,20 +2514,20 @@ void Document::load_after_translations(const xmlpp::Element* element, const shar
   }
 
   //If it has a singular title, then load that too:
-  const sharedptr<HasTitleSingular> has_title_singular =
-     sharedptr<HasTitleSingular>::cast_dynamic(item);
+  const std::shared_ptr<HasTitleSingular> has_title_singular =
+     std::dynamic_pointer_cast<HasTitleSingular>(item);
   if(has_title_singular)
   {
     const xmlpp::Element* nodeTitleSingular = XmlUtils::get_node_child_named(element, 
GLOM_NODE_TABLE_TITLE_SINGULAR);
 
     if(!has_title_singular->m_title_singular)
-     has_title_singular->m_title_singular = sharedptr<TranslatableItem>::create();
+     has_title_singular->m_title_singular = std::shared_ptr<TranslatableItem>(new TranslatableItem());
 
     load_after_translations(nodeTitleSingular, has_title_singular->m_title_singular);
   }
 }
 
-void Document::load_after_print_layout_position(const xmlpp::Element* nodeItem, const sharedptr<LayoutItem>& 
item)
+void Document::load_after_print_layout_position(const xmlpp::Element* nodeItem, const 
std::shared_ptr<LayoutItem>& item)
 {
   if(!nodeItem)
     return;
@@ -2543,12 +2543,12 @@ void Document::load_after_print_layout_position(const xmlpp::Element* nodeItem,
   }
 }
 
-void Document::load_after_choicevalue(const xmlpp::Element* element, const sharedptr<ChoiceValue>& item, 
Field::glom_field_type field_type)
+void Document::load_after_choicevalue(const xmlpp::Element* element, const std::shared_ptr<ChoiceValue>& 
item, Field::glom_field_type field_type)
 {
   const Gnome::Gda::Value value = XmlUtils::get_node_attribute_value_as_value(element, GLOM_ATTRIBUTE_VALUE, 
field_type);
   item->set_value(value);
 
-  sharedptr<ChoiceValue> nonconst_item = item; //TODO: Avoid this.
+  std::shared_ptr<ChoiceValue> nonconst_item = item; //TODO: Avoid this.
   load_after_translations(element, nonconst_item);
 }
 
@@ -2559,11 +2559,11 @@ bool Document::load_after(int& failure_code)
 
   //TODO: Use some callback UI to show a busy cursor?
   /*
-  //Use a std::auto_ptr<> to avoid even unncessarily instantiating a BusyCursor,
+  //Use a std::shared_ptr<> to avoid even unncessarily instantiating a BusyCursor,
   //which would require GTK+ to be initialized:
-  std::auto_ptr<BusyCursor> auto_cursor;
+  std::shared_ptr<BusyCursor> auto_cursor;
   if(m_parent_window)
-    auto_cursor = std::auto_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
+    auto_cursor = std::shared_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
   */
 
   m_block_modified_set = true; //Prevent the set_ functions from triggering a save.
@@ -2670,10 +2670,10 @@ bool Document::load_after(int& failure_code)
         {
           const Glib::ustring table_name = XmlUtils::get_node_attribute_value(nodeTable, 
GLOM_ATTRIBUTE_NAME);
 
-          const sharedptr<DocumentTableInfo> doctableinfo = sharedptr<DocumentTableInfo>::create();
+          const std::shared_ptr<DocumentTableInfo> doctableinfo = std::shared_ptr<DocumentTableInfo>(new 
DocumentTableInfo());
           m_tables[table_name] = doctableinfo;
 
-          sharedptr<TableInfo> table_info(new TableInfo());
+          std::shared_ptr<TableInfo> table_info(new TableInfo());
           table_info->set_name(table_name);
           table_info->set_hidden( XmlUtils::get_node_attribute_value_as_bool(nodeTable, 
GLOM_ATTRIBUTE_HIDDEN) );
           table_info->set_default( XmlUtils::get_node_attribute_value_as_bool(nodeTable, 
GLOM_ATTRIBUTE_DEFAULT) );
@@ -2697,7 +2697,7 @@ bool Document::load_after(int& failure_code)
               const xmlpp::Element* nodeChild = dynamic_cast<xmlpp::Element*>(*iter);
               if(nodeChild)
               {
-                sharedptr<Relationship> relationship = sharedptr<Relationship>::create();
+                std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new 
Relationship());
                 const Glib::ustring relationship_name = XmlUtils::get_node_attribute_value(nodeChild, 
GLOM_ATTRIBUTE_NAME);
 
                 relationship->set_from_table(table_name);
@@ -2730,7 +2730,7 @@ bool Document::load_after(int& failure_code)
               const xmlpp::Element* nodeChild = dynamic_cast<xmlpp::Element*>(*iter);
               if(nodeChild)
               {
-                sharedptr<Field> field(new Field());
+                std::shared_ptr<Field> field(new Field());
 
                 const Glib::ustring strName = XmlUtils::get_node_attribute_value(nodeChild, 
GLOM_ATTRIBUTE_NAME);
                 field->set_name( strName );
@@ -2744,7 +2744,7 @@ bool Document::load_after(int& failure_code)
                 if(nodeLookup)
                 {
                   const Glib::ustring lookup_relationship_name = 
XmlUtils::get_node_attribute_value(nodeLookup, GLOM_ATTRIBUTE_RELATIONSHIP_NAME);
-                  sharedptr<Relationship> lookup_relationship = get_relationship(table_name, 
lookup_relationship_name);
+                  std::shared_ptr<Relationship> lookup_relationship = get_relationship(table_name, 
lookup_relationship_name);
                   field->set_lookup_relationship(lookup_relationship);
 
                   field->set_lookup_field( XmlUtils::get_node_attribute_value(nodeLookup, 
GLOM_ATTRIBUTE_FIELD) );
@@ -2816,7 +2816,7 @@ bool Document::load_after(int& failure_code)
                       // consider a map to find the column more quickly.
                       for(unsigned int i = 0; i < doctableinfo->m_fields.size(); ++i)
                       {
-                        sharedptr<const Field> field = doctableinfo->m_fields[i];
+                        std::shared_ptr<const Field> field = doctableinfo->m_fields[i];
                         //std::cout << "  DEBUG: searching: field i=" << i << " =" << field->get_name() << 
std::endl;
                         if(field && (field->get_name() == column_name->get_value()))
                         {
@@ -2849,7 +2849,7 @@ bool Document::load_after(int& failure_code)
         if(nodeTable)
         {
           const Glib::ustring table_name = XmlUtils::get_node_attribute_value(nodeTable, 
GLOM_ATTRIBUTE_NAME);
-          const sharedptr<DocumentTableInfo> doctableinfo = m_tables[table_name];
+          const std::shared_ptr<DocumentTableInfo> doctableinfo = m_tables[table_name];
 
           //Layouts:
           const xmlpp::Element* nodeDataLayouts = XmlUtils::get_node_child_named(nodeTable, 
GLOM_NODE_DATA_LAYOUTS);
@@ -2879,7 +2879,7 @@ bool Document::load_after(int& failure_code)
                       const Glib::ustring group_name = XmlUtils::get_node_attribute_value(node, 
GLOM_ATTRIBUTE_NAME);
                       if(!group_name.empty())
                       {
-                        sharedptr<LayoutGroup> group(new LayoutGroup());
+                        std::shared_ptr<LayoutGroup> group(new LayoutGroup());
                         load_after_layout_group(node, table_name, group);
 
                         layout_groups.push_back(group);
@@ -2913,7 +2913,7 @@ bool Document::load_after(int& failure_code)
 
                 //type_list_layout_groups layout_groups;
 
-                sharedptr<Report> report(new Report());
+                std::shared_ptr<Report> report(new Report());
                 report->set_name(report_name);
                 report->set_show_table_title(show_table_title);
 
@@ -2927,7 +2927,7 @@ bool Document::load_after(int& failure_code)
                     const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
                     if(node)
                     {
-                      sharedptr<LayoutGroup> group = report->get_layout_group();
+                      std::shared_ptr<LayoutGroup> group = report->get_layout_group();
                       group->remove_all_items();
                       load_after_layout_group(node, table_name, group);
 
@@ -2958,7 +2958,7 @@ bool Document::load_after(int& failure_code)
                 const Glib::ustring name = XmlUtils::get_node_attribute_value(node, GLOM_ATTRIBUTE_NAME);
                 const bool show_table_title = XmlUtils::get_node_attribute_value_as_bool(node, 
GLOM_ATTRIBUTE_REPORT_SHOW_TABLE_TITLE);
 
-                sharedptr<PrintLayout> print_layout(new PrintLayout());
+                std::shared_ptr<PrintLayout> print_layout(new PrintLayout());
                 print_layout->set_name(name);
                 print_layout->set_show_table_title(show_table_title);
 
@@ -3016,7 +3016,7 @@ bool Document::load_after(int& failure_code)
                     const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(*iter);
                     if(node)
                     {
-                      sharedptr<LayoutGroup> group = print_layout->get_layout_group();
+                      std::shared_ptr<LayoutGroup> group = print_layout->get_layout_group();
                       group->remove_all_items();
                       load_after_layout_group(node, table_name, group, true /* load positions too. */);
 
@@ -3119,14 +3119,14 @@ bool Document::load_after(int& failure_code)
   return result;
 }
 
-void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, const sharedptr<const 
LayoutItem_WithFormatting>& layout_item)
+void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, const std::shared_ptr<const 
LayoutItem_WithFormatting>& layout_item)
 {
   if(!layout_item)
     return;
 
   const Formatting& format = layout_item->m_formatting;
 
-  sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
   Field::glom_field_type field_type = Field::TYPE_INVALID;
   if(field)
@@ -3188,7 +3188,7 @@ void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, cons
       const Formatting::type_list_values list_values = format.get_choices_custom();
       for(Formatting::type_list_values::const_iterator iter = list_values.begin(); iter != 
list_values.end(); ++iter)
       {
-        const sharedptr<const ChoiceValue> value = *iter; 
+        const std::shared_ptr<const ChoiceValue> value = *iter; 
         xmlpp::Element* childChoice = child->add_child(GLOM_NODE_FORMAT_CUSTOM_CHOICE);
         save_before_choicevalue(childChoice, value, field_type);
       }
@@ -3196,9 +3196,9 @@ void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, cons
 
     XmlUtils::set_node_attribute_value_as_bool(nodeItem, GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED, 
format.get_has_related_choices() );
 
-    sharedptr<const Relationship> choice_relationship;
-    sharedptr<const LayoutItem_Field> choice_layout_first;
-    sharedptr<const LayoutGroup> choice_extra_layouts;
+    std::shared_ptr<const Relationship> choice_relationship;
+    std::shared_ptr<const LayoutItem_Field> choice_layout_first;
+    std::shared_ptr<const LayoutGroup> choice_extra_layouts;
     Formatting::type_list_sort_fields choice_sort_fields;
     bool choice_show_all = false;
     format.get_choices_related(choice_relationship, choice_layout_first, choice_extra_layouts, 
choice_sort_fields, choice_show_all);
@@ -3230,7 +3230,7 @@ void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, cons
   }
 }
 
-void Document::save_before_layout_item_usesrelationship(xmlpp::Element* nodeItem, const sharedptr<const 
UsesRelationship>& item)
+void Document::save_before_layout_item_usesrelationship(xmlpp::Element* nodeItem, const 
std::shared_ptr<const UsesRelationship>& item)
 {
   if(!item)
     return;
@@ -3239,7 +3239,7 @@ void Document::save_before_layout_item_usesrelationship(xmlpp::Element* nodeItem
   XmlUtils::set_node_attribute_value(nodeItem, GLOM_ATTRIBUTE_RELATED_RELATIONSHIP_NAME, 
item->get_related_relationship_name());
 }
 
-void Document::save_before_layout_item_field(xmlpp::Element* nodeItem, const sharedptr<const 
LayoutItem_Field>& field)
+void Document::save_before_layout_item_field(xmlpp::Element* nodeItem, const std::shared_ptr<const 
LayoutItem_Field>& field)
 {
   if(!field)
     return;
@@ -3250,7 +3250,7 @@ void Document::save_before_layout_item_field(xmlpp::Element* nodeItem, const sha
 
   XmlUtils::set_node_attribute_value_as_bool(nodeItem, 
GLOM_ATTRIBUTE_DATA_LAYOUT_ITEM_FIELD_USE_DEFAULT_FORMATTING, field->get_formatting_use_default());
 
-  sharedptr<const CustomTitle> custom_title = field->get_title_custom();
+  std::shared_ptr<const CustomTitle> custom_title = field->get_title_custom();
   if(custom_title)
   {
     xmlpp::Element* elementCustomTitle = nodeItem->add_child(GLOM_NODE_LAYOUT_ITEM_CUSTOM_TITLE);
@@ -3267,7 +3267,7 @@ void Document::save_before_sort_by(xmlpp::Element* node, const LayoutItem_GroupB
 
   for(LayoutItem_GroupBy::type_list_sort_fields::const_iterator iter = list_fields.begin(); iter != 
list_fields.end(); ++iter)
   {
-    sharedptr<const LayoutItem_Field> field = iter->first;
+    std::shared_ptr<const LayoutItem_Field> field = iter->first;
 
     xmlpp::Element* nodeChild = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM);
     save_before_layout_item_field(nodeChild, field);
@@ -3276,7 +3276,7 @@ void Document::save_before_sort_by(xmlpp::Element* node, const LayoutItem_GroupB
   }
 }
 
-void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<const LayoutGroup>& group, 
bool with_print_layout_positions)
+void Document::save_before_layout_group(xmlpp::Element* node, const std::shared_ptr<const LayoutGroup>& 
group, bool with_print_layout_positions)
 {
   if(!node || !group)
     return;
@@ -3285,7 +3285,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
 
   xmlpp::Element* child = 0;
 
-  sharedptr<const LayoutItem_GroupBy> group_by = sharedptr<const LayoutItem_GroupBy>::cast_dynamic(group);
+  std::shared_ptr<const LayoutItem_GroupBy> group_by = std::dynamic_pointer_cast<const 
LayoutItem_GroupBy>(group);
   if(group_by) //If it is a GroupBy report part.
   {
     child = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_GROUPBY);
@@ -3312,7 +3312,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
   }
   else
   {
-    sharedptr<const LayoutItem_Summary> summary = sharedptr<const LayoutItem_Summary>::cast_dynamic(group);
+    std::shared_ptr<const LayoutItem_Summary> summary = std::dynamic_pointer_cast<const 
LayoutItem_Summary>(group);
     if(summary) //If it is a GroupBy report part.
     {
       child = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_SUMMARY);
@@ -3320,35 +3320,35 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
     }
     else
     {
-      sharedptr<const LayoutItem_VerticalGroup> verticalgroup = sharedptr<const 
LayoutItem_VerticalGroup>::cast_dynamic(group);
+      std::shared_ptr<const LayoutItem_VerticalGroup> verticalgroup = std::dynamic_pointer_cast<const 
LayoutItem_VerticalGroup>(group);
       if(verticalgroup) //If it is a GroupBy report part.
       {
         child = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_VERTICALGROUP);
       }
       else
       {
-        sharedptr<const LayoutItem_Header> headerGroup = sharedptr<const 
LayoutItem_Header>::cast_dynamic(group);
+        std::shared_ptr<const LayoutItem_Header> headerGroup = std::dynamic_pointer_cast<const 
LayoutItem_Header>(group);
         if(headerGroup) //If it is a GroupBy report part.
         {
           child = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_HEADER);
         }
         else
         {
-          sharedptr<const LayoutItem_Footer> footerGroup = sharedptr<const 
LayoutItem_Footer>::cast_dynamic(group);
+          std::shared_ptr<const LayoutItem_Footer> footerGroup = std::dynamic_pointer_cast<const 
LayoutItem_Footer>(group);
           if(footerGroup) //If it is a GroupBy report part.
           {
             child = node->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_FOOTER);
           }
           else
           {
-            sharedptr<const LayoutItem_Portal> portal = sharedptr<const 
LayoutItem_Portal>::cast_dynamic(group);
+            std::shared_ptr<const LayoutItem_Portal> portal = std::dynamic_pointer_cast<const 
LayoutItem_Portal>(group);
             if(portal) //If it is a related records portal
             {
-              sharedptr<const LayoutItem_CalendarPortal> calendar_portal = sharedptr<const 
LayoutItem_CalendarPortal>::cast_dynamic(portal);
+              std::shared_ptr<const LayoutItem_CalendarPortal> calendar_portal = 
std::dynamic_pointer_cast<const LayoutItem_CalendarPortal>(portal);
               if(calendar_portal)
               {
                 child = node->add_child(GLOM_NODE_DATA_LAYOUT_CALENDAR_PORTAL);
-                sharedptr<const Field> date_field = calendar_portal->get_date_field();
+                std::shared_ptr<const Field> date_field = calendar_portal->get_date_field();
                 if(date_field)
                   XmlUtils::set_node_attribute_value(child, GLOM_ATTRIBUTE_PORTAL_CALENDAR_DATE_FIELD, 
date_field->get_name());
               }
@@ -3359,7 +3359,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
 
               //Portal navigation details:
               Glib::ustring navigation_type_string;
-              sharedptr<const UsesRelationship> relationship_navigation_specific;
+              std::shared_ptr<const UsesRelationship> relationship_navigation_specific;
 
               switch(portal->get_navigation_type())
               {
@@ -3415,7 +3415,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
             }
             else
             {
-              sharedptr<const LayoutItem_Notebook> notebook = sharedptr<const 
LayoutItem_Notebook>::cast_dynamic(group);
+              std::shared_ptr<const LayoutItem_Notebook> notebook = std::dynamic_pointer_cast<const 
LayoutItem_Notebook>(group);
               if(notebook) //If it is a notebook.
               {
                 child = node->add_child(GLOM_NODE_DATA_LAYOUT_NOTEBOOK);
@@ -3450,10 +3450,10 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
   LayoutGroup::type_list_const_items items = group->get_items();
   for(LayoutGroup::type_list_const_items::const_iterator iterItems = items.begin(); iterItems != 
items.end(); ++iterItems)
   {
-    sharedptr<const LayoutItem> item = *iterItems;
+    std::shared_ptr<const LayoutItem> item = *iterItems;
     //g_warning("save_before_layout_group: child part type=%s", item->get_part_type_name().c_str());
 
-    sharedptr<const LayoutGroup> child_group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<const LayoutGroup> child_group = std::dynamic_pointer_cast<const LayoutGroup>(item);
     if(child_group) //If it is a group, portal, summary, or groupby.
     {
       //recurse:
@@ -3463,7 +3463,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
     {
       xmlpp::Element* nodeItem = 0;
 
-      sharedptr<const LayoutItem_FieldSummary> fieldsummary = sharedptr<const 
LayoutItem_FieldSummary>::cast_dynamic(item);
+      std::shared_ptr<const LayoutItem_FieldSummary> fieldsummary = std::dynamic_pointer_cast<const 
LayoutItem_FieldSummary>(item);
       if(fieldsummary) //If it is a summaryfield
       {
         nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_ITEM_FIELDSUMMARY);
@@ -3472,7 +3472,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
       }
       else
       {
-        sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(item);
+        std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
         if(field) //If it is a field
         {
           nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_ITEM);
@@ -3480,7 +3480,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
         }
         else
         {
-          sharedptr<const LayoutItem_Button> button = sharedptr<const LayoutItem_Button>::cast_dynamic(item);
+          std::shared_ptr<const LayoutItem_Button> button = std::dynamic_pointer_cast<const 
LayoutItem_Button>(item);
           if(button) //If it is a button
           {
             nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_BUTTON);
@@ -3489,7 +3489,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
           }
           else
           {
-            sharedptr<const LayoutItem_Text> textobject = sharedptr<const 
LayoutItem_Text>::cast_dynamic(item);
+            std::shared_ptr<const LayoutItem_Text> textobject = std::dynamic_pointer_cast<const 
LayoutItem_Text>(item);
             if(textobject) //If it is a text object.
             {
               nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_TEXTOBJECT);
@@ -3501,7 +3501,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
             }
             else
             {
-              sharedptr<const LayoutItem_Image> imageobject = sharedptr<const 
LayoutItem_Image>::cast_dynamic(item);
+              std::shared_ptr<const LayoutItem_Image> imageobject = std::dynamic_pointer_cast<const 
LayoutItem_Image>(item);
               if(imageobject) //If it is an image object.
               {
                 nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_IMAGEOBJECT);
@@ -3512,7 +3512,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
               }
               else
               {
-                sharedptr<const LayoutItem_Line> line = sharedptr<const LayoutItem_Line>::cast_dynamic(item);
+                std::shared_ptr<const LayoutItem_Line> line = std::dynamic_pointer_cast<const 
LayoutItem_Line>(item);
                 if(line) //If it is a line
                 {
                   nodeItem = child->add_child(GLOM_NODE_DATA_LAYOUT_LINE);
@@ -3540,7 +3540,7 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
         }
 
         //Save formatting for any layout items that use it:
-        sharedptr<const LayoutItem_WithFormatting> withformatting = sharedptr<const 
LayoutItem_WithFormatting>::cast_dynamic(item);
+        std::shared_ptr<const LayoutItem_WithFormatting> withformatting = std::dynamic_pointer_cast<const 
LayoutItem_WithFormatting>(item);
         if(withformatting)
         {
           xmlpp::Element* elementFormat = nodeItem->add_child(GLOM_NODE_FORMAT);
@@ -3563,12 +3563,12 @@ void Document::save_before_layout_group(xmlpp::Element* node, const sharedptr<co
   }
 }
 
-void Document::save_before_translations(xmlpp::Element* element, const sharedptr<const TranslatableItem>& 
item)
+void Document::save_before_translations(xmlpp::Element* element, const std::shared_ptr<const 
TranslatableItem>& item)
 {
   if(!element)
     return;
 
-  const sharedptr<const ChoiceValue> choicevalue = sharedptr<const ChoiceValue>::cast_dynamic(item);
+  const std::shared_ptr<const ChoiceValue> choicevalue = std::dynamic_pointer_cast<const ChoiceValue>(item);
   if(!choicevalue) //This item does not use the title, but uses the title translations to translate its 
value, if it is of type text.
   {
     XmlUtils::set_node_attribute_value(element, GLOM_ATTRIBUTE_TITLE, item->get_title_original());
@@ -3588,8 +3588,8 @@ void Document::save_before_translations(xmlpp::Element* element, const sharedptr
   }
 
   //If it has a singular title, then save that too:
-  const sharedptr<const HasTitleSingular> has_title_singular =
-    sharedptr<const HasTitleSingular>::cast_dynamic(item);
+  const std::shared_ptr<const HasTitleSingular> has_title_singular =
+    std::dynamic_pointer_cast<const HasTitleSingular>(item);
   if(has_title_singular && has_title_singular->m_title_singular
     && !(has_title_singular->m_title_singular->get_title_original().empty()))
   {
@@ -3598,7 +3598,7 @@ void Document::save_before_translations(xmlpp::Element* element, const sharedptr
   }
 }
 
-void Document::save_before_print_layout_position(xmlpp::Element* nodeItem, const sharedptr<const 
LayoutItem>& item)
+void Document::save_before_print_layout_position(xmlpp::Element* nodeItem, const std::shared_ptr<const 
LayoutItem>& item)
 {
   xmlpp::Element* child = nodeItem->add_child(GLOM_NODE_POSITION);
 
@@ -3618,7 +3618,7 @@ void Document::save_before_print_layout_position(xmlpp::Element* nodeItem, const
     nodeItem->remove_child(child);
 }
 
-void Document::save_before_choicevalue(xmlpp::Element* nodeItem, const sharedptr<const ChoiceValue>& item, 
Field::glom_field_type field_type)
+void Document::save_before_choicevalue(xmlpp::Element* nodeItem, const std::shared_ptr<const ChoiceValue>& 
item, Field::glom_field_type field_type)
 {
   if(!item)
     return;
@@ -3631,11 +3631,11 @@ bool Document::save_before()
 {
   //TODO: Use some callback UI to show a busy cursor?
   /*
-  //Use a std::auto_ptr<> to avoid even unncessarily instantiating a BusyCursor,
+  //Use a std::shared_ptr<> to avoid even unncessarily instantiating a BusyCursor,
   //which would require GTK+ to be initialized:
-  std::auto_ptr<BusyCursor> auto_cursor;
+  std::shared_ptr<BusyCursor> auto_cursor;
   if(m_parent_window)
-    auto_cursor = std::auto_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
+    auto_cursor = std::shared_ptr<BusyCursor>( new BusyCursor(m_parent_window) );
   */
 
   //TODO: Add xmlpp::Document::remove_root_node() to libxml++
@@ -3705,7 +3705,7 @@ bool Document::save_before()
     //Add tables:
     for(type_tables::const_iterator iter = m_tables.begin(); iter != m_tables.end(); ++iter)
     {
-      const sharedptr<const DocumentTableInfo> doctableinfo = iter->second;
+      const std::shared_ptr<const DocumentTableInfo> doctableinfo = iter->second;
       if(!doctableinfo || !doctableinfo->m_info)
         continue;
 
@@ -3736,7 +3736,7 @@ bool Document::save_before()
               const unsigned int row_data_size = row_data.size();
               for(unsigned int i = 0; i < row_data_size; ++i)
               {
-                sharedptr<const Field> field = doctableinfo->m_fields[i];
+                std::shared_ptr<const Field> field = doctableinfo->m_fields[i];
                 if(!field)
                   break;
 
@@ -3759,7 +3759,7 @@ bool Document::save_before()
 
         for(type_vec_fields::const_iterator iter = doctableinfo->m_fields.begin(); iter != 
doctableinfo->m_fields.end(); ++iter)
         {
-          sharedptr<const Field> field = *iter;
+          std::shared_ptr<const Field> field = *iter;
 
           xmlpp::Element* elemField = elemFields->add_child(GLOM_NODE_FIELD);
           XmlUtils::set_node_attribute_value(elemField, GLOM_ATTRIBUTE_NAME, field->get_name());
@@ -3783,7 +3783,7 @@ bool Document::save_before()
           {
             xmlpp::Element* elemFieldLookup = elemField->add_child(GLOM_NODE_FIELD_LOOKUP);
 
-            sharedptr<Relationship> lookup_relationship = field->get_lookup_relationship();
+            std::shared_ptr<Relationship> lookup_relationship = field->get_lookup_relationship();
             XmlUtils::set_node_attribute_value(elemFieldLookup, GLOM_ATTRIBUTE_RELATIONSHIP_NAME, 
glom_get_sharedptr_name(lookup_relationship));
 
             XmlUtils::set_node_attribute_value(elemFieldLookup, GLOM_ATTRIBUTE_FIELD, 
field->get_lookup_field());
@@ -3805,7 +3805,7 @@ bool Document::save_before()
         const type_vec_relationships relationships = doctableinfo->m_relationships;
         for(type_vec_relationships::const_iterator iter = relationships.begin(); iter != 
relationships.end(); ++iter)
         {
-          sharedptr<const Relationship> relationship = *iter;
+          std::shared_ptr<const Relationship> relationship = *iter;
           if(relationship)
           {
             xmlpp::Element* elemRelationship = elemRelationships->add_child(GLOM_NODE_RELATIONSHIP);
@@ -3849,7 +3849,7 @@ bool Document::save_before()
         {
           xmlpp::Element* nodeReport = nodeReports->add_child(GLOM_NODE_REPORT);
 
-          sharedptr<const Report> report = iter->second;
+          std::shared_ptr<const Report> report = iter->second;
           XmlUtils::set_node_attribute_value(nodeReport, GLOM_ATTRIBUTE_NAME, report->get_name());
           XmlUtils::set_node_attribute_value_as_bool(nodeReport, GLOM_ATTRIBUTE_REPORT_SHOW_TABLE_TITLE, 
report->get_show_table_title());
 
@@ -3868,7 +3868,7 @@ bool Document::save_before()
         {
           xmlpp::Element* nodePrintLayout = nodePrintLayouts->add_child(GLOM_NODE_PRINT_LAYOUT);
 
-          sharedptr<const PrintLayout> print_layout = iter->second;
+          std::shared_ptr<const PrintLayout> print_layout = iter->second;
           XmlUtils::set_node_attribute_value(nodePrintLayout, GLOM_ATTRIBUTE_NAME, print_layout->get_name());
           XmlUtils::set_node_attribute_value_as_bool(nodePrintLayout, 
GLOM_ATTRIBUTE_REPORT_SHOW_TABLE_TITLE, print_layout->get_show_table_title());
 
@@ -4063,7 +4063,7 @@ void Document::remove_group(const Glib::ustring& group_name)
 
 std::vector<Glib::ustring> Document::get_report_names(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     std::vector<Glib::ustring> result;
@@ -4078,9 +4078,9 @@ std::vector<Glib::ustring> Document::get_report_names(const Glib::ustring& table
     return std::vector<Glib::ustring>();
 }
 
-void Document::set_report(const Glib::ustring& table_name, const sharedptr<Report>& report)
+void Document::set_report(const Glib::ustring& table_name, const std::shared_ptr<Report>& report)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     info->m_reports[report->get_name()] = report;
@@ -4088,9 +4088,9 @@ void Document::set_report(const Glib::ustring& table_name, const sharedptr<Repor
   }
 }
 
-sharedptr<Report> Document::get_report(const Glib::ustring& table_name, const Glib::ustring& report_name) 
const
+std::shared_ptr<Report> Document::get_report(const Glib::ustring& table_name, const Glib::ustring& 
report_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     DocumentTableInfo::type_reports::const_iterator iterFindReport = info->m_reports.find(report_name);
@@ -4100,12 +4100,12 @@ sharedptr<Report> Document::get_report(const Glib::ustring& table_name, const Gl
     }
   }
 
-  return sharedptr<Report>();
+  return std::shared_ptr<Report>();
 }
 
 void Document::remove_report(const Glib::ustring& table_name, const Glib::ustring& report_name)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     DocumentTableInfo::type_reports::iterator iterFindReport = info->m_reports.find(report_name);
@@ -4121,7 +4121,7 @@ void Document::remove_report(const Glib::ustring& table_name, const Glib::ustrin
 
 std::vector<Glib::ustring> Document::get_print_layout_names(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     std::vector<Glib::ustring> result;
@@ -4137,9 +4137,9 @@ std::vector<Glib::ustring> Document::get_print_layout_names(const Glib::ustring&
 }
 
 
-void Document::set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& print_layout)
+void Document::set_print_layout(const Glib::ustring& table_name, const std::shared_ptr<PrintLayout>& 
print_layout)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     info->m_print_layouts[print_layout->get_name()] = print_layout;
@@ -4147,9 +4147,9 @@ void Document::set_print_layout(const Glib::ustring& table_name, const sharedptr
   }
 }
 
-sharedptr<PrintLayout> Document::get_print_layout(const Glib::ustring& table_name, const Glib::ustring& 
print_layout_name) const
+std::shared_ptr<PrintLayout> Document::get_print_layout(const Glib::ustring& table_name, const 
Glib::ustring& print_layout_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     DocumentTableInfo::type_print_layouts::const_iterator iterFindPrintLayout = 
info->m_print_layouts.find(print_layout_name);
@@ -4159,12 +4159,12 @@ sharedptr<PrintLayout> Document::get_print_layout(const Glib::ustring& table_nam
     }
   }
 
-  return sharedptr<PrintLayout>();
+  return std::shared_ptr<PrintLayout>();
 }
 
 void Document::remove_print_layout(const Glib::ustring& table_name, const Glib::ustring& print_layout_name)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     DocumentTableInfo::type_print_layouts::iterator iterFindPrintLayout = 
info->m_print_layouts.find(print_layout_name);
@@ -4181,10 +4181,10 @@ void Document::remove_print_layout(const Glib::ustring& table_name, const Glib::
 
 bool Document::get_relationship_is_to_one(const Glib::ustring& table_name, const Glib::ustring& 
relationship_name) const
 {
-  sharedptr<const Relationship> relationship = get_relationship(table_name, relationship_name);
+  std::shared_ptr<const Relationship> relationship = get_relationship(table_name, relationship_name);
   if(relationship)
   {
-    sharedptr<const Field> field_to = get_field(relationship->get_to_table(), relationship->get_to_field());
+    std::shared_ptr<const Field> field_to = get_field(relationship->get_to_table(), 
relationship->get_to_field());
     if(field_to)
       return (field_to->get_primary_key() || field_to->get_unique_key());
   }
@@ -4192,9 +4192,9 @@ bool Document::get_relationship_is_to_one(const Glib::ustring& table_name, const
   return false;
 }
 
-sharedptr<const Relationship> Document::get_field_used_in_relationship_to_one(const Glib::ustring& 
table_name, const sharedptr<const LayoutItem_Field>& layout_field) const
+std::shared_ptr<const Relationship> Document::get_field_used_in_relationship_to_one(const Glib::ustring& 
table_name, const std::shared_ptr<const LayoutItem_Field>& layout_field) const
 {
-  sharedptr<const Relationship> result;
+  std::shared_ptr<const Relationship> result;
 
   if(!layout_field)
   {
@@ -4203,7 +4203,7 @@ sharedptr<const Relationship> Document::get_field_used_in_relationship_to_one(co
   }
 
   const Glib::ustring table_used = layout_field->get_table_used(table_name);
-  const sharedptr<const DocumentTableInfo> table_info = get_table_info(table_used);
+  const std::shared_ptr<const DocumentTableInfo> table_info = get_table_info(table_used);
   if(!table_info)
   {
     //This table is special. We would not create a relationship to it using a field:
@@ -4218,7 +4218,7 @@ sharedptr<const Relationship> Document::get_field_used_in_relationship_to_one(co
   const Glib::ustring field_name = layout_field->get_name();
   for(type_vec_relationships::const_iterator iterRel = table_info->m_relationships.begin(); iterRel != 
table_info->m_relationships.end(); ++iterRel)
   {
-    sharedptr<const Relationship> relationship = *iterRel;
+    std::shared_ptr<const Relationship> relationship = *iterRel;
     if(relationship)
     {
       //If the relationship uses the field
@@ -4242,21 +4242,21 @@ sharedptr<const Relationship> Document::get_field_used_in_relationship_to_one(co
 
 void Document::forget_layout_record_viewed(const Glib::ustring& table_name)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     info->m_map_current_record.clear();
 }
 
 void Document::set_layout_record_viewed(const Glib::ustring& table_name, const Glib::ustring& layout_name, 
const Gnome::Gda::Value& primary_key_value)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     info->m_map_current_record[layout_name] = primary_key_value;
 }
 
 Gnome::Gda::Value Document::get_layout_record_viewed(const Glib::ustring& table_name, const Glib::ustring& 
layout_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
   {
     DocumentTableInfo::type_map_layout_primarykeys::const_iterator iterLayoutKeys = 
info->m_map_current_record.find(layout_name);
@@ -4269,21 +4269,21 @@ Gnome::Gda::Value Document::get_layout_record_viewed(const Glib::ustring& table_
 
 void Document::set_layout_current(const Glib::ustring& table_name, const Glib::ustring& layout_name)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     info->m_layout_current = layout_name;
 }
 
 void Document::set_criteria_current(const Glib::ustring& table_name, const FoundSet& found_set)
 {
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     info->m_foundset_current = found_set;
 }
 
 Glib::ustring Document::get_layout_current(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     return info->m_layout_current;
 
@@ -4292,7 +4292,7 @@ Glib::ustring Document::get_layout_current(const Glib::ustring& table_name) cons
 
 FoundSet Document::get_criteria_current(const Glib::ustring& table_name) const
 {
-  const sharedptr<const DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<const DocumentTableInfo> info = get_table_info(table_name);
   if(info)
     return info->m_foundset_current;
 
@@ -4394,7 +4394,7 @@ private:
 
 } //anonymous namespace
 
-static void add_to_translatable_list(Document::type_list_translatables& list, const 
sharedptr<TranslatableItem>& item, const Glib::ustring& hint)
+static void add_to_translatable_list(Document::type_list_translatables& list, const 
std::shared_ptr<TranslatableItem>& item, const Glib::ustring& hint)
 {
   // Only add the item/hint combination if it is not there already:
   const Document::pair_translatable_item_and_hint item_and_hint(item, hint);
@@ -4437,7 +4437,7 @@ Document::type_list_translatables Document::get_translatable_items()
   type_listTableInfo tables = get_tables();
   for(type_listTableInfo::const_iterator iter = tables.begin(); iter != tables.end(); ++iter)
   {
-    sharedptr<TableInfo> tableinfo = *iter;
+    std::shared_ptr<TableInfo> tableinfo = *iter;
     if(!tableinfo)
       continue;
 
@@ -4450,7 +4450,7 @@ Document::type_list_translatables Document::get_translatable_items()
     type_vec_fields fields = get_table_fields(table_name);
     for(type_vec_fields::iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       if(!field)
         continue;
 
@@ -4475,7 +4475,7 @@ Document::type_list_translatables Document::get_translatable_items()
     for(std::vector<Glib::ustring>::iterator iter = listReports.begin(); iter != listReports.end(); ++iter)
     {
       const Glib::ustring report_name = *iter;
-      sharedptr<Report> report = get_report(table_name, report_name);
+      std::shared_ptr<Report> report = get_report(table_name, report_name);
       if(!report)
         continue;
 
@@ -4492,7 +4492,7 @@ Document::type_list_translatables Document::get_translatable_items()
     for(std::vector<Glib::ustring>::iterator iter = listPrintLayouts.begin(); iter != 
listPrintLayouts.end(); ++iter)
     {
       const Glib::ustring print_layout_name = *iter;
-      sharedptr<PrintLayout> print_layout = get_print_layout(table_name, print_layout_name);
+      std::shared_ptr<PrintLayout> print_layout = get_print_layout(table_name, print_layout_name);
       if(!print_layout)
         continue;
 
@@ -4516,7 +4516,7 @@ Document::type_list_translatables Document::get_translatable_layout_items(const
 {
   type_list_translatables result;
 
-  const sharedptr<DocumentTableInfo> info = get_table_info(table_name);
+  const std::shared_ptr<DocumentTableInfo> info = get_table_info(table_name);
   if(!info)
     return result;
 
@@ -4527,7 +4527,7 @@ Document::type_list_translatables Document::get_translatable_layout_items(const
     //Look at each group:
     for(type_list_layout_groups::iterator iterGroup = iterLayouts->m_layout_groups.begin(); iterGroup != 
iterLayouts->m_layout_groups.end(); ++iterGroup)
     {
-      sharedptr<LayoutGroup> group = *iterGroup;
+      std::shared_ptr<LayoutGroup> group = *iterGroup;
       if(group)
       {
         fill_translatable_layout_items(group, result, hint);
@@ -4543,7 +4543,7 @@ Document::type_list_translatables Document::get_translatable_report_items(const
 {
   Document::type_list_translatables the_list;
 
-  sharedptr<Report> report = get_report(table_name, report_name);
+  std::shared_ptr<Report> report = get_report(table_name, report_name);
   if(report)
     fill_translatable_layout_items(report->get_layout_group(), the_list, hint);
 
@@ -4554,7 +4554,7 @@ Document::type_list_translatables Document::get_translatable_print_layout_items(
 {
   Document::type_list_translatables the_list;
 
-  sharedptr<PrintLayout> print_layout = get_print_layout(table_name, print_layout_name);
+  std::shared_ptr<PrintLayout> print_layout = get_print_layout(table_name, print_layout_name);
   if(print_layout)
     fill_translatable_layout_items(print_layout->get_layout_group(), the_list, hint);
 
@@ -4569,17 +4569,17 @@ void Document::fill_translatable_custom_choices(Formatting& formatting, type_lis
   Formatting::type_list_values values = formatting.get_choices_custom();
   for(Formatting::type_list_values::iterator iter = values.begin(); iter != values.end(); ++iter)
   {
-    sharedptr<ChoiceValue> value = *iter;
+    std::shared_ptr<ChoiceValue> value = *iter;
 
     the_list.push_back( pair_translatable_item_and_hint(value, hint) );
   }
 }
 
-void Document::fill_translatable_layout_items(const sharedptr<LayoutItem_Field>& layout_field, 
type_list_translatables& the_list, const Glib::ustring& hint)
+void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutItem_Field>& layout_field, 
type_list_translatables& the_list, const Glib::ustring& hint)
 {
   //LayoutItem_Field items do not have their own titles.
   //They use either the field's title or a custom title:
-  sharedptr<CustomTitle> custom_title = layout_field->get_title_custom();
+  std::shared_ptr<CustomTitle> custom_title = layout_field->get_title_custom();
   if(custom_title)
   {
     the_list.push_back( pair_translatable_item_and_hint(custom_title, hint) ); 
@@ -4597,10 +4597,10 @@ void Document::fill_translatable_layout_items(const sharedptr<LayoutItem_Field>&
 }
 
 
-void Document::fill_translatable_layout_items(const sharedptr<LayoutGroup>& group, type_list_translatables& 
the_list, const Glib::ustring& hint)
+void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutGroup>& group, 
type_list_translatables& the_list, const Glib::ustring& hint)
 {
   //Portals don't have their own titles - they use the relationship title (though we might want to allow 
custom titles)
-  sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(group);
+  std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(group);
   if(!portal)
   {
     the_list.push_back( pair_translatable_item_and_hint(group, hint) );
@@ -4615,15 +4615,15 @@ void Document::fill_translatable_layout_items(const sharedptr<LayoutGroup>& grou
   LayoutGroup::type_list_items items = group->get_items();
   for(LayoutGroup::type_list_items::const_iterator iterItems = items.begin(); iterItems != items.end(); 
++iterItems)
   {
-    sharedptr<LayoutItem> item = *iterItems;
+    std::shared_ptr<LayoutItem> item = *iterItems;
 
-    sharedptr<LayoutGroup> child_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutGroup> child_group = std::dynamic_pointer_cast<LayoutGroup>(item);
     if(child_group) //If it is a group, portal, summary, or groupby.
     {
-      sharedptr<LayoutItem_GroupBy> group_by = sharedptr<LayoutItem_GroupBy>::cast_dynamic(child_group);
+      std::shared_ptr<LayoutItem_GroupBy> group_by = 
std::dynamic_pointer_cast<LayoutItem_GroupBy>(child_group);
       if(group_by)
       {
-        sharedptr<LayoutItem_Field> field = group_by->get_field_group_by();
+        std::shared_ptr<LayoutItem_Field> field = group_by->get_field_group_by();
         fill_translatable_layout_items(field, the_list, hint);
 
         fill_translatable_layout_items(group_by->get_secondary_fields(), the_list, this_hint);
@@ -4635,12 +4635,12 @@ void Document::fill_translatable_layout_items(const sharedptr<LayoutGroup>& grou
     else
     {
       //Buttons too:
-      sharedptr<LayoutItem_Button> button = sharedptr<LayoutItem_Button>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Button> button = std::dynamic_pointer_cast<LayoutItem_Button>(item);
       if(button)
         the_list.push_back( pair_translatable_item_and_hint(button, this_hint) );
       else
       {
-        sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+        std::shared_ptr<LayoutItem_Text> text = std::dynamic_pointer_cast<LayoutItem_Text>(item);
         if(text)
         {
           the_list.push_back( pair_translatable_item_and_hint(text, this_hint) );
@@ -4650,12 +4650,12 @@ void Document::fill_translatable_layout_items(const sharedptr<LayoutGroup>& grou
         else
         {
           //Images have titles:
-          sharedptr<LayoutItem_Image> image = sharedptr<LayoutItem_Image>::cast_dynamic(item);
+          std::shared_ptr<LayoutItem_Image> image = std::dynamic_pointer_cast<LayoutItem_Image>(item);
           if(image)
             the_list.push_back( pair_translatable_item_and_hint(image, this_hint) );
           else
           {
-            sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+            std::shared_ptr<LayoutItem_Field> layout_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(item);
             if(layout_field)
             {
               fill_translatable_layout_items(layout_field, the_list, hint);
@@ -4957,20 +4957,20 @@ Document::type_list_lookups Document::get_lookup_fields(const Glib::ustring& tab
   const type_vec_fields fields = get_table_fields(table_name); //TODO_Performance: Cache this?
   for(type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end();  ++iter)
   {
-    sharedptr<Field> field = *iter;
+    std::shared_ptr<Field> field = *iter;
 
     //Examine each field that looks up its data from a relationship:
     if(field && field->get_is_lookup())
     {
       //Get the relationship information:
-      sharedptr<Relationship> relationship = field->get_lookup_relationship();
+      std::shared_ptr<Relationship> relationship = field->get_lookup_relationship();
       if(relationship)
       {
         //If the relationship is triggererd by the specified field:
         if(relationship->get_from_field() == field_name)
         {
           //Add it:
-          sharedptr<LayoutItem_Field> item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
           item->set_full_field_details(field);
           result.push_back( type_pairFieldTrigger(item, relationship) );
         }
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index cde3d1f..88f9fcb 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -182,14 +182,14 @@ public:
    */
   std::vector<Glib::ustring> get_translation_available_locales() const;
 
-  typedef std::vector< sharedptr<Relationship> > type_vec_relationships;
+  typedef std::vector< std::shared_ptr<Relationship> > type_vec_relationships;
   type_vec_relationships get_relationships(const Glib::ustring& table_name, bool plus_system_prefs = false) 
const;
   void set_relationships(const Glib::ustring& table_name, const type_vec_relationships& vecRelationships);
 
-  sharedptr<Relationship> get_relationship(const Glib::ustring& table_name, const Glib::ustring& 
relationship_name) const;
-  void set_relationship(const Glib::ustring& table_name, const sharedptr<Relationship>& relationship);
+  std::shared_ptr<Relationship> get_relationship(const Glib::ustring& table_name, const Glib::ustring& 
relationship_name) const;
+  void set_relationship(const Glib::ustring& table_name, const std::shared_ptr<Relationship>& relationship);
 
-  void remove_relationship(const sharedptr<const Relationship>& relationship);
+  void remove_relationship(const std::shared_ptr<const Relationship>& relationship);
 
   /** Returns whether the relationship's to-field is a primary key  or unique field, meaning
    * that there can be only one related record for each value of the from-field.
@@ -199,15 +199,15 @@ public:
   /** Returns whether the field is the from-field in a to-one relationship.
    * @see get_relationship_is_to_one(). Ignores hidden tables.
    */
-  sharedptr<const Relationship> get_field_used_in_relationship_to_one(const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& layout_field) const;
+  std::shared_ptr<const Relationship> get_field_used_in_relationship_to_one(const Glib::ustring& table_name, 
const std::shared_ptr<const LayoutItem_Field>& layout_field) const;
 
-  typedef std::vector< sharedptr<Field> > type_vec_fields;
+  typedef std::vector< std::shared_ptr<Field> > type_vec_fields;
   type_vec_fields get_table_fields(const Glib::ustring& table_name) const;
   void set_table_fields(const Glib::ustring& table_name, const type_vec_fields& vecFields);
 
-  sharedptr<Field> get_field(const Glib::ustring& table_name, const Glib::ustring& strFieldName) const;
+  std::shared_ptr<Field> get_field(const Glib::ustring& table_name, const Glib::ustring& strFieldName) const;
 
-  sharedptr<Field> get_field_primary_key(const Glib::ustring& table_name) const;
+  std::shared_ptr<Field> get_field_primary_key(const Glib::ustring& table_name) const;
 
   /** Use this after removing a field from a table,
    * so that it is not used anymore in relationships, layouts, reports, etc.
@@ -215,7 +215,7 @@ public:
   void remove_field(const Glib::ustring& table_name, const Glib::ustring& field_name);
   
   
-  typedef std::pair< sharedptr<LayoutItem_Field>, sharedptr<Relationship> > type_pairFieldTrigger;
+  typedef std::pair< std::shared_ptr<LayoutItem_Field>, std::shared_ptr<Relationship> > 
type_pairFieldTrigger;
   typedef std::vector<type_pairFieldTrigger> type_list_lookups;
   
   /** Get the fields whose values should be looked up when @a field_name changes, with
@@ -225,7 +225,7 @@ public:
 
 
 
-  typedef std::vector< sharedptr<LayoutGroup> > type_list_layout_groups;
+  typedef std::vector< std::shared_ptr<LayoutGroup> > type_list_layout_groups;
 
   /** Get the layout groups for a layout.
    * @param layout_name The name of the layout, such as list or details.
@@ -261,7 +261,7 @@ public:
   type_list_layout_groups get_data_layout_groups_default(const Glib::ustring& layout_name, const 
Glib::ustring& parent_table_name, const Glib::ustring& layout_platform = Glib::ustring()) const;
 
   /// The translatable item and a hint about what it is.
-  typedef std::pair< sharedptr<TranslatableItem>, Glib::ustring> pair_translatable_item_and_hint;
+  typedef std::pair< std::shared_ptr<TranslatableItem>, Glib::ustring> pair_translatable_item_and_hint;
 
   typedef std::vector<pair_translatable_item_and_hint> type_list_translatables;
   type_list_translatables get_translatable_items();
@@ -269,7 +269,7 @@ public:
   static void fill_translatable_custom_choices(Formatting& formatting, type_list_translatables& the_list, 
const Glib::ustring& hint);
 
 
-  void fill_layout_field_details(const Glib::ustring& parent_table_name, const sharedptr<LayoutGroup>& 
layout_group) const;
+  void fill_layout_field_details(const Glib::ustring& parent_table_name, const std::shared_ptr<LayoutGroup>& 
layout_group) const;
   void fill_layout_field_details(const Glib::ustring& parent_table_name, type_list_layout_groups& groups) 
const;
 
   ///When a field name is changed, change it in the relationships, layouts, reports, and fields data:
@@ -281,17 +281,17 @@ public:
   ///When a relationship name is changed, change it in layouts and reports:
   void change_relationship_name(const Glib::ustring& table_name, const Glib::ustring& name, const 
Glib::ustring& name_new);
 
-  typedef std::vector< sharedptr<TableInfo> > type_listTableInfo;
+  typedef std::vector< std::shared_ptr<TableInfo> > type_listTableInfo;
   type_listTableInfo get_tables(bool plus_system_prefs = false);
 
-  typedef std::vector< sharedptr<const TableInfo> > type_listConstTableInfo;
+  typedef std::vector< std::shared_ptr<const TableInfo> > type_listConstTableInfo;
   type_listConstTableInfo get_tables(bool plus_system_prefs = false) const;
   std::vector<Glib::ustring> get_table_names(bool plus_system_prefs = false) const;
 
   void set_tables(const type_listTableInfo& tables);
 
-  sharedptr<TableInfo> get_table(const Glib::ustring& table_name) const;
-  void add_table(const sharedptr<TableInfo>& table_name);
+  std::shared_ptr<TableInfo> get_table(const Glib::ustring& table_name) const;
+  void add_table(const std::shared_ptr<TableInfo>& table_name);
 
   /** Use this after DROPing the table.
    * It removes information about the table, including fields and layouts,
@@ -355,14 +355,14 @@ public:
 
   std::vector<Glib::ustring> get_report_names(const Glib::ustring& table_name) const;
 
-  void set_report(const Glib::ustring& table_name, const sharedptr<Report>& report);
-  sharedptr<Report> get_report(const Glib::ustring& table_name, const Glib::ustring& report_name) const;
+  void set_report(const Glib::ustring& table_name, const std::shared_ptr<Report>& report);
+  std::shared_ptr<Report> get_report(const Glib::ustring& table_name, const Glib::ustring& report_name) 
const;
   void remove_report(const Glib::ustring& table_name, const Glib::ustring& report_name);
 
   //Print Layouts are precisely positioned layouts for printing to a printer:
   std::vector<Glib::ustring> get_print_layout_names(const Glib::ustring& table_name) const;
-  void set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& print_layout);
-  sharedptr<PrintLayout> get_print_layout(const Glib::ustring& table_name, const Glib::ustring& 
print_layout_name) const;
+  void set_print_layout(const Glib::ustring& table_name, const std::shared_ptr<PrintLayout>& print_layout);
+  std::shared_ptr<PrintLayout> get_print_layout(const Glib::ustring& table_name, const Glib::ustring& 
print_layout_name) const;
   void remove_print_layout(const Glib::ustring& table_name, const Glib::ustring& print_layout_name);
 
   void set_layout_record_viewed(const Glib::ustring& table_name, const Glib::ustring& layout_name, const 
Gnome::Gda::Value& primary_key_value);
@@ -476,10 +476,10 @@ protected:
 
 #ifndef SWIG
 public:
-  static sharedptr<TableInfo> create_table_system_preferences();
-  static sharedptr<TableInfo> create_table_system_preferences(type_vec_fields& fields);
-  static sharedptr<Relationship> create_relationship_system_preferences(const Glib::ustring& table_name);
-  static bool get_relationship_is_system_properties(const sharedptr<const Relationship>& relationship);
+  static std::shared_ptr<TableInfo> create_table_system_preferences();
+  static std::shared_ptr<TableInfo> create_table_system_preferences(type_vec_fields& fields);
+  static std::shared_ptr<Relationship> create_relationship_system_preferences(const Glib::ustring& 
table_name);
+  static bool get_relationship_is_system_properties(const std::shared_ptr<const Relationship>& relationship);
 #endif //SWIG
 
   /// Failure codes that could be returned by load_after()
@@ -492,35 +492,35 @@ private:
   //Overrides:
 
   virtual bool save_before();
-  void save_before_layout_group(xmlpp::Element* node, const sharedptr<const LayoutGroup>& group, bool 
with_print_layout_positions = false);
+  void save_before_layout_group(xmlpp::Element* node, const std::shared_ptr<const LayoutGroup>& group, bool 
with_print_layout_positions = false);
   void save_before_sort_by(xmlpp::Element* node, const LayoutItem_GroupBy::type_list_sort_fields& 
list_fields);
-  void save_before_layout_item_usesrelationship(xmlpp::Element* nodeItem, const sharedptr<const 
UsesRelationship>& item);
-  void save_before_layout_item_field(xmlpp::Element* nodeItem, const sharedptr<const LayoutItem_Field>& 
item);
+  void save_before_layout_item_usesrelationship(xmlpp::Element* nodeItem, const std::shared_ptr<const 
UsesRelationship>& item);
+  void save_before_layout_item_field(xmlpp::Element* nodeItem, const std::shared_ptr<const 
LayoutItem_Field>& item);
   void save_before_layout_item_formatting(xmlpp::Element* nodeItem, const Formatting& format, 
Field::glom_field_type field_type = Field::TYPE_INVALID);
-  void save_before_layout_item_formatting(xmlpp::Element* nodeItem, const sharedptr<const 
LayoutItem_WithFormatting>& layout_item);
+  void save_before_layout_item_formatting(xmlpp::Element* nodeItem, const std::shared_ptr<const 
LayoutItem_WithFormatting>& layout_item);
 
-  void save_before_translations(xmlpp::Element* nodeItem, const sharedptr<const TranslatableItem>& item);
-  void save_before_print_layout_position(xmlpp::Element* nodeItem, const sharedptr<const LayoutItem>& item);
-  void save_before_choicevalue(xmlpp::Element* nodeItem, const sharedptr<const ChoiceValue>& item, 
Field::glom_field_type field_type);
+  void save_before_translations(xmlpp::Element* nodeItem, const std::shared_ptr<const TranslatableItem>& 
item);
+  void save_before_print_layout_position(xmlpp::Element* nodeItem, const std::shared_ptr<const LayoutItem>& 
item);
+  void save_before_choicevalue(xmlpp::Element* nodeItem, const std::shared_ptr<const ChoiceValue>& item, 
Field::glom_field_type field_type);
 
   void save_changes();
 
   virtual bool load_after(int& failure_code);
-  void load_after_layout_group(const xmlpp::Element* node, const Glib::ustring& table_name, const 
sharedptr<LayoutGroup>& group, bool with_print_layout_positions = false);
+  void load_after_layout_group(const xmlpp::Element* node, const Glib::ustring& table_name, const 
std::shared_ptr<LayoutGroup>& group, bool with_print_layout_positions = false);
   void load_after_sort_by(const xmlpp::Element* node, const Glib::ustring& table_name, 
LayoutItem_GroupBy::type_list_sort_fields& list_fields);
-  void load_after_layout_item_usesrelationship(const xmlpp::Element* element, const Glib::ustring& 
table_name, const sharedptr<UsesRelationship>& item);
-  void load_after_layout_item_field(const xmlpp::Element* element, const Glib::ustring& table_name, const 
sharedptr<LayoutItem_Field>& item);
+  void load_after_layout_item_usesrelationship(const xmlpp::Element* element, const Glib::ustring& 
table_name, const std::shared_ptr<UsesRelationship>& item);
+  void load_after_layout_item_field(const xmlpp::Element* element, const Glib::ustring& table_name, const 
std::shared_ptr<LayoutItem_Field>& item);
   void load_after_layout_item_formatting(const xmlpp::Element* element, Formatting& format, 
Field::glom_field_type field_type = Field::TYPE_INVALID, const Glib::ustring& table_name = Glib::ustring(), 
const Glib::ustring& field_name = Glib::ustring());
- void load_after_layout_item_formatting(const xmlpp::Element* element, const 
sharedptr<LayoutItem_WithFormatting>& layout_item, const Glib::ustring& table_name = Glib::ustring());
+ void load_after_layout_item_formatting(const xmlpp::Element* element, const 
std::shared_ptr<LayoutItem_WithFormatting>& layout_item, const Glib::ustring& table_name = Glib::ustring());
 
-  void load_after_translations(const xmlpp::Element* element, const sharedptr<TranslatableItem>& item);
-  void load_after_print_layout_position(const xmlpp::Element* nodeItem, const sharedptr<LayoutItem>& item);
-  void load_after_choicevalue(const xmlpp::Element* element, const sharedptr<ChoiceValue>& item, 
Field::glom_field_type field_type);
+  void load_after_translations(const xmlpp::Element* element, const std::shared_ptr<TranslatableItem>& item);
+  void load_after_print_layout_position(const xmlpp::Element* nodeItem, const std::shared_ptr<LayoutItem>& 
item);
+  void load_after_choicevalue(const xmlpp::Element* element, const std::shared_ptr<ChoiceValue>& item, 
Field::glom_field_type field_type);
 
   void on_app_state_userlevel_changed(AppState::userlevels userlevel);
 
-  static void fill_translatable_layout_items(const sharedptr<LayoutItem_Field>& layout_field, 
type_list_translatables& the_list, const Glib::ustring& hint);
-  static void fill_translatable_layout_items(const sharedptr<LayoutGroup>& group, type_list_translatables& 
the_list, const Glib::ustring& hint);
+  static void fill_translatable_layout_items(const std::shared_ptr<LayoutItem_Field>& layout_field, 
type_list_translatables& the_list, const Glib::ustring& hint);
+  static void fill_translatable_layout_items(const std::shared_ptr<LayoutGroup>& group, 
type_list_translatables& the_list, const Glib::ustring& hint);
 
   void fill_sort_field_details(const Glib::ustring& parent_table_name, Formatting::type_list_sort_fields& 
sort_fields) const;
 
@@ -555,10 +555,10 @@ private:
       : m_overviewx ( ),
         m_overviewy ( std::numeric_limits<float>::infinity () )
     {
-      m_info = sharedptr<TableInfo>(new TableInfo()); //Avoid a null sharedptr.
+      m_info = std::shared_ptr<TableInfo>(new TableInfo()); //Avoid a null std::shared_ptr.
     }
 
-    sharedptr<TableInfo> m_info;
+    std::shared_ptr<TableInfo> m_info;
 
     type_vec_fields m_fields;
     type_vec_relationships m_relationships;
@@ -566,10 +566,10 @@ private:
     typedef std::vector< LayoutInfo > type_layouts;
     type_layouts m_layouts;
 
-    typedef std::map< Glib::ustring, sharedptr<Report> > type_reports; //map of report names to reports
+    typedef std::map< Glib::ustring, std::shared_ptr<Report> > type_reports; //map of report names to reports
     type_reports m_reports;
 
-    typedef std::map< Glib::ustring, sharedptr<PrintLayout> > type_print_layouts; //map of print layout 
names to print layouts
+    typedef std::map< Glib::ustring, std::shared_ptr<PrintLayout> > type_print_layouts; //map of print 
layout names to print layouts
     type_print_layouts m_print_layouts;
 
     //Example data, used when creating a database from an example.
@@ -589,12 +589,12 @@ private:
     DocumentTableInfo& operator=(const DocumentTableInfo& src);
   };
 
-  sharedptr<DocumentTableInfo> get_table_info_with_add(const Glib::ustring& table_name);
+  std::shared_ptr<DocumentTableInfo> get_table_info_with_add(const Glib::ustring& table_name);
 
-  sharedptr<DocumentTableInfo> get_table_info(const Glib::ustring& table_name);
-  sharedptr<const DocumentTableInfo> get_table_info(const Glib::ustring& table_name) const;
+  std::shared_ptr<DocumentTableInfo> get_table_info(const Glib::ustring& table_name);
+  std::shared_ptr<const DocumentTableInfo> get_table_info(const Glib::ustring& table_name) const;
 
-  typedef std::map<Glib::ustring, sharedptr<DocumentTableInfo> > type_tables;
+  typedef std::map<Glib::ustring, std::shared_ptr<DocumentTableInfo> > type_tables;
   type_tables m_tables;
 
 
@@ -602,7 +602,7 @@ private:
   typedef std::map<Glib::ustring, GroupInfo> type_map_groups;
   type_map_groups m_groups;
 
-  sharedptr<DatabaseTitle> m_database_title;
+  std::shared_ptr<DatabaseTitle> m_database_title;
   Glib::ustring m_translation_original_locale;
   std::vector<Glib::ustring> m_translation_available_locales; //Just a cache, based on other data.
 
diff --git a/glom/libglom/example_document_load.cc b/glom/libglom/example_document_load.cc
index cee3d5a..bbd664d 100644
--- a/glom/libglom/example_document_load.cc
+++ b/glom/libglom/example_document_load.cc
@@ -27,7 +27,7 @@
 
 #include <iostream>
 
-void print_layout_group(const Glom::sharedptr<Glom::LayoutGroup>& layout_group, const Glib::ustring& indent)
+void print_layout_group(const std::shared_ptr<Glom::LayoutGroup>& layout_group, const Glib::ustring& indent)
 {
   if(!layout_group)
     return;
@@ -36,7 +36,7 @@ void print_layout_group(const Glom::sharedptr<Glom::LayoutGroup>& layout_group,
   const Glom::LayoutGroup::type_list_items items = layout_group->get_items();
   for(Glom::LayoutGroup::type_list_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
   {
-    Glom::sharedptr<Glom::LayoutItem> layout_item = *iter;
+    std::shared_ptr<Glom::LayoutItem> layout_item = *iter;
     if(!layout_item)
       continue;
 
@@ -50,7 +50,7 @@ void print_layout_group(const Glom::sharedptr<Glom::LayoutGroup>& layout_group,
     std::cout << std::endl;
 
     //Recurse into child groups:
-    Glom::sharedptr<Glom::LayoutGroup> group = Glom::sharedptr<Glom::LayoutGroup>::cast_dynamic(layout_item);
+    std::shared_ptr<Glom::LayoutGroup> group = std::dynamic_pointer_cast<Glom::LayoutGroup>(layout_item);
     if(group)
     {
       print_layout_group(group, indent + "  ");
@@ -62,7 +62,7 @@ void print_layout(const Glom::Document::type_list_layout_groups& layout_groups)
 {
   for(Glom::Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != 
layout_groups.end(); ++iter)
   {
-    Glom::sharedptr<Glom::LayoutGroup> layout_group = *iter;
+    std::shared_ptr<Glom::LayoutGroup> layout_group = *iter;
     if(!layout_group)
       continue;
 
@@ -118,7 +118,7 @@ int main()
     Glom::Document::type_vec_fields fields = document.get_table_fields(table_name);
     for(Glom::Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-       const Glom::sharedptr<const Glom::Field> field = *iter;
+       const std::shared_ptr<const Glom::Field> field = *iter;
        if(!field)
          continue;
 
@@ -134,7 +134,7 @@ int main()
     Glom::Document::type_vec_relationships relationships = document.get_relationships(table_name);
     for(Glom::Document::type_vec_relationships::const_iterator iter = relationships.begin(); iter != 
relationships.end(); ++iter)
     {
-       const Glom::sharedptr<const Glom::Relationship> relationship = *iter;
+       const std::shared_ptr<const Glom::Relationship> relationship = *iter;
        if(!relationship)
          continue;
 
diff --git a/glom/libglom/filelist.am b/glom/libglom/filelist.am
index d4feee5..bb4f1e2 100644
--- a/glom/libglom/filelist.am
+++ b/glom/libglom/filelist.am
@@ -21,7 +21,7 @@ libglom_toplevel_headers =                            \
        glom/libglom/appstate.h                         \
        glom/libglom/init.h                             \
        glom/libglom/libglom_config.h                   \
-       glom/libglom/sharedptr.h                        \
+       glom/libglom/sharedptr.h                        \
        glom/libglom/standard_table_prefs_fields.h      \
        glom/libglom/utils.h                            \
        glom/libglom/db_utils.h \
diff --git a/glom/libglom/privs.cc b/glom/libglom/privs.cc
index a41a76a..aa0c3c0 100644
--- a/glom/libglom/privs.cc
+++ b/glom/libglom/privs.cc
@@ -274,7 +274,7 @@ bool Privs::set_table_privileges(const Glib::ustring& group_name, const Glib::us
 
 static Glib::RefPtr<Gnome::Gda::Connection> get_connection()
 {
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
      sharedconnection = ConnectionPool::get_and_connect();
@@ -475,7 +475,7 @@ Privileges Privs::get_current_privs(const Glib::ustring& table_name)
     result.m_developer = true;
   }
   */
-  sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+  std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
   if(sharedconnection && 
sharedconnection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
   {
     //Get the "true" rights for any groups that the user is in:
diff --git a/glom/libglom/python_embed/py_glom_record.cc b/glom/libglom/python_embed/py_glom_record.cc
index 0e8ed59..d93eeae 100644
--- a/glom/libglom/python_embed/py_glom_record.cc
+++ b/glom/libglom/python_embed/py_glom_record.cc
@@ -140,7 +140,7 @@ void PyGlomRecord::setitem(const boost::python::object& key, const boost::python
   if(extractor.check())
     field_name = extractor;
 
-  sharedptr<const Field> field = m_document->get_field(m_table_name, field_name);
+  std::shared_ptr<const Field> field = m_document->get_field(m_table_name, field_name);
   if(!field)
   {
      std::cerr << G_STRFUNC << ": field=" << field_name << " not found in table=" << m_table_name << 
std::endl;
@@ -212,7 +212,7 @@ void PyGlomRecord::setitem(const boost::python::object& key, const boost::python
   //TODO: Do dependent calculations and lookups. Or just do them for all fields for this record when 
finishing the script?
 }
 
-void PyGlomRecord::set_fields(const PyGlomRecord::type_map_field_values& field_values, Document* document, 
const Glib::ustring& table_name, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& 
key_field_value, const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection)
+void PyGlomRecord::set_fields(const PyGlomRecord::type_map_field_values& field_values, Document* document, 
const Glib::ustring& table_name, const std::shared_ptr<const Field>& key_field, const Gnome::Gda::Value& 
key_field_value, const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection)
 {
   m_map_field_values = field_values;
   /* Just for debugging:
diff --git a/glom/libglom/python_embed/py_glom_record.h b/glom/libglom/python_embed/py_glom_record.h
index 35f564d..959e280 100644
--- a/glom/libglom/python_embed/py_glom_record.h
+++ b/glom/libglom/python_embed/py_glom_record.h
@@ -63,7 +63,7 @@ public:
   void set_fields(const PyGlomRecord::type_map_field_values& field_values,
     Document* document,
     const Glib::ustring& table_name,
-    const sharedptr<const Field>& key_field,
+    const std::shared_ptr<const Field>& key_field,
     const Gnome::Gda::Value& key_field_value,
     const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection);
 
@@ -72,7 +72,7 @@ public:
   Glib::ustring m_table_name;
   type_map_field_values m_map_field_values;
 private:
-  sharedptr<const Field> m_key_field;
+  std::shared_ptr<const Field> m_key_field;
   Gnome::Gda::Value m_key_field_value;
 
   boost::python::object m_related; //Actually a PyGlomRelated
diff --git a/glom/libglom/python_embed/py_glom_related.cc b/glom/libglom/python_embed/py_glom_related.cc
index 2b2acd9..c7905d1 100644
--- a/glom/libglom/python_embed/py_glom_related.cc
+++ b/glom/libglom/python_embed/py_glom_related.cc
@@ -72,7 +72,7 @@ boost::python::object PyGlomRelated::getitem(const boost::python::object& cppite
           //Fill it.
 
           //Get the value of the from_key in the parent record.
-          sharedptr<Relationship> relationship = iterFind->second;
+          std::shared_ptr<Relationship> relationship = iterFind->second;
           const Glib::ustring from_key = relationship->get_from_field();
 
           boost::python::extract<PyGlomRecord*> extractor(m_record);
@@ -86,7 +86,7 @@ boost::python::object PyGlomRelated::getitem(const boost::python::object& cppite
 
               //TODO_Performance:
               //Get the full field details so we can sqlize its value:
-              sharedptr<const Field> from_key_field = record->m_document->get_field(record->m_table_name, 
from_key);
+              std::shared_ptr<const Field> from_key_field = 
record->m_document->get_field(record->m_table_name, from_key);
               if(from_key_field)
               {
                 pyRelatedRecord->set_relationship(iterFind->second, from_key_value, record->m_document);
diff --git a/glom/libglom/python_embed/py_glom_related.h b/glom/libglom/python_embed/py_glom_related.h
index cd3716a..62708bd 100644
--- a/glom/libglom/python_embed/py_glom_related.h
+++ b/glom/libglom/python_embed/py_glom_related.h
@@ -36,7 +36,7 @@ public:
   PyGlomRelated();
   ~PyGlomRelated();
 
-  typedef std::map<Glib::ustring, sharedptr<Relationship> > type_map_relationships;
+  typedef std::map<Glib::ustring, std::shared_ptr<Relationship> > type_map_relationships;
   void set_relationships(const PyGlomRelated::type_map_relationships& relationships);
 
 
diff --git a/glom/libglom/python_embed/py_glom_relatedrecord.cc 
b/glom/libglom/python_embed/py_glom_relatedrecord.cc
index 1843d02..f62c889 100644
--- a/glom/libglom/python_embed/py_glom_relatedrecord.cc
+++ b/glom/libglom/python_embed/py_glom_relatedrecord.cc
@@ -69,7 +69,7 @@ boost::python::object PyGlomRelatedRecord::getitem(const boost::python::object&
 
   //Check whether the field exists in the table.
   //TODO_Performance: Do this without the useless Field information?
-  sharedptr<const Field> field = m_document->get_field(m_relationship->get_to_table(), field_name);
+  std::shared_ptr<const Field> field = m_document->get_field(m_relationship->get_to_table(), field_name);
   if(!field)
   {
     std::cerr << G_STRFUNC << ": field " << field_name << " not found in table " << 
m_relationship->get_to_table() << std::endl;
@@ -80,7 +80,7 @@ boost::python::object PyGlomRelatedRecord::getitem(const boost::python::object&
   {
     //Try to get the value from the database:
     //const Glib::ustring parent_key_name;
-    sharedptr<SharedConnection> sharedconnection = ConnectionPool::get_instance()->connect();
+    std::shared_ptr<SharedConnection> sharedconnection = ConnectionPool::get_instance()->connect();
 
     if(!sharedconnection)
     {
@@ -156,7 +156,7 @@ boost::python::object PyGlomRelatedRecord::generic_aggregate(const std::string&
 
   //Check whether the field exists in the table.
   //TODO_Performance: Do this without the useless Field information?
-  sharedptr<Field> field = m_document->get_field(m_relationship->get_to_table(), field_name);
+  std::shared_ptr<Field> field = m_document->get_field(m_relationship->get_to_table(), field_name);
   if(!field)
   {
     g_warning("RelatedRecord_sum: field %s not found in table %s", field_name.c_str(), 
m_relationship->get_to_table().c_str());
@@ -165,7 +165,7 @@ boost::python::object PyGlomRelatedRecord::generic_aggregate(const std::string&
 
   //Try to get the value from the database:
   //const Glib::ustring parent_key_name;
-  sharedptr<SharedConnection> sharedconnection = ConnectionPool::get_instance()->connect();
+  std::shared_ptr<SharedConnection> sharedconnection = ConnectionPool::get_instance()->connect();
   if(!sharedconnection)
   {
     g_warning("RelatedRecord_sum: no connection.");
@@ -244,7 +244,7 @@ boost::python::object PyGlomRelatedRecord::max(const std::string& field_name) co
   return generic_aggregate(field_name, "max");
 }
 
-void PyGlomRelatedRecord::set_relationship(const sharedptr<const Relationship>& relationship, const 
Gnome::Gda::Value& from_key_value,  Document* document)
+void PyGlomRelatedRecord::set_relationship(const std::shared_ptr<const Relationship>& relationship, const 
Gnome::Gda::Value& from_key_value,  Document* document)
 {
   m_relationship = relationship;
   m_from_key_value = from_key_value;
diff --git a/glom/libglom/python_embed/py_glom_relatedrecord.h 
b/glom/libglom/python_embed/py_glom_relatedrecord.h
index 6da7dea..63b9281 100644
--- a/glom/libglom/python_embed/py_glom_relatedrecord.h
+++ b/glom/libglom/python_embed/py_glom_relatedrecord.h
@@ -38,7 +38,7 @@ public:
   PyGlomRelatedRecord();
   ~PyGlomRelatedRecord();
 
-  void set_relationship(const sharedptr<const Relationship>& relationship, const Gnome::Gda::Value& 
from_key_value, Document* document);
+  void set_relationship(const std::shared_ptr<const Relationship>& relationship, const Gnome::Gda::Value& 
from_key_value, Document* document);
 
   boost::python::object sum(const std::string& field_name) const;
   boost::python::object count(const std::string& field_name) const;
@@ -60,7 +60,7 @@ private:
   //PyGlomRecord* m_record_parent;
   Document* m_document;
 
-  sharedptr<const Relationship> m_relationship;
+  std::shared_ptr<const Relationship> m_relationship;
   Gnome::Gda::Value m_from_key_value;
 
   mutable type_map_field_values m_map_field_values; //A cache.
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index 7c78642..44d0f90 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -41,7 +41,7 @@ ReportBuilder::~ReportBuilder()
 {
 }
 
-bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::Element& parent_node, const 
sharedptr<LayoutGroup>& group)
+bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::Element& parent_node, const 
std::shared_ptr<LayoutGroup>& group)
 {
   //Add XML node:
   xmlpp::Element* node = parent_node.add_child(group->get_report_part_id());
@@ -50,9 +50,9 @@ bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::
   type_vecLayoutItems itemsToGet;
   for(LayoutGroup::type_list_items::iterator iterChildren = group->m_list_items.begin(); iterChildren != 
group->m_list_items.end(); ++iterChildren)
   {
-    sharedptr<LayoutItem> item = *iterChildren;
+    std::shared_ptr<LayoutItem> item = *iterChildren;
 
-    sharedptr<LayoutItem_Text> item_text = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_Text> item_text = std::dynamic_pointer_cast<LayoutItem_Text>(item);
     if(item_text)
     {
       if(!report_build_records_text(found_set, *node, item_text))
@@ -63,7 +63,7 @@ bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::
     }
     else
     {
-      sharedptr<LayoutItem_Image> item_image = sharedptr<LayoutItem_Image>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Image> item_image = std::dynamic_pointer_cast<LayoutItem_Image>(item);
       if(item_image)
       {
         if(!report_build_records_image(found_set, *node, item_image))
@@ -74,7 +74,7 @@ bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::
       }
       else
       {
-        sharedptr<LayoutItem_Field> pField = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+        std::shared_ptr<LayoutItem_Field> pField = std::dynamic_pointer_cast<LayoutItem_Field>(item);
         if(pField)
         {
           guint col_index = 0; //ignored.
@@ -86,7 +86,7 @@ bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::
         }
         else
         {
-          sharedptr<LayoutItem_VerticalGroup> vertical_group = 
sharedptr<LayoutItem_VerticalGroup>::cast_dynamic(item);
+          std::shared_ptr<LayoutItem_VerticalGroup> vertical_group = 
std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(item);
           if(vertical_group)
           {
             //Reuse (a bit hacky) this function for the header and footer:
@@ -105,7 +105,7 @@ bool ReportBuilder::report_build_headerfooter(const FoundSet& found_set, xmlpp::
   return true;
 }
 
-bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Element& parent_node, const 
sharedptr<LayoutItem_Summary>& summary)
+bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Element& parent_node, const 
std::shared_ptr<LayoutItem_Summary>& summary)
 {
   //Add XML node:
   xmlpp::Element* node = parent_node.add_child(summary->get_report_part_id());
@@ -114,9 +114,9 @@ bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Eleme
   type_vecLayoutItems itemsToGet;
   for(LayoutGroup::type_list_items::iterator iterChildren = summary->m_list_items.begin(); iterChildren != 
summary->m_list_items.end(); ++iterChildren)
   {
-    sharedptr<LayoutItem> item = *iterChildren;
+    std::shared_ptr<LayoutItem> item = *iterChildren;
 
-    sharedptr<LayoutItem_GroupBy> pGroupBy = sharedptr<LayoutItem_GroupBy>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_GroupBy> pGroupBy = std::dynamic_pointer_cast<LayoutItem_GroupBy>(item);
     if(pGroupBy)
     {
       //Recurse, adding a sub-groupby block:
@@ -128,7 +128,7 @@ bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Eleme
     }
     else
     {
-      sharedptr<LayoutItem_Summary> pSummary = sharedptr<LayoutItem_Summary>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Summary> pSummary = std::dynamic_pointer_cast<LayoutItem_Summary>(item);
       if(pSummary)
       {
         //Recurse, adding a summary block:
@@ -166,15 +166,15 @@ bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Eleme
 
 
 
-bool ReportBuilder::report_build_groupby_children(const FoundSet& found_set, xmlpp::Element& node, const 
sharedptr<LayoutItem_GroupBy>& group_by)
+bool ReportBuilder::report_build_groupby_children(const FoundSet& found_set, xmlpp::Element& node, const 
std::shared_ptr<LayoutItem_GroupBy>& group_by)
 {
   //Get data and add child rows:
   type_vecLayoutItems itemsToGet;
   for(LayoutGroup::type_list_items::iterator iterChildren = group_by->m_list_items.begin(); iterChildren != 
group_by->m_list_items.end(); ++iterChildren)
   {
-    sharedptr<LayoutItem> item = *iterChildren;
+    std::shared_ptr<LayoutItem> item = *iterChildren;
 
-    sharedptr<LayoutItem_GroupBy> pGroupBy = sharedptr<LayoutItem_GroupBy>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_GroupBy> pGroupBy = std::dynamic_pointer_cast<LayoutItem_GroupBy>(item);
     if(pGroupBy)
     {
       //Recurse, adding a sub-groupby block:
@@ -186,7 +186,7 @@ bool ReportBuilder::report_build_groupby_children(const FoundSet& found_set, xml
     }
     else
     {
-      sharedptr<LayoutItem_Summary> pSummary = sharedptr<LayoutItem_Summary>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Summary> pSummary = std::dynamic_pointer_cast<LayoutItem_Summary>(item);
       if(pSummary)
       {
         //Recurse, adding a summary block:
@@ -218,12 +218,12 @@ bool ReportBuilder::report_build_groupby_children(const FoundSet& found_set, xml
   return true;
 }
 
-bool ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp::Element& parent_node, 
const sharedptr<LayoutItem_GroupBy>& group_by)
+bool ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp::Element& parent_node, 
const std::shared_ptr<LayoutItem_GroupBy>& group_by)
 {
   //Get the possible heading values.
   if(group_by->get_has_field_group_by())
   {
-    sharedptr<LayoutItem_Field> field_group_by = group_by->get_field_group_by();
+    std::shared_ptr<LayoutItem_Field> field_group_by = group_by->get_field_group_by();
     DbUtils::layout_item_fill_field_details(get_document(), found_set_parent.m_table_name, field_group_by);
 
     //Get the possible group values, ignoring repeats by using GROUP BY.
@@ -284,7 +284,7 @@ bool ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
           type_vecLayoutItems itemsToGet;
           for(LayoutGroup::type_list_items::iterator iterChildren = 
group_by->get_secondary_fields()->m_list_items.begin(); iterChildren != 
group_by->get_secondary_fields()->m_list_items.end(); ++iterChildren)
           {
-            sharedptr<LayoutItem> item = *iterChildren;
+            std::shared_ptr<LayoutItem> item = *iterChildren;
             itemsToGet.push_back( glom_sharedptr_clone(item) );
           }
 
@@ -319,13 +319,13 @@ bool ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
   return true;
 }
 
-bool ReportBuilder::report_build_records_get_fields(const FoundSet& found_set, const sharedptr<LayoutGroup>& 
group, type_vecLayoutFields& items)
+bool ReportBuilder::report_build_records_get_fields(const FoundSet& found_set, const 
std::shared_ptr<LayoutGroup>& group, type_vecLayoutFields& items)
 {
   for(LayoutGroup::type_list_items::iterator iterChildren = group->m_list_items.begin(); iterChildren != 
group->m_list_items.end(); ++iterChildren)
   {
-    sharedptr<LayoutItem> item = *iterChildren;
+    std::shared_ptr<LayoutItem> item = *iterChildren;
 
-    sharedptr<LayoutItem_VerticalGroup> pVerticalGroup = 
sharedptr<LayoutItem_VerticalGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_VerticalGroup> pVerticalGroup = 
std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(item);
     if(pVerticalGroup)
     {
       if(!report_build_records_get_fields(found_set, pVerticalGroup, items))
@@ -336,7 +336,7 @@ bool ReportBuilder::report_build_records_get_fields(const FoundSet& found_set, c
     }
     else
     {
-      sharedptr<LayoutItem_Field> pField = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Field> pField = std::dynamic_pointer_cast<LayoutItem_Field>(item);
       if(pField)
         items.push_back(pField);
     }
@@ -352,8 +352,8 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
     //Add Field headings:
     for(type_vecLayoutItems::const_iterator iter = items.begin(); iter != items.end(); ++iter)
     {
-      sharedptr<LayoutItem> layout_item = *iter;
-      sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = *iter;
+      std::shared_ptr<LayoutItem_Field> layoutitem_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
 
       //This adds a field heading (and therefore, column) for fields, or for a vertical group.
       xmlpp::Element* nodeFieldHeading = parent_node.add_child("field_heading");
@@ -368,13 +368,13 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
     Utils::type_vecLayoutFields fieldsToGet;
     for(type_vecLayoutItems::const_iterator iter = items.begin(); iter != items.end(); ++iter)
     {
-      sharedptr<LayoutItem> layout_item = *iter;
-      sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = *iter;
+      std::shared_ptr<LayoutItem_Field> layoutitem_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
       if(layoutitem_field)
         fieldsToGet.push_back(layoutitem_field);
       else
       {
-        sharedptr<LayoutItem_VerticalGroup> vertical_group = 
sharedptr<LayoutItem_VerticalGroup>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_VerticalGroup> vertical_group = 
std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(layout_item);
         if(vertical_group)
         {
           //Get all the fields in this group:
@@ -394,7 +394,7 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
 
     Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = 
Utils::build_sql_select_with_where_clause(found_set.m_table_name,
       fieldsToGet,
-      found_set.m_where_clause, sharedptr<const Relationship>() /* extra_join */, found_set.m_sort_clause,
+      found_set.m_where_clause, std::shared_ptr<const Relationship>() /* extra_join */, 
found_set.m_sort_clause,
       limit);
 
     Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(sql_query);
@@ -416,8 +416,8 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
         {
           xmlpp::Element* nodeField = 0;
 
-          sharedptr<LayoutItem> item = *iter;
-          sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+          std::shared_ptr<LayoutItem> item = *iter;
+          std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
           if(field)
           {
             if(!report_build_records_field(found_set, *nodeRow, field, datamodel, row, colField))
@@ -428,7 +428,7 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
           }
           else
           {
-            sharedptr<LayoutItem_Text> item_text = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+            std::shared_ptr<LayoutItem_Text> item_text = std::dynamic_pointer_cast<LayoutItem_Text>(item);
             if(item_text)
             {
               if(!report_build_records_text(found_set, *nodeRow, item_text))
@@ -439,7 +439,7 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
             }
             else
             {
-              sharedptr<LayoutItem_VerticalGroup> item_verticalgroup = 
sharedptr<LayoutItem_VerticalGroup>::cast_dynamic(item);
+              std::shared_ptr<LayoutItem_VerticalGroup> item_verticalgroup = 
std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(item);
               if(item_verticalgroup)
               {
                 if(!report_build_records_vertical_group(found_set, *nodeRow, item_verticalgroup, datamodel, 
row, colField))
@@ -465,7 +465,7 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
   return true;
 }
 
-bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
sharedptr<const LayoutItem_Field>& field, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint row, 
guint& colField, bool vertical)
+bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
std::shared_ptr<const LayoutItem_Field>& field, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint 
row, guint& colField, bool vertical)
 {
   const Field::glom_field_type field_type = field->get_glom_type();
 
@@ -513,7 +513,7 @@ bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
     Glib::ustring text_value = Conversions::get_text_for_gda_value(field_type, value, 
field->get_formatting_used().m_numeric_format);
 
     //The Postgres summary functions return NULL when summarising NULL records, but 0 is more sensible:
-    if(text_value.empty() && sharedptr<const LayoutItem_FieldSummary>::cast_dynamic(field) && (field_type == 
Field::TYPE_NUMERIC))
+    if(text_value.empty() && std::dynamic_pointer_cast<const LayoutItem_FieldSummary>(field) && (field_type 
== Field::TYPE_NUMERIC))
     {
       //Use get_text_for_gda_value() instead of "0" so we get the correct numerical formatting:
       const Gnome::Gda::Value value = Conversions::parse_value(0);
@@ -528,7 +528,7 @@ bool ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
   return true;
 }
 
-bool ReportBuilder::report_build_records_text(const FoundSet& /* found_set */, xmlpp::Element& nodeParent, 
const sharedptr<const LayoutItem_Text>& textobject, bool vertical)
+bool ReportBuilder::report_build_records_text(const FoundSet& /* found_set */, xmlpp::Element& nodeParent, 
const std::shared_ptr<const LayoutItem_Text>& textobject, bool vertical)
 {
   //Text object:
   xmlpp::Element* nodeField = nodeParent.add_child(textobject->get_report_part_id()); //We reuse this node 
type for text objects.
@@ -540,7 +540,7 @@ bool ReportBuilder::report_build_records_text(const FoundSet& /* found_set */, x
   return true;
 }
 
-bool ReportBuilder::report_build_records_image(const FoundSet& /* found_set */, xmlpp::Element& nodeParent, 
const sharedptr<const LayoutItem_Image>& imageobject, bool vertical)
+bool ReportBuilder::report_build_records_image(const FoundSet& /* found_set */, xmlpp::Element& nodeParent, 
const std::shared_ptr<const LayoutItem_Image>& imageobject, bool vertical)
 {
   //Text object:
   xmlpp::Element* nodeImage = nodeParent.add_child(imageobject->get_report_part_id()); //We reuse this node 
type for text objects.
@@ -552,15 +552,15 @@ bool ReportBuilder::report_build_records_image(const FoundSet& /* found_set */,
   return true;
 }
 
-bool ReportBuilder::report_build_records_vertical_group(const FoundSet& found_set, xmlpp::Element& 
parentNode, const sharedptr<LayoutItem_VerticalGroup>& group, const Glib::RefPtr<Gnome::Gda::DataModel>& 
datamodel, guint row, guint& field_index)
+bool ReportBuilder::report_build_records_vertical_group(const FoundSet& found_set, xmlpp::Element& 
parentNode, const std::shared_ptr<LayoutItem_VerticalGroup>& group, const 
Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint row, guint& field_index)
 {
   xmlpp::Element* nodeGroupVertical = parentNode.add_child(group->get_report_part_id());
 
   for(LayoutGroup::type_list_items::iterator iterChildren = group->m_list_items.begin(); iterChildren != 
group->m_list_items.end(); ++iterChildren)
   {
-    sharedptr<LayoutItem> item = *iterChildren;
+    std::shared_ptr<LayoutItem> item = *iterChildren;
 
-    sharedptr<LayoutItem_VerticalGroup> pVerticalGroup = 
sharedptr<LayoutItem_VerticalGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_VerticalGroup> pVerticalGroup = 
std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(item);
     if(pVerticalGroup)
     {
       if(!report_build_records_vertical_group(found_set, *nodeGroupVertical, pVerticalGroup, datamodel, row, 
field_index))
@@ -571,7 +571,7 @@ bool ReportBuilder::report_build_records_vertical_group(const FoundSet& found_se
     }
     else
     {
-      sharedptr<LayoutItem_Field> pField = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Field> pField = std::dynamic_pointer_cast<LayoutItem_Field>(item);
       if(pField)
       {
         if(!report_build_records_field(found_set, *nodeGroupVertical, pField, datamodel, row, field_index, 
true /* vertical, so we get a row for each field too. */))
@@ -582,7 +582,7 @@ bool ReportBuilder::report_build_records_vertical_group(const FoundSet& found_se
       }
       else
       {
-        sharedptr<LayoutItem_Text> pText = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+        std::shared_ptr<LayoutItem_Text> pText = std::dynamic_pointer_cast<LayoutItem_Text>(item);
         if(pText)
         {
           if(!report_build_records_text(found_set, *nodeGroupVertical, pText, true))
@@ -599,7 +599,7 @@ bool ReportBuilder::report_build_records_vertical_group(const FoundSet& found_se
 }
 
 //TODO: Return a URI
-std::string ReportBuilder::report_build_and_save(const FoundSet& found_set, const sharedptr<const Report>& 
report)
+std::string ReportBuilder::report_build_and_save(const FoundSet& found_set, const std::shared_ptr<const 
Report>& report)
 {
   const Glib::ustring contents = report_build(found_set, report);
 
@@ -650,7 +650,7 @@ std::string ReportBuilder::report_build_and_save(const FoundSet& found_set, cons
 }
  
 
-Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const sharedptr<const Report>& report)
+Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const std::shared_ptr<const Report>& 
report)
 {
   //Create a DOM Document with the XML:
   xmlpp::DomParser dom_parser;;
@@ -680,13 +680,13 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const share
 
   type_vecLayoutItems itemsToGet_TopLevel;
 
-  const sharedptr<const LayoutGroup> group = report->get_layout_group();
+  const std::shared_ptr<const LayoutGroup> group = report->get_layout_group();
   for(LayoutGroup::type_list_items::const_iterator iter = group->m_list_items.begin(); iter != 
group->m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> pPart = *iter;
+    std::shared_ptr<LayoutItem> pPart = *iter;
 
     //The Group, and the details for each record in the group:
-    sharedptr<LayoutItem_GroupBy> pGroupBy = sharedptr<LayoutItem_GroupBy>::cast_dynamic(pPart);
+    std::shared_ptr<LayoutItem_GroupBy> pGroupBy = std::dynamic_pointer_cast<LayoutItem_GroupBy>(pPart);
     if(pGroupBy)
     {
       if(!report_build_groupby(found_set, *nodeParent, pGroupBy))
@@ -697,7 +697,7 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const share
     }
     else
     {
-      sharedptr<LayoutItem_Summary> pSummary = sharedptr<LayoutItem_Summary>::cast_dynamic(pPart);
+      std::shared_ptr<LayoutItem_Summary> pSummary = std::dynamic_pointer_cast<LayoutItem_Summary>(pPart);
       if(pSummary)
       {
         //Recurse, adding a summary block:
@@ -709,11 +709,11 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const share
       }
       else
       {
-        sharedptr<LayoutGroup> pGroup = sharedptr<LayoutGroup>::cast_dynamic(pPart);
+        std::shared_ptr<LayoutGroup> pGroup = std::dynamic_pointer_cast<LayoutGroup>(pPart);
         if(pGroup)
         {
-          sharedptr<LayoutItem_Header> pHeader = sharedptr<LayoutItem_Header>::cast_dynamic(pPart);
-          sharedptr<LayoutItem_Footer> pFooter = sharedptr<LayoutItem_Footer>::cast_dynamic(pPart);
+          std::shared_ptr<LayoutItem_Header> pHeader = std::dynamic_pointer_cast<LayoutItem_Header>(pPart);
+          std::shared_ptr<LayoutItem_Footer> pFooter = std::dynamic_pointer_cast<LayoutItem_Footer>(pPart);
           if(pHeader || pFooter)
           {
             //Recurse, adding a summary block:
@@ -744,7 +744,7 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const share
   return GlomXslUtils::transform(*pDocument, "print_report_to_html.xsl");
 }
 
-static void fill_standard_list_report_fill(const sharedptr<Report>& report, const sharedptr<const 
LayoutGroup>& layout_group)
+static void fill_standard_list_report_fill(const std::shared_ptr<Report>& report, const 
std::shared_ptr<const LayoutGroup>& layout_group)
 {
   if(!report)
     return;
@@ -754,18 +754,18 @@ static void fill_standard_list_report_fill(const sharedptr<Report>& report, cons
 
   for(LayoutGroup::type_list_items::const_iterator iter = layout_group->m_list_items.begin(); iter != 
layout_group->m_list_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> item = *iter;
+    const std::shared_ptr<const LayoutItem> item = *iter;
     if(!item)
       continue;
 
-    const sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(item); //TODO: Avoid this?
+    const std::shared_ptr<LayoutItem> unconst = std::const_pointer_cast<LayoutItem>(item); //TODO: Avoid 
this?
     report->get_layout_group()->add_item(unconst);
   }
 }
 
-sharedptr<Report> ReportBuilder::create_standard_list_report(const Document* document, const Glib::ustring& 
table_name)
+std::shared_ptr<Report> ReportBuilder::create_standard_list_report(const Document* document, const 
Glib::ustring& table_name)
 {
-  sharedptr<Report> result(new Report());
+  std::shared_ptr<Report> result(new Report());
   result->set_name("list");
   //Translators: This is a noun. It is the title of a report.
   result->set_title_original(_("List"));
@@ -774,7 +774,7 @@ sharedptr<Report> ReportBuilder::create_standard_list_report(const Document* doc
     document->get_data_layout_groups("list", table_name); //TODO: layout_platform.
   for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != 
layout_groups.end(); ++iter)
   {
-    const sharedptr<const LayoutGroup> group = *iter;
+    const std::shared_ptr<const LayoutGroup> group = *iter;
     if(group)
       fill_standard_list_report_fill(result, group);
   }
diff --git a/glom/libglom/report_builder.h b/glom/libglom/report_builder.h
index 4e1008b..7d524ea 100644
--- a/glom/libglom/report_builder.h
+++ b/glom/libglom/report_builder.h
@@ -38,41 +38,41 @@ public:
   explicit ReportBuilder(const Glib::ustring& locale);
   virtual ~ReportBuilder();
 
-  static sharedptr<Report> create_standard_list_report(const Document* document, const Glib::ustring& 
table_name);
+  static std::shared_ptr<Report> create_standard_list_report(const Document* document, const Glib::ustring& 
table_name);
 
   //TODO: Remove set_document() and get_document()?
   void set_document(Document* document);
 
-  //void set_report(const Glib::ustring& table_name, const sharedptr<const Report>& report);
-  //sharedptr<Report> get_report();
+  //void set_report(const Glib::ustring& table_name, const std::shared_ptr<const Report>& report);
+  //std::shared_ptr<Report> get_report();
 
   /**
    * @result The HTML of the generated report.
    */
-  Glib::ustring report_build(const FoundSet& found_set, const sharedptr<const Report>& report);
+  Glib::ustring report_build(const FoundSet& found_set, const std::shared_ptr<const Report>& report);
 
   /**
    * @result The filepath of a temporary file containing the generated HTML file.
    */
-  std::string report_build_and_save(const FoundSet& found_set, const sharedptr<const Report>& report);
+  std::string report_build_and_save(const FoundSet& found_set, const std::shared_ptr<const Report>& report);
  
  
 private:
 
-  bool report_build_groupby(const FoundSet& found_set_parent, xmlpp::Element& parent_node, const 
sharedptr<LayoutItem_GroupBy>& group_by);
-  bool report_build_groupby_children(const FoundSet& found_set, xmlpp::Element& nodeGroupBy, const 
sharedptr<LayoutItem_GroupBy>& group_by);
-  bool report_build_summary(const FoundSet& found_set_parent, xmlpp::Element& parent_node, const 
sharedptr<LayoutItem_Summary>& summary);
-  bool report_build_headerfooter(const FoundSet& found_set, xmlpp::Element& parent_node, const 
sharedptr<LayoutGroup>& group);
+  bool report_build_groupby(const FoundSet& found_set_parent, xmlpp::Element& parent_node, const 
std::shared_ptr<LayoutItem_GroupBy>& group_by);
+  bool report_build_groupby_children(const FoundSet& found_set, xmlpp::Element& nodeGroupBy, const 
std::shared_ptr<LayoutItem_GroupBy>& group_by);
+  bool report_build_summary(const FoundSet& found_set_parent, xmlpp::Element& parent_node, const 
std::shared_ptr<LayoutItem_Summary>& summary);
+  bool report_build_headerfooter(const FoundSet& found_set, xmlpp::Element& parent_node, const 
std::shared_ptr<LayoutGroup>& group);
 
-  typedef std::vector< sharedptr<LayoutItem> > type_vecLayoutItems;
-  typedef std::vector< sharedptr<LayoutItem_Field> > type_vecLayoutFields;
+  typedef std::vector< std::shared_ptr<LayoutItem> > type_vecLayoutItems;
+  typedef std::vector< std::shared_ptr<LayoutItem_Field> > type_vecLayoutFields;
 
   bool report_build_records(const FoundSet& found_set, xmlpp::Element& parent_node, const 
type_vecLayoutItems& items, bool one_record_only = false);
-  bool report_build_records_get_fields(const FoundSet& found_set, const sharedptr<LayoutGroup>& group, 
type_vecLayoutFields& items);
-  bool report_build_records_field(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
sharedptr<const LayoutItem_Field>& field, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint row, 
guint& colField, bool vertical = false);
-  bool report_build_records_text(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
sharedptr<const LayoutItem_Text>& textobject, bool vertical = false);
-  bool report_build_records_image(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
sharedptr<const LayoutItem_Image>& imageobject, bool vertical = false);
-  bool report_build_records_vertical_group(const FoundSet& found_set, xmlpp::Element& vertical_group_node, 
const sharedptr<LayoutItem_VerticalGroup>& group, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint 
row, guint& field_index);
+  bool report_build_records_get_fields(const FoundSet& found_set, const std::shared_ptr<LayoutGroup>& group, 
type_vecLayoutFields& items);
+  bool report_build_records_field(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
std::shared_ptr<const LayoutItem_Field>& field, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, guint 
row, guint& colField, bool vertical = false);
+  bool report_build_records_text(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
std::shared_ptr<const LayoutItem_Text>& textobject, bool vertical = false);
+  bool report_build_records_image(const FoundSet& found_set, xmlpp::Element& nodeParent, const 
std::shared_ptr<const LayoutItem_Image>& imageobject, bool vertical = false);
+  bool report_build_records_vertical_group(const FoundSet& found_set, xmlpp::Element& vertical_group_node, 
const std::shared_ptr<LayoutItem_VerticalGroup>& group, const Glib::RefPtr<Gnome::Gda::DataModel>& datamodel, 
guint row, guint& field_index);
 
   Document* get_document();
 
diff --git a/glom/libglom/spawn_with_feedback.cc b/glom/libglom/spawn_with_feedback.cc
index 765023d..0845da0 100644
--- a/glom/libglom/spawn_with_feedback.cc
+++ b/glom/libglom/spawn_with_feedback.cc
@@ -27,7 +27,7 @@
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/i18n.h>
-#include <memory> //For auto_ptr.
+#include <memory> //For shared_ptr.
 #include <stdexcept>
 #include <iostream>
 
@@ -300,16 +300,16 @@ private:
 #endif
 };
 
-static std::auto_ptr<const SpawnInfo> spawn_async(const Glib::ustring& command_line, int redirect)
+static std::shared_ptr<const SpawnInfo> spawn_async(const Glib::ustring& command_line, int redirect)
 {
-  return std::auto_ptr<const SpawnInfo>(new SpawnInfo(command_line, redirect));
+  return std::shared_ptr<const SpawnInfo>(new SpawnInfo(command_line, redirect));
 }
 
 /**
  * @param return_status: The return value of the command.
  * @result Whether we successfully ended the async spawn.
  */
-static bool spawn_async_end(std::auto_ptr<const SpawnInfo> info, std::string* stdout_text = 0, std::string* 
stderr_text = 0, int* return_status = 0)
+static bool spawn_async_end(std::shared_ptr<const SpawnInfo> info, std::string* stdout_text = 0, 
std::string* stderr_text = 0, int* return_status = 0)
 {
   if(stdout_text)
     info->get_stdout(*stdout_text);
@@ -334,7 +334,7 @@ static int spawn_sync(const Glib::ustring& command_line, std::string* stdout_tex
 
   Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(false);
 
-  std::auto_ptr<const SpawnInfo> info = spawn_async(command_line, redirect_flags); //This could throw
+  std::shared_ptr<const SpawnInfo> info = spawn_async(command_line, redirect_flags); //This could throw
   info->signal_finished().connect(
     sigc::bind(sigc::ptr_fun(&on_spawn_info_finished), sigc::ref(mainloop) ) );
 
@@ -353,7 +353,7 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
 {
   //Show UI progress feedback while we wait for the command to finish:
 
-  std::auto_ptr<const Impl::SpawnInfo> info;
+  std::shared_ptr<const Impl::SpawnInfo> info;
   
   try
   {
@@ -396,7 +396,7 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
 
   //Show UI progress feedback while we wait for the command to finish:
 
-  std::auto_ptr<const Impl::SpawnInfo> info;
+  std::shared_ptr<const Impl::SpawnInfo> info;
   
   try
   {
@@ -558,7 +558,7 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
   std::cout << "debug: Command: " << command << std::endl;
   #endif //GLOM_SPAWN_DEBUG
 
-  std::auto_ptr<const Impl::SpawnInfo> info;
+  std::shared_ptr<const Impl::SpawnInfo> info;
 
   try
   {
@@ -619,7 +619,7 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
     {
       /* TODO: Allow the caller to show a dialog?
       // Command failed
-      std::auto_ptr<Gtk::MessageDialog> error_dialog;
+      std::shared_ptr<Gtk::MessageDialog> error_dialog;
       if(parent_window)
         error_dialog.reset(new Gtk::MessageDialog(*parent_window, "Child command failed", false, 
Gtk::MESSAGE_ERROR));
       else
diff --git a/glom/libglom/test_connectionpool.cc b/glom/libglom/test_connectionpool.cc
index ff05098..4e32bee 100644
--- a/glom/libglom/test_connectionpool.cc
+++ b/glom/libglom/test_connectionpool.cc
@@ -58,12 +58,12 @@ int main()
       Glom::ConnectionPoolBackends::Sqlite* backend = new Glom::ConnectionPoolBackends::Sqlite;
 #endif //GLOM_ENABLE_POSTGRESQL
 
-      connection_pool->set_backend(std::auto_ptr<Glom::ConnectionPool::Backend>(backend));
+      connection_pool->set_backend(std::shared_ptr<Glom::ConnectionPool::Backend>(backend));
       connection_pool->set_ready_to_connect(); //connect_to_server() will now attempt the connection-> 
Shared instances of m_Connection will also be usable.
     }
 
     //Connect:
-    Glom::sharedptr<Glom::SharedConnection> connection;
+    std::shared_ptr<Glom::SharedConnection> connection;
     
     try
     {
diff --git a/glom/libglom/translations_po.cc b/glom/libglom/translations_po.cc
index df2c619..010e027 100644
--- a/glom/libglom/translations_po.cc
+++ b/glom/libglom/translations_po.cc
@@ -126,7 +126,7 @@ static void on_gettextpo_error(int status, int errnum, const char * /* format */
 }
 #endif //HAVE_GETTEXTPO_XERROR
 
-Glib::ustring get_po_context_for_item(const sharedptr<const TranslatableItem>& item, const Glib::ustring& 
hint)
+Glib::ustring get_po_context_for_item(const std::shared_ptr<const TranslatableItem>& item, const 
Glib::ustring& hint)
 {
   // Note that this context string should use English rather than the translated strings,
   // or the context would change depending on the locale of the user doing the export:
@@ -172,7 +172,7 @@ bool write_translations_to_po_file(Document* document, const Glib::ustring& po_f
   Document::type_list_translatables list_layout_items = document->get_translatable_items();
   for(Document::type_list_translatables::iterator iter = list_layout_items.begin(); iter != 
list_layout_items.end(); ++iter)
   {
-    sharedptr<TranslatableItem> item = iter->first;
+    std::shared_ptr<TranslatableItem> item = iter->first;
     if(!item)
       continue;
 
@@ -262,7 +262,7 @@ bool import_translations_from_po_file(Document* document, const Glib::ustring& p
       //Find the matching item in the list:
       for(Document::type_list_translatables::iterator iter = list_layout_items.begin(); iter != 
list_layout_items.end(); ++iter)
       {
-        sharedptr<TranslatableItem> item = iter->first;
+        std::shared_ptr<TranslatableItem> item = iter->first;
         if(!item)
           continue;
 
diff --git a/glom/libglom/translations_po.h b/glom/libglom/translations_po.h
index 842462d..902a2a8 100644
--- a/glom/libglom/translations_po.h
+++ b/glom/libglom/translations_po.h
@@ -52,7 +52,7 @@ bool import_translations_from_po_file(Document* document, const Glib::ustring& p
  * because not all text with the same contents should be translated the same 
  * way in all languages - the context might change the translation.
  */ 
-Glib::ustring get_po_context_for_item(const sharedptr<const TranslatableItem>& item, const Glib::ustring& 
hint);
+Glib::ustring get_po_context_for_item(const std::shared_ptr<const TranslatableItem>& item, const 
Glib::ustring& hint);
 
 } //namespace Glom
 
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index c7b8dd2..987f812 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -60,7 +60,7 @@ public:
   {
   }
 
-  predicate_UsesRelationshipHasRelationships(const sharedptr<const UsesRelationship> uses_relationship_name, 
bool first_level_only = false)
+  predicate_UsesRelationshipHasRelationships(const std::shared_ptr<const UsesRelationship> 
uses_relationship_name, bool first_level_only = false)
   : m_relationship_name(uses_relationship_name->get_relationship_name()),
     m_related_relationship_name(uses_relationship_name->get_related_relationship_name())
   {
@@ -78,12 +78,12 @@ public:
     return (element.get_relationship_name() == m_relationship_name) && 
(element.get_related_relationship_name() == m_related_relationship_name);
   }
 
-  bool operator() (const sharedptr<T_Element>& element)
+  bool operator() (const std::shared_ptr<T_Element>& element)
   {
     return (element->get_relationship_name() == m_relationship_name) && 
(element->get_related_relationship_name() == m_related_relationship_name);
   }
 
-  bool operator() (const sharedptr<const T_Element>& element)
+  bool operator() (const std::shared_ptr<const T_Element>& element)
   {
     return (element->get_relationship_name() == m_relationship_name) && 
(element->get_related_relationship_name() == m_related_relationship_name);
   }
@@ -209,7 +209,7 @@ Glib::ustring Utils::string_clean_for_xml(const Glib::ustring& src)
 }
 
 
-Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(const Glib::ustring& 
table_name, const type_vecLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause, const 
sharedptr<const Relationship>& extra_join, const type_sort_clause& sort_clause, guint limit)
+Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(const Glib::ustring& 
table_name, const type_vecLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause, const 
std::shared_ptr<const Relationship>& extra_join, const type_sort_clause& sort_clause, guint limit)
 {
   //TODO_Performance:
   type_vecConstLayoutFields constFieldsToGet;
@@ -252,9 +252,9 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_count_rows(const Gl
   return result;
 }
 
-typedef std::list< sharedptr<const UsesRelationship> > type_list_relationships;
+typedef std::list< std::shared_ptr<const UsesRelationship> > type_list_relationships;
 
-static void add_to_relationships_list(type_list_relationships& list_relationships, const sharedptr<const 
LayoutItem_Field>& layout_item)
+static void add_to_relationships_list(type_list_relationships& list_relationships, const 
std::shared_ptr<const LayoutItem_Field>& layout_item)
 {
   g_return_if_fail(layout_item);
 
@@ -265,7 +265,7 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
   type_list_relationships::const_iterator iterFind = std::find_if(list_relationships.begin(), 
list_relationships.end(), predicate_UsesRelationshipHasRelationships<UsesRelationship>(layout_item, true /* 
top_level_only */) );
   if(iterFind == list_relationships.end()) //If the table is not yet in the list:
   {
-    sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::create();
+    std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
     uses_rel->set_relationship(layout_item->get_relationship());
     list_relationships.push_front(uses_rel); //These need to be at the front, so that related relationships 
can use them later in the SQL statement.
   }
@@ -274,7 +274,7 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
   iterFind = std::find_if(list_relationships.begin(), list_relationships.end(), 
predicate_UsesRelationshipHasRelationships<UsesRelationship>(layout_item) );
   if(iterFind == list_relationships.end()) //If the table is not yet in the list:
   {
-    sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::create();
+    std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
     uses_rel->set_relationship(layout_item->get_relationship());
     uses_rel->set_related_relationship(layout_item->get_related_relationship());
     list_relationships.push_back(uses_rel);
@@ -282,9 +282,9 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
 
 }
 
-static void builder_add_join(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& builder, const sharedptr<const 
UsesRelationship>& uses_relationship)
+static void builder_add_join(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& builder, const 
std::shared_ptr<const UsesRelationship>& uses_relationship)
 {
-  sharedptr<const Relationship> relationship = uses_relationship->get_relationship();
+  std::shared_ptr<const Relationship> relationship = uses_relationship->get_relationship();
   if(!relationship->get_has_fields()) //TODO: Handle related_record has_fields.
   {
     if(relationship->get_has_to_table())
@@ -319,7 +319,7 @@ static void builder_add_join(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& builder
   {
      UsesRelationship parent_relationship;
      parent_relationship.set_relationship(relationship);
-     sharedptr<const Relationship> related_relationship = uses_relationship->get_related_relationship();
+     std::shared_ptr<const Relationship> related_relationship = 
uses_relationship->get_related_relationship();
 
      const guint to_target_id = builder->select_add_target(related_relationship->get_to_table(), alias_name);
 
@@ -337,18 +337,18 @@ static void builder_add_join(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& builder
 void Utils::build_sql_select_add_fields_to_get(const Glib::RefPtr<Gnome::Gda::SqlBuilder>& builder, const 
Glib::ustring& table_name, const type_vecConstLayoutFields& fieldsToGet, const type_sort_clause& sort_clause, 
bool extra_join)
 {
   //Get all relationships used in the query:
-  typedef std::list< sharedptr<const UsesRelationship> > type_list_relationships;
+  typedef std::list< std::shared_ptr<const UsesRelationship> > type_list_relationships;
   type_list_relationships list_relationships;
 
   for(type_vecConstLayoutFields::const_iterator iter = fieldsToGet.begin(); iter != fieldsToGet.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> layout_item = *iter;
+    std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
     add_to_relationships_list(list_relationships, layout_item);
   }
 
   for(type_sort_clause::const_iterator iter = sort_clause.begin(); iter != sort_clause.end(); ++iter)
   {
-    sharedptr<const LayoutItem_Field> layout_item = iter->first;
+    std::shared_ptr<const LayoutItem_Field> layout_item = iter->first;
     add_to_relationships_list(list_relationships, layout_item);
   }
 
@@ -357,7 +357,7 @@ void Utils::build_sql_select_add_fields_to_get(const Glib::RefPtr<Gnome::Gda::Sq
   //and give us our fields for this table even if there is no corresponding value in the other table.
   for(type_list_relationships::const_iterator iter = list_relationships.begin(); iter != 
list_relationships.end(); ++iter)
   {
-    sharedptr<const UsesRelationship> uses_relationship = *iter;
+    std::shared_ptr<const UsesRelationship> uses_relationship = *iter;
     builder_add_join(builder, uses_relationship);
   }
 
@@ -366,7 +366,7 @@ void Utils::build_sql_select_add_fields_to_get(const Glib::RefPtr<Gnome::Gda::Sq
   {
     Glib::ustring one_sql_part;
 
-    sharedptr<const LayoutItem_Field> layout_item = *iter;
+    std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
     if(!layout_item)
     {
       g_warn_if_reached();
@@ -376,7 +376,8 @@ void Utils::build_sql_select_add_fields_to_get(const Glib::RefPtr<Gnome::Gda::Sq
     //Get the parent, such as the table name, or the alias name for the join:
     const Glib::ustring parent = layout_item->get_sql_table_or_join_alias_name(table_name);
 
-    const LayoutItem_FieldSummary* fieldsummary = dynamic_cast<const 
LayoutItem_FieldSummary*>(layout_item.obj());
+    //TODO: Use std::dynamic_pointer_cast?
+    const LayoutItem_FieldSummary* fieldsummary = dynamic_cast<const 
LayoutItem_FieldSummary*>(layout_item.get());
     if(fieldsummary)
     {
       const Gnome::Gda::SqlBuilder::Id id_function = builder->add_function(
@@ -409,7 +410,7 @@ void Utils::build_sql_select_add_fields_to_get(const Glib::RefPtr<Gnome::Gda::Sq
 }
 
 
-Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(const Glib::ustring& 
table_name, const type_vecConstLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause, const 
sharedptr<const Relationship>& extra_join, const type_sort_clause& sort_clause, guint limit)
+Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(const Glib::ustring& 
table_name, const type_vecConstLayoutFields& fieldsToGet, const Gnome::Gda::SqlExpr& where_clause, const 
std::shared_ptr<const Relationship>& extra_join, const type_sort_clause& sort_clause, guint limit)
 {
   Glib::RefPtr<Gnome::Gda::SqlBuilder> builder;
 
@@ -422,11 +423,11 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(c
     //Add the fields to SELECT, plus the tables that they are selected FROM.
     //We tell it whether extra_join is empty, so it can do an extra GROUP BY if necessary.
     //TODO: Try to use DISTINCT instead, with a proper test case.
-    Utils::build_sql_select_add_fields_to_get(builder, table_name, fieldsToGet, sort_clause, extra_join /* 
bool */);
+    Utils::build_sql_select_add_fields_to_get(builder, table_name, fieldsToGet, sort_clause, 
(bool)extra_join);
 
     if(extra_join)
     {
-      sharedptr<UsesRelationship> uses_relationship = sharedptr<UsesRelationship>::create();
+      std::shared_ptr<UsesRelationship> uses_relationship = std::shared_ptr<UsesRelationship>(new 
UsesRelationship());
       uses_relationship->set_relationship(extra_join);
       builder_add_join(builder, uses_relationship);
     }
@@ -443,7 +444,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(c
     {
       for(type_sort_clause::const_iterator iter = sort_clause.begin(); iter != sort_clause.end(); ++iter)
       {
-        sharedptr<const LayoutItem_Field> layout_item = iter->first;
+        std::shared_ptr<const LayoutItem_Field> layout_item = iter->first;
         if(layout_item)
         {
           const bool ascending = iter->second;
@@ -471,7 +472,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(c
 }
 
 
-Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib::ustring& table_name, const 
type_vecLayoutFields& fieldsToGet, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& 
key_value, const type_sort_clause& sort_clause, guint limit)
+Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib::ustring& table_name, const 
type_vecLayoutFields& fieldsToGet, const std::shared_ptr<const Field>& key_field, const Gnome::Gda::Value& 
key_value, const type_sort_clause& sort_clause, guint limit)
 {
   //TODO_Performance:
   type_vecConstLayoutFields constFieldsToGet;
@@ -483,7 +484,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib
   return build_sql_select_with_key(table_name, constFieldsToGet, key_field, key_value, sort_clause, limit);
 }
 
-Gnome::Gda::SqlExpr Utils::build_simple_where_expression(const Glib::ustring& table_name, const 
sharedptr<const Field>& key_field, const Gnome::Gda::Value& key_value)
+Gnome::Gda::SqlExpr Utils::build_simple_where_expression(const Glib::ustring& table_name, const 
std::shared_ptr<const Field>& key_field, const Gnome::Gda::Value& key_value)
 {
   if(!key_field)
   {
@@ -513,7 +514,7 @@ Gnome::Gda::SqlExpr Utils::build_combined_where_expression(const Gnome::Gda::Sql
   return builder->export_expression(id);
 }
 
-Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib::ustring& table_name, const 
type_vecConstLayoutFields& fieldsToGet, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& 
key_value, const type_sort_clause& sort_clause, guint limit)
+Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib::ustring& table_name, const 
type_vecConstLayoutFields& fieldsToGet, const std::shared_ptr<const Field>& key_field, const 
Gnome::Gda::Value& key_value, const type_sort_clause& sort_clause, guint limit)
 {
   //We choose instead to have no where clause in this case,
   //because that is useful to some callers:
@@ -527,16 +528,16 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib
   }
 
   return Utils::build_sql_select_with_where_clause(table_name, fieldsToGet, where_clause,
-    sharedptr<const Relationship>(), sort_clause, limit);
+    std::shared_ptr<const Relationship>(), sort_clause, limit);
 }
 
-Utils::type_list_values_with_second Utils::get_choice_values_all(const Document* document, const 
sharedptr<const LayoutItem_Field>& field)
+Utils::type_list_values_with_second Utils::get_choice_values_all(const Document* document, const 
std::shared_ptr<const LayoutItem_Field>& field)
 {
   return get_choice_values(document, field,
     Gnome::Gda::Value() /* means get all with no WHERE clause */);
 }
 
-Utils::type_list_values_with_second Utils::get_choice_values(const Document* document, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& foreign_key_value)
+Utils::type_list_values_with_second Utils::get_choice_values(const Document* document, const 
std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& foreign_key_value)
 {
   //TODO: Reduce duplication between this and get_choice_values(field).
 
@@ -552,9 +553,9 @@ Utils::type_list_values_with_second Utils::get_choice_values(const Document* doc
   */
 
   const Formatting& format = field->get_formatting_used();
-  sharedptr<const Relationship> choice_relationship;
-  sharedptr<const LayoutItem_Field> layout_choice_first;
-  sharedptr<const LayoutGroup> layout_choice_extra;
+  std::shared_ptr<const Relationship> choice_relationship;
+  std::shared_ptr<const LayoutItem_Field> layout_choice_first;
+  std::shared_ptr<const LayoutGroup> layout_choice_extra;
   Formatting::type_list_sort_fields choice_sort_fields;
   bool choice_show_all = false;
   format.get_choices_related(choice_relationship, layout_choice_first, layout_choice_extra, 
choice_sort_fields, choice_show_all);
@@ -574,15 +575,15 @@ Utils::type_list_values_with_second Utils::get_choice_values(const Document* doc
     for(LayoutGroup::type_list_const_items::const_iterator iter = extra_fields.begin();
       iter != extra_fields.end(); ++iter)
     {
-      const sharedptr<const LayoutItem> item = *iter;
-      const sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(item);
+      const std::shared_ptr<const LayoutItem> item = *iter;
+      const std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
       if(item_field)
          fields.push_back(item_field); //TODO: Don't ignore other usable items such as static text.
     }
   }
 
   const Glib::ustring to_table = choice_relationship->get_to_table();
-  const sharedptr<const Field> to_field = document->get_field(to_table, choice_relationship->get_to_field());
+  const std::shared_ptr<const Field> to_field = document->get_field(to_table, 
choice_relationship->get_to_field());
 
   if(!to_field)
   {
@@ -612,7 +613,7 @@ Utils::type_list_values_with_second Utils::get_choice_values(const Document* doc
   //TODO: builder->select_order_by(choice_field_id);
 
   //Connect to database and get the related values:
-  sharedptr<SharedConnection> connection = ConnectionPool::get_instance()->connect();
+  std::shared_ptr<SharedConnection> connection = ConnectionPool::get_instance()->connect();
 
   if(!connection)
   {
@@ -1029,7 +1030,7 @@ bool Utils::file_exists(const Glib::RefPtr<Gio::File>& file)
 //Merge all db utilities into db_utils in glom 1.24:
 static Glib::RefPtr<Gnome::Gda::Connection> get_connection()
 {
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
   try
   {
      sharedconnection = ConnectionPool::get_and_connect();
@@ -1145,13 +1146,13 @@ Gnome::Gda::SqlExpr Utils::get_find_where_clause_quick(const Document* document,
   const Document::type_vec_fields fields = document->get_table_fields(table_name);
 
   guint previous_id = 0;
-  typedef std::vector< sharedptr<LayoutItem_Field> > type_vecLayoutFields;
+  typedef std::vector< std::shared_ptr<LayoutItem_Field> > type_vecLayoutFields;
   type_vecLayoutFields fieldsToGet;
   for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
     Glib::ustring strClausePart;
 
-    sharedptr<const Field> field = *iter;
+    std::shared_ptr<const Field> field = *iter;
 
     bool use_this_field = true;
     if(field->get_glom_type() != Field::TYPE_TEXT)
@@ -1192,7 +1193,7 @@ Gnome::Gda::SqlExpr Utils::get_find_where_clause_quick(const Document* document,
 
 Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_update_with_where_clause(
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& field, const Gnome::Gda::Value& value,
+  const std::shared_ptr<const Field>& field, const Gnome::Gda::Value& value,
   const Gnome::Gda::SqlExpr& where_clause)
 {
   Glib::RefPtr<Gnome::Gda::SqlBuilder> builder;
@@ -1361,7 +1362,7 @@ Glib::ustring Utils::get_list_of_layout_items_for_display(const LayoutGroup::typ
   Glib::ustring result;
   for(LayoutGroup::type_list_items::const_iterator iter = list_layout_fields.begin(); iter != 
list_layout_fields.end(); ++iter)
   {
-    const sharedptr<LayoutItem> item = *iter;
+    const std::shared_ptr<LayoutItem> item = *iter;
     if(item)
     {
       if(!result.empty())
@@ -1374,7 +1375,7 @@ Glib::ustring Utils::get_list_of_layout_items_for_display(const LayoutGroup::typ
   return result;
 }
 
-Glib::ustring Utils::get_list_of_layout_items_for_display(const sharedptr<const LayoutGroup>& layout_group)
+Glib::ustring Utils::get_list_of_layout_items_for_display(const std::shared_ptr<const LayoutGroup>& 
layout_group)
 {
   if(layout_group)
     return get_list_of_layout_items_for_display(layout_group->m_list_items);
@@ -1387,7 +1388,7 @@ Glib::ustring Utils::get_list_of_sort_fields_for_display(const Formatting::type_
   Glib::ustring text;
   for(Formatting::type_list_sort_fields::const_iterator iter = sort_fields.begin(); iter != 
sort_fields.end(); ++iter)
   {
-    const sharedptr<const LayoutItem_Field> item = iter->first;
+    const std::shared_ptr<const LayoutItem_Field> item = iter->first;
     if(!item)
       continue;
     
@@ -1478,14 +1479,14 @@ LayoutGroup::type_list_const_items Utils::get_layout_items_plus_primary_key(cons
     return items;
   }
 
-  const sharedptr<Field> field_primary_key = document->get_field_primary_key(table_name);
+  const std::shared_ptr<Field> field_primary_key = document->get_field_primary_key(table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": Could not find the primary key." << std::endl;
     return items;
   }
 
-  sharedptr<LayoutItem_Field> pk_layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> pk_layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
   pk_layout_item->set_hidden();
   pk_layout_item->set_full_field_details(field_primary_key);
   
@@ -1507,14 +1508,14 @@ LayoutGroup::type_list_items Utils::get_layout_items_plus_primary_key(const Layo
     return items;
   }
 
-  const sharedptr<Field> field_primary_key = document->get_field_primary_key(table_name);
+  const std::shared_ptr<Field> field_primary_key = document->get_field_primary_key(table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": Could not find the primary key." << std::endl;
     return items;
   }
 
-  sharedptr<LayoutItem_Field> pk_layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> pk_layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
   pk_layout_item->set_hidden();
   pk_layout_item->set_full_field_details(field_primary_key);
   
diff --git a/glom/libglom/utils.h b/glom/libglom/utils.h
index dfa2bc6..af0965a 100644
--- a/glom/libglom/utils.h
+++ b/glom/libglom/utils.h
@@ -34,7 +34,7 @@ namespace Glom
 {
 
 ///field, ascending
-typedef std::pair< sharedptr<const LayoutItem_Field>, bool> type_pair_sort_field;
+typedef std::pair< std::shared_ptr<const LayoutItem_Field>, bool> type_pair_sort_field;
 typedef std::vector<type_pair_sort_field> type_sort_clause;
 
 namespace Utils
@@ -49,13 +49,13 @@ Glib::ustring string_replace(const Glib::ustring& src, const Glib::ustring& sear
 Glib::ustring string_clean_for_xml(const Glib::ustring& src);
 
 //typedef Base_DB::type_vecLayoutFields type_vecLayoutFields;
-typedef std::vector< sharedptr<LayoutItem_Field> > type_vecLayoutFields;
-typedef std::vector< sharedptr<const LayoutItem_Field> > type_vecConstLayoutFields;
+typedef std::vector< std::shared_ptr<LayoutItem_Field> > type_vecLayoutFields;
+typedef std::vector< std::shared_ptr<const LayoutItem_Field> > type_vecConstLayoutFields;
 
 //TODO: Move these to their own file:
 
 // Create a Gnome::Gda::SqlExpr.
-Gnome::Gda::SqlExpr build_simple_where_expression(const Glib::ustring& table_name, const sharedptr<const 
Field>& key_field, const Gnome::Gda::Value& key_value);
+Gnome::Gda::SqlExpr build_simple_where_expression(const Glib::ustring& table_name, const 
std::shared_ptr<const Field>& key_field, const Gnome::Gda::Value& key_value);
 
 // Create a where clause that is two other conditions combined together.
 Gnome::Gda::SqlExpr build_combined_where_expression(const Gnome::Gda::SqlExpr& a, const Gnome::Gda::SqlExpr& 
b, Gnome::Gda::SqlOperatorType op);
@@ -78,7 +78,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_where_clause(
   const Glib::ustring& table_name,
   const type_vecLayoutFields& fieldsToGet,
   const Gnome::Gda::SqlExpr& where_clause = Gnome::Gda::SqlExpr(),
-  const sharedptr<const Relationship>& extra_join = sharedptr<const Relationship>(),
+  const std::shared_ptr<const Relationship>& extra_join = std::shared_ptr<const Relationship>(),
   const type_sort_clause& sort_clause = type_sort_clause(),
   guint limit = 0);
 
@@ -88,7 +88,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_where_clause(
   const Glib::ustring& table_name,
   const type_vecConstLayoutFields& fieldsToGet,
   const Gnome::Gda::SqlExpr& where_clause = Gnome::Gda::SqlExpr(),
-  const sharedptr<const Relationship>& extra_join = sharedptr<const Relationship>(),
+  const std::shared_ptr<const Relationship>& extra_join = std::shared_ptr<const Relationship>(),
   const type_sort_clause& sort_clause = type_sort_clause(),
   guint limit = 0);
 
@@ -98,7 +98,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_where_clause(
 Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_key(
   const Glib::ustring& table_name,
   const type_vecLayoutFields& fieldsToGet,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_value,
   const type_sort_clause& sort_clause = type_sort_clause(),
   guint limit = 0);
@@ -108,7 +108,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_key(
 Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_with_key(
   const Glib::ustring& table_name,
   const type_vecConstLayoutFields& fieldsToGet,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_value,
   const type_sort_clause& sort_clause = type_sort_clause(),
   guint limit = 0);
@@ -130,14 +130,14 @@ Gnome::Gda::SqlExpr get_find_where_clause_quick(const Document* document, const
  */
 Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_update_with_where_clause(
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& field, const Gnome::Gda::Value& value,
+  const std::shared_ptr<const Field>& field, const Gnome::Gda::Value& value,
   const Gnome::Gda::SqlExpr& where_clause);
 
 typedef std::vector<Gnome::Gda::Value> type_list_values;
 typedef std::vector< std::pair<Gnome::Gda::Value, type_list_values> > type_list_values_with_second; //TODO: 
Rename this now that we have more than just 1 extra field.
-type_list_values_with_second get_choice_values_all(const Document* document, const sharedptr<const 
LayoutItem_Field>& field);
+type_list_values_with_second get_choice_values_all(const Document* document, const std::shared_ptr<const 
LayoutItem_Field>& field);
 
-type_list_values_with_second get_choice_values(const Document* document, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& foreign_key_value);
+type_list_values_with_second get_choice_values(const Document* document, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& foreign_key_value);
 
 /// Get the full query string suitable for use with std::cout.
 std::string sqlbuilder_get_full_query(
@@ -208,7 +208,7 @@ Glib::ustring get_list_of_layout_items_for_display(const LayoutGroup::type_list_
 
 /** Get a string to display to the user, as a representation of a list of layout items.
  */
-Glib::ustring get_list_of_layout_items_for_display(const sharedptr<const LayoutGroup>& layout_group);
+Glib::ustring get_list_of_layout_items_for_display(const std::shared_ptr<const LayoutGroup>& layout_group);
 
 /** Get a string to display to the user, as a representation of a sort order
  */
diff --git a/glom/libglom/xsl_utils.h b/glom/libglom/xsl_utils.h
index 7d74093..7b6e990 100644
--- a/glom/libglom/xsl_utils.h
+++ b/glom/libglom/xsl_utils.h
@@ -32,7 +32,7 @@ namespace Glom
 {
 
 ///field, ascending
-typedef std::pair< sharedptr<const LayoutItem_Field>, bool> type_pair_sort_field;
+typedef std::pair< std::shared_ptr<const LayoutItem_Field>, bool> type_pair_sort_field;
 typedef std::vector<type_pair_sort_field> type_sort_clause;
 
 namespace GlomXslUtils
diff --git a/glom/mode_data/box_data.cc b/glom/mode_data/box_data.cc
index 3aa37cd..4c4b564 100644
--- a/glom/mode_data/box_data.cc
+++ b/glom/mode_data/box_data.cc
@@ -106,7 +106,7 @@ Gnome::Gda::SqlExpr Box_Data::get_find_where_clause() const
 
     if(!Conversions::value_is_empty(data))
     {
-      const sharedptr<const Field> field = (*iter)->get_full_field_details();
+      const std::shared_ptr<const Field> field = (*iter)->get_full_field_details();
       if(field)
       {
         bool use_this_field = true;
@@ -278,7 +278,7 @@ Document::type_list_layout_groups Box_Data::get_data_layout_groups(const Glib::u
   return layout_groups;
 }
 
-void Box_Data::fill_layout_group_field_info(const sharedptr<LayoutGroup>& group, const Privileges& 
table_privs)
+void Box_Data::fill_layout_group_field_info(const std::shared_ptr<LayoutGroup>& group, const Privileges& 
table_privs)
 {
   if(!group)
    return;
@@ -288,8 +288,8 @@ void Box_Data::fill_layout_group_field_info(const sharedptr<LayoutGroup>& group,
   LayoutGroup::type_list_items items = group->get_items();
   for(LayoutGroup::type_list_items::iterator iter = items.begin(); iter != items.end(); ++iter)
   {
-    sharedptr<LayoutItem> item = *iter;
-    sharedptr<LayoutItem_Field> item_field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem> item = *iter;
+    std::shared_ptr<LayoutItem_Field> item_field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
     if(item_field) //If is a field rather than some other layout item
     {
 
@@ -297,10 +297,10 @@ void Box_Data::fill_layout_group_field_info(const sharedptr<LayoutGroup>& group,
       {
         //Get the full field information:
         const Glib::ustring relationship_name = item_field->get_relationship_name();
-        sharedptr<const Relationship> relationship = document->get_relationship(m_table_name, 
relationship_name);
+        std::shared_ptr<const Relationship> relationship = document->get_relationship(m_table_name, 
relationship_name);
         if(relationship)
         {
-          sharedptr<Field> field = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), item->get_name());
+          std::shared_ptr<Field> field = DbUtils::get_fields_for_table_one_field(document, 
relationship->get_to_table(), item->get_name());
           if(field)
           {
             item_field->set_full_field_details(field);
@@ -315,7 +315,7 @@ void Box_Data::fill_layout_group_field_info(const sharedptr<LayoutGroup>& group,
       else
       {
         //Get the field info:
-        sharedptr<Field> field = DbUtils::get_fields_for_table_one_field(document, m_table_name, 
item_field->get_name());
+        std::shared_ptr<Field> field = DbUtils::get_fields_for_table_one_field(document, m_table_name, 
item_field->get_name());
         if(field)
         {
           item_field->set_full_field_details(field); //TODO_Performance: Just use this as the output arg?
@@ -326,7 +326,7 @@ void Box_Data::fill_layout_group_field_info(const sharedptr<LayoutGroup>& group,
     }
     else
     {
-      sharedptr<LayoutGroup> item_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> item_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(item_group) //If it is a group
       {
         //recurse, to fill the fields info in this group:
@@ -350,17 +350,17 @@ Glib::ustring Box_Data::get_layout_name() const
   return m_layout_name;
 }
 
-void Box_Data::execute_button_script(const sharedptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key_value)
+void Box_Data::execute_button_script(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key_value)
 {
   const Glib::ustring script = layout_item->get_script();
   if(!Utils::script_check_for_pygtk2_with_warning(script, get_app_window()))
     return;
 
-  const sharedptr<Field> field_primary_key = get_field_primary_key();
+  const std::shared_ptr<Field> field_primary_key = get_field_primary_key();
   const type_map_fields field_values = get_record_field_values_for_calculation(m_table_name, 
field_primary_key, primary_key_value);
 
   //We need the connection when we run the script, so that the script may use it.
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
 
   //Allow this UI to respond to UI change requests from the Python code:
   AppPythonUICallbacks callbacks;
diff --git a/glom/mode_data/box_data.h b/glom/mode_data/box_data.h
index 7a2a8d1..b524adc 100644
--- a/glom/mode_data/box_data.h
+++ b/glom/mode_data/box_data.h
@@ -104,9 +104,9 @@ protected:
   /** Get the layout groups, with the Field information filled in.
    */
   Document::type_list_layout_groups get_data_layout_groups(const Glib::ustring& layout_name, const 
Glib::ustring& layout_platform);
-  void fill_layout_group_field_info(const sharedptr<LayoutGroup>& group, const Privileges& table_privs);
+  void fill_layout_group_field_info(const std::shared_ptr<LayoutGroup>& group, const Privileges& 
table_privs);
 
-  void execute_button_script(const sharedptr<const LayoutItem_Button>& layout_item, const Gnome::Gda::Value& 
primary_key_value);
+  void execute_button_script(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key_value);
 
 private:
 
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 5a171d2..6dc8968 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -70,7 +70,7 @@ void Box_Data_Calendar_Related::enable_buttons()
   //m_calendar.set_allow_view_details(view_details_possible); //Don't allow the user to go to a record in a 
hidden table.
 }
 
-bool Box_Data_Calendar_Related::init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool 
show_title)
+bool Box_Data_Calendar_Related::init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool 
show_title)
 {
   //This calls the other method overload:
   return Box_Data_Portal::init_db_details(portal, show_title);
@@ -116,7 +116,7 @@ bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_tabl
       LayoutWidgetBase::m_table_name, m_portal->get_to_field_used());
   }
   else
-    m_key_field.clear();
+    m_key_field.reset();
 
   enable_buttons();
 
@@ -164,23 +164,23 @@ bool Box_Data_Calendar_Related::fill_from_database()
     Gnome::Gda::Value date_end_value(date_end);
 
     //Add a WHERE clause for this date range:
-    sharedptr<const Relationship> relationship = m_portal->get_relationship();
+    std::shared_ptr<const Relationship> relationship = m_portal->get_relationship();
     Glib::ustring where_clause_to_table_name = relationship->get_to_table();
 
-    sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+    std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
     const Glib::ustring date_field_name = derived_portal->get_date_field()->get_name();
 
-    sharedptr<const Relationship> relationship_related = m_portal->get_related_relationship();
+    std::shared_ptr<const Relationship> relationship_related = m_portal->get_related_relationship();
     if(relationship_related)
     {
       //Adjust the WHERE clause appropriately for the extra JOIN:
-      sharedptr<UsesRelationship> uses_rel_temp = sharedptr<UsesRelationship>::create();
+      std::shared_ptr<UsesRelationship> uses_rel_temp = std::shared_ptr<UsesRelationship>(new 
UsesRelationship());
       uses_rel_temp->set_relationship(relationship);
       where_clause_to_table_name = uses_rel_temp->get_sql_join_alias_name();
     }
 
     //Add an AND to the existing where clause, to get only records within these dates, if any:
-    sharedptr<const Field> date_field = derived_portal->get_date_field();
+    std::shared_ptr<const Field> date_field = derived_portal->get_date_field();
 
     Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
       Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
@@ -271,7 +271,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary
   if(m_key_field)
   {
     //m_key_field is the field in this table that must match another field in the parent table.
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_full_field_details(m_key_field);
     //TODO: key_value = m_calendar.get_value(row, layout_item);
   }
@@ -290,7 +290,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary
   }
   else
   {
-    sharedptr<Field> field_primary_key; //TODO: = m_calendar.get_key_field();
+    std::shared_ptr<Field> field_primary_key; //TODO: = m_calendar.get_key_field();
 
     //Create the link by setting the foreign key
     if(m_key_field && m_portal)
@@ -308,7 +308,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary
       if(test)
       {
         //Show it on the view, if it's visible:
-        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layout_item->set_full_field_details(field_primary_key);
 
         //TODO: m_calendar.set_value(row, layout_item, m_key_value);
@@ -323,14 +323,14 @@ Box_Data_Calendar_Related::type_vecConstLayoutFields Box_Data_Calendar_Related::
 {
   type_vecConstLayoutFields layout_fields = Box_Data_Portal::get_fields_to_show();
 
-  sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+  std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
   if(!derived_portal)
   {
     std::cerr << G_STRFUNC << ": The portal is not a LayoutItem_CalendarPortal." << std::endl;
     return layout_fields;
   }
 
-  sharedptr<const Field> date_field = derived_portal->get_date_field();
+  std::shared_ptr<const Field> date_field = derived_portal->get_date_field();
   if(!date_field)
   {
     std::cerr << G_STRFUNC << ": get_date_field() returned no field." << std::endl;
@@ -338,7 +338,7 @@ Box_Data_Calendar_Related::type_vecConstLayoutFields Box_Data_Calendar_Related::
   }
 
   //Add it to the list to ensure that we request the date (though it will not really be shown in the 
calendar):
-  sharedptr<LayoutItem_Field> layout_item_date_field = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_item_date_field = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
   layout_item_date_field->set_full_field_details(date_field);
   layout_fields.push_back(layout_item_date_field);
   m_query_column_date_field = layout_fields.size() - 1;
@@ -354,15 +354,15 @@ void Box_Data_Calendar_Related::on_dialog_layout_hide()
 
 
   //Update the UI:
-  sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+  std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
   init_db_details(derived_portal);
 
   Box_Data::on_dialog_layout_hide();
 
-  sharedptr<LayoutItem_CalendarPortal> pLayoutItem = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_CalendarPortal> pLayoutItem = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(get_layout_item());
   if(pLayoutItem)
   {
-    sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+    std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
     if(derived_portal)
       *pLayoutItem = *derived_portal;
 
@@ -384,7 +384,7 @@ void Box_Data_Calendar_Related::prepare_layout_dialog(Dialog_Layout* dialog)
   Dialog_Layout_Calendar_Related* related_dialog = dynamic_cast<Dialog_Layout_Calendar_Related*>(dialog);
   g_assert(related_dialog);
 
-  sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+  std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
   if(derived_portal && derived_portal->get_has_relationship_name())
   {
     related_dialog->init_with_portal(m_layout_name, m_layout_platform, get_document(), derived_portal);
@@ -404,14 +404,14 @@ void Box_Data_Calendar_Related::on_calendar_month_changed()
 
 Glib::ustring Box_Data_Calendar_Related::on_calendar_details(guint year, guint month, guint day)
 {
-  sharedptr<LayoutItem_CalendarPortal> derived_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
+  std::shared_ptr<LayoutItem_CalendarPortal> derived_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(m_portal);
   if(!derived_portal)
   {
     //std::cout << "debug: " << G_STRFUNC << ": date_field is NULL" << std::endl;
     return Glib::ustring();
   }
 
-  sharedptr<const Field> date_field = derived_portal->get_date_field();
+  std::shared_ptr<const Field> date_field = derived_portal->get_date_field();
   if(!date_field)
   {
     std::cerr << G_STRFUNC << ":  get_date_field() returned no field." << std::endl;
@@ -453,20 +453,20 @@ Glib::ustring Box_Data_Calendar_Related::on_calendar_details(guint year, guint m
     LayoutGroup::type_list_items items = m_portal->get_items();
     for(LayoutGroup::type_list_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
     {
-      sharedptr<const LayoutItem> layout_item = *iter;
+      std::shared_ptr<const LayoutItem> layout_item = *iter;
       if(!layout_item)
         continue;
 
       Glib::ustring text;
 
       //Text for a text item:
-      sharedptr<const LayoutItem_Text> layout_item_text = sharedptr<const 
LayoutItem_Text>::cast_dynamic(layout_item);
+      std::shared_ptr<const LayoutItem_Text> layout_item_text = std::dynamic_pointer_cast<const 
LayoutItem_Text>(layout_item);
       if(layout_item_text)
         text = layout_item_text->get_text(AppWindow::get_current_locale());
       else
       {
         //Text for a field:
-        sharedptr<const LayoutItem_Field> layout_item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+        std::shared_ptr<const LayoutItem_Field> layout_item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
         const Gnome::Gda::Value value = (*pRow)[column_index];
         text = Conversions::get_text_for_gda_value(layout_item_field->get_glom_type(), value, 
layout_item_field->get_formatting_used().m_numeric_format);
diff --git a/glom/mode_data/box_data_calendar_related.h b/glom/mode_data/box_data_calendar_related.h
index ddebfcb..20a219d 100644
--- a/glom/mode_data/box_data_calendar_related.h
+++ b/glom/mode_data/box_data_calendar_related.h
@@ -42,7 +42,7 @@ public:
   /**
    * @param portal: The full portal details
    */
-  virtual bool init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool show_title = true);
+  virtual bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = 
true);
 
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 39f99f1..7216b0e 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -259,7 +259,7 @@ bool Box_Data_Details::fill_from_database()
 
   //TODO: This should keep the connection open, so we don't need to
   //reconnect many times..
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
 
   try
   {
@@ -296,7 +296,7 @@ bool Box_Data_Details::fill_from_database()
       if(table_privs.m_view)
       {
         //Add extra possibly-non-visible columns that we need:
-        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layout_item->set_full_field_details(m_field_primary_key);
 
         //Get the primary key index, adding the primary key if necessary:
@@ -316,7 +316,7 @@ bool Box_Data_Details::fill_from_database()
           const type_vecLayoutFields::size_type count = fieldsToGet.size();
           for(type_vecLayoutFields::size_type i = 0; i < count; ++i)
           {
-            sharedptr<const LayoutItem_Field> element = fieldsToGet[i];
+            std::shared_ptr<const LayoutItem_Field> element = fieldsToGet[i];
             if(!element)
               continue;
 
@@ -324,8 +324,8 @@ bool Box_Data_Details::fill_from_database()
               continue;
 
             //Compare the relationship and related relationship:
-            sharedptr<const UsesRelationship> uses_a = layout_item;
-            sharedptr<const UsesRelationship> uses_b = element;
+            std::shared_ptr<const UsesRelationship> uses_a = layout_item;
+            std::shared_ptr<const UsesRelationship> uses_b = element;
             if(*uses_a == *uses_b)
             {
               index_primary_key = i;
@@ -368,7 +368,7 @@ bool Box_Data_Details::fill_from_database()
             //Get field values to show:
             for(int i = 0; i < cols_count; ++i)
             {
-              sharedptr<const LayoutItem_Field> layout_item = fieldsToGet[i];
+              std::shared_ptr<const LayoutItem_Field> layout_item = fieldsToGet[i];
 
               //Field value:
               Gnome::Gda::Value value;
@@ -486,17 +486,17 @@ void Box_Data_Details::on_button_nav_last()
     signal_nav_last().emit();
 }
 
-Gnome::Gda::Value Box_Data_Details::get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) 
const
+Gnome::Gda::Value Box_Data_Details::get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& 
field) const
 {
   return m_FlowTable.get_field_value(field);
 }
 
-void Box_Data_Details::set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
+void Box_Data_Details::set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
 {
   m_FlowTable.set_field_value(field, value);
 }
 
-void Box_Data_Details::set_entered_field_data(const Gtk::TreeModel::iterator& /* row */, const 
sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+void Box_Data_Details::set_entered_field_data(const Gtk::TreeModel::iterator& /* row */, const 
std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   set_entered_field_data(field, value);
 }
@@ -514,23 +514,23 @@ void Box_Data_Details::recalculate_fields_for_related_records(const Glib::ustrin
   const Gnome::Gda::Value primary_key_value = get_primary_key_value_selected();
   for(type_vec_fields::iterator iter = m_TableFields.begin(); iter != m_TableFields.end(); ++iter)
   {
-    const sharedptr<const Field> field = *iter;
+    const std::shared_ptr<const Field> field = *iter;
 
     //Is this field triggered by this relationship?
     const Field::type_list_strings triggered_by = field->get_calculation_relationships();
     Field::type_list_strings::const_iterator iterFind = std::find(triggered_by.begin(), triggered_by.end(), 
relationship_name);
     if(iterFind != triggered_by.end()) //If it was found
     {
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       if(field)
       {
-        sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::create();
+        std::shared_ptr<LayoutItem_Field> layoutitem_field = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         layoutitem_field->set_full_field_details(field);
         LayoutFieldInRecord field_in_record(layoutitem_field, m_table_name, m_field_primary_key, 
primary_key_value);
         calculate_field(field_in_record); //And any dependencies.
 
         //Calculate anything that depends on this.
-        //sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        //std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
         //layout_item->set_full_field_details(field);
 
         do_calculations(field_in_record, false /* recurse, reusing m_FieldsCalculationInProgress */);
@@ -641,18 +641,18 @@ void Box_Data_Details::on_flowtable_related_record_changed(const Glib::ustring&
   recalculate_fields_for_related_records(relationship_name);
 }
 
-void Box_Data_Details::on_flowtable_field_open_details_requested(const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& field_value)
+void Box_Data_Details::on_flowtable_field_open_details_requested(const std::shared_ptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& field_value)
 {
   if(Conversions::value_is_empty(field_value))
     return; //Ignore empty ID fields.
 
   //Updating doesn't seem necessary. The field details seem to be full already.
   //Update the field details from the document:
-  ////sharedptr<LayoutItem_Field> unconst_field = sharedptr<LayoutItem_Field>::cast_const(layout_field); //A 
hack, because layout_field_should_have_navigation() needs to get full field details.
+  ////std::shared_ptr<LayoutItem_Field> unconst_field = 
std::const_pointer_cast<LayoutItem_Field>(layout_field); //A hack, because 
layout_field_should_have_navigation() needs to get full field details.
   //unconst_field->set_full_field_details(
   //  document->get_field(field->get_table_used(table_name), field->get_name()) ); //Otherwise 
get_primary_key() returns false always.
       
-  sharedptr<Relationship> field_used_in_relationship_to_one;
+  std::shared_ptr<Relationship> field_used_in_relationship_to_one;
   const bool has_open_button = 
     DbUtils::layout_field_should_have_navigation(m_table_name, layout_field, get_document(), 
     field_used_in_relationship_to_one);
@@ -673,7 +673,7 @@ void Box_Data_Details::on_flowtable_field_open_details_requested(const sharedptr
   }
 }
 
-void Box_Data_Details::on_flowtable_script_button_clicked(const sharedptr<const LayoutItem_Button>& 
layout_item)
+void Box_Data_Details::on_flowtable_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& 
layout_item)
 {
   if(!layout_item)
   {
@@ -702,7 +702,7 @@ void Box_Data_Details::on_flowtable_script_button_clicked(const sharedptr<const
   }
 }
 
-void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& layout_field, 
const Gnome::Gda::Value& field_value)
+void Box_Data_Details::on_flowtable_field_edited(const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& field_value)
 {
   if(m_ignore_signals)
     return;
@@ -718,7 +718,7 @@ void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutIte
   if(!Conversions::value_is_empty(primary_key_value)) //If there is not a stored primary key value yet:
   {
     Glib::ustring table_name;
-    sharedptr<Field> primary_key_field;
+    std::shared_ptr<Field> primary_key_field;
     Gnome::Gda::Value primary_key_value;
 
     if(!layout_field->get_has_relationship_name())
@@ -733,7 +733,7 @@ void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutIte
       //plus how to identify the record in that table.
       const Glib::ustring relationship_name = layout_field->get_relationship_name();
 
-      sharedptr<Relationship> relationship = document->get_relationship(get_table_name(), relationship_name);
+      std::shared_ptr<Relationship> relationship = document->get_relationship(get_table_name(), 
relationship_name);
       if(relationship)
       {
         table_name = relationship->get_to_table();
@@ -743,7 +743,7 @@ void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutIte
         if(primary_key_field)
         {
           //Get the value of the corresponding key in the current table (that identifies the record in the 
table that we will change)
-          sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+          std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
           layout_item->set_full_field_details( document->get_field(relationship->get_from_table(), 
relationship->get_from_field()) );
 
           primary_key_value = get_entered_field_data(layout_item);
@@ -896,7 +896,7 @@ void Box_Data_Details::on_flowtable_field_edited(const sharedptr<const LayoutIte
   } //if(get_primary_key_value_selected().size())
 }
 
-void Box_Data_Details::on_flowtable_field_choices_changed(const sharedptr<const LayoutItem_Field>& 
layout_field)
+void Box_Data_Details::on_flowtable_field_choices_changed(const std::shared_ptr<const LayoutItem_Field>& 
layout_field)
 {
   if(m_ignore_signals)
     return;
@@ -915,7 +915,7 @@ void Box_Data_Details::on_userlevel_changed(AppState::userlevels user_level)
 #endif
 }
 
-sharedptr<Field> Box_Data_Details::get_field_primary_key() const
+std::shared_ptr<Field> Box_Data_Details::get_field_primary_key() const
 {
   return m_field_primary_key;
 }
@@ -946,7 +946,7 @@ void Box_Data_Details::print_layout()
   //breaks because those spaces would be empty space on the page after
   //we have moved items down when expanding:
   //TODO: Squash that space when expanding custom layouts.
-  sharedptr<PrintLayout> print_layout = 
+  std::shared_ptr<PrintLayout> print_layout = 
     PrintLayoutUtils::create_standard(page_setup, m_table_name, document,
       false /* do not avoid page margins */);
   
diff --git a/glom/mode_data/box_data_details.h b/glom/mode_data/box_data_details.h
index 9ae5082..36a504c 100644
--- a/glom/mode_data/box_data_details.h
+++ b/glom/mode_data/box_data_details.h
@@ -82,16 +82,16 @@ protected:
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value);
   virtual Gnome::Gda::Value get_primary_key_value(const Gtk::TreeModel::iterator& row) const; //Actual 
primary key value of this record.
 
-  virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const;
-  virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
-  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  virtual Gnome::Gda::Value get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const;
+  virtual void set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
+  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
 
 
   virtual bool fill_from_database(); //override.
   virtual void create_layout();
   //virtual void fill_related();
 
-  virtual sharedptr<Field> get_field_primary_key() const;
+  virtual std::shared_ptr<Field> get_field_primary_key() const;
   void set_found_set_from_primary_key_value();
 
 private:
@@ -120,14 +120,14 @@ protected:
   //virtual void on_related_user_requested_details(Gnome::Gda::Value key_value, Glib::ustring table_name);
 
   //This is virtual so it can be overriden in Box_Data_Details_Find.
-  virtual void on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& layout_field, const 
Gnome::Gda::Value& value);
+  virtual void on_flowtable_field_edited(const std::shared_ptr<const LayoutItem_Field>& layout_field, const 
Gnome::Gda::Value& value);
 
-  void on_flowtable_field_choices_changed(const sharedptr<const LayoutItem_Field>& layout_field);
-  void on_flowtable_field_open_details_requested(const sharedptr<const LayoutItem_Field>& id, const 
Gnome::Gda::Value& value);
+  void on_flowtable_field_choices_changed(const std::shared_ptr<const LayoutItem_Field>& layout_field);
+  void on_flowtable_field_open_details_requested(const std::shared_ptr<const LayoutItem_Field>& id, const 
Gnome::Gda::Value& value);
   void on_flowtable_related_record_changed(const Glib::ustring& relationship_name);
   void on_flowtable_requested_related_details(const Glib::ustring& table_name, Gnome::Gda::Value 
primary_key_value);
 
-  void on_flowtable_script_button_clicked(const sharedptr<const LayoutItem_Button>& layout_item);
+  void on_flowtable_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& layout_item);
 
   virtual void recalculate_fields_for_related_records(const Glib::ustring& relationship_name);
 
@@ -136,7 +136,7 @@ protected:
   virtual void prepare_layout_dialog(Dialog_Layout* dialog); // override.
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  sharedptr<Field> m_field_primary_key;
+  std::shared_ptr<Field> m_field_primary_key;
   Gnome::Gda::Value m_primary_key_value;
 
   //Member widgets:
diff --git a/glom/mode_data/box_data_list.cc b/glom/mode_data/box_data_list.cc
index 88e0d76..c2c985a 100644
--- a/glom/mode_data/box_data_list.cc
+++ b/glom/mode_data/box_data_list.cc
@@ -109,7 +109,7 @@ bool Box_Data_List::fill_from_database()
 
   BusyCursor busy_cursor(get_app_window());
 
-  sharedptr<SharedConnection> sharedconnection;
+  std::shared_ptr<SharedConnection> sharedconnection;
 
   try
   {
@@ -185,14 +185,14 @@ void Box_Data_List::on_adddel_user_reordered_columns()
   Document* pDoc = dynamic_cast<Document*>(get_document());
   if(pDoc)
   {
-    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
+    std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     group->set_name("toplevel");
 
     AddDel::type_vec_strings vec_field_names = m_AddDel.get_columns_order();
 
     for(AddDel::type_vec_strings::iterator iter = vec_field_names.begin(); iter != vec_field_names.end(); 
++iter)
     {
-      sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layout_item->set_name(*iter);
       group->add_item(layout_item);
     }
@@ -204,7 +204,7 @@ void Box_Data_List::on_adddel_user_reordered_columns()
   }
 }
 
-void Box_Data_List::on_adddel_script_button_clicked(const sharedptr<const LayoutItem_Button>& layout_item, 
const Gtk::TreeModel::iterator& row)
+void Box_Data_List::on_adddel_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& 
layout_item, const Gtk::TreeModel::iterator& row)
 {
   if(!layout_item)
     return;
@@ -224,7 +224,7 @@ void Box_Data_List::on_adddel_script_button_clicked(const sharedptr<const Layout
       primary_key_value));
 }
 
-bool Box_Data_List::on_script_button_idle(const sharedptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key)
+bool Box_Data_List::on_script_button_idle(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key)
 {
   execute_button_script(layout_item, primary_key);
 
@@ -372,17 +372,17 @@ Gnome::Gda::Value Box_Data_List::get_primary_key_value_first() const
   return Gnome::Gda::Value();
 }
 
-Gnome::Gda::Value Box_Data_List::get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const
+Gnome::Gda::Value Box_Data_List::get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& 
field) const
 {
   return m_AddDel.get_value_selected(field);
 }
 
-void Box_Data_List::set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
+void Box_Data_List::set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
 {
   return m_AddDel.set_value_selected(field, value);
 }
 
-void Box_Data_List::set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+void Box_Data_List::set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   return m_AddDel.set_value(row, field, value);
 }
@@ -415,7 +415,7 @@ void Box_Data_List::create_layout()
   m_AddDel.set_table_name(m_table_name);
 
 
-  sharedptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
+  std::shared_ptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": primary key not found for table: " << m_table_name << std::endl;
@@ -432,20 +432,20 @@ void Box_Data_List::create_layout()
   Document::type_list_layout_groups layout_groups = create_layout_get_layout();
   for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != 
layout_groups.end(); ++iter)
   {
-    const sharedptr<LayoutGroup> layout_group = *iter;
+    const std::shared_ptr<LayoutGroup> layout_group = *iter;
     if(!layout_group)
       continue;
 
     const LayoutGroup::type_list_items child_items = layout_group->get_items_recursive();
     for(LayoutGroup::type_list_items::const_iterator iterItems = child_items.begin(); iterItems != 
child_items.end(); ++iterItems)
     {
-      sharedptr<LayoutItem> child_item = *iterItems;
+      std::shared_ptr<LayoutItem> child_item = *iterItems;
 
       //TODO: Set the whole thing as read-only instead:
       if(m_read_only)
         child_item->set_editable(false);
 
-      sharedptr<const LayoutItem_Field> child_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(child_item);
+      std::shared_ptr<const LayoutItem_Field> child_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(child_item);
 
       //This check has already happened in Frame_Glom::update_table_in_document_from_database().
       //It is inefficient and unnecessary to do it here too.
@@ -472,7 +472,7 @@ void Box_Data_List::create_layout()
   items_to_use = Utils::get_layout_items_plus_primary_key(items_to_use, pDoc, m_table_name);
   if(field_primary_key)
   {
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_hidden();
     layout_item->set_full_field_details(m_AddDel.get_key_field());
 
@@ -488,7 +488,7 @@ void Box_Data_List::create_layout()
   m_FieldsShown = get_fields_to_show();
 }
 
-sharedptr<Field> Box_Data_List::get_field_primary_key() const
+std::shared_ptr<Field> Box_Data_List::get_field_primary_key() const
 {
   return m_AddDel.get_key_field();
 }
diff --git a/glom/mode_data/box_data_list.h b/glom/mode_data/box_data_list.h
index 3f804cd..d084393 100644
--- a/glom/mode_data/box_data_list.h
+++ b/glom/mode_data/box_data_list.h
@@ -43,9 +43,9 @@ public:
   virtual Gnome::Gda::Value get_primary_key_value_selected() const;
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value);
 
-  virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const;
-  virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
-  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  virtual Gnome::Gda::Value get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const;
+  virtual void set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
+  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
 
   virtual Gtk::TreeModel::iterator get_row_selected();
 
@@ -86,7 +86,7 @@ protected:
   virtual bool fill_from_database(); //override.
   virtual void enable_buttons();
 
-  virtual sharedptr<Field> get_field_primary_key() const;
+  virtual std::shared_ptr<Field> get_field_primary_key() const;
 
   //Signal handlers:
   void on_adddel_user_requested_edit(const Gtk::TreeModel::iterator& row);
@@ -98,8 +98,8 @@ protected:
   void on_adddel_user_requested_layout();
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  void on_adddel_script_button_clicked(const sharedptr<const LayoutItem_Button>& layout_item, const 
Gtk::TreeModel::iterator& row);
-  bool on_script_button_idle(const sharedptr<const LayoutItem_Button>& layout_item, const Gnome::Gda::Value& 
primary_key);
+  void on_adddel_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gtk::TreeModel::iterator& row);
+  bool on_script_button_idle(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   virtual Dialog_Layout* create_layout_dialog() const; // override.
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index 3c2771f..c079740 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -68,7 +68,7 @@ void Box_Data_List_Related::enable_buttons()
   m_AddDel.set_allow_view_details(view_details_possible);
 }
 
-bool Box_Data_List_Related::init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool 
show_title)
+bool Box_Data_List_Related::init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool 
show_title)
 {
   //This calls the other method overload:
   return Box_Data_Portal::init_db_details(portal, show_title);
@@ -120,7 +120,7 @@ bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table, b
       LayoutWidgetBase::m_table_name, m_portal->get_to_field_used());
   }
   else
-    m_key_field.clear();
+    m_key_field.reset();
 
 
   //Prevent impossible multiple related records:
@@ -216,7 +216,7 @@ void Box_Data_List_Related::on_adddel_user_requested_layout()
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
 
-void Box_Data_List_Related::on_adddel_script_button_clicked(const sharedptr<const LayoutItem_Button>& 
layout_item, const Gtk::TreeModel::iterator& row)
+void Box_Data_List_Related::on_adddel_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& 
layout_item, const Gtk::TreeModel::iterator& row)
 {
   if(!layout_item)
     return;
@@ -236,7 +236,7 @@ void Box_Data_List_Related::on_adddel_script_button_clicked(const sharedptr<cons
       primary_key_value));
 }
 
-bool Box_Data_List_Related::on_script_button_idle(const sharedptr<const LayoutItem_Button>& layout_item, 
const Gnome::Gda::Value& primary_key)
+bool Box_Data_List_Related::on_script_button_idle(const std::shared_ptr<const LayoutItem_Button>& 
layout_item, const Gnome::Gda::Value& primary_key)
 {
   execute_button_script(layout_item, primary_key);
 
@@ -275,7 +275,7 @@ void Box_Data_List_Related::on_adddel_record_added(const Gtk::TreeModel::iterato
   if(m_key_field)
   {
     //m_key_field is the field in this table that must match another field in the parent table.
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_full_field_details(m_key_field);
     key_value = m_AddDel.get_value(row, layout_item);
   }
@@ -295,7 +295,7 @@ void Box_Data_List_Related::on_adddel_record_added(const Gtk::TreeModel::iterato
   }
   else
   {
-    sharedptr<Field> field_primary_key = m_AddDel.get_key_field();
+    std::shared_ptr<Field> field_primary_key = m_AddDel.get_key_field();
 
     //Create the link by setting the foreign key
     if(m_key_field && m_portal)
@@ -303,7 +303,7 @@ void Box_Data_List_Related::on_adddel_record_added(const Gtk::TreeModel::iterato
       make_record_related(primary_key_value);
 
       //Show it on the view, if it's visible:
-      sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+      std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
       layout_item->set_full_field_details(m_key_field);
 
       //TODO: Although the to-field value is visible on the new related record, get_value() returns NULL so 
you can't immediately navigate to the new record:
@@ -333,7 +333,7 @@ void Box_Data_List_Related::on_dialog_layout_hide()
 
   Box_Data::on_dialog_layout_hide();
 
-  sharedptr<LayoutItem_Portal> pLayoutItem = sharedptr<LayoutItem_Portal>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Portal> pLayoutItem = 
std::dynamic_pointer_cast<LayoutItem_Portal>(get_layout_item());
   if(pLayoutItem)
   {
     *pLayoutItem = *m_portal;
@@ -364,7 +364,7 @@ Gnome::Gda::Value Box_Data_List_Related::get_primary_key_value_selected() const
   return m_AddDel.get_value_key_selected();
 }
 
-sharedptr<Field> Box_Data_List_Related::get_field_primary_key() const
+std::shared_ptr<Field> Box_Data_List_Related::get_field_primary_key() const
 {
   return m_AddDel.get_key_field();
 }
@@ -414,7 +414,7 @@ void Box_Data_List_Related::create_layout()
       m_AddDel.set_height_rows(rows_count_min, rows_count_max);
   }
 
-  sharedptr<Field> field_primary_key = get_field_primary_key_for_table(Base_DB_Table::m_table_name);
+  std::shared_ptr<Field> field_primary_key = get_field_primary_key_for_table(Base_DB_Table::m_table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": primary key not found." << std::endl;
@@ -431,20 +431,20 @@ void Box_Data_List_Related::create_layout()
   Document::type_list_layout_groups layout_groups = create_layout_get_layout();
   for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != 
layout_groups.end(); ++iter)
   {
-    const sharedptr<LayoutGroup> layout_group = *iter;
+    const std::shared_ptr<LayoutGroup> layout_group = *iter;
     if(!layout_group)
       continue;
 
     const LayoutGroup::type_list_items child_items = layout_group->get_items_recursive();
     for(LayoutGroup::type_list_items::const_iterator iterItems = child_items.begin(); iterItems != 
child_items.end(); ++iterItems)
     {
-      sharedptr<LayoutItem> child_item = *iterItems;
+      std::shared_ptr<LayoutItem> child_item = *iterItems;
 
       //TODO: Set the whole thing as read-only instead:
       if(m_read_only)
         child_item->set_editable(false);
 
-      sharedptr<const LayoutItem_Field> child_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(child_item);
+      std::shared_ptr<const LayoutItem_Field> child_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(child_item);
       
       //This check has already happened in Frame_Glom::update_table_in_document_from_database().
       //It is inefficient and unnecessary to do it here too.
@@ -470,7 +470,7 @@ void Box_Data_List_Related::create_layout()
   //TODO: Only add it if it is not already there.
   if(field_primary_key)
   {
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_hidden();
     layout_item->set_full_field_details(m_AddDel.get_key_field());
     m_FieldsShown.push_back(layout_item);
diff --git a/glom/mode_data/box_data_list_related.h b/glom/mode_data/box_data_list_related.h
index a60dfee..8b94c59 100644
--- a/glom/mode_data/box_data_list_related.h
+++ b/glom/mode_data/box_data_list_related.h
@@ -36,7 +36,7 @@ public:
   /**
    * @param portal: The full portal details
    */
-  virtual bool init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool show_title = true);
+  virtual bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = 
true);
 
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
@@ -53,8 +53,8 @@ protected:
   void on_adddel_user_requested_delete(const Gtk::TreeModel::iterator& rowStart, const 
Gtk::TreeModel::iterator& rowEnd);
   void on_adddel_user_reordered_columns();
 
-  void on_adddel_script_button_clicked(const sharedptr<const LayoutItem_Button>& layout_item, const 
Gtk::TreeModel::iterator& row);
-  bool on_script_button_idle(const sharedptr<const LayoutItem_Button>& layout_item, const Gnome::Gda::Value& 
primary_key);
+  void on_adddel_script_button_clicked(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gtk::TreeModel::iterator& row);
+  bool on_script_button_idle(const std::shared_ptr<const LayoutItem_Button>& layout_item, const 
Gnome::Gda::Value& primary_key);
 
   void on_adddel_record_added(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& 
primary_key_value);
 
@@ -67,7 +67,7 @@ protected:
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   //Implementations of pure virtual methods from Base_DB_Table_Data:
-  virtual sharedptr<Field> get_field_primary_key() const; //TODO: Already in base class?
+  virtual std::shared_ptr<Field> get_field_primary_key() const; //TODO: Already in base class?
   virtual Gnome::Gda::Value get_primary_key_value_selected() const;
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value);
   virtual Gnome::Gda::Value get_primary_key_value(const Gtk::TreeModel::iterator& row) const;
diff --git a/glom/mode_data/box_data_manyrecords.cc b/glom/mode_data/box_data_manyrecords.cc
index c850bdb..a51b039 100644
--- a/glom/mode_data/box_data_manyrecords.cc
+++ b/glom/mode_data/box_data_manyrecords.cc
@@ -85,7 +85,7 @@ void Box_Data_ManyRecords::print_layout()
   {
     //Create a simple report on the fly:
     Document* document = get_document();
-    sharedptr<Report> report_temp = ReportBuilder::create_standard_list_report(document, m_table_name);
+    std::shared_ptr<Report> report_temp = ReportBuilder::create_standard_list_report(document, m_table_name);
 
     ReportBuilder report_builder(AppWindow::get_current_locale());
     report_builder.set_document(document);
@@ -95,7 +95,7 @@ void Box_Data_ManyRecords::print_layout()
   }
 }
 
-void Box_Data_ManyRecords::print_layout_group(xmlpp::Element* /* node_parent */, const sharedptr<const 
LayoutGroup>& /* group */)
+void Box_Data_ManyRecords::print_layout_group(xmlpp::Element* /* node_parent */, const std::shared_ptr<const 
LayoutGroup>& /* group */)
 {
 }
 
diff --git a/glom/mode_data/box_data_manyrecords.h b/glom/mode_data/box_data_manyrecords.h
index 1bd2f5f..22ce274 100644
--- a/glom/mode_data/box_data_manyrecords.h
+++ b/glom/mode_data/box_data_manyrecords.h
@@ -58,10 +58,10 @@ public:
 
 protected:
   //virtual Document::type_list_layout_groups create_layout_get_layout(); //overriden in 
Box_Data_ManyRecords_Related.
-  void create_layout_add_group(const sharedptr<LayoutGroup>& layout_group);
+  void create_layout_add_group(const std::shared_ptr<LayoutGroup>& layout_group);
 
   virtual void print_layout();
-  virtual void print_layout_group(xmlpp::Element* node_parent, const sharedptr<const LayoutGroup>& group);
+  virtual void print_layout_group(xmlpp::Element* node_parent, const std::shared_ptr<const LayoutGroup>& 
group);
 
   bool m_read_only;
 
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 687187f..6b28bab 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -59,7 +59,7 @@ Box_Data_Portal::~Box_Data_Portal()
 
 void Box_Data_Portal::make_record_related(const Gnome::Gda::Value& related_record_primary_key_value)
 {
-  sharedptr<Field> field_primary_key = get_field_primary_key();
+  std::shared_ptr<Field> field_primary_key = get_field_primary_key();
 
   //Create the link by setting the foreign key
   if(!m_key_field)
@@ -95,7 +95,7 @@ void Box_Data_Portal::make_record_related(const Gnome::Gda::Value& related_recor
   }
 }
 
-bool Box_Data_Portal::init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool show_title)
+bool Box_Data_Portal::init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool 
show_title)
 {
   m_portal = glom_sharedptr_clone(portal);
 
@@ -163,12 +163,12 @@ bool Box_Data_Portal::refresh_data_from_database_with_foreign_key(const Gnome::G
   }
 }
 
-sharedptr<LayoutItem_Portal> Box_Data_Portal::get_portal() const
+std::shared_ptr<LayoutItem_Portal> Box_Data_Portal::get_portal() const
 {
   return m_portal;
 }
 
-sharedptr<const Field> Box_Data_Portal::get_key_field() const
+std::shared_ptr<const Field> Box_Data_Portal::get_key_field() const
 {
   return m_key_field;
 }
@@ -194,7 +194,7 @@ Box_Data_Portal::type_vecConstLayoutFields Box_Data_Portal::get_fields_to_show()
     Document::type_list_layout_groups mapGroups;
     mapGroups.push_back(m_portal);
 
-    sharedptr<const Relationship> relationship = m_portal->get_relationship();
+    std::shared_ptr<const Relationship> relationship = m_portal->get_relationship();
     if(relationship)
     {
       type_vecConstLayoutFields result = 
get_table_fields_to_show_for_sequence(m_portal->get_table_used(Glib::ustring() /* not relevant */), 
mapGroups);
@@ -206,7 +206,7 @@ Box_Data_Portal::type_vecConstLayoutFields Box_Data_Portal::get_fields_to_show()
       {
         for(type_vecConstLayoutFields::iterator iter = result.begin(); iter != result.end(); ++iter)
         {
-          sharedptr<const LayoutItem_Field> item = *iter;
+          std::shared_ptr<const LayoutItem_Field> item = *iter;
           if(item)
             item->set_editable(false);
         }
@@ -239,7 +239,7 @@ bool Box_Data_Portal::get_has_suitable_record_to_view_details() const
     return false;
     
   Glib::ustring navigation_table_name;
-  sharedptr<const UsesRelationship> navigation_relationship; //Ignored.
+  std::shared_ptr<const UsesRelationship> navigation_relationship; //Ignored.
   m_portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, document);
 
   return !(navigation_table_name.empty());
@@ -259,7 +259,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
     return;
     
   Glib::ustring navigation_table_name;
-  sharedptr<const UsesRelationship> navigation_relationship;
+  std::shared_ptr<const UsesRelationship> navigation_relationship;
   m_portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, document);
   
   //if(navigation_relationship && navigation_relationship->get_relationship())
@@ -271,10 +271,10 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
     return;
 
   //Get the primary key of that table:
-  sharedptr<Field> navigation_table_primary_key = get_field_primary_key_for_table(navigation_table_name);
+  std::shared_ptr<Field> navigation_table_primary_key = 
get_field_primary_key_for_table(navigation_table_name);
 
   //Build a layout item to get the field's value:
-  sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
   layout_item->set_full_field_details(navigation_table_primary_key);
 
   if(navigation_relationship)
@@ -290,7 +290,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
 
   //For instance "invoice_line_id" if this is a portal to an "invoice_lines" table:
   const Glib::ustring related_table = m_portal->get_table_used(Glib::ustring() /* not relevant */);
-  sharedptr<const Field> key_field = get_field_primary_key_for_table(related_table);
+  std::shared_ptr<const Field> key_field = get_field_primary_key_for_table(related_table);
   //std::cout << "DEBUG: related table=" << related_table << ", whose primary_key=" << key_field->get_name() 
<< ", with value=" << primary_key_value.to_string() << "getting value for: " << 
layout_item->get_layout_display_name() << std::endl;
 
   Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(related_table, fieldsToGet, 
key_field, primary_key_value);
@@ -348,7 +348,7 @@ Document::type_list_layout_groups Box_Data_Portal::create_layout_get_layout()
   return result;
 }
 
-sharedptr<Field> Box_Data_Portal::get_field_primary_key() const
+std::shared_ptr<Field> Box_Data_Portal::get_field_primary_key() const
 {
   return m_key_field;
 }
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 16a06fa..0f274a1 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -48,7 +48,7 @@ public:
   /**
    * @param portal: The full portal details
    */
-  virtual bool init_db_details(const sharedptr<const LayoutItem_Portal>& portal, bool show_title = true);
+  virtual bool init_db_details(const std::shared_ptr<const LayoutItem_Portal>& portal, bool show_title = 
true);
 
   /** Use this if no portal is yet defined, so the user can use the context menu to define a portal.
    */
@@ -60,8 +60,8 @@ public:
    */
   bool refresh_data_from_database_with_foreign_key(const Gnome::Gda::Value& foreign_key_value);
 
-  virtual sharedptr<LayoutItem_Portal> get_portal() const;
-  virtual sharedptr<const Field> get_key_field() const;
+  virtual std::shared_ptr<LayoutItem_Portal> get_portal() const;
+  virtual std::shared_ptr<const Field> get_key_field() const;
 
   sigc::signal<void, Gnome::Gda::Value> signal_record_added;
 
@@ -97,7 +97,7 @@ protected:
   virtual type_vecConstLayoutFields get_fields_to_show() const; //override
     
   //Implementations of pure virtual methods from Base_DB_Table_Data:
-  virtual sharedptr<Field> get_field_primary_key() const;
+  virtual std::shared_ptr<Field> get_field_primary_key() const;
 
   //Overrides of virtual methods from Base_Db_Table_Data: 
   virtual void on_record_added(const Gnome::Gda::Value& primary_key_value, const Gtk::TreeModel::iterator& 
row); //Override. Not a signal handler.
@@ -124,12 +124,12 @@ protected:
   Gtk::Alignment m_Alignment;
   Gtk::Label m_Label;
 
-  sharedptr<LayoutItem_Portal> m_portal;
+  std::shared_ptr<LayoutItem_Portal> m_portal;
   Glib::ustring m_parent_table; //A duplicate of the from_table in m_portal, but only when m_portal is not 
null.
   
   // m_key_field and m_key_value are the field and its value in this table that 
   // must match another field in the parent table.
-  sharedptr<Field> m_key_field;
+  std::shared_ptr<Field> m_key_field;
   Gnome::Gda::Value m_key_value;
 
   bool m_find_mode;
diff --git a/glom/mode_data/buttonglom.cc b/glom/mode_data/buttonglom.cc
index fb1f466..26e19d4 100644
--- a/glom/mode_data/buttonglom.cc
+++ b/glom/mode_data/buttonglom.cc
@@ -68,8 +68,8 @@ void ButtonGlom::on_menu_properties_activate()
   if(!dialog) //Unlikely and it already warns on stderr.
     return;
 
-  sharedptr<LayoutItem_Button> layout_item = 
-    sharedptr<LayoutItem_Button>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Button> layout_item = 
+    std::dynamic_pointer_cast<LayoutItem_Button>(get_layout_item());
   dialog->set_script(layout_item, m_table_name);
   const int response = Glom::Utils::dialog_run_with_help(dialog);
   dialog->hide();
diff --git a/glom/mode_data/datawidget/cellcreation.cc b/glom/mode_data/datawidget/cellcreation.cc
index 6a1bdaa..3528883 100644
--- a/glom/mode_data/datawidget/cellcreation.cc
+++ b/glom/mode_data/datawidget/cellcreation.cc
@@ -37,7 +37,7 @@
 namespace Glom
 {
 
-static void apply_formatting(Gtk::CellRenderer* renderer, const sharedptr<const LayoutItem_WithFormatting>& 
layout_item)
+static void apply_formatting(Gtk::CellRenderer* renderer, const std::shared_ptr<const 
LayoutItem_WithFormatting>& layout_item)
 {
   Gtk::CellRendererText* text_renderer = dynamic_cast<Gtk::CellRendererText*>(renderer);
   if(!text_renderer)
@@ -66,12 +66,12 @@ static void apply_formatting(Gtk::CellRenderer* renderer, const sharedptr<const
     text_renderer->property_background() = bg;
 }
 
-Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, const Glib::ustring& 
table_name, const Document* document, guint fixed_cell_height)
+Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_item, const Glib::ustring& 
table_name, const Document* document, guint fixed_cell_height)
 {
   Gtk::CellRenderer* cell = 0;
 
   //Create the appropriate cellrenderer type:
-  sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
   if(item_field)
   {
     //Ignore hiddent fields.
@@ -103,7 +103,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
         if(formatting.get_has_choices())
         {
           CellRendererDbList* rendererList = Gtk::manage( new CellRendererDbList() );
-          sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(layout_item); //TODO: Avoid this.
+          std::shared_ptr<LayoutItem> unconst = std::const_pointer_cast<LayoutItem>(layout_item); //TODO: 
Avoid this.
           rendererList->set_layout_item(unconst, table_name);
           bool as_radio_buttons = false; //Can't really be done in a list, so we ignore it.
           const bool restricted = formatting.get_choices_restricted(as_radio_buttons);
@@ -129,7 +129,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
   {
     //Non-fields:
 
-    sharedptr<const LayoutItem_Image> item_image = sharedptr<const 
LayoutItem_Image>::cast_dynamic(layout_item);
+    std::shared_ptr<const LayoutItem_Image> item_image = std::dynamic_pointer_cast<const 
LayoutItem_Image>(layout_item);
     if(item_image)
     {
       Gtk::CellRendererPixbuf* pixbuf_renderer = Gtk::manage( new Gtk::CellRendererPixbuf() );
@@ -144,7 +144,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
     }
     else
     {
-      sharedptr<const LayoutItem_Text> item_text = sharedptr<const 
LayoutItem_Text>::cast_dynamic(layout_item);
+      std::shared_ptr<const LayoutItem_Text> item_text = std::dynamic_pointer_cast<const 
LayoutItem_Text>(layout_item);
       if(item_text)
       {
         Gtk::CellRendererText* pCellText = Gtk::manage( new Gtk::CellRendererText() );
@@ -154,7 +154,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
       }
       else
       {
-        sharedptr<const LayoutItem_Button> item_button = sharedptr<const 
LayoutItem_Button>::cast_dynamic(layout_item);
+        std::shared_ptr<const LayoutItem_Button> item_button = std::dynamic_pointer_cast<const 
LayoutItem_Button>(layout_item);
         if(item_button)
         {
           GlomCellRenderer_ButtonText* pCellButton = Gtk::manage( new GlomCellRenderer_ButtonText() );
@@ -174,8 +174,8 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
   }
 
   //Use formatting:
-  sharedptr<const LayoutItem_WithFormatting> item_withformatting =
-    sharedptr<const LayoutItem_WithFormatting>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem_WithFormatting> item_withformatting =
+    std::dynamic_pointer_cast<const LayoutItem_WithFormatting>(layout_item);
   if(item_withformatting)
   {
     apply_formatting(cell, item_withformatting);
@@ -212,7 +212,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
       const Formatting::type_list_values list_values = 
item_field->get_formatting_used().get_choices_custom();
       for(Formatting::type_list_values::const_iterator iter = list_values.begin(); iter != 
list_values.end(); ++iter)
       {
-        const sharedptr< const ChoiceValue> value = *iter;
+        const std::shared_ptr< const ChoiceValue> value = *iter;
         if(!value)
           continue;
 
@@ -224,9 +224,9 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
   {
     if(item_field && item_field->get_formatting_used().get_has_related_choices())
     {
-      sharedptr<const Relationship> choice_relationship;
-      sharedptr<const LayoutItem_Field> choice_field;
-      sharedptr<const LayoutGroup> choice_extras; //Ignored
+      std::shared_ptr<const Relationship> choice_relationship;
+      std::shared_ptr<const LayoutItem_Field> choice_field;
+      std::shared_ptr<const LayoutGroup> choice_extras; //Ignored
       Formatting::type_list_sort_fields choice_sort_fields; //Ignored
       bool choice_show_all = false;
       item_field->get_formatting_used().get_choices_related(choice_relationship, choice_field, 
choice_extras, choice_sort_fields, choice_show_all);
diff --git a/glom/mode_data/datawidget/cellcreation.h b/glom/mode_data/datawidget/cellcreation.h
index 6602655..f238611 100644
--- a/glom/mode_data/datawidget/cellcreation.h
+++ b/glom/mode_data/datawidget/cellcreation.h
@@ -30,7 +30,7 @@ namespace Glom
 /** Create a Gtk::CellRenderer that's appropriate to display a layout item,
  * for internal use by a DbAddDel or ComboChoices widget.
  */
-Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, const Glib::ustring& 
table_name, const Document* document, guint fixed_cell_height);
+Gtk::CellRenderer* create_cell(const std::shared_ptr<const LayoutItem>& layout_item, const Glib::ustring& 
table_name, const Document* document, guint fixed_cell_height);
 
 } //namespace Glom
 
diff --git a/glom/mode_data/datawidget/cellrenderer_dblist.cc 
b/glom/mode_data/datawidget/cellrenderer_dblist.cc
index ec785cc..23e98b5 100644
--- a/glom/mode_data/datawidget/cellrenderer_dblist.cc
+++ b/glom/mode_data/datawidget/cellrenderer_dblist.cc
@@ -54,7 +54,7 @@ void CellRendererDbList::set_choices_fixed(const Formatting::type_list_values& l
   //The other cells are added in on_editing_started().
 }
 
-void CellRendererDbList::set_choices_related(const Document* document, const sharedptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
+void CellRendererDbList::set_choices_related(const Document* document, const std::shared_ptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
 {
   ComboChoicesWithTreeModel::set_choices_related(document, layout_field, foreign_key_value);
 
@@ -130,7 +130,7 @@ void CellRendererDbList::repack_cells_fixed(Gtk::CellLayout* combobox)
         cell = Gtk::manage(new Gtk::CellRendererText);
       else if(col < m_db_layout_items.size())
       {
-        sharedptr<const LayoutItem_Field> layout_item = m_db_layout_items[col];
+        std::shared_ptr<const LayoutItem_Field> layout_item = m_db_layout_items[col];
         cell = create_cell(layout_item, m_table_name, m_document, get_fixed_cell_height(*widget));
       }
 
@@ -163,7 +163,7 @@ void CellRendererDbList::repack_cells_related(Gtk::CellLayout* combobox)
   guint i = 0;
   for(type_vec_const_layout_items::const_iterator iter = m_db_layout_items.begin(); iter != 
m_db_layout_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> layout_item = *iter;
+    const std::shared_ptr<const LayoutItem> layout_item = *iter;
     Gtk::CellRenderer* cell = 0;
 
     if(i == 0 && !m_repacked_first_cell)
@@ -236,7 +236,7 @@ void CellRendererDbList::on_editing_started(Gtk::CellEditable* cell_editable, co
 
 void CellRendererDbList::set_value(const Gnome::Gda::Value& value)
 {
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   if(!layout_item)
     return;
 
@@ -269,7 +269,7 @@ void CellRendererDbList::set_value(const Gnome::Gda::Value& value)
 
 Gnome::Gda::Value CellRendererDbList::get_value() const
 {
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   bool success = false;
 
   const Glib::ustring text = get_text();
diff --git a/glom/mode_data/datawidget/cellrenderer_dblist.h b/glom/mode_data/datawidget/cellrenderer_dblist.h
index e5aa226..3761b8a 100644
--- a/glom/mode_data/datawidget/cellrenderer_dblist.h
+++ b/glom/mode_data/datawidget/cellrenderer_dblist.h
@@ -44,7 +44,7 @@ public:
   virtual void set_choices_fixed(const Formatting::type_list_values& list_values, bool restricted = false);
 
   //This creates a db-based tree model, with appropriate cell renderers:
-  virtual void set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
+  virtual void set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
 
   void set_restrict_values_to_list(bool val = true);
 
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index fe19f00..d1e55b3 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -73,8 +73,8 @@ void ComboGlom::on_fixed_cell_data(const Gtk::TreeModel::iterator& iter, Gtk::Ce
   if(!iter)
     return;
 
-  const sharedptr<const LayoutItem>& layout_item = get_layout_item();
-  const sharedptr<const LayoutItem_Field> field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  const std::shared_ptr<const LayoutItem>& layout_item = get_layout_item();
+  const std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
   if(!field)
     return;
 
@@ -120,8 +120,8 @@ void ComboGlom::set_choices_fixed(const Formatting::type_list_values& list_value
   if(columns_count)
     columns_count -= 1; //The last one is the just the extra text-equivalent of the first one, for 
GtkComboBox with has-entry=true, or for translations.
 
-  const sharedptr<const LayoutItem>& layout_item = get_layout_item();
-  const sharedptr<const LayoutItem_Field> field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  const std::shared_ptr<const LayoutItem>& layout_item = get_layout_item();
+  const std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
   //For fixed (custom) choices, this will always be 1 column anyway,
   //so the for() loop here is excessive.
@@ -154,7 +154,7 @@ void ComboGlom::set_choices_fixed(const Formatting::type_list_values& list_value
   }
 }
 
-void ComboGlom::set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value)
+void ComboGlom::set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value)
 {
   ComboChoicesWithTreeModel::set_choices_related(document, layout_field, foreign_key_value);
 
@@ -193,7 +193,7 @@ void ComboGlom::set_choices_related(const Document* document, const sharedptr<co
   guint model_column_index = 0;
   for(type_vec_const_layout_items::const_iterator iter = m_db_layout_items.begin(); iter != 
m_db_layout_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> layout_item = *iter;
+    const std::shared_ptr<const LayoutItem> layout_item = *iter;
     if(!layout_item) //column_info.m_visible)
     {
       ++model_column_index;
@@ -233,7 +233,7 @@ void ComboGlom::check_for_change()
 
 void ComboGlom::set_value(const Gnome::Gda::Value& value)
 {
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   if(!layout_item)
     return;
 
diff --git a/glom/mode_data/datawidget/combo.h b/glom/mode_data/datawidget/combo.h
index 9e1da84..1b4d78f 100644
--- a/glom/mode_data/datawidget/combo.h
+++ b/glom/mode_data/datawidget/combo.h
@@ -53,7 +53,7 @@ public:
   virtual void set_choices_fixed(const Formatting::type_list_values& list_values, bool restricted = false);
 
   //This creates a db-based tree model, with appropriate cell renderers:
-  virtual void set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
+  virtual void set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
 
   virtual void set_read_only(bool read_only = true);
 
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc 
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index 35d9c08..04b61fc 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -63,12 +63,12 @@ void ComboAsRadioButtons::set_choices_with_second(const type_list_values_with_se
   }
   m_map_buttons.clear();
 
-  sharedptr<LayoutItem_Field> layout_item =
-    sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layout_item =
+    std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   const Formatting& format = layout_item->get_formatting_used();
-  sharedptr<const Relationship> choice_relationship;
-  sharedptr<const LayoutItem_Field> layout_choice_first;
-  sharedptr<const LayoutGroup> layout_choice_extra;
+  std::shared_ptr<const Relationship> choice_relationship;
+  std::shared_ptr<const LayoutItem_Field> layout_choice_first;
+  std::shared_ptr<const LayoutGroup> layout_choice_extra;
   Formatting::type_list_sort_fields choice_sort_fields; //Ignored. TODO?
   bool choice_show_all = false;
   format.get_choices_related(choice_relationship, layout_choice_first, layout_choice_extra, 
choice_sort_fields, choice_show_all);
@@ -93,8 +93,8 @@ void ComboAsRadioButtons::set_choices_with_second(const type_list_values_with_se
         for(LayoutGroup::type_list_const_items::const_iterator iterExtra = extra_fields.begin();
           iterExtra != extra_fields.end(); ++iterExtra)
         {
-          const sharedptr<const LayoutItem> item = *iterExtra;
-          const sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(item);
+          const std::shared_ptr<const LayoutItem> item = *iterExtra;
+          const std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
           if(item_field && (iterValues != extra_values.end()))
           {
             const Gnome::Gda::Value value = *iterValues; //TODO: Use a vector instead?
@@ -136,10 +136,10 @@ void ComboAsRadioButtons::set_choices_fixed(const Formatting::type_list_values&
   Gtk::RadioButton::Group group;
   for(Formatting::type_list_values::const_iterator iter = list_values.begin(); iter != list_values.end(); 
++iter)
   {
-    sharedptr<const LayoutItem_Field> layout_item = 
sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field> layout_item = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
     if(layout_item)
     {
-      const sharedptr<ChoiceValue> choicevalue = *iter;
+      const std::shared_ptr<ChoiceValue> choicevalue = *iter;
       Gnome::Gda::Value value;
       if(choicevalue)
         value = choicevalue->get_value();
@@ -156,7 +156,7 @@ void ComboAsRadioButtons::set_choices_fixed(const Formatting::type_list_values&
   }
 }
 
-void ComboAsRadioButtons::set_choices_related(const Document* document, const sharedptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
+void ComboAsRadioButtons::set_choices_related(const Document* document, const std::shared_ptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
 {
   const Utils::type_list_values_with_second list_values =
     Utils::get_choice_values(document, layout_field, foreign_key_value);
@@ -183,7 +183,7 @@ void ComboAsRadioButtons::check_for_change()
   //Validate the input:
   bool success = false;
 
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   const Gnome::Gda::Value value = Conversions::parse_value(layout_item->get_glom_type(), new_text, 
layout_item->get_formatting_used().m_numeric_format, success);
 
   if(success)
@@ -207,7 +207,7 @@ void ComboAsRadioButtons::check_for_change()
 
 void ComboAsRadioButtons::set_value(const Gnome::Gda::Value& value)
 {
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   if(!layout_item)
     return;
 
@@ -240,7 +240,7 @@ void ComboAsRadioButtons::set_text(const Glib::ustring& text)
 
 Gnome::Gda::Value ComboAsRadioButtons::get_value() const
 {
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   bool success = false;
 
   const Glib::ustring text = get_text();
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.h 
b/glom/mode_data/datawidget/combo_as_radio_buttons.h
index d5afc6b..f1b437a 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.h
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.h
@@ -52,7 +52,7 @@ public:
 
   virtual void set_choices_fixed(const Formatting::type_list_values& list_values, bool restricted = false);
 
-  virtual void set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
+  virtual void set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
 
   virtual void set_read_only(bool read_only = true);
 
diff --git a/glom/mode_data/datawidget/combochoices.cc b/glom/mode_data/datawidget/combochoices.cc
index 6a3699f..825ddc9 100644
--- a/glom/mode_data/datawidget/combochoices.cc
+++ b/glom/mode_data/datawidget/combochoices.cc
@@ -53,8 +53,8 @@ ComboChoices::~ComboChoices()
 bool ComboChoices::refresh_data_from_database_with_foreign_key(const Document* /* document */, const 
Gnome::Gda::Value& /* foreign_key_value */)
 {
   /** TODO:
-  sharedptr<LayoutItem_Field> layout_item =
-    sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layout_item =
+    std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
 
   if(!layout_item || Conversions::value_is_empty(foreign_key_value))
   {
@@ -73,17 +73,17 @@ bool ComboChoices::refresh_data_from_database_with_foreign_key(const Document* /
   return true;
 }
 
-void ComboChoices::set_choices_related(const Document* /* document */, const sharedptr<const 
LayoutItem_Field>& /* layout_field */, const Gnome::Gda::Value& /* foreign_key_value */)
+void ComboChoices::set_choices_related(const Document* /* document */, const std::shared_ptr<const 
LayoutItem_Field>& /* layout_field */, const Gnome::Gda::Value& /* foreign_key_value */)
 {
   /* TODO:
   type_list_values_with_second list_values;
 
-  sharedptr<LayoutItem_Field> layout_item =
-    sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layout_item =
+    std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   if(layout_item)
   {
     bool choice_show_all = false;
-    const sharedptr<const Relationship> choice_relationship =
+    const std::shared_ptr<const Relationship> choice_relationship =
       layout_item->get_formatting_used().get_choices_related_relationship(choice_show_all);
 
     //Set the values now because if it will be the same regardless of the foreign key value.
diff --git a/glom/mode_data/datawidget/combochoices.h b/glom/mode_data/datawidget/combochoices.h
index 14e9ed6..2134182 100644
--- a/glom/mode_data/datawidget/combochoices.h
+++ b/glom/mode_data/datawidget/combochoices.h
@@ -41,7 +41,7 @@ public:
   explicit ComboChoices();
 
   ///You must call set_layout_item() to specify the field type and formatting of the main column.
-  explicit ComboChoices(const sharedptr<LayoutItem_Field>& field_second);
+  explicit ComboChoices(const std::shared_ptr<LayoutItem_Field>& field_second);
 
   virtual ~ComboChoices();
 
@@ -58,7 +58,7 @@ public:
    *
    * See also refresh_data_from_database_with_foreign_key().
    */
-  virtual void set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value) = 0;
+  virtual void set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value) = 0;
 
   /** Update a choices widget's list of related choices if a relevant value in its parent table has changed.
    *
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc 
b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index b4e36ed..d511070 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -140,12 +140,12 @@ void ComboChoicesWithTreeModel::set_choices_with_second(const type_list_values_w
   create_model(columns_count);
 
   //Fill the model with data:
-  sharedptr<LayoutItem_Field> layout_item =
-    sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layout_item =
+    std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   const Formatting& format = layout_item->get_formatting_used();
-  sharedptr<const Relationship> choice_relationship;
-  sharedptr<const LayoutItem_Field> layout_choice_first;
-  sharedptr<const LayoutGroup> layout_choice_extra;
+  std::shared_ptr<const Relationship> choice_relationship;
+  std::shared_ptr<const LayoutItem_Field> layout_choice_first;
+  std::shared_ptr<const LayoutGroup> layout_choice_extra;
   bool choice_show_all = false;
   format.get_choices_related(choice_relationship, layout_choice_first, layout_choice_extra, choice_show_all);
 
@@ -185,8 +185,8 @@ void ComboChoicesWithTreeModel::set_choices_with_second(const type_list_values_w
           if(iterValues == extra_values.end())
             break;
 
-          const sharedptr<const LayoutItem> item = *iterExtra;
-          const sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(item);
+          const std::shared_ptr<const LayoutItem> item = *iterExtra;
+          const std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
           if(item_field)
           {
             const Gnome::Gda::Value value = *iterValues;
@@ -221,11 +221,11 @@ void ComboChoicesWithTreeModel::set_choices_fixed(const Formatting::type_list_va
     Gtk::TreeModel::iterator iterTree = list_store->append();
     Gtk::TreeModel::Row row = *iterTree;
 
-    sharedptr<const LayoutItem_Field> layout_item = 
sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field> layout_item = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
     if(!layout_item)
       continue;
     
-    const sharedptr<ChoiceValue> choicevalue = *iter;
+    const std::shared_ptr<ChoiceValue> choicevalue = *iter;
     if(!choicevalue)
       continue;
 
@@ -255,7 +255,7 @@ void ComboChoicesWithTreeModel::set_choices_fixed(const Formatting::type_list_va
   //then sets up the view, using the model.
 }
 
-void ComboChoicesWithTreeModel::set_choices_related(const Document* document, const sharedptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
+void ComboChoicesWithTreeModel::set_choices_related(const Document* document, const std::shared_ptr<const 
LayoutItem_Field>& layout_field, const Gnome::Gda::Value& foreign_key_value)
 {
   if(!document)
   {
@@ -264,9 +264,9 @@ void ComboChoicesWithTreeModel::set_choices_related(const Document* document, co
   }
 
   const Formatting& format = layout_field->get_formatting_used();
-  sharedptr<const Relationship> choice_relationship;
-  sharedptr<const LayoutItem_Field> layout_choice_first;
-  sharedptr<const LayoutGroup> layout_choice_extra;
+  std::shared_ptr<const Relationship> choice_relationship;
+  std::shared_ptr<const LayoutItem_Field> layout_choice_first;
+  std::shared_ptr<const LayoutGroup> layout_choice_extra;
   Formatting::type_list_sort_fields choice_sort_fields;
   bool choice_show_all = false;
   format.get_choices_related(choice_relationship, layout_choice_first, layout_choice_extra, 
choice_sort_fields, choice_show_all);
@@ -274,7 +274,7 @@ void ComboChoicesWithTreeModel::set_choices_related(const Document* document, co
     std::cerr << G_STRFUNC << ": layout_choice_first has invalid type. field name: " << 
layout_choice_first->get_name() << std::endl;
 
   //Set full field details, cloning the group to avoid the constness:
-  sharedptr<LayoutGroup> layout_choice_extra_full = glom_sharedptr_clone(layout_choice_extra);
+  std::shared_ptr<LayoutGroup> layout_choice_extra_full = glom_sharedptr_clone(layout_choice_extra);
   const Glib::ustring table_name = choice_relationship->get_to_table();
   document->fill_layout_field_details(table_name,  layout_choice_extra_full);
 
@@ -298,7 +298,7 @@ void ComboChoicesWithTreeModel::set_choices_related(const Document* document, co
 
   if(!foreign_key_value.is_null())
   {
-    const sharedptr<const Field> to_field = document->get_field(to_table, 
choice_relationship->get_to_field());
+    const std::shared_ptr<const Field> to_field = document->get_field(to_table, 
choice_relationship->get_to_field());
 
     found_set.m_where_clause = Utils::build_simple_where_expression(
       to_table, to_field, foreign_key_value);
@@ -332,7 +332,7 @@ Glib::RefPtr<Gtk::TreeModel> ComboChoicesWithTreeModel::get_choices_model()
   return m_refModel;
 }
 
-void ComboChoicesWithTreeModel::set_cell_for_field_value(Gtk::CellRenderer* cell, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+void ComboChoicesWithTreeModel::set_cell_for_field_value(Gtk::CellRenderer* cell, const 
std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   if(!field)
     return;
@@ -418,8 +418,8 @@ void ComboChoicesWithTreeModel::on_cell_data(const Gtk::TreeModel::iterator& ite
   if(!iter)
     return;
 
-  const sharedptr<const LayoutItem>& layout_item = m_db_layout_items[model_column_index];
-  sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(layout_item);
+  const std::shared_ptr<const LayoutItem>& layout_item = m_db_layout_items[model_column_index];
+  std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
   if(!field)
     return;
 
@@ -463,7 +463,7 @@ int ComboChoicesWithTreeModel::get_fixed_cell_height(Gtk::Widget& widget)
     {
       Glib::ustring font_name;
 
-      const sharedptr<const LayoutItem_WithFormatting> item_withformatting = sharedptr<const 
LayoutItem_WithFormatting>::cast_dynamic(*iter);
+      const std::shared_ptr<const LayoutItem_WithFormatting> item_withformatting = 
std::dynamic_pointer_cast<const LayoutItem_WithFormatting>(*iter);
       if(item_withformatting)
       {
          const Formatting& formatting = item_withformatting->get_formatting_used();
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.h 
b/glom/mode_data/datawidget/combochoiceswithtreemodel.h
index c5e73ab..fb3b183 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.h
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.h
@@ -43,7 +43,7 @@ public:
   virtual void set_choices_fixed(const Formatting::type_list_values& list_values, bool restricted = false);
 
   //This creates a db-based tree model, with appropriate cell renderers:
-  virtual void set_choices_related(const Document* document, const sharedptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
+  virtual void set_choices_related(const Document* document, const std::shared_ptr<const LayoutItem_Field>& 
layout_field, const Gnome::Gda::Value& foreign_key_value);
 
 
   //Not named get_model(), to avoid clashing with ComboBox::get_model().
@@ -74,7 +74,7 @@ protected:
   int get_fixed_model_text_column() const;
 
 
-  typedef std::vector< sharedptr<const LayoutItem_Field> > type_vec_const_layout_items;
+  typedef std::vector< std::shared_ptr<const LayoutItem_Field> > type_vec_const_layout_items;
   type_vec_const_layout_items m_db_layout_items; //If set_choices_related() was used.
 
   //This avoids us making on_cell_data() public just so that derived classes can use it,
@@ -83,7 +83,7 @@ protected:
 
   /** Display the value in the cell according to the layout field's type and formatting.
    */
-  void set_cell_for_field_value(Gtk::CellRenderer* cell, const sharedptr<const LayoutItem_Field>& field, 
const Gnome::Gda::Value& value);
+  void set_cell_for_field_value(Gtk::CellRenderer* cell, const std::shared_ptr<const LayoutItem_Field>& 
field, const Gnome::Gda::Value& value);
 
 private:
   /// Render the model data to the cells in the view.
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index 09a9730..ca95b83 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -44,7 +44,7 @@
 namespace Glom
 {
 
-static DataWidgetChildren::ComboChoices* create_combo_widget_for_field(const sharedptr<LayoutItem_Field>& 
field)
+static DataWidgetChildren::ComboChoices* create_combo_widget_for_field(const 
std::shared_ptr<LayoutItem_Field>& field)
 {
   DataWidgetChildren::ComboChoices* result = 0;
   bool as_radio_buttons = false;
@@ -62,7 +62,7 @@ static DataWidgetChildren::ComboChoices* create_combo_widget_for_field(const sha
   return result;
 }
 
-DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ustring& table_name, const 
Document* document)
+DataWidget::DataWidget(const std::shared_ptr<LayoutItem_Field>& field, const Glib::ustring& table_name, 
const Document* document)
 :  m_child(0),
    m_button_go_to_details(0)
 {
@@ -187,7 +187,7 @@ DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ust
     field->set_full_field_details(
       document->get_field(field->get_table_used(table_name), field->get_name()) ); //Otherwise 
get_primary_key() returns false always.
 
-    sharedptr<Relationship> field_used_in_relationship_to_one;
+    std::shared_ptr<Relationship> field_used_in_relationship_to_one;
     const bool add_open_button = 
        DbUtils::layout_field_should_have_navigation(table_name, field, document, 
          field_used_in_relationship_to_one);
@@ -341,7 +341,7 @@ const Gtk::Label* DataWidget::get_label() const
   return &m_label;
 }
 
-void DataWidget::set_child_size_by_field(const sharedptr<const LayoutItem_Field>& field)
+void DataWidget::set_child_size_by_field(const std::shared_ptr<const LayoutItem_Field>& field)
 {
   const Field::glom_field_type glom_type = field->get_glom_type();
   int width = get_suitable_width(field);
@@ -366,7 +366,7 @@ void DataWidget::set_child_size_by_field(const sharedptr<const LayoutItem_Field>
   }
 }
 
-int DataWidget::get_suitable_width(const sharedptr<const LayoutItem_Field>& field_layout)
+int DataWidget::get_suitable_width(const std::shared_ptr<const LayoutItem_Field>& field_layout)
 {
   return Utils::get_suitable_field_width_for_widget(*this, field_layout);
 }
@@ -455,19 +455,19 @@ bool DataWidget::on_button_press_event(GdkEventButton *event)
   return Gtk::EventBox::on_button_press_event(event);
 }
 
-sharedptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name)
+std::shared_ptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name)
 {
-  return offer_field_list(table_name, sharedptr<LayoutItem_Field>());
+  return offer_field_list(table_name, std::shared_ptr<LayoutItem_Field>());
 }
 
-sharedptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& start_field)
+std::shared_ptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& start_field)
 {
   return offer_field_list(table_name, start_field, get_document(), get_appwindow());
 }
 
-sharedptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& start_field, Document* document, AppWindow* app)
+std::shared_ptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& start_field, Document* document, AppWindow* app)
 {
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   Dialog_ChooseField* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -492,9 +492,9 @@ sharedptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& ta
   return result;
 }
 
-sharedptr<LayoutItem_Field> DataWidget::offer_field_layout(const sharedptr<const LayoutItem_Field>& 
start_field)
+std::shared_ptr<LayoutItem_Field> DataWidget::offer_field_layout(const std::shared_ptr<const 
LayoutItem_Field>& start_field)
 {
-  sharedptr<LayoutItem_Field> result;
+  std::shared_ptr<LayoutItem_Field> result;
 
   Dialog_FieldLayout* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -526,10 +526,10 @@ void DataWidget::on_menupopup_activate_layout()
 {
   //finish_editing();
 
-  sharedptr<LayoutItem_Field> layoutField = sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layoutField = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   if(layoutField)
   {
-    sharedptr<LayoutItem_Field> itemchosen = offer_field_list(m_table_name, layoutField);
+    std::shared_ptr<LayoutItem_Field> itemchosen = offer_field_list(m_table_name, layoutField);
     if(itemchosen)
     {
       *layoutField = *itemchosen;
@@ -542,10 +542,10 @@ void DataWidget::on_menupopup_activate_layout_properties()
 {
   //finish_editing();
 
-  sharedptr<LayoutItem_Field> layoutField = sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layoutField = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   if(layoutField)
   {
-    sharedptr<LayoutItem_Field> itemchosen = offer_field_layout(layoutField);
+    std::shared_ptr<LayoutItem_Field> itemchosen = offer_field_layout(layoutField);
     if(itemchosen)
     {
       *layoutField = *itemchosen;
@@ -657,7 +657,7 @@ void DataWidget::on_button_choose_date()
 
 void DataWidget::on_self_style_changed(const Glib::RefPtr<Gtk::Style>& /* style */)
 {
-  sharedptr<LayoutItem_Field> layoutField = sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layoutField = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   set_child_size_by_field(layoutField);
 }
 
@@ -681,10 +681,10 @@ bool DataWidget::offer_related_record_id_find(Gnome::Gda::Value& chosen_id)
 
     //Discover the related table, in the relationship that uses this ID field:
     Glib::ustring related_table_name;
-    sharedptr<const LayoutItem_Field> layoutField = 
sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field> layoutField = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
     if(layoutField)
     {
-      sharedptr<const Relationship> relationship = 
get_document()->get_field_used_in_relationship_to_one(m_table_name, layoutField);
+      std::shared_ptr<const Relationship> relationship = 
get_document()->get_field_used_in_relationship_to_one(m_table_name, layoutField);
       if(relationship)
         related_table_name = relationship->get_to_table();
     }
@@ -730,10 +730,10 @@ bool DataWidget::offer_related_record_id_new(Gnome::Gda::Value& chosen_id)
 
     //Discover the related table, in the relationship that uses this ID field:
     Glib::ustring related_table_name;
-    sharedptr<const LayoutItem_Field> layoutField = 
sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field> layoutField = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
     if(layoutField)
     {
-      sharedptr<const Relationship> relationship = 
get_document()->get_field_used_in_relationship_to_one(m_table_name, layoutField);
+      std::shared_ptr<const Relationship> relationship = 
get_document()->get_field_used_in_relationship_to_one(m_table_name, layoutField);
       if(relationship)
         related_table_name = relationship->get_to_table();
     }
diff --git a/glom/mode_data/datawidget/datawidget.h b/glom/mode_data/datawidget/datawidget.h
index fe99102..29771a9 100644
--- a/glom/mode_data/datawidget/datawidget.h
+++ b/glom/mode_data/datawidget/datawidget.h
@@ -44,7 +44,7 @@ class DataWidget
    public View_Composite_Glom
 {
 public:
-  explicit DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ustring& table_name, const 
Document* document);
+  explicit DataWidget(const std::shared_ptr<LayoutItem_Field>& field, const Glib::ustring& table_name, const 
Document* document);
   virtual ~DataWidget();
 
   virtual Gtk::Label* get_label();
@@ -62,11 +62,11 @@ public:
   virtual void set_viewable(bool viewable = true);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  static sharedptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& start_field, Document* document, AppWindow* app);
-  sharedptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name);
-  sharedptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& start_field);
+  static std::shared_ptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& start_field, Document* document, AppWindow* app);
+  std::shared_ptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name);
+  std::shared_ptr<LayoutItem_Field> offer_field_list(const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& start_field);
 
-  sharedptr<LayoutItem_Field> offer_field_layout(const sharedptr<const LayoutItem_Field>& start_field);
+  std::shared_ptr<LayoutItem_Field> offer_field_layout(const std::shared_ptr<const LayoutItem_Field>& 
start_field);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   /// Get the actual child widget used to show the data:
@@ -119,8 +119,8 @@ private:
 
   virtual AppWindow* get_appwindow() const;
 
-  void set_child_size_by_field(const sharedptr<const LayoutItem_Field>& field);
-  int get_suitable_width(const sharedptr<const LayoutItem_Field>& field_layout);
+  void set_child_size_by_field(const std::shared_ptr<const LayoutItem_Field>& field);
+  int get_suitable_width(const std::shared_ptr<const LayoutItem_Field>& field_layout);
 
   /** Show a dialog with a Find so that the user can choose an ID value to indicate the related record.
    */
diff --git a/glom/mode_data/datawidget/entry.cc b/glom/mode_data/datawidget/entry.cc
index 325107a..ff362fc 100644
--- a/glom/mode_data/datawidget/entry.cc
+++ b/glom/mode_data/datawidget/entry.cc
@@ -67,7 +67,7 @@ void Entry::init()
 {
 }
 
-void Entry::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
+void Entry::set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
 {
   LayoutWidgetField::set_layout_item(layout_item, table_name);
 #ifdef GTKMM_ATKMM_ENABLED
@@ -77,8 +77,8 @@ void Entry::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib
   //Horizontal Alignment:
   Formatting::HorizontalAlignment alignment = 
     Formatting::HORIZONTAL_ALIGNMENT_LEFT;
-  sharedptr<LayoutItem_Field> layout_field =
-    sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layout_field =
+    std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   if(layout_field)
     alignment = layout_field->get_formatting_used_horizontal_alignment(true /* for details view */);
 
@@ -99,7 +99,7 @@ void Entry::check_for_change()
     //Validate the input:
     bool success = false;
 
-    sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
     Gnome::Gda::Value value = Conversions::parse_value(m_glom_type, get_text(), 
layout_item->get_formatting_used().m_numeric_format, success);
 
     if(success)
@@ -152,7 +152,7 @@ void Entry::on_changed()
 
 void Entry::set_value(const Gnome::Gda::Value& value)
 {
-  sharedptr<const LayoutItem_Field> layout_item = 
sharedptr<LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = 
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
   if(!layout_item)
     return;
 
@@ -183,7 +183,7 @@ Gnome::Gda::Value Entry::get_value() const
 {
   bool success = false;
 
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   return Conversions::parse_value(m_glom_type, get_text(), 
layout_item->get_formatting_used().m_numeric_format, success);
 }
 
diff --git a/glom/mode_data/datawidget/entry.h b/glom/mode_data/datawidget/entry.h
index c486783..454e9a2 100644
--- a/glom/mode_data/datawidget/entry.h
+++ b/glom/mode_data/datawidget/entry.h
@@ -46,7 +46,7 @@ public:
   explicit Entry(Field::glom_field_type glom_type = Field::TYPE_TEXT);
   virtual ~Entry();
 
-  virtual void set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name);
+  virtual void set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name);
 
   void set_glom_type(Field::glom_field_type glom_type);
 
diff --git a/glom/mode_data/datawidget/label.cc b/glom/mode_data/datawidget/label.cc
index 0e015e8..b816075 100644
--- a/glom/mode_data/datawidget/label.cc
+++ b/glom/mode_data/datawidget/label.cc
@@ -77,7 +77,7 @@ AppWindow* Label::get_appwindow() const
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 void Label::on_menu_properties_activate()
 {
-  sharedptr<LayoutItem_Text> textobject = sharedptr<LayoutItem_Text>::cast_dynamic(m_pLayoutItem);
+  std::shared_ptr<LayoutItem_Text> textobject = std::dynamic_pointer_cast<LayoutItem_Text>(m_pLayoutItem);
   if(!textobject)
     return;
 
diff --git a/glom/mode_data/datawidget/textview.cc b/glom/mode_data/datawidget/textview.cc
index 8371b1f..0f76aed 100644
--- a/glom/mode_data/datawidget/textview.cc
+++ b/glom/mode_data/datawidget/textview.cc
@@ -88,7 +88,7 @@ void TextView::check_for_change()
     //Validate the input:
     bool success = false;
 
-    sharedptr<const LayoutItem_Field>layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+    std::shared_ptr<const LayoutItem_Field>layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
     Gnome::Gda::Value value = Conversions::parse_value(m_glom_type, new_text, 
layout_item->get_formatting_used().m_numeric_format, success);
 
     if(success)
@@ -150,7 +150,7 @@ void TextView::on_insert_text(const Glib::ustring& text, int* position)
 
 void TextView::set_value(const Gnome::Gda::Value& value)
 {
-  sharedptr<const LayoutItem_Field>layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field>layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
   if(layout_item)
     set_text(Conversions::get_text_for_gda_value(m_glom_type, value, 
layout_item->get_formatting_used().m_numeric_format));
 }
@@ -167,7 +167,7 @@ Gnome::Gda::Value TextView::get_value() const
 {
   bool success = false;
 
-  sharedptr<const LayoutItem_Field>layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(get_layout_item());
+  std::shared_ptr<const LayoutItem_Field>layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(get_layout_item());
 
   TextView* pNonConstThis = const_cast<TextView*>(this); //Gtk::TextBuffer::get_text() is non-const in gtkmm 
<=2.6.
   return Conversions::parse_value(m_glom_type, pNonConstThis->m_TextView.get_buffer()->get_text(true), 
layout_item->get_formatting_used().m_numeric_format, success);
diff --git a/glom/mode_data/datawidget/treemodel_db.cc b/glom/mode_data/datawidget/treemodel_db.cc
index ceb4a3b..e04e172 100644
--- a/glom/mode_data/datawidget/treemodel_db.cc
+++ b/glom/mode_data/datawidget/treemodel_db.cc
@@ -209,7 +209,7 @@ DbTreeModel::DbTreeModel(const FoundSet& found_set, const type_vec_const_layout_
   {
     for(type_vec_const_layout_items::const_iterator iter = layout_items.begin(); iter != layout_items.end(); 
++iter)
     {
-      sharedptr<const LayoutItem_Field> item_field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+      std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(*iter);
       if(item_field)
       {
         if(item_field->get_glom_type() == Field::TYPE_INVALID)
@@ -228,13 +228,13 @@ DbTreeModel::DbTreeModel(const FoundSet& found_set, const type_vec_const_layout_
     bool key_found = false;
     for( DbTreeModel::type_vec_const_fields::const_iterator iter = m_column_fields.begin(); iter != 
m_column_fields.end(); ++iter)
     {
-      const sharedptr<const LayoutItem_Field> layout_item = *iter;
+      const std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
       if(!layout_item)
         continue;
 
       if( !(layout_item->get_has_relationship_name()) )
       {
-        const sharedptr<const Field> field_full = layout_item->get_full_field_details();
+        const std::shared_ptr<const Field> field_full = layout_item->get_full_field_details();
         if(!field_full)
           std::cerr << G_STRFUNC << ": The layout item (" << layout_item->get_name() << ") has no field 
details." << std::endl;
         else if(field_full->get_primary_key() )
@@ -252,7 +252,7 @@ DbTreeModel::DbTreeModel(const FoundSet& found_set, const type_vec_const_layout_
       std::cerr << G_STRFUNC << ": no primary key field found in the list of items:" << std::endl;
       for(DbTreeModel::type_vec_const_fields::const_iterator iter = m_column_fields.begin(); iter != 
m_column_fields.end(); ++iter)
       {
-        const sharedptr<const LayoutItem_Field> layout_item = *iter;
+        const std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
         if(layout_item)
           std::cerr << "  field: " << layout_item->get_name() << std::endl;
       }
@@ -312,7 +312,7 @@ bool DbTreeModel::refresh_from_database(const FoundSet& found_set)
     int col = 0;
     for(type_vec_const_fields::const_iterator iter = m_column_fields.begin(); iter != m_column_fields.end(); 
++iter)
     {
-      sharedptr<const LayoutItem_Field> layout_item = *iter;
+      std::shared_ptr<const LayoutItem_Field> layout_item = *iter;
       if(layout_item)
       {
         const Field::glom_field_type glom_type = layout_item->get_glom_type();
diff --git a/glom/mode_data/datawidget/treemodel_db.h b/glom/mode_data/datawidget/treemodel_db.h
index eabece8..0fb1602 100644
--- a/glom/mode_data/datawidget/treemodel_db.h
+++ b/glom/mode_data/datawidget/treemodel_db.h
@@ -73,8 +73,8 @@ public:
   friend class DbTreeModelRow;
 
 public:
-  typedef std::vector< sharedptr<LayoutItem> > type_vec_layout_items;
-  typedef std::vector< sharedptr<const LayoutItem> > type_vec_const_layout_items;
+  typedef std::vector< std::shared_ptr<LayoutItem> > type_vec_layout_items;
+  typedef std::vector< std::shared_ptr<const LayoutItem> > type_vec_const_layout_items;
   
 protected:
 
@@ -199,7 +199,7 @@ private:
    int m_column_index_key; //The index of the primary key in the Gda::DataModel.
 
    //Data:
-   sharedptr<SharedConnection> m_connection;
+   std::shared_ptr<SharedConnection> m_connection;
    Glib::RefPtr<Gnome::Gda::DataModel> m_gda_datamodel;
    guint m_data_model_rows_count;
    guint m_data_model_columns_count; //1 less than m_columns_count, which also has a model column for the 
key.
diff --git a/glom/mode_data/datawidget/treemodel_db_withextratext.cc 
b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
index ddbd03a..a296704 100644
--- a/glom/mode_data/datawidget/treemodel_db_withextratext.cc
+++ b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
@@ -42,8 +42,8 @@ DbTreeModelWithExtraText::DbTreeModelWithExtraText(const FoundSet& found_set, co
   int column_index = 0;
   for(type_vec_const_layout_items::const_iterator iter = layout_items.begin(); iter != layout_items.end(); 
++iter)
   {
-    const sharedptr<const LayoutItem_Field> item_field = 
-      sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    const std::shared_ptr<const LayoutItem_Field> item_field = 
+      std::dynamic_pointer_cast<const LayoutItem_Field>(*iter);
     if(item_field)
     {
       m_item_first = item_field;
diff --git a/glom/mode_data/datawidget/treemodel_db_withextratext.h 
b/glom/mode_data/datawidget/treemodel_db_withextratext.h
index 1459d11..7e610e3 100644
--- a/glom/mode_data/datawidget/treemodel_db_withextratext.h
+++ b/glom/mode_data/datawidget/treemodel_db_withextratext.h
@@ -63,7 +63,7 @@ private:
   
   
   int m_column_index_first; //The index of the first field in the TreeModel.
-  sharedptr<const LayoutItem_Field> m_item_first;
+  std::shared_ptr<const LayoutItem_Field> m_item_first;
 };
 
 } //namespace Glom
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index cb70fb6..55a84d0 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -355,7 +355,7 @@ Gtk::TreeModel::iterator DbAddDel::get_item_placeholder()
    return Gtk::TreeModel::iterator();
 }
 
-Gnome::Gda::Value DbAddDel::get_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const 
LayoutItem_Field>& layout_item) const
+Gnome::Gda::Value DbAddDel::get_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
LayoutItem_Field>& layout_item) const
 {
   Gnome::Gda::Value value;
 
@@ -390,7 +390,7 @@ Gnome::Gda::Value DbAddDel::get_value_key_selected() const
     return Gnome::Gda::Value();
 }
 
-Gnome::Gda::Value DbAddDel::get_value_selected(const sharedptr<const LayoutItem_Field>& layout_item) const
+Gnome::Gda::Value DbAddDel::get_value_selected(const std::shared_ptr<const LayoutItem_Field>& layout_item) 
const
 {
   return get_value(get_item_selected(), layout_item);
 }
@@ -446,7 +446,7 @@ Gtk::TreeModel::iterator DbAddDel::get_row(const Gnome::Gda::Value& key)
 bool DbAddDel::select_item(const Gtk::TreeModel::iterator& iter, bool start_editing)
 {
   //Find the first column with a layout_item:
-  sharedptr<const LayoutItem> layout_item;
+  std::shared_ptr<const LayoutItem> layout_item;
   for(type_column_items::const_iterator iter_columns = m_column_items.begin(); iter_columns != 
m_column_items.end(); ++iter_columns)
   {
     layout_item = *iter_columns;
@@ -457,7 +457,7 @@ bool DbAddDel::select_item(const Gtk::TreeModel::iterator& iter, bool start_edit
   return select_item(iter, layout_item, start_editing);
 }
 
-bool DbAddDel::select_item(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem>& 
layout_item, bool start_editing)
+bool DbAddDel::select_item(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const LayoutItem>& 
layout_item, bool start_editing)
 {
   if(!m_refListStore)
     return false;
@@ -550,7 +550,7 @@ guint DbAddDel::get_fixed_cell_height()
     {
       Glib::ustring font_name;
 
-      sharedptr<const LayoutItem_WithFormatting> item_withformatting = sharedptr<const 
LayoutItem_WithFormatting>::cast_dynamic(*iter);
+      std::shared_ptr<const LayoutItem_WithFormatting> item_withformatting = std::dynamic_pointer_cast<const 
LayoutItem_WithFormatting>(*iter);
       if(item_withformatting)
       {
          const Formatting& formatting = item_withformatting->get_formatting_used();
@@ -584,13 +584,13 @@ guint DbAddDel::get_fixed_cell_height()
 }
 
 
-Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const sharedptr<LayoutItem>& 
layout_item, int model_column_index, int data_model_column_index)
+Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const std::shared_ptr<LayoutItem>& 
layout_item, int model_column_index, int data_model_column_index)
 {
   InnerIgnore innerIgnore(this); //see comments for InnerIgnore class
 
   Gtk::CellRenderer* pCellRenderer = create_cell(layout_item, m_table_name, get_document(), 
get_fixed_cell_height());
 
-  sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
   //Set extra cellrenderer attributes, depending on the type used,
   //to support editing:
@@ -638,7 +638,7 @@ Gtk::CellRenderer* DbAddDel::construct_specified_columns_cellrenderer(const shar
   GlomCellRenderer_ButtonText* pCellButton = Gtk::manage( new GlomCellRenderer_ButtonText() );
   if(pCellButton)
   {
-    sharedptr<const LayoutItem_Button> item_button = sharedptr<const 
LayoutItem_Button>::cast_dynamic(layout_item);
+    std::shared_ptr<const LayoutItem_Button> item_button = std::dynamic_pointer_cast<const 
LayoutItem_Button>(layout_item);
     if(item_button)
     {
       pCellButton->signal_clicked().connect(
@@ -723,7 +723,7 @@ void DbAddDel::construct_specified_columns()
 
   for(type_column_items::iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    const sharedptr<LayoutItem> layout_item = m_column_items[model_column_index]; //TODO: Inefficient.
+    const std::shared_ptr<LayoutItem> layout_item = m_column_items[model_column_index]; //TODO: Inefficient.
     if(layout_item) //column_info.m_visible)
     {
       no_columns_used = false;
@@ -734,7 +734,7 @@ void DbAddDel::construct_specified_columns()
       // Whenever we are dealing with real database fields,
       // we need to know the index of the field in the query:
       int item_data_model_column_index = -1;
-      sharedptr<const LayoutItem_Field> item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<const LayoutItem_Field> item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
       if(item_field)
       {
         item_data_model_column_index = data_model_column_index;
@@ -835,12 +835,12 @@ bool DbAddDel::refresh_from_database_blank()
   return true;
 }
 
-void DbAddDel::set_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& 
layout_item, const Gnome::Gda::Value& value)
+void DbAddDel::set_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
LayoutItem_Field>& layout_item, const Gnome::Gda::Value& value)
 {
   set_value(iter, layout_item, value, true /* including the specified field */);
 }
 
-void DbAddDel::set_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& 
layout_item, const Gnome::Gda::Value& value, bool set_specified_field_layout)
+void DbAddDel::set_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
LayoutItem_Field>& layout_item, const Gnome::Gda::Value& value, bool set_specified_field_layout)
 {
   //g_warning("DbAddDel::set_value begin");
 
@@ -878,7 +878,7 @@ void DbAddDel::set_value(const Gtk::TreeModel::iterator& iter, const sharedptr<c
   //g_warning("DbAddDel::set_value end");
 }
 
-void DbAddDel::set_value_selected(const sharedptr<const LayoutItem_Field>& layout_item, const 
Gnome::Gda::Value& value)
+void DbAddDel::set_value_selected(const std::shared_ptr<const LayoutItem_Field>& layout_item, const 
Gnome::Gda::Value& value)
 {
   set_value(get_item_selected(), layout_item, value);
 }
@@ -891,8 +891,8 @@ void DbAddDel::refresh_cell_choices_data_from_database_with_foreign_key(guint mo
     return;
   }
 
-  sharedptr<const LayoutItem> item = m_column_items[model_index];
-  sharedptr<const LayoutItem_Field> layout_field = sharedptr<const LayoutItem_Field>::cast_dynamic(item);
+  std::shared_ptr<const LayoutItem> item = m_column_items[model_index];
+  std::shared_ptr<const LayoutItem_Field> layout_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
   if(!layout_field)
   {
     std::cerr << G_STRFUNC << ": The layout item was not a LayoutItem_Field." << std::endl;
@@ -937,7 +937,7 @@ void DbAddDel::set_columns(const LayoutGroup::type_list_items& layout_items)
 
   for(LayoutGroup::type_list_items::const_iterator iter = layout_items.begin(); iter != layout_items.end(); 
++iter)
   {
-    sharedptr<LayoutItem> layout_item = *iter;
+    std::shared_ptr<LayoutItem> layout_item = *iter;
 
     if(!layout_item)
       continue; //TODO: Do something more sensible.
@@ -945,10 +945,10 @@ void DbAddDel::set_columns(const LayoutGroup::type_list_items& layout_items)
     //Make it non-editable if it is auto-generated:
     //TODO: Actually use this bool:
     /*
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
     if(field)
     {
-      sharedptr<const Field> field_full = field->get_full_field_details();
+      std::shared_ptr<const Field> field_full = field->get_full_field_details();
       if(field_full && field_full->get_auto_increment())
         column_info.m_editable = false;
       else
@@ -973,7 +973,7 @@ FoundSet DbAddDel::get_found_set() const
   return m_found_set;
 }
 
-DbAddDel::type_list_indexes DbAddDel::get_data_model_column_index(const sharedptr<const LayoutItem_Field>& 
layout_item_field, bool including_specified_field_layout) const
+DbAddDel::type_list_indexes DbAddDel::get_data_model_column_index(const std::shared_ptr<const 
LayoutItem_Field>& layout_item_field, bool including_specified_field_layout) const
 {
   //TODO_Performance: Replace all this looping by a cache/map:
 
@@ -985,7 +985,7 @@ DbAddDel::type_list_indexes DbAddDel::get_data_model_column_index(const sharedpt
   guint data_model_column_index = 0;
   for(type_column_items::const_iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter); 
//TODO_Performance: This would be unnecessary if !layout_item_field
+    std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(*iter); //TODO_Performance: This would be unnecessary if !layout_item_field
     if(field)
     {
       if(field->is_same_field(layout_item_field)
@@ -1001,19 +1001,19 @@ DbAddDel::type_list_indexes DbAddDel::get_data_model_column_index(const sharedpt
   return list_indexes;
 }
 
-DbAddDel::type_list_indexes DbAddDel::get_column_index(const sharedptr<const LayoutItem>& layout_item) const
+DbAddDel::type_list_indexes DbAddDel::get_column_index(const std::shared_ptr<const LayoutItem>& layout_item) 
const
 {
   //TODO_Performance: Replace all this looping by a cache/map:
 
   type_list_indexes list_indexes;
 
-  sharedptr<const LayoutItem_Field> layout_item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem_Field> layout_item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
   guint i = 0;
   for(type_column_items::const_iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> item = *iter;
-    const sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(item); 
//TODO_Performance: This would be unnecessary if !layout_item_field
+    const std::shared_ptr<const LayoutItem> item = *iter;
+    const std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item); //TODO_Performance: This would be unnecessary if !layout_item_field
     if(field && layout_item_field && field->is_same_field(layout_item_field))
     {
       list_indexes.push_back(i);
@@ -1029,7 +1029,7 @@ DbAddDel::type_list_indexes DbAddDel::get_column_index(const sharedptr<const Lay
   return list_indexes;
 }
 
-DbAddDel::type_list_indexes DbAddDel::get_choice_index(const sharedptr<const LayoutItem_Field>& from_key)
+DbAddDel::type_list_indexes DbAddDel::get_choice_index(const std::shared_ptr<const LayoutItem_Field>& 
from_key)
 {
   type_list_indexes result;
 
@@ -1041,14 +1041,14 @@ DbAddDel::type_list_indexes DbAddDel::get_choice_index(const sharedptr<const Lay
   guint index = 0;
   for(type_column_items::const_iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+    std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const LayoutItem_Field>(*iter);
     if(!field)
        continue;
 
     const Formatting& format = field->get_formatting_used();
 
     bool choice_show_all = false;
-    const sharedptr<const Relationship> choice_relationship =
+    const std::shared_ptr<const Relationship> choice_relationship =
       format.get_choices_related_relationship(choice_show_all);
     if(choice_relationship && !choice_show_all) //"Show All" choices don't use the ID field values.
     {
@@ -1063,16 +1063,16 @@ DbAddDel::type_list_indexes DbAddDel::get_choice_index(const sharedptr<const Lay
 }
 
 
-sharedptr<const LayoutItem_Field> DbAddDel::get_column_field(guint column_index) const
+std::shared_ptr<const LayoutItem_Field> DbAddDel::get_column_field(guint column_index) const
 {
   if(column_index < m_column_items.size())
   {
-    sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic( 
m_column_items[column_index] );
+    std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>( 
m_column_items[column_index] );
     if(field)
       return field;
   }
 
-  return sharedptr<const LayoutItem_Field>();
+  return std::shared_ptr<const LayoutItem_Field>();
 }
 
 bool DbAddDel::get_prevent_user_signals() const
@@ -1288,8 +1288,8 @@ void DbAddDel::on_cell_layout_button_clicked(const Gtk::TreeModel::Path& path, i
   Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
   if(iter)
   {
-    sharedptr<const LayoutItem> layout_item = m_column_items[model_column_index];
-    sharedptr<const LayoutItem_Button> item_button = sharedptr<const 
LayoutItem_Button>::cast_dynamic(layout_item);
+    std::shared_ptr<const LayoutItem> layout_item = m_column_items[model_column_index];
+    std::shared_ptr<const LayoutItem_Button> item_button = std::dynamic_pointer_cast<const 
LayoutItem_Button>(layout_item);
     if(item_button)
     {
       m_signal_script_button_clicked.emit(item_button, iter);
@@ -1470,7 +1470,7 @@ void DbAddDel::on_treeview_cell_edited(const Glib::ustring& path_string, const G
     }
 
 
-    sharedptr<LayoutItem_Field> item_field = 
sharedptr<LayoutItem_Field>::cast_dynamic(m_column_items[model_column_index]);
+    std::shared_ptr<LayoutItem_Field> item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(m_column_items[model_column_index]);
     if(!item_field)
       return;
 
@@ -1602,7 +1602,7 @@ void DbAddDel::on_treeview_column_resized(int model_column_index, DbTreeViewColu
   if(n_view_columns && (view_column == m_TreeView.get_column(n_view_columns -1)))
     return;
 
-  const sharedptr<LayoutItem>& layout_item = m_column_items[model_column_index];
+  const std::shared_ptr<LayoutItem>& layout_item = m_column_items[model_column_index];
 
   const int width = view_column->get_width();
   //std::cout << "debug: " << G_STRFUNC << ": width=" << width << std::endl;
@@ -1622,7 +1622,7 @@ void DbAddDel::on_treeview_column_clicked(int model_column_index)
   if(model_column_index >= (int)m_column_items.size())
     return;
 
-  sharedptr<const LayoutItem_Field> layout_item = sharedptr<const 
LayoutItem_Field>::cast_dynamic(m_column_items[model_column_index]); //We can only sort on fields, not on 
other layout item.
+  std::shared_ptr<const LayoutItem_Field> layout_item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(m_column_items[model_column_index]); //We can only sort on fields, not on other layout item.
   if(layout_item && layout_item->get_name_not_empty())
   {
     bool ascending = true;
@@ -1683,9 +1683,9 @@ bool DbAddDel::get_column_to_expand(guint& column_to_expand) const
   guint i = 0;
   for(type_column_items::const_iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> layout_item = *iter;
+    std::shared_ptr<LayoutItem> layout_item = *iter;
 
-    sharedptr<LayoutItem_Field> layout_item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
     if(layout_item_field)
     {
       //Only text columns should expand.
@@ -1722,8 +1722,8 @@ guint DbAddDel::treeview_append_column(const Glib::ustring& title, Gtk::CellRend
 
   guint cols_count = m_TreeView.append_column(*pViewColumn);
 
-  sharedptr<const LayoutItem> layout_item = m_column_items[model_column_index];
-  sharedptr<const LayoutItem_Field> layout_item_field = sharedptr<const 
LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<const LayoutItem> layout_item = m_column_items[model_column_index];
+  std::shared_ptr<const LayoutItem_Field> layout_item_field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(layout_item);
 
   //Tell the Treeview.how to render the Gnome::Gda::Values:
   if(layout_item_field)
@@ -1911,12 +1911,12 @@ guint DbAddDel::get_count_hidden_system_columns() const
   //return 2; //The key and the placeholder boolean.
 }
 
-sharedptr<Field> DbAddDel::get_key_field() const
+std::shared_ptr<Field> DbAddDel::get_key_field() const
 {
   return m_key_field;
 }
 
-void DbAddDel::set_key_field(const sharedptr<Field>& field)
+void DbAddDel::set_key_field(const std::shared_ptr<Field>& field)
 {
   m_key_field = field;
 }
@@ -1927,9 +1927,9 @@ void DbAddDel::treeviewcolumn_on_cell_data(Gtk::CellRenderer* renderer, const Gt
 
   if(iter)
   {
-    const sharedptr<LayoutItem>& layout_item = m_column_items[model_column_index];
+    const std::shared_ptr<LayoutItem>& layout_item = m_column_items[model_column_index];
 
-    sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
     if(field)
     {
       const guint col_real = data_model_column_index + get_count_hidden_system_columns();
@@ -2102,7 +2102,7 @@ bool DbAddDel::start_new_record()
   if(!iter)
     return false;
 
-  sharedptr<LayoutItem_Field> fieldToEdit;
+  std::shared_ptr<LayoutItem_Field> fieldToEdit;
 
   //Start editing in the primary key or the first cell if the primary key is auto-incremented (because there 
is no point in editing an auto-generated value)
   //guint index_primary_key = 0;
@@ -2110,14 +2110,14 @@ bool DbAddDel::start_new_record()
   if(!bPresent)
     return false;
 
-  sharedptr<Field> fieldPrimaryKey = get_key_field();
+  std::shared_ptr<Field> fieldPrimaryKey = get_key_field();
   if(fieldPrimaryKey && fieldPrimaryKey->get_auto_increment())
   {
     //Start editing in the first cell that is not auto_increment:
     for(type_column_items::iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
     {
-      sharedptr<LayoutItem> layout_item = *iter;
-      sharedptr<LayoutItem_Field> layout_item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = *iter;
+      std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
       if(!(layout_item_field->get_full_field_details()->get_auto_increment()))
       {
         fieldToEdit = layout_item_field;
@@ -2128,7 +2128,7 @@ bool DbAddDel::start_new_record()
   else
   {
     //The primary key is not auto-increment, so start by editing it:
-    fieldToEdit = sharedptr<LayoutItem_Field>::create();
+    fieldToEdit = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
     fieldToEdit->set_full_field_details(fieldPrimaryKey);
   }
 
@@ -2153,12 +2153,12 @@ void DbAddDel::user_changed(const Gtk::TreeModel::iterator& row, guint col)
   const Gnome::Gda::Value parent_primary_key_value = get_value_key(row);
   //std::cout << "debug: " << G_STRFUNC << ": parent_primary_key_value=" << 
parent_primary_key_value.to_string() << std::endl;
 
-  sharedptr<const LayoutItem_Field> layout_field = get_column_field(col);
+  std::shared_ptr<const LayoutItem_Field> layout_field = get_column_field(col);
 
   if(!Conversions::value_is_empty(parent_primary_key_value)) //If the record's primary key is filled in:
   {
     Glib::ustring table_name = m_found_set.m_table_name;
-    sharedptr<Field> primary_key_field;
+    std::shared_ptr<Field> primary_key_field;
     Gnome::Gda::Value primary_key_value;
     Gtk::Window* window = get_appwindow();
 
@@ -2179,7 +2179,7 @@ void DbAddDel::user_changed(const Gtk::TreeModel::iterator& row, guint col)
 
         Document* document = dynamic_cast<Document*>(get_document());
 
-        sharedptr<Relationship> relationship = document->get_relationship(m_found_set.m_table_name, 
relationship_name);
+        std::shared_ptr<Relationship> relationship = document->get_relationship(m_found_set.m_table_name, 
relationship_name);
         if(relationship)
         {
           table_name = relationship->get_to_table();
@@ -2190,7 +2190,7 @@ void DbAddDel::user_changed(const Gtk::TreeModel::iterator& row, guint col)
           if(primary_key_field)
           {
             //Get the value of the corresponding key in the current table (that identifies the record in the 
table that we will change)
-            sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+            std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
             layout_item->set_full_field_details( document->get_field(relationship->get_from_table(), 
relationship->get_from_field()) );
 
             primary_key_value = get_value_selected(layout_item);
@@ -2219,7 +2219,7 @@ void DbAddDel::user_changed(const Gtk::TreeModel::iterator& row, guint col)
       //Update the field in the record (the record with this primary key):
       const Gnome::Gda::Value field_value = get_value(row, layout_field);
       //std::cout << "debug: " << G_STRFUNC << ": field_value = " << field_value.to_string() << std::endl;
-      //const sharedptr<const Field>& field = layout_field->m_field;
+      //const std::shared_ptr<const Field>& field = layout_field->m_field;
       //const Glib::ustring strFieldName = layout_field->get_name();
 
       LayoutFieldInRecord field_in_record(layout_field, m_found_set.m_table_name /* parent */, 
primary_key_field, primary_key_value);
@@ -2318,7 +2318,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
 
   Gnome::Gda::Value primary_key_value;
 
-  sharedptr<const Field> primary_key_field = get_key_field();
+  std::shared_ptr<const Field> primary_key_field = get_key_field();
 
   //Get the new primary key value, if one is available now:
   if(primary_key_field->get_auto_increment())
@@ -2334,7 +2334,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
     //This only works when the primary key is already stored: primary_key_value = get_value_key(row);
     //primary_key_value = get_value_key_selected();
 
-    sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_field = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_field->set_full_field_details(primary_key_field);
     primary_key_value = get_value_selected(layout_field);
     std::cout << "DEBUG: get_value_key_selected(): " << primary_key_value.to_string() << std::endl;
@@ -2344,7 +2344,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
   if(Conversions::value_is_empty(primary_key_value))
     return;
 
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(get_appwindow()); //Keep it alive while 
we need the data_model.
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(get_appwindow()); //Keep it alive 
while we need the data_model.
   if(!sharedconnection)
   {
     //Add Record failed.
@@ -2354,7 +2354,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
   }
 
 
-  sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layout_field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
   layout_field->set_full_field_details(primary_key_field);
   if(!check_entered_value_for_uniqueness(m_found_set.m_table_name, layout_field, primary_key_value, 
get_appwindow()))
   {
@@ -2382,7 +2382,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
   //If it's an auto-increment, then get the value and show it:
   if(primary_key_field->get_auto_increment())
   {
-    sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item->set_full_field_details(primary_key_field);
     set_value(row, layout_item, primary_key_value);
   }
@@ -2411,23 +2411,23 @@ void DbAddDel::user_requested_delete(const Gtk::TreeModel::iterator& rowStart, c
 }
 
 //An override of the Base_DB method:
-void DbAddDel::set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
+void DbAddDel::set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
 {
   return set_value_selected(field, value);
 }
 
 //An override of the Base_DB method:
-void DbAddDel::set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+void DbAddDel::set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   return set_value(row, field, value);
 }
 
-Gnome::Gda::Value DbAddDel::get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const
+Gnome::Gda::Value DbAddDel::get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const
 {
   return get_value_selected(field);
 }
 
-sharedptr<Field> DbAddDel::get_field_primary_key() const
+std::shared_ptr<Field> DbAddDel::get_field_primary_key() const
 {
   return get_key_field();
 }
diff --git a/glom/mode_data/db_adddel/db_adddel.h b/glom/mode_data/db_adddel/db_adddel.h
index dfc4b6f..955b056 100644
--- a/glom/mode_data/db_adddel/db_adddel.h
+++ b/glom/mode_data/db_adddel/db_adddel.h
@@ -87,7 +87,7 @@ public:
 
   void remove_item(const Gtk::TreeModel::iterator& iter);
 
-  Gnome::Gda::Value get_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& 
layout_item) const;
+  Gnome::Gda::Value get_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
LayoutItem_Field>& layout_item) const;
 
   /** Get the row's hidden key
    */
@@ -100,7 +100,7 @@ public:
   /** @param col A value returned from add_column().
    * @result The value on the selected row.
    */
-  Gnome::Gda::Value get_value_selected(const sharedptr<const LayoutItem_Field>& layout_item) const;
+  Gnome::Gda::Value get_value_selected(const std::shared_ptr<const LayoutItem_Field>& layout_item) const;
   Gnome::Gda::Value get_value_key_selected() const;
 
   Gtk::TreeModel::iterator get_item_selected();
@@ -112,7 +112,7 @@ public:
    * @param start_editing Whether editing should start in the cell.
    * @result Whether the row was successfully selected.
    */
-  bool select_item(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem>& layout_item, 
bool start_editing = false);  //bool indicates success.
+  bool select_item(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const LayoutItem>& 
layout_item, bool start_editing = false);  //bool indicates success.
   bool select_item(const Gtk::TreeModel::iterator& iter, bool start_editing = false);
 
   guint get_count() const;
@@ -122,13 +122,13 @@ public:
    * @param layout_item Describes the column(s) whose values should be changed.
    * @param value The new value.
    */
-  virtual void set_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& 
layout_item, const Gnome::Gda::Value& value);
+  virtual void set_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
LayoutItem_Field>& layout_item, const Gnome::Gda::Value& value);
 
   /**
    * @param col A value returned from add_column().
    * @param value The new value.
    */
-  virtual void set_value_selected(const sharedptr<const LayoutItem_Field>& layout_item, const 
Gnome::Gda::Value& value);
+  virtual void set_value_selected(const std::shared_ptr<const LayoutItem_Field>& layout_item, const 
Gnome::Gda::Value& value);
 
   bool get_is_first_row(const Gtk::TreeModel::iterator& iter) const;
 
@@ -143,8 +143,8 @@ public:
    */
   bool get_is_placeholder_row(const Gtk::TreeModel::iterator& iter) const;
 
-  sharedptr<Field> get_key_field() const;
-  void set_key_field(const sharedptr<Field>& field);
+  std::shared_ptr<Field> get_key_field() const;
+  void set_key_field(const std::shared_ptr<Field>& field);
 
   void set_table_name(const Glib::ustring& table_name);
 
@@ -172,7 +172,7 @@ public:
 
   guint get_columns_count() const;
 
-  sharedptr<const LayoutItem_Field> get_column_field(guint column_index) const;
+  std::shared_ptr<const LayoutItem_Field> get_column_field(guint column_index) const;
 
   typedef std::vector<Glib::ustring> type_vec_strings;
 
@@ -225,7 +225,7 @@ public:
    * @param layout_button The layout item for the script button that was clicked.
    * @param row
    */
-  typedef sigc::signal<void, const sharedptr<const LayoutItem_Button>&, const Gtk::TreeModel::iterator&> 
type_signal_script_button_clicked;
+  typedef sigc::signal<void, const std::shared_ptr<const LayoutItem_Button>&, const 
Gtk::TreeModel::iterator&> type_signal_script_button_clicked;
   type_signal_script_button_clicked signal_script_button_clicked();
 
   /** Allow a parent widget to set the foreign key when a record is added,
@@ -274,36 +274,36 @@ public:
 
 private:
 
-  void set_value(const Gtk::TreeModel::iterator& iter, const sharedptr<const LayoutItem_Field>& layout_item, 
const Gnome::Gda::Value& value, bool set_specified_field_layout);
+  void set_value(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const LayoutItem_Field>& 
layout_item, const Gnome::Gda::Value& value, bool set_specified_field_layout);
 
   //Overrides of Base_DB/Base_DB_Table methods:
-  virtual void set_entered_field_data(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
-  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const sharedptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
-  virtual Gnome::Gda::Value get_entered_field_data(const sharedptr<const LayoutItem_Field>& field) const;
+  virtual void set_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
+  virtual void set_entered_field_data(const Gtk::TreeModel::iterator& row, const std::shared_ptr<const 
LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  virtual Gnome::Gda::Value get_entered_field_data(const std::shared_ptr<const LayoutItem_Field>& field) 
const;
   virtual Gtk::TreeModel::iterator get_row_selected();
 
   //Implementations of pure virtual methods from Base_DB_Table_Data:
-  virtual sharedptr<Field> get_field_primary_key() const;
+  virtual std::shared_ptr<Field> get_field_primary_key() const;
   virtual Gnome::Gda::Value get_primary_key_value_selected() const;
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value);
   virtual Gnome::Gda::Value get_primary_key_value(const Gtk::TreeModel::iterator& row) const;
 
-  Gtk::CellRenderer* construct_specified_columns_cellrenderer(const sharedptr<LayoutItem>& layout_item, int 
model_column_index, int data_model_column_index);
+  Gtk::CellRenderer* construct_specified_columns_cellrenderer(const std::shared_ptr<LayoutItem>& 
layout_item, int model_column_index, int data_model_column_index);
 
   bool get_model_column_index(guint view_column_index, guint& model_column_index);
 
 
   typedef std::list<guint> type_list_indexes;
   ///Return the column indexes of any columns that display this field.
-  type_list_indexes get_column_index(const sharedptr<const LayoutItem>& layout_item) const;
+  type_list_indexes get_column_index(const std::shared_ptr<const LayoutItem>& layout_item) const;
 
   /// Get indexes of any columns with choices with !show_all relationships that have @a from_key as the 
from_key.
-  type_list_indexes get_choice_index(const sharedptr<const LayoutItem_Field>& from_key);
+  type_list_indexes get_choice_index(const std::shared_ptr<const LayoutItem_Field>& from_key);
 
   /** Return the query column index of any columns that display this field:
    * @param including_specified_field_layout If false, then don't return the actual layout item itself.
    */
-  type_list_indexes get_data_model_column_index(const sharedptr<const LayoutItem_Field>& layout_item_field, 
bool including_specified_field_layout = true) const;
+  type_list_indexes get_data_model_column_index(const std::shared_ptr<const LayoutItem_Field>& 
layout_item_field, bool including_specified_field_layout = true) const;
 
 protected:
   void setup_menu();
@@ -387,7 +387,7 @@ private:
 
   void refresh_cell_choices_data_from_database_with_foreign_key(guint model_index, const Gnome::Gda::Value& 
foreign_key_value);
 
-  static void apply_formatting(Gtk::CellRenderer* renderer, const sharedptr<const 
LayoutItem_WithFormatting>& layout_item);
+  static void apply_formatting(Gtk::CellRenderer* renderer, const std::shared_ptr<const 
LayoutItem_WithFormatting>& layout_item);
 
   typedef Gtk::Box type_base;
 
@@ -441,7 +441,7 @@ private:
   Glib::ustring m_validation_invalid_text_for_retry;
 
   /// The primary key for the table:
-  sharedptr<Field> m_key_field;
+  std::shared_ptr<Field> m_key_field;
 
   bool m_allow_view;
   bool m_allow_view_details;
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index c3f3230..893af4e 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -92,16 +92,16 @@ void FlowTableWithFields::set_table(const Glib::ustring& table_name)
   }
 }
 
-void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
+void FlowTableWithFields::add_layout_item(const std::shared_ptr<LayoutItem>& item)
 {
   //Get derived type and do the appropriate thing:
-  sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+  std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
   if(field)
   {
     add_field(field, m_table_name);
 
     //Do not allow editing of auto-increment fields:
-    sharedptr<const Field> field_details = field->get_full_field_details();
+    std::shared_ptr<const Field> field_details = field->get_full_field_details();
     if(field_details)
     {
       if(field_details->get_auto_increment())
@@ -112,36 +112,36 @@ void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
   }
   else
   {
-    sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(item);
     if(portal)
     {
       add_layout_portal(portal);
     }
     else
     {
-      sharedptr<LayoutItem_Notebook> notebook = sharedptr<LayoutItem_Notebook>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Notebook> notebook = std::dynamic_pointer_cast<LayoutItem_Notebook>(item);
       if(notebook)
       {
         add_layout_notebook(notebook);
       }
       else
       {
-        sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(item);
+        std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(item);
         if(group)
           add_layout_group(group);
         else
         {
-          sharedptr<LayoutItem_Button> layout_button = sharedptr<LayoutItem_Button>::cast_dynamic(item);
+          std::shared_ptr<LayoutItem_Button> layout_button = 
std::dynamic_pointer_cast<LayoutItem_Button>(item);
           if(layout_button)
             add_button(layout_button, m_table_name);
           else
           {
-            sharedptr<LayoutItem_Text> layout_textobject = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+            std::shared_ptr<LayoutItem_Text> layout_textobject = 
std::dynamic_pointer_cast<LayoutItem_Text>(item);
             if(layout_textobject)
               add_textobject(layout_textobject, m_table_name);
             else
             {
-              sharedptr<LayoutItem_Image> layout_imageobject = 
sharedptr<LayoutItem_Image>::cast_dynamic(item);
+              std::shared_ptr<LayoutItem_Image> layout_imageobject = 
std::dynamic_pointer_cast<LayoutItem_Image>(item);
               if(layout_imageobject)
                 add_imageobject(layout_imageobject, m_table_name);
             }
@@ -152,7 +152,7 @@ void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
   }
 }
 
-void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent)
+void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool with_indent)
 {
   if(!group)
     return;
@@ -221,7 +221,7 @@ void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group,
     LayoutGroup::type_list_items items = group->get_items();
     for(LayoutGroup::type_list_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
     {
-      sharedptr<LayoutItem> item = *iter;
+      std::shared_ptr<LayoutItem> item = *iter;
       if(item)
       {
         flow_table->add_layout_item(item);
@@ -247,7 +247,7 @@ void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group,
   }
 }
 
-Box_Data_List_Related* FlowTableWithFields::create_related(const sharedptr<LayoutItem_Portal>& portal, bool 
show_title)
+Box_Data_List_Related* FlowTableWithFields::create_related(const std::shared_ptr<LayoutItem_Portal>& portal, 
bool show_title)
 {
   if(!portal)
     return 0;
@@ -266,7 +266,7 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const sharedptr<Layou
       portal_box->init_db_details(m_table_name, show_title);
 
     Glib::ustring to_table;
-    sharedptr<Relationship> relationship = pDocument->get_relationship(m_table_name, 
portal->get_relationship_name());
+    std::shared_ptr<Relationship> relationship = pDocument->get_relationship(m_table_name, 
portal->get_relationship_name());
     if(relationship)
       to_table = relationship->get_to_table();
 
@@ -287,7 +287,7 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const sharedptr<Layou
   return 0;
 }
 
-Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const 
sharedptr<LayoutItem_CalendarPortal>& portal, bool show_title)
+Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const 
std::shared_ptr<LayoutItem_CalendarPortal>& portal, bool show_title)
 {
   if(!portal)
     return 0;
@@ -306,7 +306,7 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const sh
       portal_box->init_db_details(m_table_name, show_title);
 
     Glib::ustring to_table;
-    sharedptr<Relationship> relationship = pDocument->get_relationship(m_table_name, 
portal->get_relationship_name());
+    std::shared_ptr<Relationship> relationship = pDocument->get_relationship(m_table_name, 
portal->get_relationship_name());
     if(relationship)
       to_table = relationship->get_to_table();
 
@@ -327,10 +327,10 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const sh
   return 0;
 }
 
-void FlowTableWithFields::add_layout_portal(const sharedptr<LayoutItem_Portal>& portal)
+void FlowTableWithFields::add_layout_portal(const std::shared_ptr<LayoutItem_Portal>& portal)
 {
   Box_Data_Portal* portal_box = 0;
-  sharedptr<LayoutItem_CalendarPortal> calendar_portal = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(portal);
+  std::shared_ptr<LayoutItem_CalendarPortal> calendar_portal = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(portal);
   if(calendar_portal)
     portal_box = create_related_calendar(calendar_portal);
   else
@@ -345,7 +345,7 @@ void FlowTableWithFields::add_layout_portal(const sharedptr<LayoutItem_Portal>&
     std::cerr << G_STRFUNC << ": No portal was created." << std::endl;
 }
 
-void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Notebook>& notebook)
+void FlowTableWithFields::add_layout_notebook(const std::shared_ptr<LayoutItem_Notebook>& notebook)
 {
   if(!notebook)
     return;
@@ -358,7 +358,7 @@ void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Noteboo
 
   for(LayoutGroup::type_list_items::iterator iter = notebook->m_list_items.begin(); iter != 
notebook->m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(*iter);
+    std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(*iter);
     if(group)
     {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -371,7 +371,7 @@ void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Noteboo
 
       tab_label->set_label(item_get_title_or_name(group));
 
-      sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(group);
+      std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(group);
       if(portal)
       {
         //Add a Related Records list for this portal:
@@ -418,7 +418,7 @@ void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Noteboo
         LayoutGroup::type_list_items items = group->get_items();
         for(LayoutGroup::type_list_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
         {
-          sharedptr<LayoutItem> item = *iter;
+          std::shared_ptr<LayoutItem> item = *iter;
           if(item)
           {
             flow_table->add_layout_item(item);
@@ -500,7 +500,7 @@ void FlowTableWithFields::add_group(const Glib::ustring& group_name, const Glib:
 }
 */
 
-void FlowTableWithFields::add_field(const sharedptr<LayoutItem_Field>& layoutitem_field, const 
Glib::ustring& table_name)
+void FlowTableWithFields::add_field(const std::shared_ptr<LayoutItem_Field>& layoutitem_field, const 
Glib::ustring& table_name)
 {
   Info info;
   info.m_field = layoutitem_field;
@@ -562,7 +562,7 @@ void FlowTableWithFields::add_field(const sharedptr<LayoutItem_Field>& layoutite
 }
 
 
-void FlowTableWithFields::add_button(const sharedptr<LayoutItem_Button>& layoutitem_button, const 
Glib::ustring& table_name)
+void FlowTableWithFields::add_button(const std::shared_ptr<LayoutItem_Button>& layoutitem_button, const 
Glib::ustring& table_name)
 {
   //Add the widget
   ButtonGlom* button = Gtk::manage(new ButtonGlom());
@@ -603,7 +603,7 @@ void FlowTableWithFields::add_button(const sharedptr<LayoutItem_Button>& layouti
   apply_formatting(*button, layoutitem_button);
 }
 
-void FlowTableWithFields::add_textobject(const sharedptr<LayoutItem_Text>& layoutitem_text, const 
Glib::ustring& table_name)
+void FlowTableWithFields::add_textobject(const std::shared_ptr<LayoutItem_Text>& layoutitem_text, const 
Glib::ustring& table_name)
 {
   //Add the widget:
 
@@ -645,7 +645,7 @@ void FlowTableWithFields::add_textobject(const sharedptr<LayoutItem_Text>& layou
   }
 }
 
-void FlowTableWithFields::add_imageobject(const sharedptr<LayoutItem_Image>& layoutitem_image, const 
Glib::ustring& table_name)
+void FlowTableWithFields::add_imageobject(const std::shared_ptr<LayoutItem_Image>& layoutitem_image, const 
Glib::ustring& table_name)
 {
   //Add the widget:
   ImageGlom* image = Gtk::manage(new ImageGlom());
@@ -678,16 +678,16 @@ void FlowTableWithFields::add_imageobject(const sharedptr<LayoutItem_Image>& lay
 
 void FlowTableWithFields::get_layout_groups(Document::type_list_layout_groups& groups)
 {
-  sharedptr<LayoutGroup> group(get_layout_group());
+  std::shared_ptr<LayoutGroup> group(get_layout_group());
   if(group)
   {
     groups.push_back(group);
   }
 }
 
-sharedptr<LayoutGroup> FlowTableWithFields::get_layout_group()
+std::shared_ptr<LayoutGroup> FlowTableWithFields::get_layout_group()
 {
-  return sharedptr<LayoutGroup>::cast_dynamic(get_layout_item());
+  return std::dynamic_pointer_cast<LayoutGroup>(get_layout_item());
 }
 
 
@@ -717,12 +717,12 @@ void FlowTableWithFields::remove_field(const Glib::ustring& id)
   }
 }
 
-void FlowTableWithFields::set_field_value(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
+void FlowTableWithFields::set_field_value(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
 {
   set_field_value(field, value, true);
 }
 
-void FlowTableWithFields::set_field_value(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value, bool set_specified_field_layout)
+void FlowTableWithFields::set_field_value(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value, bool set_specified_field_layout)
 {
   //Set widgets which should show the value of this field:
   type_list_widgets list_widgets = get_field(field, set_specified_field_layout);
@@ -760,12 +760,12 @@ void FlowTableWithFields::set_field_value(const sharedptr<const LayoutItem_Field
   }
 }
 
-void FlowTableWithFields::set_other_field_value(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
+void FlowTableWithFields::set_other_field_value(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value)
 {
   set_field_value(field, value, false);
 }
 
-Gnome::Gda::Value FlowTableWithFields::get_field_value(const sharedptr<const LayoutItem_Field>& field) const
+Gnome::Gda::Value FlowTableWithFields::get_field_value(const std::shared_ptr<const LayoutItem_Field>& field) 
const
 {
   type_list_const_widgets list_widgets = get_field(field, true);
   for(type_list_const_widgets::const_iterator iter = list_widgets.begin();
@@ -784,7 +784,7 @@ Gnome::Gda::Value FlowTableWithFields::get_field_value(const sharedptr<const Lay
   return Gnome::Gda::Value(); //null.
 }
 
-void FlowTableWithFields::set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable)
+void FlowTableWithFields::set_field_editable(const std::shared_ptr<const LayoutItem_Field>& field, bool 
editable)
 {
   type_list_widgets list_widgets = get_field(field, true);
   for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
@@ -797,7 +797,7 @@ void FlowTableWithFields::set_field_editable(const sharedptr<const LayoutItem_Fi
   }
 }
 
-void FlowTableWithFields::update_choices(const sharedptr<const LayoutItem_Field>& field)
+void FlowTableWithFields::update_choices(const std::shared_ptr<const LayoutItem_Field>& field)
 {
   type_list_widgets list_widgets = get_field(field, true);
   for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
@@ -811,9 +811,9 @@ void FlowTableWithFields::update_choices(const sharedptr<const LayoutItem_Field>
     if(!combo)
       continue;
 
-    const sharedptr<const LayoutItem> layout_item = combo->get_layout_item();
-    const sharedptr<const LayoutItem_Field> layout_item_field = 
-      sharedptr<const LayoutItem_Field>::cast_dynamic(layout_item);
+    const std::shared_ptr<const LayoutItem> layout_item = combo->get_layout_item();
+    const std::shared_ptr<const LayoutItem_Field> layout_item_field = 
+      std::dynamic_pointer_cast<const LayoutItem_Field>(layout_item);
     if(!layout_item_field || !layout_item_field->get_formatting_used().get_has_related_choices())
       continue;
 
@@ -825,7 +825,7 @@ void FlowTableWithFields::update_choices(const sharedptr<const LayoutItem_Field>
 }
 
 
-FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const sharedptr<const LayoutItem_Field>& 
from_key)
+FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const std::shared_ptr<const 
LayoutItem_Field>& from_key)
 {
   type_portals result;
 
@@ -838,10 +838,10 @@ FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const sharedp
     Box_Data_Portal* pPortalUI = *iter;
     if(pPortalUI)
     {
-      sharedptr<LayoutItem_Portal> portal = pPortalUI->get_portal();
+      std::shared_ptr<LayoutItem_Portal> portal = pPortalUI->get_portal();
       if(portal)
       {
-        sharedptr<const Relationship> relationship = portal->get_relationship(); //In this case, we only 
care about the first relationship (not any child relationships), because that's what would trigger a change.
+        std::shared_ptr<const Relationship> relationship = portal->get_relationship(); //In this case, we 
only care about the first relationship (not any child relationships), because that's what would trigger a 
change.
         if(relationship && (relationship->get_from_field() == from_key_name))
           result.push_back(pPortalUI);
       }
@@ -870,7 +870,7 @@ FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const sharedp
   return result;
 }
 
-FlowTableWithFields::type_choice_widgets FlowTableWithFields::get_choice_widgets(const sharedptr<const 
LayoutItem_Field>& from_key)
+FlowTableWithFields::type_choice_widgets FlowTableWithFields::get_choice_widgets(const std::shared_ptr<const 
LayoutItem_Field>& from_key)
 {
   type_choice_widgets result;
   if(!from_key)
@@ -890,17 +890,17 @@ FlowTableWithFields::type_choice_widgets FlowTableWithFields::get_choice_widgets
     if(!combochoices)
       continue;
 
-    const sharedptr<const LayoutItem> layout_item =
+    const std::shared_ptr<const LayoutItem> layout_item =
       combochoices->get_layout_item();
-    const sharedptr<const LayoutItem_Field> field =
-       sharedptr<const LayoutItem_Field>::cast_dynamic(layout_item);
+    const std::shared_ptr<const LayoutItem_Field> field =
+       std::dynamic_pointer_cast<const LayoutItem_Field>(layout_item);
     if(!field)
       continue;
 
     const Formatting& format = field->get_formatting_used();
 
     bool choice_show_all = false;
-    const sharedptr<const Relationship> choice_relationship =
+    const std::shared_ptr<const Relationship> choice_relationship =
       format.get_choices_related_relationship(choice_show_all);
     if(choice_show_all)
       continue; //"Show All" choices don't use the ID field values.
@@ -932,7 +932,7 @@ namespace
   // Get the direct widgets represesenting a given layout item
   // from a flowtable, without considering subflowtables:
   template<typename InputIterator, typename OutputIterator>
-  static void get_direct_fields(InputIterator begin, InputIterator end, OutputIterator out, const 
sharedptr<const LayoutItem_Field>& layout_item, bool include_item)
+  static void get_direct_fields(InputIterator begin, InputIterator end, OutputIterator out, const 
std::shared_ptr<const LayoutItem_Field>& layout_item, bool include_item)
   {
     for(InputIterator iter = begin; iter != end; ++iter)
     {
@@ -947,7 +947,7 @@ namespace
   }
 }
 
-FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(const sharedptr<const 
LayoutItem_Field>& layout_item, bool include_item) const
+FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(const std::shared_ptr<const 
LayoutItem_Field>& layout_item, bool include_item) const
 {
   type_list_const_widgets result;
 
@@ -971,7 +971,7 @@ FlowTableWithFields::type_list_const_widgets FlowTableWithFields::get_field(cons
   return result;
 }
 
-FlowTableWithFields::type_list_widgets FlowTableWithFields::get_field(const sharedptr<const 
LayoutItem_Field>& layout_item, bool include_item)
+FlowTableWithFields::type_list_widgets FlowTableWithFields::get_field(const std::shared_ptr<const 
LayoutItem_Field>& layout_item, bool include_item)
 {
   type_list_widgets result;
 
@@ -1077,22 +1077,22 @@ FlowTableWithFields::type_signal_script_button_clicked FlowTableWithFields::sign
   return m_signal_script_button_clicked;
 }
 
-void FlowTableWithFields::on_script_button_clicked(const sharedptr< LayoutItem_Button>& layout_item)
+void FlowTableWithFields::on_script_button_clicked(const std::shared_ptr< LayoutItem_Button>& layout_item)
 {
   m_signal_script_button_clicked.emit(layout_item);
 }
 
-void FlowTableWithFields::on_entry_edited(const Gnome::Gda::Value& value, const sharedptr<const 
LayoutItem_Field> field)
+void FlowTableWithFields::on_entry_edited(const Gnome::Gda::Value& value, const std::shared_ptr<const 
LayoutItem_Field> field)
 {
   m_signal_field_edited.emit(field, value);
 }
 
-void FlowTableWithFields::on_entry_choices_changed(const sharedptr<const LayoutItem_Field> field)
+void FlowTableWithFields::on_entry_choices_changed(const std::shared_ptr<const LayoutItem_Field> field)
 {
   m_signal_field_choices_changed.emit(field);
 }
 
-void FlowTableWithFields::on_entry_open_details_requested(const Gnome::Gda::Value& value, const 
sharedptr<const LayoutItem_Field> field)
+void FlowTableWithFields::on_entry_open_details_requested(const Gnome::Gda::Value& value, const 
std::shared_ptr<const LayoutItem_Field> field)
 {
   m_signal_field_open_details_requested.emit(field, value);
 }
@@ -1131,7 +1131,7 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
   //so the new item will be after that item, next to it.
 
   //Get the widget's layout item:
-  sharedptr<const LayoutItem> layout_item = pDataWidget->get_layout_item();
+  std::shared_ptr<const LayoutItem> layout_item = pDataWidget->get_layout_item();
   if(!layout_item)
   {
     std::cerr << G_STRFUNC << ": layout_item is null." << std::endl;
@@ -1141,7 +1141,7 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
   //std::cout << "debug: layout_item name=" << layout_item->get_name() << std::endl;
 
   //Get the group that the widget's layout item is in:
-  sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(get_layout_item());
   if(!layout_group)
   {
     std::cerr << G_STRFUNC << ": layout_group is null." << std::endl;
@@ -1150,10 +1150,10 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
 
 
   //Create/Choose the new layout item:
-  sharedptr<LayoutItem> layout_item_new;
+  std::shared_ptr<LayoutItem> layout_item_new;
   if(item_type == LayoutWidgetBase::TYPE_FIELD)
   {
-    sharedptr<LayoutItem_Field> layout_item_field = pDataWidget->offer_field_list(m_table_name);
+    std::shared_ptr<LayoutItem_Field> layout_item_field = pDataWidget->offer_field_list(m_table_name);
     if(layout_item_field)
     {
       //TODO: privileges.
@@ -1162,17 +1162,17 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
   }
   else if(item_type == LayoutWidgetBase::TYPE_GROUP)
   {
-    sharedptr<LayoutGroup> layout_item = sharedptr<LayoutGroup>::create();
+    std::shared_ptr<LayoutGroup> layout_item = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     layout_item->set_title_original(_("New Group"));
     layout_item_new = layout_item;
   }
   else if(item_type == LayoutWidgetBase::TYPE_NOTEBOOK)
   {
-    sharedptr<LayoutItem_Notebook> layout_item = sharedptr<LayoutItem_Notebook>::create();
+    std::shared_ptr<LayoutItem_Notebook> layout_item = std::shared_ptr<LayoutItem_Notebook>(new 
LayoutItem_Notebook());
     layout_item->set_name(_("notebook"));
 
     //Add an example tab, so that it shows up.
-    sharedptr<LayoutGroup> group_tab = sharedptr<LayoutGroup>::create();
+    std::shared_ptr<LayoutGroup> group_tab = std::shared_ptr<LayoutGroup>(new LayoutGroup());
 
     //Note to translators: This is the default name (not seen by most users) for a notebook tab.
     group_tab->set_name(_("tab1"));
@@ -1190,14 +1190,14 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
   }
   else if(item_type == LayoutWidgetBase::TYPE_BUTTON)
   {
-    sharedptr<LayoutItem_Button> layout_item = sharedptr<LayoutItem_Button>::create();
+    std::shared_ptr<LayoutItem_Button> layout_item = std::shared_ptr<LayoutItem_Button>(new 
LayoutItem_Button());
     layout_item->set_name(_("button"));
     layout_item->set_title_original(_("New Button"));
     layout_item_new = layout_item;
   }
   else if(item_type == LayoutWidgetBase::TYPE_TEXT)
   {
-    sharedptr<LayoutItem_Text> layout_item = sharedptr<LayoutItem_Text>::create();
+    std::shared_ptr<LayoutItem_Text> layout_item = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
     layout_item->set_name(_("text"));
     layout_item->set_text_original(_("New Text"));
     layout_item_new = layout_item;
@@ -1208,7 +1208,7 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
   {
     layout_group->add_item(layout_item_new, layout_item);
 
-    //We have changed the structure itself in the document, because we are using the same structure via 
sharedptr.
+    //We have changed the structure itself in the document, because we are using the same structure via 
std::shared_ptr.
     //So we just tell the parent widgets to rebuild the layout from the document:
     signal_layout_changed().emit(); //This should result in a complete re-layout.
   }
@@ -1218,7 +1218,7 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
 //TODO: Use Value by const &
 void FlowTableWithFields::on_portal_user_requested_details(Gnome::Gda::Value primary_key_value, 
Box_Data_Portal* portal_box)
 {
-  sharedptr<const LayoutItem_Portal> portal = portal_box->get_portal();
+  std::shared_ptr<const LayoutItem_Portal> portal = portal_box->get_portal();
   if(!portal)
     return;
 
@@ -1336,7 +1336,7 @@ void FlowTableWithFields::on_menu_properties_activate()
   const int response = dialog->run();
   if(response == Gtk::RESPONSE_OK)
   {
-    sharedptr<LayoutGroup> group = get_layout_group();
+    std::shared_ptr<LayoutGroup> group = get_layout_group();
     group->set_columns_count( dialog->get_columns_count() );
     group->set_title(dialog->get_title(), AppWindow::get_current_locale());
     signal_layout_changed().emit();
@@ -1391,12 +1391,12 @@ bool FlowTableWithFields::on_button_press_event(GdkEventButton *event)
 }
 
 //TODO: Rename this? It's not a simpler getter. It does UI.
-sharedptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship()
+std::shared_ptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship()
 {
   Dialog_ChooseRelationship* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
   if(!dialog) //Unlikely and it already warns on stderr.
-    return sharedptr<LayoutItem_Portal>();
+    return std::shared_ptr<LayoutItem_Portal>();
 
   Document* pDocument = static_cast<Document*>(get_document());
   dialog->set_document(pDocument, m_table_name);
@@ -1406,10 +1406,10 @@ sharedptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship()
   if(response == Gtk::RESPONSE_OK)
   {
     //Get the chosen relationship:
-    sharedptr<Relationship> relationship  = dialog->get_relationship_chosen();
+    std::shared_ptr<Relationship> relationship  = dialog->get_relationship_chosen();
     if(relationship)
     {
-      sharedptr<LayoutItem_Portal> layout_item = sharedptr<LayoutItem_Portal>::create();
+      std::shared_ptr<LayoutItem_Portal> layout_item = std::shared_ptr<LayoutItem_Portal>(new 
LayoutItem_Portal());
       layout_item->set_relationship(relationship);
       delete dialog;
       return layout_item;
@@ -1417,7 +1417,7 @@ sharedptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship()
   }
 
   delete dialog;
-  return sharedptr<LayoutItem_Portal>();
+  return std::shared_ptr<LayoutItem_Portal>();
 }
 
 void FlowTableWithFields::set_find_mode(bool val)
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index e82d39e..2cc5656 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -81,36 +81,36 @@ public:
    * @param layoutitem_field The layout item that describes this field,
    * @param table_name The table on which this layout appears.
    */
-  void add_field(const sharedptr<LayoutItem_Field>& layoutitem_field, const Glib::ustring& table_name);
+  void add_field(const std::shared_ptr<LayoutItem_Field>& layoutitem_field, const Glib::ustring& table_name);
 
   void remove_field(const Glib::ustring& id);
 
   typedef std::map<int, Field> type_map_field_sequence;
   //virtual void add_group(const Glib::ustring& group_name, const Glib::ustring& group_title, const 
type_map_field_sequence& fields);
 
-  void add_layout_item(const sharedptr<LayoutItem>& item);
+  void add_layout_item(const std::shared_ptr<LayoutItem>& item);
 
   /**
    * @param with_indent Pass true for top-level groups, to avoid wasting extra space with an unnecessary 
indent.
    */
-  void add_layout_group(const sharedptr<LayoutGroup>& group, bool with_indent = true);
+  void add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool with_indent = true);
 
-  void set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable = true);
+  void set_field_editable(const std::shared_ptr<const LayoutItem_Field>& field, bool editable = true);
 
-  Gnome::Gda::Value get_field_value(const sharedptr<const LayoutItem_Field>& field) const;
+  Gnome::Gda::Value get_field_value(const std::shared_ptr<const LayoutItem_Field>& field) const;
 
   /** Set the displayed @a value in any instances of the specified @a field.
    */
-  void set_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  void set_field_value(const std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
 
   /** Set the displayed @a value in any instances of the field other than the specified @a layout_field.
    */
-  void set_other_field_value(const sharedptr<const LayoutItem_Field>& layout_field, const Gnome::Gda::Value& 
value);
+  void set_other_field_value(const std::shared_ptr<const LayoutItem_Field>& layout_field, const 
Gnome::Gda::Value& value);
 
   /** Refresh the list of related records in choice combo boxes, 
    * in any instance of the specified field.
    */
-  void update_choices(const sharedptr<const LayoutItem_Field>& field);
+  void update_choices(const std::shared_ptr<const LayoutItem_Field>& field);
 
   typedef std::list<Gtk::Widget*> type_list_widgets;
   typedef std::list<const Gtk::Widget*> type_list_const_widgets;
@@ -141,27 +141,27 @@ public:
    * or a new relationship for a portal.
    */
   void get_layout_groups(Document::type_list_layout_groups& groups);
-  sharedptr<LayoutGroup> get_layout_group();
+  std::shared_ptr<LayoutGroup> get_layout_group();
   
   void set_enable_drag_and_drop(bool enabled = true);
 
   /** For instance,
-   * void on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& 
value);
+   * void on_flowtable_field_edited(const std::shared_ptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
    */
-  typedef sigc::signal<void, const sharedptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> 
type_signal_field_edited;
+  typedef sigc::signal<void, const std::shared_ptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> 
type_signal_field_edited;
   type_signal_field_edited signal_field_edited();
 
   /** For instance,
-   * void on_flowtable_field_choices_changed(const sharedptr<const LayoutItem_Field>& field);
+   * void on_flowtable_field_choices_changed(const std::shared_ptr<const LayoutItem_Field>& field);
    */
-  typedef sigc::signal<void, const sharedptr<const LayoutItem_Field>&> type_signal_field_choices_changed;
+  typedef sigc::signal<void, const std::shared_ptr<const LayoutItem_Field>&> 
type_signal_field_choices_changed;
   type_signal_field_choices_changed signal_field_choices_changed();
 
 
   /** For instance,
-   * void on_flowtable_field_open_details_requested(const sharedptr<const LayoutItem_Field>& field, const 
Gnome::Gda::Value& value);
+   * void on_flowtable_field_open_details_requested(const std::shared_ptr<const LayoutItem_Field>& field, 
const Gnome::Gda::Value& value);
    */
-  typedef sigc::signal<void, const sharedptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> 
type_signal_field_open_details_requested;
+  typedef sigc::signal<void, const std::shared_ptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> 
type_signal_field_open_details_requested;
   type_signal_field_open_details_requested signal_field_open_details_requested();
 
   /** For instance,
@@ -177,30 +177,30 @@ public:
   type_signal_requested_related_details signal_requested_related_details();
 
  /** For instance,
-   * void on_script_button_clicked(const sharedptr<LayoutItem_Button>& layout_item>);
+   * void on_script_button_clicked(const std::shared_ptr<LayoutItem_Button>& layout_item>);
    */
-  typedef sigc::signal<void, const sharedptr<LayoutItem_Button>&> type_signal_script_button_clicked;
+  typedef sigc::signal<void, const std::shared_ptr<LayoutItem_Button>&> type_signal_script_button_clicked;
   type_signal_script_button_clicked signal_script_button_clicked();
 
 private:
 
-  void set_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value, bool 
set_specified_field_layout);
+  void set_field_value(const std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value, 
bool set_specified_field_layout);
 
   // If include_item is set, then the output list will contain field's widget,
   // otherwise not.
-  type_list_widgets get_field(const sharedptr<const LayoutItem_Field>& field, bool include_item);
-  type_list_const_widgets get_field(const sharedptr<const LayoutItem_Field>& field, bool include_item) const;
+  type_list_widgets get_field(const std::shared_ptr<const LayoutItem_Field>& field, bool include_item);
+  type_list_const_widgets get_field(const std::shared_ptr<const LayoutItem_Field>& field, bool include_item) 
const;
 
   typedef std::list<Box_Data_Portal*> type_portals;
 
   /// Get portals whose relationships have @a from_key as the from_key.
-  type_portals get_portals(const sharedptr<const LayoutItem_Field>& from_key);
+  type_portals get_portals(const std::shared_ptr<const LayoutItem_Field>& from_key);
 
 
   typedef std::list<DataWidgetChildren::ComboChoices*> type_choice_widgets;
 
   /// Get choice widgets with !show_all relationships that have @a from_key as the from_key.
-  type_choice_widgets get_choice_widgets(const sharedptr<const LayoutItem_Field>& from_key);
+  type_choice_widgets get_choice_widgets(const std::shared_ptr<const LayoutItem_Field>& from_key);
 
   /** Examine this flow table and all child flow tables, discovering which
    * has the most columns.
@@ -209,11 +209,11 @@ private:
 
   //int get_suitable_width(Field::glom_field_type field_type);
 
-  void on_entry_edited(const Gnome::Gda::Value& value, const sharedptr<const LayoutItem_Field> field);
-  void on_entry_choices_changed(const sharedptr<const LayoutItem_Field> field);
-  void on_entry_open_details_requested(const Gnome::Gda::Value& value, const sharedptr<const 
LayoutItem_Field> field);
+  void on_entry_edited(const Gnome::Gda::Value& value, const std::shared_ptr<const LayoutItem_Field> field);
+  void on_entry_choices_changed(const std::shared_ptr<const LayoutItem_Field> field);
+  void on_entry_open_details_requested(const Gnome::Gda::Value& value, const std::shared_ptr<const 
LayoutItem_Field> field);
 
-  void on_script_button_clicked(const sharedptr<LayoutItem_Button>& layout_item);
+  void on_script_button_clicked(const std::shared_ptr<LayoutItem_Button>& layout_item);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   void on_datawidget_layout_item_added(LayoutWidgetBase::enumType item_type, DataWidget* pDataWidget);
@@ -225,7 +225,7 @@ private:
   public:
     Info();
 
-    sharedptr<const LayoutItem_Field> m_field; //Store the field information so we know the title, ID, and 
type.
+    std::shared_ptr<const LayoutItem_Field> m_field; //Store the field information so we know the title, ID, 
and type.
 
     Gtk::Label* m_first;
     Gtk::EventBox* m_first_eventbox; //The label is often inside an eventbox.
@@ -248,22 +248,22 @@ private:
   typedef std::list< LayoutWidgetBase* > type_list_layoutwidgets;
   type_list_layoutwidgets m_list_layoutwidgets;
 
-  void add_button(const sharedptr<LayoutItem_Button>& layoutitem_button, const Glib::ustring& table_name);
-  void add_textobject(const sharedptr<LayoutItem_Text>& layoutitem_text, const Glib::ustring& table_name);
-  void add_imageobject(const sharedptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& table_name);
+  void add_button(const std::shared_ptr<LayoutItem_Button>& layoutitem_button, const Glib::ustring& 
table_name);
+  void add_textobject(const std::shared_ptr<LayoutItem_Text>& layoutitem_text, const Glib::ustring& 
table_name);
+  void add_imageobject(const std::shared_ptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& 
table_name);
 
   void add_layoutwidgetbase(LayoutWidgetBase* layout_widget);
-  void add_layout_notebook(const sharedptr<LayoutItem_Notebook>& notebook);
-  void add_layout_portal(const sharedptr<LayoutItem_Portal>& portal);
+  void add_layout_notebook(const std::shared_ptr<LayoutItem_Notebook>& notebook);
+  void add_layout_portal(const std::shared_ptr<LayoutItem_Portal>& portal);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 
-  sharedptr<LayoutItem_Portal> get_portal_relationship();
+  std::shared_ptr<LayoutItem_Portal> get_portal_relationship();
 
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-  Box_Data_List_Related* create_related(const sharedptr<LayoutItem_Portal>& portal, bool show_title = true);
-  Box_Data_Calendar_Related* create_related_calendar(const sharedptr<LayoutItem_CalendarPortal>& portal, 
bool show_title = true);
+  Box_Data_List_Related* create_related(const std::shared_ptr<LayoutItem_Portal>& portal, bool show_title = 
true);
+  Box_Data_Calendar_Related* create_related_calendar(const std::shared_ptr<LayoutItem_CalendarPortal>& 
portal, bool show_title = true);
 
   Gtk::Alignment* m_placeholder;
 
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 9f3acc5..74bc417 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -127,7 +127,7 @@ bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda:
   //Performance optimisation:
   //Keep the connection open during all these operations:
   {
-    sharedptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
+    std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
 
     result = m_Box_List.init_db_details(found_set, get_active_layout_platform(get_document())); //TODO: 
Select the last selected record.
 
@@ -279,7 +279,7 @@ FoundSet Notebook_Data::get_found_set_selected() const
       return found_set;
     }
     
-    sharedptr<Field> primary_key_field =
+    std::shared_ptr<Field> primary_key_field =
       document->get_field_primary_key(m_table_name);
     found_set.m_where_clause = Utils::build_simple_where_expression(
       m_table_name, primary_key_field,
diff --git a/glom/mode_data/test_flowtablewithfields.cc b/glom/mode_data/test_flowtablewithfields.cc
index 8d25875..0273485 100644
--- a/glom/mode_data/test_flowtablewithfields.cc
+++ b/glom/mode_data/test_flowtablewithfields.cc
@@ -40,36 +40,36 @@ void on_drag_data_get_entry(const Glib::RefPtr<Gdk::DragContext>&, Gtk::Selectio
 static void fill_flowtable(Glom::FlowTableWithFields& flowtable)
 {
   {
-    Glom::sharedptr<Glom::LayoutItem_Text> item =
-      Glom::sharedptr<Glom::LayoutItem_Text>::create();
+    std::shared_ptr<Glom::LayoutItem_Text> item =
+      std::shared_ptr<Glom::LayoutItem_Text>(new Glom::LayoutItem_Text());
     item->set_text("test static text 1");
     flowtable.add_layout_item(item);
   }
 
   {
-    Glom::sharedptr<Glom::LayoutItem_Text> item =
-      Glom::sharedptr<Glom::LayoutItem_Text>::create();
+    std::shared_ptr<Glom::LayoutItem_Text> item =
+      std::shared_ptr<Glom::LayoutItem_Text>(new Glom::LayoutItem_Text());
     item->set_text("test static text 2");
     item->set_title("title for text 2", AppWindow::get_current_locale());
     flowtable.add_layout_item(item);
   }
 
   {
-    Glom::sharedptr<Glom::LayoutItem_Image> item =
-      Glom::sharedptr<Glom::LayoutItem_Image>::create();
+    std::shared_ptr<Glom::LayoutItem_Image> item =
+      std::shared_ptr<Glom::LayoutItem_Image>(new Glom::LayoutItem_Image());
     //item->set_image(somevalue);
     item->set_title("title for image", AppWindow::get_current_locale());
     flowtable.add_layout_item(item);
   }
   
-  Glom::sharedptr<Glom::LayoutGroup> group = 
-    Glom::sharedptr<Glom::LayoutGroup>::create();
-  Glom::sharedptr<Glom::LayoutItem_Text> item =
-    Glom::sharedptr<Glom::LayoutItem_Text>::create();
+  std::shared_ptr<Glom::LayoutGroup> group = 
+    std::shared_ptr<Glom::LayoutGroup>(new Glom::LayoutGroup());
+  std::shared_ptr<Glom::LayoutItem_Text> item =
+    std::shared_ptr<Glom::LayoutItem_Text>(new Glom::LayoutItem_Text());
   item->set_text("inner text 1");
   group->add_item(item);
   item =
-    Glom::sharedptr<Glom::LayoutItem_Text>::create();
+    std::shared_ptr<Glom::LayoutItem_Text>(new Glom::LayoutItem_Text());
   item->set_text("inner text 2");
   group->add_item(item);
   flowtable.add_layout_item(group);
diff --git a/glom/mode_design/box_db_table_relationships.cc b/glom/mode_design/box_db_table_relationships.cc
index 4208b47..97bdb01 100644
--- a/glom/mode_design/box_db_table_relationships.cc
+++ b/glom/mode_design/box_db_table_relationships.cc
@@ -86,7 +86,7 @@ bool Box_DB_Table_Relationships::fill_from_database()
 
   m_AddDel.remove_all();
 
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
   if(sharedconnection)
   {
     Glib::RefPtr<Gnome::Gda::Connection> connection = sharedconnection->get_gda_connection();
@@ -104,7 +104,7 @@ bool Box_DB_Table_Relationships::fill_from_database()
     //Add the relationships:
     for(Document::type_vec_relationships::iterator iter = vecRelationships.begin(); iter != 
vecRelationships.end(); ++iter)
     {
-      sharedptr<const Relationship> relationship = *iter;
+      std::shared_ptr<const Relationship> relationship = *iter;
       if(relationship)
       {
         //Name:
@@ -154,9 +154,9 @@ void Box_DB_Table_Relationships::save_to_document()
 
       if(std::find_if(vecRelationships.begin(), vecRelationships.end(), 
predicate_FieldHasName<Relationship>(name)) == vecRelationships.end()) //Don't add 2 relationships with the 
same name.
       {
-        sharedptr<Relationship> relationship = document->get_relationship(m_table_name, name); //Preserve 
other information, such as translations.
+        std::shared_ptr<Relationship> relationship = document->get_relationship(m_table_name, name); 
//Preserve other information, such as translations.
         if(!relationship)
-          relationship = sharedptr<Relationship>::create();
+          relationship = std::shared_ptr<Relationship>(new Relationship());
 
         relationship->set_name(name);
         relationship->set_title(m_AddDel.get_value(iter, m_colTitle), AppWindow::get_current_locale());
@@ -243,7 +243,7 @@ void Box_DB_Table_Relationships::on_adddel_user_activated(const Gtk::TreeModel::
       //Set list of 'To' fields depending on table:
       m_AddDel.set_value(row, m_colToField, Glib::ustring(""));
 
-      sharedptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
+      std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
       if(sharedconnection)
       {
         Glib::RefPtr<Gnome::Gda::Connection> connection = sharedconnection->get_gda_connection();
@@ -282,7 +282,7 @@ void Box_DB_Table_Relationships::on_adddel_user_requested_delete(const Gtk::Tree
     Document* document = get_document();
     if(document)
     {
-      sharedptr<const Relationship> relationship = document->get_relationship(m_table_name, 
relationship_name);
+      std::shared_ptr<const Relationship> relationship = document->get_relationship(m_table_name, 
relationship_name);
       if(relationship)
       {
         document->remove_relationship(relationship);
diff --git a/glom/mode_design/dialog_add_related_table.cc b/glom/mode_design/dialog_add_related_table.cc
index b2d7723..9c11111 100644
--- a/glom/mode_design/dialog_add_related_table.cc
+++ b/glom/mode_design/dialog_add_related_table.cc
@@ -75,7 +75,7 @@ void Dialog_AddRelatedTable::set_fields(const Glib::ustring& table_name)
   m_combo_from_field->remove_all();
   for(type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
-     sharedptr<Field> item = *iter;
+     std::shared_ptr<Field> item = *iter;
      if(item)
        m_combo_from_field->append(item->get_name());
   }
diff --git a/glom/mode_design/dialog_database_preferences.cc b/glom/mode_design/dialog_database_preferences.cc
index da7ee0b..d347f48 100644
--- a/glom/mode_design/dialog_database_preferences.cc
+++ b/glom/mode_design/dialog_database_preferences.cc
@@ -165,7 +165,7 @@ void Dialog_Database_Preferences::load_from_document()
     const Document::type_vec_fields fields = document->get_table_fields((*iter)->get_name());
     for(Document::type_vec_fields::const_iterator iterFields = fields.begin(); iterFields != fields.end(); 
++iterFields)
     {
-      sharedptr<Field> field = *iterFields;
+      std::shared_ptr<Field> field = *iterFields;
       if(field->get_primary_key())
         DbUtils::auto_increment_insert_first_if_necessary((*iter)->get_name(), field->get_name());
     }
@@ -270,7 +270,7 @@ void Dialog_Database_Preferences::on_button_test_script()
     return;
 
   //We need the connection when we run the script, so that the script may use it.
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(this /* parent window */);
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(this /* parent window */);
 
   Glib::ustring error_message; //TODO: Check this and tell the user.
   PythonUICallbacks callbacks;
@@ -278,7 +278,7 @@ void Dialog_Database_Preferences::on_button_test_script()
     type_map_fields(),
     document,
     Glib::ustring() /* table_name */,
-    sharedptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB, which 
we would not encourage in a test.
+    std::shared_ptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB, 
which we would not encourage in a test.
     sharedconnection->get_gda_connection(),
     callbacks,
     error_message);
diff --git a/glom/mode_design/dialog_database_preferences.h b/glom/mode_design/dialog_database_preferences.h
index 35155d5..f349943 100644
--- a/glom/mode_design/dialog_database_preferences.h
+++ b/glom/mode_design/dialog_database_preferences.h
@@ -48,7 +48,7 @@ public:
   Dialog_Database_Preferences(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_Database_Preferences();
 
-  sharedptr<SharedConnection> connect_to_server_with_connection_settings() const;
+  std::shared_ptr<SharedConnection> connect_to_server_with_connection_settings() const;
 
   virtual void load_from_document(); //override
   virtual void save_to_document(); //override
diff --git a/glom/mode_design/fields/box_db_table_definition.cc 
b/glom/mode_design/fields/box_db_table_definition.cc
index 28795ca..4ba8b7e 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -94,7 +94,7 @@ Box_DB_Table_Definition::~Box_DB_Table_Definition()
   }
 }
 
-void Box_DB_Table_Definition::fill_field_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const 
Field>& field)
+void Box_DB_Table_Definition::fill_field_row(const Gtk::TreeModel::iterator& iter, const 
std::shared_ptr<const Field>& field)
 {
   m_AddDel.set_value_key(iter, field->get_name());
 
@@ -146,7 +146,7 @@ bool Box_DB_Table_Definition::fill_from_database()
 
     for(type_vec_fields::iterator iter = m_vecFields.begin(); iter != m_vecFields.end(); ++iter)
     {
-      const sharedptr<const Field>& field = *iter;
+      const std::shared_ptr<const Field>& field = *iter;
 
       //Name:
       Gtk::TreeModel::iterator tree_iter= m_AddDel.add_item(field->get_name());
@@ -174,7 +174,7 @@ void Box_DB_Table_Definition::on_adddel_add(const Gtk::TreeModel::iterator& row)
   Glib::ustring name = m_AddDel.get_value(row, m_colName);
   if(!name.empty())
   {
-    sharedptr<Field> field(new Field());
+    std::shared_ptr<Field> field(new Field());
     field->set_name(name);
     field->set_title( Utils::title_from_string(name) , AppWindow::get_current_locale()); //Start with a 
title that might be useful.
     field->set_glom_type(Field::TYPE_NUMERIC);
@@ -254,7 +254,7 @@ void Box_DB_Table_Definition::on_adddel_delete(const Gtk::TreeModel::iterator& r
   fill_from_database();
 }
 
-bool Box_DB_Table_Definition::check_field_change(const sharedptr<const Field>& field_old, const 
sharedptr<const Field>& field_new)
+bool Box_DB_Table_Definition::check_field_change(const std::shared_ptr<const Field>& field_old, const 
std::shared_ptr<const Field>& field_new)
 {
   bool result = true; //Tells the caller whether to continue.
 
@@ -352,7 +352,7 @@ void Box_DB_Table_Definition::on_adddel_changed(const Gtk::TreeModel::iterator&
   {
     const Glib::ustring strFieldNameBeingEdited = m_AddDel.get_value_key(row);
 
-    sharedptr<const Field> constfield = pDoc->get_field(m_table_name, strFieldNameBeingEdited);
+    std::shared_ptr<const Field> constfield = pDoc->get_field(m_table_name, strFieldNameBeingEdited);
     m_Field_BeingEdited = constfield;
 
     //Get DB field info: (TODO: This might be unnecessary).
@@ -361,11 +361,11 @@ void Box_DB_Table_Definition::on_adddel_changed(const Gtk::TreeModel::iterator&
       std::cerr << G_STRFUNC << ": field not found: " << strFieldNameBeingEdited << std::endl;
     else
     {
-      sharedptr<const Field> constfield = *iterFind;
+      std::shared_ptr<const Field> constfield = *iterFind;
       m_Field_BeingEdited = constfield;
 
       //Get new field definition:
-      sharedptr<Field> fieldNew = get_field_definition(row);
+      std::shared_ptr<Field> fieldNew = get_field_definition(row);
 
       //Change it:
       if(*m_Field_BeingEdited != *fieldNew) //If it has really changed.
@@ -373,7 +373,7 @@ void Box_DB_Table_Definition::on_adddel_changed(const Gtk::TreeModel::iterator&
         const bool bcontinue = check_field_change(m_Field_BeingEdited, fieldNew);
         if(bcontinue)
         {
-          sharedptr<Field> fieldNewWithModifications = change_definition(m_Field_BeingEdited, fieldNew);
+          std::shared_ptr<Field> fieldNewWithModifications = change_definition(m_Field_BeingEdited, 
fieldNew);
 
           //Update the row to show any extra changes (such as unique being set/unset whenever the primary 
key is set/unset) 
          // TODO: When change_definition decides to unset another column from
@@ -393,7 +393,7 @@ void Box_DB_Table_Definition::on_adddel_changed(const Gtk::TreeModel::iterator&
 
 void Box_DB_Table_Definition::on_adddel_edit(const Gtk::TreeModel::iterator& row)
 {
-  sharedptr<const Field> constfield = get_field_definition(row);
+  std::shared_ptr<const Field> constfield = get_field_definition(row);
   m_Field_BeingEdited = constfield;
 
   m_pDialog->set_field(m_Field_BeingEdited, m_table_name);
@@ -407,9 +407,9 @@ void Box_DB_Table_Definition::on_adddel_edit(const Gtk::TreeModel::iterator& row
   m_pDialog->show();
 }
 
-sharedptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::TreeModel::iterator& row)
+std::shared_ptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::TreeModel::iterator& row)
 {
-  sharedptr<Field> fieldResult;
+  std::shared_ptr<Field> fieldResult;
 
   //Get old field definition (to preserve anything that the user doesn't have access to):
 
@@ -429,7 +429,7 @@ sharedptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::TreeMo
     else
     {
       //Start with a default:
-      fieldResult = sharedptr<Field>(new Field());
+      fieldResult = std::shared_ptr<Field>(new Field());
     }
   }
 
@@ -438,7 +438,7 @@ sharedptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::TreeMo
 
   //Start with original definitions, so that we preserve things like UNSIGNED.
   //TODO maybe use document's fieldinfo instead of m_vecFields.
-  sharedptr<const Field> field_temp = 
+  std::shared_ptr<const Field> field_temp = 
     DbUtils::get_fields_for_table_one_field(pDoc, m_table_name, strFieldNameBeforeEdit);
   if(field_temp)
   {
@@ -485,7 +485,7 @@ sharedptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::TreeMo
 
 void Box_DB_Table_Definition::on_Properties_apply()
 {
-  sharedptr<Field> field_New = m_pDialog->get_field();
+  std::shared_ptr<Field> field_New = m_pDialog->get_field();
 
   if(*m_Field_BeingEdited != *field_New)
   {
@@ -503,13 +503,13 @@ void Box_DB_Table_Definition::on_Properties_apply()
   m_pDialog->hide();
 }
 
-sharedptr<Field> Box_DB_Table_Definition::change_definition(const sharedptr<const Field>& fieldOld, const 
sharedptr<const Field>& field)
+std::shared_ptr<Field> Box_DB_Table_Definition::change_definition(const std::shared_ptr<const Field>& 
fieldOld, const std::shared_ptr<const Field>& field)
 {
   BusyCursor busy_cursor(get_app_window());
 
   //DB field definition:
 
-  sharedptr<Field> result;
+  std::shared_ptr<Field> result;
   
   if(!fieldOld || !field)
     return result;
@@ -525,10 +525,10 @@ sharedptr<Field> Box_DB_Table_Definition::change_definition(const sharedptr<cons
     {
       //Unset the current primary key:
       //(There should be one.)
-      sharedptr<Field> existing_primary_key = get_field_primary_key_for_table(m_table_name);
+      std::shared_ptr<Field> existing_primary_key = get_field_primary_key_for_table(m_table_name);
       if(existing_primary_key)
       {
-        sharedptr<Field> existing_primary_key_unset = glom_sharedptr_clone(existing_primary_key);
+        std::shared_ptr<Field> existing_primary_key_unset = glom_sharedptr_clone(existing_primary_key);
         existing_primary_key_unset->set_primary_key(false);
        old_fields.push_back(existing_primary_key);
        new_fields.push_back(existing_primary_key_unset);
@@ -628,7 +628,7 @@ void Box_DB_Table_Definition::fill_fields()
   m_vecFields = DbUtils::get_fields_for_table(get_document(), m_table_name);
 }
 
-bool Box_DB_Table_Definition::field_has_null_values(const sharedptr<const Field>& field)
+bool Box_DB_Table_Definition::field_has_null_values(const std::shared_ptr<const Field>& field)
 {
   //Note that "= Null" doesn't work, though it doesn't error either.
   //Note also that SELECT COUNT always returns 0 if all the values are NULL, so we can't use that to be more 
efficient.
@@ -658,7 +658,7 @@ bool Box_DB_Table_Definition::field_has_null_values(const sharedptr<const Field>
   return null_count > 0; 
 }
 
-bool Box_DB_Table_Definition::field_has_non_unique_values(const sharedptr<const Field>& field)
+bool Box_DB_Table_Definition::field_has_non_unique_values(const std::shared_ptr<const Field>& field)
 {
   long count_distinct = 0;
   long count_all = 0;
diff --git a/glom/mode_design/fields/box_db_table_definition.h 
b/glom/mode_design/fields/box_db_table_definition.h
index c2d26f6..ad31173 100644
--- a/glom/mode_design/fields/box_db_table_definition.h
+++ b/glom/mode_design/fields/box_db_table_definition.h
@@ -39,14 +39,14 @@ private:
   virtual bool fill_from_database();
   virtual void fill_fields();
 
-  void fill_field_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const Field>& field);
+  void fill_field_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const Field>& field);
 
-  sharedptr<Field> get_field_definition(const Gtk::TreeModel::iterator& row);
+  std::shared_ptr<Field> get_field_definition(const Gtk::TreeModel::iterator& row);
 
-  sharedptr<Field> change_definition(const sharedptr<const Field>& fieldOld, const sharedptr<const Field>& 
field);
+  std::shared_ptr<Field> change_definition(const std::shared_ptr<const Field>& fieldOld, const 
std::shared_ptr<const Field>& field);
 
-  bool field_has_null_values(const sharedptr<const Field>& field);
-  bool field_has_non_unique_values(const sharedptr<const Field>& field);
+  bool field_has_null_values(const std::shared_ptr<const Field>& field);
+  bool field_has_non_unique_values(const std::shared_ptr<const Field>& field);
 
   //Signal handlers:
   virtual void on_adddel_add(const Gtk::TreeModel::iterator& row);
@@ -56,14 +56,14 @@ private:
 
   virtual void on_Properties_apply();
 
-  bool check_field_change(const sharedptr<const Field>& field_old, const sharedptr<const Field>& field_new);
+  bool check_field_change(const std::shared_ptr<const Field>& field_old, const std::shared_ptr<const Field>& 
field_new);
 
   mutable AddDel_WithButtons m_AddDel; //mutable because its get_ methods aren't const.
 
   guint m_colName, m_colTitle, m_colType, m_colUnique, m_colPrimaryKey;
 
   Dialog_FieldDefinition* m_pDialog;
-  sharedptr<const Field> m_Field_BeingEdited; //TODO_FieldShared
+  std::shared_ptr<const Field> m_Field_BeingEdited; //TODO_FieldShared
   type_vec_fields m_vecFields;
 };
 
diff --git a/glom/mode_design/fields/dialog_fieldcalculation.cc 
b/glom/mode_design/fields/dialog_fieldcalculation.cc
index dba8411..124ec4f 100644
--- a/glom/mode_design/fields/dialog_fieldcalculation.cc
+++ b/glom/mode_design/fields/dialog_fieldcalculation.cc
@@ -72,7 +72,7 @@ Dialog_FieldCalculation::~Dialog_FieldCalculation()
 {
 }
 
-void Dialog_FieldCalculation::set_field(const sharedptr<const Field>& field, const Glib::ustring& table_name)
+void Dialog_FieldCalculation::set_field(const std::shared_ptr<const Field>& field, const Glib::ustring& 
table_name)
 {
   //set_blocked();
 
@@ -87,9 +87,9 @@ void Dialog_FieldCalculation::set_field(const sharedptr<const Field>& field, con
   //Dialog_Properties::set_modified(false);
 }
 
-sharedptr<Field> Dialog_FieldCalculation::get_field() const
+std::shared_ptr<Field> Dialog_FieldCalculation::get_field() const
 {
-  sharedptr<Field> field = glom_sharedptr_clone(m_field); //Start with the old details, to preserve anything 
that is not in our UI.
+  std::shared_ptr<Field> field = glom_sharedptr_clone(m_field); //Start with the old details, to preserve 
anything that is not in our UI.
 
   field->set_calculation( m_text_view->get_buffer()->get_text() );
 
@@ -124,14 +124,14 @@ void Dialog_FieldCalculation::on_button_test()
     const Document::type_vec_fields fields = document->get_table_fields(m_table_name);
     for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      const sharedptr<const Field> field = *iter;
+      const std::shared_ptr<const Field> field = *iter;
       const Gnome::Gda::Value example_value = Conversions::get_example_value(field->get_glom_type());
       field_values[field->get_name()] = example_value;
     }
   }
 
   //We need the connection when we run the script, so that the script may use it.
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(this /* parent window */);
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(this /* parent window */);
 
   Glib::ustring error_message;
   const Gnome::Gda::Value value = glom_evaluate_python_function_implementation(
@@ -140,7 +140,7 @@ void Dialog_FieldCalculation::on_button_test()
     field_values, //TODO: Maybe use the field's type here.
     document,
     m_table_name,
-    sharedptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB.
+    std::shared_ptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB.
     sharedconnection->get_gda_connection(),
     error_message);
 
@@ -150,9 +150,9 @@ void Dialog_FieldCalculation::on_button_test()
     Utils::show_ok_dialog( _("Calculation failed"), Glib::ustring::compose(_("The calculation failed with 
this error:\n%s"), error_message), *this, Gtk::MESSAGE_ERROR);
 
   //Show what fields would trigger the recalculation:
-  sharedptr<Field> temp = sharedptr<Field>::create();
+  std::shared_ptr<Field> temp = std::shared_ptr<Field>(new Field());
   temp->set_calculation(calculation);
-  sharedptr<LayoutItem_Field> layoutitem_temp = sharedptr<LayoutItem_Field>::create();
+  std::shared_ptr<LayoutItem_Field> layoutitem_temp = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
   layoutitem_temp->set_full_field_details(temp);
   const type_list_const_field_items triggered_fields = get_calculation_fields(m_table_name, layoutitem_temp);
 
diff --git a/glom/mode_design/fields/dialog_fieldcalculation.h 
b/glom/mode_design/fields/dialog_fieldcalculation.h
index b324082..b833dad 100644
--- a/glom/mode_design/fields/dialog_fieldcalculation.h
+++ b/glom/mode_design/fields/dialog_fieldcalculation.h
@@ -44,8 +44,8 @@ public:
   Dialog_FieldCalculation(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_FieldCalculation();
 
-  void set_field(const sharedptr<const Field>& field, const Glib::ustring& table_name);
-  sharedptr<Field> get_field() const;
+  void set_field(const std::shared_ptr<const Field>& field, const Glib::ustring& table_name);
+  std::shared_ptr<Field> get_field() const;
 
 private:
   void on_button_test();
@@ -55,7 +55,7 @@ private:
   Gtk::Button* m_button_test;
   Gtk::Label* m_label_triggered_by;
 
-  sharedptr<Field> m_field;
+  std::shared_ptr<Field> m_field;
   Glib::ustring m_table_name;
 };
 
diff --git a/glom/mode_design/fields/dialog_fielddefinition.cc 
b/glom/mode_design/fields/dialog_fielddefinition.cc
index 693a894..52e1a51 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.cc
+++ b/glom/mode_design/fields/dialog_fielddefinition.cc
@@ -118,7 +118,7 @@ Dialog_FieldDefinition::~Dialog_FieldDefinition()
   remove_view(m_box_formatting);
 }
 
-void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, const Glib::ustring& table_name)
+void Dialog_FieldDefinition::set_field(const std::shared_ptr<const Field>& field, const Glib::ustring& 
table_name)
 {
   set_blocked();
 
@@ -153,8 +153,8 @@ void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, cons
 
   //We use a regular DataWidget for the default value, so we can reuse its functionality,
   //but it's not a real field - hence the special title.
-  sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
-  sharedptr<Field> field_default_value = glom_sharedptr_clone(m_Field);
+  std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
+  std::shared_ptr<Field> field_default_value = glom_sharedptr_clone(m_Field);
   field_default_value->set_name("glom_temp_default_value");
   field_default_value->set_title_original(_("Default Value"));
   layout_item->set_full_field_details(field_default_value);
@@ -185,7 +185,7 @@ void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, cons
     m_pCombo_LookupRelationship->set_relationships(vecRelationships);
   }
 
-  sharedptr<Relationship> lookup_relationship;
+  std::shared_ptr<Relationship> lookup_relationship;
   if(!disable_default_value)
     lookup_relationship = m_Field->get_lookup_relationship();
 
@@ -222,11 +222,11 @@ void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, cons
   Dialog_Properties::set_modified(false);
 }
 
-sharedptr<Field> Dialog_FieldDefinition::get_field() const
+std::shared_ptr<Field> Dialog_FieldDefinition::get_field() const
 {
-  sharedptr<Field> field = glom_sharedptr_clone(m_Field); //Start with the old details, to preserve anything 
that is not in our UI.
+  std::shared_ptr<Field> field = glom_sharedptr_clone(m_Field); //Start with the old details, to preserve 
anything that is not in our UI.
   // const_cast is necessary and save here for the window (jhs)
-  sharedptr<SharedConnection> sharedcnc = connect_to_server(const_cast<Dialog_FieldDefinition*>(this));
+  std::shared_ptr<SharedConnection> sharedcnc = connect_to_server(const_cast<Dialog_FieldDefinition*>(this));
   Glib::RefPtr<Gnome::Gda::Connection> cnc = sharedcnc->get_gda_connection();
 
   //Get the field info from the widgets:
@@ -247,7 +247,7 @@ sharedptr<Field> Dialog_FieldDefinition::get_field() const
 
   //Lookup:
   const bool is_lookup = m_pCheck_Lookup->get_active();
-  sharedptr<Relationship> relationship;
+  std::shared_ptr<Relationship> relationship;
   if(is_lookup)
     relationship = m_pCombo_LookupRelationship->get_selected_relationship();
   field->set_lookup_relationship(relationship);
@@ -353,7 +353,7 @@ void Dialog_FieldDefinition::on_combo_lookup_relationship_changed()
   m_pCombo_LookupField->remove_all();
 
   //Get the relationship name:
-  sharedptr<const Relationship> relationship = m_pCombo_LookupRelationship->get_selected_relationship();
+  std::shared_ptr<const Relationship> relationship = 
m_pCombo_LookupRelationship->get_selected_relationship();
   if(relationship)
   {
     //Get the relationship details:
diff --git a/glom/mode_design/fields/dialog_fielddefinition.h 
b/glom/mode_design/fields/dialog_fielddefinition.h
index 1132c05..fa2dedf 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.h
+++ b/glom/mode_design/fields/dialog_fielddefinition.h
@@ -50,8 +50,8 @@ public:
   Dialog_FieldDefinition(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_FieldDefinition();
 
-  virtual void set_field(const sharedptr<const Field>& field, const Glib::ustring& table_name);
-  virtual sharedptr<Field> get_field() const; //TODO_FieldShared
+  virtual void set_field(const std::shared_ptr<const Field>& field, const Glib::ustring& table_name);
+  virtual std::shared_ptr<Field> get_field() const; //TODO_FieldShared
 
 private:
 
@@ -97,7 +97,7 @@ private:
   Gtk::Box* m_box_formatting_placeholder;
   Box_Formatting* m_box_formatting;
 
-  sharedptr<Field> m_Field;
+  std::shared_ptr<Field> m_Field;
   Glib::ustring m_table_name;
 };
 
diff --git a/glom/mode_design/layout/combobox_fields.cc b/glom/mode_design/layout/combobox_fields.cc
index 6576ac5..0c769b8 100644
--- a/glom/mode_design/layout/combobox_fields.cc
+++ b/glom/mode_design/layout/combobox_fields.cc
@@ -53,7 +53,7 @@ ComboBox_Fields::~ComboBox_Fields()
 
 }
 
-sharedptr<Field> ComboBox_Fields::get_selected_field() const
+std::shared_ptr<Field> ComboBox_Fields::get_selected_field() const
 {
   Gtk::TreeModel::iterator iter = get_active();
   if(iter)
@@ -62,16 +62,16 @@ sharedptr<Field> ComboBox_Fields::get_selected_field() const
     return row[m_model_columns.m_field];
   }
   else
-    return sharedptr<Field>();
+    return std::shared_ptr<Field>();
 }
 
 Glib::ustring ComboBox_Fields::get_selected_field_name() const
 {
-  sharedptr<Field> field = get_selected_field();
+  std::shared_ptr<Field> field = get_selected_field();
   return glom_get_sharedptr_name(field);
 }
 
-void ComboBox_Fields::set_selected_field(const sharedptr<const Field>& field)
+void ComboBox_Fields::set_selected_field(const std::shared_ptr<const Field>& field)
 {
   if(field)
     set_selected_field(field->get_name());
@@ -88,7 +88,7 @@ void ComboBox_Fields::set_selected_field(const Glib::ustring& field_name)
     for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); ++iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<Field> field = row[m_model_columns.m_field];
+      std::shared_ptr<Field> field = row[m_model_columns.m_field];
       const Glib::ustring this_name = glom_get_sharedptr_name(field);
 
       //(An empty name means Select the parent table item.)
@@ -126,7 +126,7 @@ void ComboBox_Fields::set_fields(Document* document, const Glib::ustring parent_
     Gtk::TreeModel::iterator tree_iter = m_model->append();
     Gtk::TreeModel::Row row = *tree_iter;
 
-    sharedptr<Field> rel = *iter;
+    std::shared_ptr<Field> rel = *iter;
     row[m_model_columns.m_field] = rel;
     row[m_model_columns.m_separator] = false;
   }
@@ -147,7 +147,7 @@ void ComboBox_Fields::set_fields(Document* document, const Glib::ustring parent_
   //Fill the model:
   for(type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
-    sharedptr<Field> rel = *iter;
+    std::shared_ptr<Field> rel = *iter;
     if(rel && (rel->get_glom_type() == field_type))
     {
       std::cout << "DEBUG: ComboBox_Fields::set_fields() 1" << std::endl;
@@ -174,14 +174,14 @@ void ComboBox_Fields::set_fields(const type_vec_fields& fields, bool with_none_i
     Gtk::TreeModel::iterator tree_iter = m_model->append();
     Gtk::TreeModel::Row row = *tree_iter;
 
-    row[m_model_columns.m_field] = sharedptr<Field>(); 
+    row[m_model_columns.m_field] = std::shared_ptr<Field>(); 
     row[m_model_columns.m_separator] = false;
 
     //Add a separator after the "None" item:
     tree_iter = m_model->append();
     row = *tree_iter;
 
-    row[m_model_columns.m_field] = sharedptr<Field>(); 
+    row[m_model_columns.m_field] = std::shared_ptr<Field>(); 
     row[m_model_columns.m_separator] = true;
   }
 
@@ -199,7 +199,7 @@ void ComboBox_Fields::set_fields(const type_vec_fields& fields, bool with_none_i
 void ComboBox_Fields::on_cell_data_title(const Gtk::TreeModel::const_iterator& iter)
 {
   Gtk::TreeModel::Row row = *iter;
-  sharedptr<Field> field = row[m_model_columns.m_field];
+  std::shared_ptr<Field> field = row[m_model_columns.m_field];
   if(field)
   {
     m_renderer_title->set_property("text", item_get_title_or_name(field));
diff --git a/glom/mode_design/layout/combobox_fields.h b/glom/mode_design/layout/combobox_fields.h
index 4192278..7fa2944 100644
--- a/glom/mode_design/layout/combobox_fields.h
+++ b/glom/mode_design/layout/combobox_fields.h
@@ -38,7 +38,7 @@ public:
   ComboBox_Fields(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~ComboBox_Fields();
 
-  typedef std::vector< sharedptr<Field> > type_vec_fields;
+  typedef std::vector< std::shared_ptr<Field> > type_vec_fields;
     
   /** Fill the combo box with fields.
    * @param fields The fields to show in the combo box.
@@ -60,10 +60,10 @@ public:
    */
   void set_fields(Document* document, const Glib::ustring parent_table_name, Field::glom_field_type 
field_type);
 
-  void set_selected_field(const sharedptr<const Field>& field);
+  void set_selected_field(const std::shared_ptr<const Field>& field);
   void set_selected_field(const Glib::ustring& field_name);
  
-  sharedptr<Field> get_selected_field() const;
+  std::shared_ptr<Field> get_selected_field() const;
   Glib::ustring get_selected_field_name() const;
 
 
@@ -82,7 +82,7 @@ private:
     ModelColumns()
     { add(m_field); add(m_separator); }
 
-    Gtk::TreeModelColumn< sharedptr<Field> > m_field;
+    Gtk::TreeModelColumn< std::shared_ptr<Field> > m_field;
     Gtk::TreeModelColumn<bool> m_separator;
   };
 
diff --git a/glom/mode_design/layout/combobox_relationship.cc 
b/glom/mode_design/layout/combobox_relationship.cc
index 08bb24b..d4ba217 100644
--- a/glom/mode_design/layout/combobox_relationship.cc
+++ b/glom/mode_design/layout/combobox_relationship.cc
@@ -58,7 +58,7 @@ ComboBox_Relationship::~ComboBox_Relationship()
 
 }
 
-sharedptr<Relationship> ComboBox_Relationship::get_selected_relationship() const
+std::shared_ptr<Relationship> ComboBox_Relationship::get_selected_relationship() const
 {
   Gtk::TreeModel::iterator iter = get_active();
   if(iter)
@@ -67,10 +67,10 @@ sharedptr<Relationship> ComboBox_Relationship::get_selected_relationship() const
     return row[m_model_columns.m_relationship];
   }
   else
-    return sharedptr<Relationship>();
+    return std::shared_ptr<Relationship>();
 }
 
-sharedptr<Relationship> ComboBox_Relationship::get_selected_relationship(sharedptr<Relationship>& 
related_relationship) const
+std::shared_ptr<Relationship> 
ComboBox_Relationship::get_selected_relationship(std::shared_ptr<Relationship>& related_relationship) const
 {
   Gtk::TreeModel::iterator iter = get_active();
   if(iter)
@@ -87,10 +87,10 @@ sharedptr<Relationship> ComboBox_Relationship::get_selected_relationship(sharedp
       return row[m_model_columns.m_relationship];
   }
   else
-    return sharedptr<Relationship>();
+    return std::shared_ptr<Relationship>();
 }
 
-void ComboBox_Relationship::set_selected_relationship(const sharedptr<const Relationship>& relationship)
+void ComboBox_Relationship::set_selected_relationship(const std::shared_ptr<const Relationship>& 
relationship)
 {
   if(relationship)
     set_selected_relationship(relationship->get_name());
@@ -98,7 +98,7 @@ void ComboBox_Relationship::set_selected_relationship(const sharedptr<const Rela
     set_selected_relationship(Glib::ustring());
 }
 
-void ComboBox_Relationship::set_selected_relationship(const sharedptr<const Relationship>& relationship, 
const sharedptr<const Relationship>& related_relationship)
+void ComboBox_Relationship::set_selected_relationship(const std::shared_ptr<const Relationship>& 
relationship, const std::shared_ptr<const Relationship>& related_relationship)
 {
   if(relationship)
     set_selected_relationship(relationship->get_name(), glom_get_sharedptr_name(related_relationship));
@@ -115,7 +115,7 @@ void ComboBox_Relationship::set_selected_relationship(const Glib::ustring& relat
     for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); ++iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<Relationship> relationship = row[m_model_columns.m_relationship];
+      std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
       const Glib::ustring this_name = glom_get_sharedptr_name(relationship);
 
       //(An empty name means Select the parent table item.)
@@ -131,7 +131,7 @@ void ComboBox_Relationship::set_selected_relationship(const Glib::ustring& relat
           for(Gtk::TreeModel::iterator iterChildren = iter->children().begin(); iterChildren != 
iter->children().end(); ++iterChildren)
           {
             Gtk::TreeModel::Row row = *iterChildren;
-            sharedptr<Relationship> relationship = row[m_model_columns.m_relationship];
+            std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
             const Glib::ustring this_name = glom_get_sharedptr_name(relationship);
             if(this_name == related_relationship_name)
             {
@@ -170,7 +170,7 @@ void ComboBox_Relationship::set_relationships(Document* document, const Glib::us
     Gtk::TreeModel::iterator tree_iter = m_model->append();
     Gtk::TreeModel::Row row = *tree_iter;
 
-    sharedptr<Relationship> rel = *iter;
+    std::shared_ptr<Relationship> rel = *iter;
     row[m_model_columns.m_relationship] = rel;
     row[m_model_columns.m_separator] = false;
 
@@ -183,7 +183,7 @@ void ComboBox_Relationship::set_relationships(Document* document, const Glib::us
         Gtk::TreeModel::iterator tree_iter_child = m_model->append(tree_iter->children());
         Gtk::TreeModel::Row row = *tree_iter_child;
 
-        sharedptr<Relationship> rel = *iter;
+        std::shared_ptr<Relationship> rel = *iter;
         row[m_model_columns.m_relationship] = rel;
         row[m_model_columns.m_separator] = false;
       }
@@ -212,7 +212,7 @@ void ComboBox_Relationship::set_relationships(const type_vec_relationships& rela
 void ComboBox_Relationship::on_cell_data_name(const Gtk::TreeModel::const_iterator& iter)
 {
   Gtk::TreeModel::Row row = *iter;
-  sharedptr<Relationship> relationship = row[m_model_columns.m_relationship];
+  std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
   if(relationship)
     m_renderer_name->property_text() = relationship->get_name();
   else if(get_has_parent_table())
@@ -223,14 +223,14 @@ void ComboBox_Relationship::on_cell_data_name(const Gtk::TreeModel::const_iterat
 void ComboBox_Relationship::on_cell_data_title(const Gtk::TreeModel::const_iterator& iter)
 {
   Gtk::TreeModel::Row row = *iter;
-  sharedptr<Relationship> relationship = row[m_model_columns.m_relationship];
+  std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
   if(relationship)
   {
     Gtk::TreeModel::iterator iterParent = row->parent();
     if(iterParent)
     {
       //related relationship:
-      sharedptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
+      std::shared_ptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(relationship)
         m_renderer_title->set_property("text", item_get_title_or_name(parent_relationship) + "::" + 
item_get_title_or_name(relationship));
     }
@@ -257,13 +257,13 @@ bool ComboBox_Relationship::on_row_separator(const Glib::RefPtr<Gtk::TreeModel>&
 void ComboBox_Relationship::on_cell_data_fromfield(const Gtk::TreeModel::const_iterator& iter)
 {
   Gtk::TreeModel::Row row = *iter;
-  sharedptr<Relationship> relationship = row[m_model_columns.m_relationship];
+  std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
   if(relationship && relationship->get_has_fields())
   {
     Gtk::TreeModel::iterator iterParent = iter->parent();
     if(iterParent)
     {
-      sharedptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
+      std::shared_ptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(parent_relationship)
         m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1::%2"), 
item_get_title(parent_relationship), relationship->get_from_field()));
     }
@@ -296,7 +296,7 @@ void ComboBox_Relationship::set_display_parent_table(const Glib::ustring& table_
 
     tree_iter = m_model->prepend();
     row = *tree_iter;
-    row[m_model_columns.m_relationship] = sharedptr<Relationship>(); //A marker for the parent table's item. 
See the on_data_* signal handlers.
+    row[m_model_columns.m_relationship] = std::shared_ptr<Relationship>(); //A marker for the parent table's 
item. See the on_data_* signal handlers.
     row[m_model_columns.m_separator] = false;
   }
 }
@@ -306,7 +306,7 @@ void ComboBox_Relationship::set_selected_parent_table(const Glib::ustring& table
   //Save the values:
   set_display_parent_table(table_name, table_title);
 
-  set_selected_relationship(sharedptr<Relationship>()); //Select the extra item.
+  set_selected_relationship(std::shared_ptr<Relationship>()); //Select the extra item.
 }
 
 bool ComboBox_Relationship::get_has_parent_table() const
diff --git a/glom/mode_design/layout/combobox_relationship.h b/glom/mode_design/layout/combobox_relationship.h
index e653c37..4441e75 100644
--- a/glom/mode_design/layout/combobox_relationship.h
+++ b/glom/mode_design/layout/combobox_relationship.h
@@ -38,16 +38,16 @@ public:
   ComboBox_Relationship(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~ComboBox_Relationship();
 
-  typedef std::vector< sharedptr<Relationship> > type_vec_relationships;
+  typedef std::vector< std::shared_ptr<Relationship> > type_vec_relationships;
   void set_relationships(const type_vec_relationships& relationships, const Glib::ustring& parent_table_name 
= Glib::ustring(), const Glib::ustring& parent_table_title = Glib::ustring());
 
   void set_relationships(Document* document, const Glib::ustring parent_table_name, bool 
show_related_relationships = false, bool show_parent_table = true);
 
-  void set_selected_relationship(const sharedptr<const Relationship>& relationship);
-  void set_selected_relationship(const sharedptr<const Relationship>& relationship, const sharedptr<const 
Relationship>& related_relationship);
+  void set_selected_relationship(const std::shared_ptr<const Relationship>& relationship);
+  void set_selected_relationship(const std::shared_ptr<const Relationship>& relationship, const 
std::shared_ptr<const Relationship>& related_relationship);
   void set_selected_relationship(const Glib::ustring& name, const Glib::ustring& related_relationship_name = 
Glib::ustring());
-  sharedptr<Relationship> get_selected_relationship() const;
-  sharedptr<Relationship> get_selected_relationship(sharedptr<Relationship>& related_relatioship) const;
+  std::shared_ptr<Relationship> get_selected_relationship() const;
+  std::shared_ptr<Relationship> get_selected_relationship(std::shared_ptr<Relationship>& 
related_relatioship) const;
 
   //Sometimes we want to show the parent table as an option too, instead of just relationships:
 
@@ -74,7 +74,7 @@ private:
     ModelColumns()
     { add(m_relationship); add(m_separator); }
 
-    Gtk::TreeModelColumn< sharedptr<Relationship> > m_relationship;
+    Gtk::TreeModelColumn< std::shared_ptr<Relationship> > m_relationship;
     Gtk::TreeModelColumn<bool> m_separator;
   };
 
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index 189a197..c75b4b1 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -74,7 +74,7 @@ Dialog_ChooseField::~Dialog_ChooseField()
 {
 }
 
-void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& table_name, const 
sharedptr<const LayoutItem_Field>& field)
+void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& table_name, const 
std::shared_ptr<const LayoutItem_Field>& field)
 {
   set_document(document, table_name);
 
@@ -129,7 +129,7 @@ void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& t
 {
   m_document = document;
   m_table_name = table_name;
-  m_start_field.clear();
+  m_start_field.reset();
 
   if(!m_document)
   {
@@ -168,7 +168,7 @@ void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& t
       Gtk::TreeModel::iterator iterRow = m_model->append();
       Gtk::TreeModel::Row row = *iterRow;
 
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       row[m_ColumnsFields.m_col_name] = field->get_name();
       row[m_ColumnsFields.m_col_title] = item_get_title(field);
       row[m_ColumnsFields.m_col_field] = field;
@@ -197,9 +197,9 @@ void Dialog_ChooseField::select_item(const Field& field)
 }
 */
 
-sharedptr<LayoutItem_Field> Dialog_ChooseField::get_field_chosen() const
+std::shared_ptr<LayoutItem_Field> Dialog_ChooseField::get_field_chosen() const
 {
-  sharedptr<LayoutItem_Field> field;
+  std::shared_ptr<LayoutItem_Field> field;
 
   type_list_field_items list_fields = get_fields_chosen();
   if(!(list_fields.empty()))
@@ -237,8 +237,8 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
     
   //Relationship:
   //Note that a null relationship means that the parent table was selected instead.
-  sharedptr<Relationship> related_relationship;
-  sharedptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(related_relationship);
+  std::shared_ptr<Relationship> related_relationship;
+  std::shared_ptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(related_relationship);
 
     
   typedef std::vector<Gtk::TreeModel::Path> type_list_paths;
@@ -253,12 +253,12 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
 
     // Setup a LayoutItem_Field for the Field, 
     // so is_same_field() can work:
-    sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
     field->set_relationship(relationship);
     field->set_related_relationship(related_relationship);
       
     Gtk::TreeModel::Row row = *tree_iter;
-    sharedptr<Field> field_details = row[m_ColumnsFields.m_col_field];
+    std::shared_ptr<Field> field_details = row[m_ColumnsFields.m_col_field];
     field->set_full_field_details(field_details); 
       
     // Start with the original LayoutItem_Field, 
@@ -266,7 +266,7 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
     if(m_start_field && m_start_field->is_same_field(field))
       field = m_start_field; 
     else
-      field = sharedptr<LayoutItem_Field>::create();
+      field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
 
     //Use the chosen field:
     field->set_relationship(relationship);
@@ -295,8 +295,8 @@ void Dialog_ChooseField::on_checkbutton_related_relationships_toggled()
   const bool show_related_relationships = m_checkbutton_show_related_relationships->get_active();
 
   //Preserve the selection:
-  sharedptr<Relationship> related_relationship;
-  sharedptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(related_relationship);
+  std::shared_ptr<Relationship> related_relationship;
+  std::shared_ptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(related_relationship);
 
   //Refresh the list, hiding or showing the child relationships:
   m_combo_relationship->set_relationships(m_document, m_table_name, show_related_relationships);
@@ -306,7 +306,7 @@ void Dialog_ChooseField::on_checkbutton_related_relationships_toggled()
 
 void Dialog_ChooseField::on_combo_relationship_changed()
 {
-  sharedptr<Relationship> relationship = m_combo_relationship->get_selected_relationship();
+  std::shared_ptr<Relationship> relationship = m_combo_relationship->get_selected_relationship();
 
   Document* pDocument = m_document;
   if(pDocument)
@@ -327,7 +327,7 @@ void Dialog_ChooseField::on_combo_relationship_changed()
       Gtk::TreeModel::iterator iterRow = m_model->append();
       Gtk::TreeModel::Row row = *iterRow;
 
-      sharedptr<Field> field = *iter;
+      std::shared_ptr<Field> field = *iter;
       row[m_ColumnsFields.m_col_name] = field->get_name();
       row[m_ColumnsFields.m_col_title] = item_get_title(field);
       row[m_ColumnsFields.m_col_field] = field;
diff --git a/glom/mode_design/layout/dialog_choose_field.h b/glom/mode_design/layout/dialog_choose_field.h
index 070cde9..78d479e 100644
--- a/glom/mode_design/layout/dialog_choose_field.h
+++ b/glom/mode_design/layout/dialog_choose_field.h
@@ -46,15 +46,15 @@ public:
    * @param table_name The table name.
    * @param field The starting field information.
    */
-  virtual void set_document(Document* document, const Glib::ustring& table_name, const sharedptr<const 
LayoutItem_Field>& field);
+  virtual void set_document(Document* document, const Glib::ustring& table_name, const std::shared_ptr<const 
LayoutItem_Field>& field);
   virtual void set_document(Document* document, const Glib::ustring& table_name);
 
 
-  //void select_item(const sharedptr<const Field>& field);
+  //void select_item(const std::shared_ptr<const Field>& field);
 
-  sharedptr<LayoutItem_Field> get_field_chosen() const;
+  std::shared_ptr<LayoutItem_Field> get_field_chosen() const;
   
-  typedef std::list< sharedptr<LayoutItem_Field> > type_list_field_items;
+  typedef std::list< std::shared_ptr<LayoutItem_Field> > type_list_field_items;
   type_list_field_items get_fields_chosen() const;
 
 private:
@@ -74,7 +74,7 @@ private:
 
     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
     Gtk::TreeModelColumn<Glib::ustring> m_col_title;
-    Gtk::TreeModelColumn< sharedptr<Field> > m_col_field;
+    Gtk::TreeModelColumn< std::shared_ptr<Field> > m_col_field;
   };
 
   ModelColumns_Fields m_ColumnsFields;
@@ -86,7 +86,7 @@ private:
   Glib::RefPtr<Gtk::ListStore> m_model;
 
   Glib::ustring m_table_name;
-  sharedptr<LayoutItem_Field> m_start_field; //stored so we can preserve extra information that's not 
changed here.
+  std::shared_ptr<LayoutItem_Field> m_start_field; //stored so we can preserve extra information that's not 
changed here.
 
   Document* m_document;
 };
diff --git a/glom/mode_design/layout/dialog_choose_relationship.cc 
b/glom/mode_design/layout/dialog_choose_relationship.cc
index bdf7efc..d2d0cf8 100644
--- a/glom/mode_design/layout/dialog_choose_relationship.cc
+++ b/glom/mode_design/layout/dialog_choose_relationship.cc
@@ -82,7 +82,7 @@ void Dialog_ChooseRelationship::set_document(Document* document, const Glib::ust
       Gtk::TreeModel::iterator iterRow = m_model->append();
       Gtk::TreeModel::Row row = *iterRow;
 
-      sharedptr<Relationship> relationship = *iter;
+      std::shared_ptr<Relationship> relationship = *iter;
       if(relationship)
         row[m_ColumnsRelationships.m_col_name] = glom_get_sharedptr_name(relationship);
 
@@ -92,7 +92,7 @@ void Dialog_ChooseRelationship::set_document(Document* document, const Glib::ust
   }
 }
 
-void Dialog_ChooseRelationship::select_item(const sharedptr<const Relationship>& relationship)
+void Dialog_ChooseRelationship::select_item(const std::shared_ptr<const Relationship>& relationship)
 {
   Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview->get_selection();
   if(!refTreeSelection)
@@ -108,7 +108,7 @@ void Dialog_ChooseRelationship::select_item(const sharedptr<const Relationship>&
       const Glib::ustring relationship_name = glom_get_sharedptr_name(relationship);
 
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<Relationship> relationship_item = row[m_ColumnsRelationships.m_col_relationship];
+      std::shared_ptr<Relationship> relationship_item = row[m_ColumnsRelationships.m_col_relationship];
       if(glom_get_sharedptr_name(relationship_item) == relationship_name)
       {
         //Select the item:
@@ -118,9 +118,9 @@ void Dialog_ChooseRelationship::select_item(const sharedptr<const Relationship>&
   }
 }
 
-sharedptr<Relationship> Dialog_ChooseRelationship::get_relationship_chosen() const
+std::shared_ptr<Relationship> Dialog_ChooseRelationship::get_relationship_chosen() const
 {
-  sharedptr<Relationship> result;
+  std::shared_ptr<Relationship> result;
 
   Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview->get_selection();
   if(refTreeSelection)
diff --git a/glom/mode_design/layout/dialog_choose_relationship.h 
b/glom/mode_design/layout/dialog_choose_relationship.h
index 7315628..1de489d 100644
--- a/glom/mode_design/layout/dialog_choose_relationship.h
+++ b/glom/mode_design/layout/dialog_choose_relationship.h
@@ -45,9 +45,9 @@ public:
    */
   virtual void set_document(Document* document, const Glib::ustring& table_name);
 
-  void select_item(const sharedptr<const Relationship>& relationship);
+  void select_item(const std::shared_ptr<const Relationship>& relationship);
 
-  sharedptr<Relationship> get_relationship_chosen() const;
+  std::shared_ptr<Relationship> get_relationship_chosen() const;
 
 private:
 
@@ -61,7 +61,7 @@ private:
 
     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
     //Gtk::TreeModelColumn<Glib::ustring> m_col_title;
-    Gtk::TreeModelColumn< sharedptr<Relationship> > m_col_relationship;
+    Gtk::TreeModelColumn< std::shared_ptr<Relationship> > m_col_relationship;
   };
 
   ModelColumns_Relationships m_ColumnsRelationships;
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc 
b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index 5353fbf..c2b0f02 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -95,7 +95,7 @@ Dialog_Layout_Calendar_Related::~Dialog_Layout_Calendar_Related()
 }
 
 
-void Dialog_Layout_Calendar_Related::init_with_portal(const Glib::ustring& layout, const Glib::ustring& 
layout_platform, Document* document, const sharedptr<const LayoutItem_CalendarPortal>& portal)
+void Dialog_Layout_Calendar_Related::init_with_portal(const Glib::ustring& layout, const Glib::ustring& 
layout_platform, Document* document, const std::shared_ptr<const LayoutItem_CalendarPortal>& portal)
 {
   m_portal = glom_sharedptr_clone(portal);
 
@@ -110,7 +110,7 @@ void Dialog_Layout_Calendar_Related::init_with_tablename(const Glib::ustring& la
 {
   if(!m_portal)
   {
-    m_portal = sharedptr<LayoutItem_CalendarPortal>::create(); //The rest of the class assumes that this is 
not null.
+    m_portal = std::shared_ptr<LayoutItem_CalendarPortal>(new LayoutItem_CalendarPortal()); //The rest of 
the class assumes that this is not null.
   }
 
   type_vecConstLayoutFields empty_fields; //Just to satisfy the base class.
@@ -158,7 +158,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
     }
 
     //Set the table name and title:
-    //sharedptr<LayoutItem_CalendarPortal> portal_temp = m_portal;
+    //std::shared_ptr<LayoutItem_CalendarPortal> portal_temp = m_portal;
     m_combo_relationship->set_selected_relationship(m_portal->get_relationship(), 
m_portal->get_related_relationship());
 
     Document::type_list_layout_groups mapGroups;
@@ -175,14 +175,14 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
 
     for(Document::type_list_layout_groups::const_iterator iter = mapGroups.begin(); iter != mapGroups.end(); 
++iter)
     {
-      sharedptr<const LayoutGroup> group = *iter;
-      sharedptr<const LayoutGroup> portal = sharedptr<const LayoutItem_CalendarPortal>::cast_dynamic(group);
+      std::shared_ptr<const LayoutGroup> group = *iter;
+      std::shared_ptr<const LayoutGroup> portal = std::dynamic_pointer_cast<const 
LayoutItem_CalendarPortal>(group);
       if(portal)
       {
         for(LayoutGroup::type_list_items::const_iterator iterInner = group->m_list_items.begin(); iterInner 
!= group->m_list_items.end(); ++iterInner)
         {
-          sharedptr<const LayoutItem> item = *iterInner;
-          sharedptr<const LayoutGroup> groupInner = sharedptr<const LayoutGroup>::cast_dynamic(item);
+          std::shared_ptr<const LayoutItem> item = *iterInner;
+          std::shared_ptr<const LayoutGroup> groupInner = std::dynamic_pointer_cast<const LayoutGroup>(item);
 
           if(groupInner)
             add_group(Gtk::TreeModel::iterator() /* null == top-level */, groupInner);
@@ -206,7 +206,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
   bool navigation_is_automatic = false;
   if(m_portal->get_navigation_type() == LayoutItem_Portal::NAVIGATION_SPECIFIC)
   {
-    sharedptr<UsesRelationship> navrel = m_portal->get_navigation_relationship_specific();
+    std::shared_ptr<UsesRelationship> navrel = m_portal->get_navigation_relationship_specific();
     //std::cout << "debug navrel=" << navrel->get_relationship()->get_name() << std::endl;
     m_combo_navigation_specify->set_selected_relationship(navrel->get_relationship(), 
navrel->get_related_relationship());
   }
@@ -214,7 +214,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
   {
     navigation_is_automatic = true;
 
-    sharedptr<const Relationship> none;
+    std::shared_ptr<const Relationship> none;
     m_combo_navigation_specify->set_selected_relationship(none);
   }
 
@@ -225,7 +225,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
 
 
   //Describe the automatic navigation:
-  sharedptr<const UsesRelationship> relationship_navigation_automatic
+  std::shared_ptr<const UsesRelationship> relationship_navigation_automatic
     = m_portal->get_portal_navigation_relationship_automatic(document);
   Glib::ustring automatic_navigation_description = 
     m_portal->get_relationship_name_used(); //TODO: Use get_relationship_display_name() instead?
@@ -241,7 +241,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
 
   m_label_navigation_automatic->set_text(automatic_navigation_description);
 
-  sharedptr<Field> debugfield = m_portal->get_date_field();
+  std::shared_ptr<Field> debugfield = m_portal->get_date_field();
   if(!debugfield)
     std::cout << "debug: " << G_STRFUNC << ": date field is NULL" << std::endl;
   else
@@ -273,7 +273,7 @@ void Dialog_Layout_Calendar_Related::save_to_document()
     {
       Gtk::TreeModel::Row row = *iterFields;
 
-      sharedptr<LayoutItem> item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> item = row[m_model_items->m_columns.m_col_layout_item];
       const Glib::ustring field_name = item->get_name();
       if(!field_name.empty())
       {
@@ -285,10 +285,10 @@ void Dialog_Layout_Calendar_Related::save_to_document()
 
     if(m_radio_navigation_specify->get_active())
     {
-      sharedptr<Relationship> rel, rel_related;
+      std::shared_ptr<Relationship> rel, rel_related;
       rel = m_combo_navigation_specify->get_selected_relationship(rel_related);
 
-      sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::create();
+      std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
       uses_rel->set_relationship(rel);
       uses_rel->set_related_relationship(rel_related);
 
@@ -299,13 +299,13 @@ void Dialog_Layout_Calendar_Related::save_to_document()
     else
     {
       //std::cout << "debug: set_navigation_relationship_specific(false, none)" << std::endl;
-      sharedptr<UsesRelationship> none;
+      std::shared_ptr<UsesRelationship> none;
       m_portal->set_navigation_relationship_specific(none);
     }
 
     m_portal->set_date_field( m_combobox_date_field->get_selected_field() );
 
-    sharedptr<Field> debugfield = m_portal->get_date_field();
+    std::shared_ptr<Field> debugfield = m_portal->get_date_field();
     if(!debugfield)
       std::cout << "debug: " << G_STRFUNC << ": date field is NULL" << std::endl;
     else
@@ -323,8 +323,8 @@ void Dialog_Layout_Calendar_Related::on_combo_relationship_changed()
   if(!m_portal)
     return;
 
-  sharedptr<Relationship> relationship_related;
-  sharedptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(relationship_related);
+  std::shared_ptr<Relationship> relationship_related;
+  std::shared_ptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(relationship_related);
   if(relationship)
   {
     //Clear the list of fields if the relationship has changed, because the fields could not possible be 
correct for the new table:
@@ -348,7 +348,7 @@ void Dialog_Layout_Calendar_Related::on_combo_relationship_changed()
   }
 }
 
-sharedptr<Relationship> Dialog_Layout_Calendar_Related::get_relationship() const
+std::shared_ptr<Relationship> Dialog_Layout_Calendar_Related::get_relationship() const
 {
   std::cout << "debug: I wonder if this function is used." << std::endl;
   return m_combo_relationship->get_selected_relationship();
@@ -374,7 +374,7 @@ void Dialog_Layout_Calendar_Related::on_button_add_field()
   type_list_field_items fields_list = offer_field_list(m_table_name, this);
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen)
   {
-    sharedptr<LayoutItem_Field> field = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> field = *iter_chosen;
     if(!field)
       continue;
 
@@ -405,11 +405,11 @@ void Dialog_Layout_Calendar_Related::on_button_edit()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
 
       //Get the chosen field:
-      sharedptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, 
m_portal->get_table_used(m_table_name), this);
+      std::shared_ptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, 
m_portal->get_table_used(m_table_name), this);
       if(field_chosen)
       {
         //Set the field details in the layout treeview:
@@ -431,7 +431,7 @@ void Dialog_Layout_Calendar_Related::on_button_edit()
   }
 }
 
-sharedptr<LayoutItem_CalendarPortal> Dialog_Layout_Calendar_Related::get_portal_layout()
+std::shared_ptr<LayoutItem_CalendarPortal> Dialog_Layout_Calendar_Related::get_portal_layout()
 {
   return m_portal;
 }
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.h 
b/glom/mode_design/layout/dialog_layout_calendar_related.h
index 92a30a8..adcef53 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.h
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.h
@@ -46,14 +46,14 @@ public:
    * @param table_name The table name.
    * @param table_fields: The actual fields in the table, in case the document does not yet know about them 
all.
    */
-  void init_with_portal(const Glib::ustring& layout, const Glib::ustring& layout_platform, Document* 
document, const sharedptr<const LayoutItem_CalendarPortal>& portal);
+  void init_with_portal(const Glib::ustring& layout, const Glib::ustring& layout_platform, Document* 
document, const std::shared_ptr<const LayoutItem_CalendarPortal>& portal);
 
   void init_with_tablename(const Glib::ustring& layout, const Glib::ustring& layout_platform, Document* 
document, const Glib::ustring& parent_table);
 
   virtual void update_ui(bool including_relationships_list = true);
 
-  sharedptr<Relationship> get_relationship() const;
-  sharedptr<LayoutItem_CalendarPortal>  get_portal_layout();
+  std::shared_ptr<Relationship> get_relationship() const;
+  std::shared_ptr<LayoutItem_CalendarPortal>  get_portal_layout();
 
 private:
 
@@ -72,7 +72,7 @@ private:
 
   ComboBox_Relationship* m_combo_relationship;
   Gtk::CheckButton* m_checkbutton_show_child_relationships;
-  sharedptr<LayoutItem_CalendarPortal> m_portal;
+  std::shared_ptr<LayoutItem_CalendarPortal> m_portal;
 
   Gtk::RadioButton* m_radio_navigation_automatic;
   Gtk::RadioButton* m_radio_navigation_specify;
diff --git a/glom/mode_design/layout/dialog_layout_details.cc 
b/glom/mode_design/layout/dialog_layout_details.cc
index a8b1786..885f687 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -210,21 +210,21 @@ Dialog_Layout_Details::~Dialog_Layout_Details()
 {
 }
 
-void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, sharedptr<LayoutGroup>& group)
+void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, std::shared_ptr<LayoutGroup>& 
group)
 {
-  sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(group);
+  std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(group);
   if(portal)
     return; //This method is not for portals.
 
   if(iter)
   {
     Gtk::TreeModel::Row row = *iter;
-    sharedptr<LayoutItem> layout_item_top = row[m_model_items->m_columns.m_col_layout_item];
-    sharedptr<LayoutGroup> group_row = sharedptr<LayoutGroup>::cast_dynamic(layout_item_top);
+    std::shared_ptr<LayoutItem> layout_item_top = row[m_model_items->m_columns.m_col_layout_item];
+    std::shared_ptr<LayoutGroup> group_row = std::dynamic_pointer_cast<LayoutGroup>(layout_item_top);
     if(!group_row)
       return;
 
-    sharedptr<LayoutItem_Portal> portal_row = sharedptr<LayoutItem_Portal>::cast_dynamic(group_row);
+    std::shared_ptr<LayoutItem_Portal> portal_row = std::dynamic_pointer_cast<LayoutItem_Portal>(group_row);
     if(portal_row) //This is only for groups.
       return;
 
@@ -236,9 +236,9 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, sha
     {
       Gtk::TreeModel::Row rowChild = *iterChild;
 
-      sharedptr<LayoutItem> layout_item = rowChild[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = rowChild[m_model_items->m_columns.m_col_layout_item];
 
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layout_portal)
       {
         //std::cout << "debug: " << G_STRFUNC << ": adding portal." << std::endl;
@@ -247,12 +247,12 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, sha
       else
       {
         //std::cout << "debug: " << G_STRFUNC << ": adding group." << std::endl;
-        sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-        sharedptr<LayoutItem_Portal> layout_portal = 
sharedptr<LayoutItem_Portal>::cast_dynamic(layout_group);
+        std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+        std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_group);
         if(layout_group && !layout_portal)
         {
           //Recurse:
-          sharedptr<LayoutGroup> group_child = glom_sharedptr_clone(layout_group);
+          std::shared_ptr<LayoutGroup> group_child = glom_sharedptr_clone(layout_group);
           fill_group(iterChild, group_child);
           group->add_item(group_child);
         }
@@ -261,7 +261,7 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, sha
           //std::cout << "debug: " << G_STRFUNC << ": adding item." << std::endl;
 
           //Add field or button:
-          sharedptr<LayoutItem> item = glom_sharedptr_clone(layout_item);
+          std::shared_ptr<LayoutItem> item = glom_sharedptr_clone(layout_item);
           group->add_item(item);
         }
       }
@@ -270,12 +270,12 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, sha
 }
 
 
-void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, const sharedptr<const 
LayoutGroup>& group)
+void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, const std::shared_ptr<const 
LayoutGroup>& group)
 {
   if(!group)
    return;
 
-  sharedptr<const LayoutItem_Portal> portal = sharedptr<const LayoutItem_Portal>::cast_dynamic(group);
+  std::shared_ptr<const LayoutItem_Portal> portal = std::dynamic_pointer_cast<const 
LayoutItem_Portal>(group);
   if(portal)
     return; //This method is not for portals.
 
@@ -294,7 +294,7 @@ void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, co
   {
     Gtk::TreeModel::Row rowGroup = *iterNewGroup;
 
-    sharedptr<LayoutGroup> group_inserted = glom_sharedptr_clone(group);
+    std::shared_ptr<LayoutGroup> group_inserted = glom_sharedptr_clone(group);
     group_inserted->remove_all_items();
     rowGroup[m_model_items->m_columns.m_col_layout_item] = group_inserted;
 
@@ -302,9 +302,9 @@ void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, co
     LayoutGroup::type_list_const_items items = group->get_items();
     for(LayoutGroup::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); ++iter)
     {
-      sharedptr<const LayoutItem> item = *iter;
+      std::shared_ptr<const LayoutItem> item = *iter;
 
-      sharedptr<const LayoutItem_Portal> portal = sharedptr<const LayoutItem_Portal>::cast_dynamic(item);
+      std::shared_ptr<const LayoutItem_Portal> portal = std::dynamic_pointer_cast<const 
LayoutItem_Portal>(item);
       if(portal) //If it is a portal
       {
         //Handle this differently to regular groups, so we do not also add its children:
@@ -314,7 +314,7 @@ void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, co
       }
       else
       {
-        sharedptr<const LayoutGroup> child_group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+        std::shared_ptr<const LayoutGroup> child_group = std::dynamic_pointer_cast<const LayoutGroup>(item);
         if(child_group) //If it is a group:
           add_group(iterNewGroup, child_group); //recursive
         else
@@ -351,7 +351,7 @@ void Dialog_Layout_Details::init(const Glib::ustring& layout_name, const Glib::u
 
     if(list_groups.empty())
     {
-      sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
+      std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
       group->set_name("main");
       group->set_columns_count(1);
 
@@ -365,8 +365,8 @@ void Dialog_Layout_Details::init(const Glib::ustring& layout_name, const Glib::u
 
     for(Document::type_list_layout_groups::const_iterator iter = list_groups.begin(); iter != 
list_groups.end(); ++iter)
     {
-      sharedptr<const LayoutGroup> group = *iter;
-      sharedptr<const LayoutGroup> portal = sharedptr<const LayoutItem_Portal>::cast_dynamic(group);
+      std::shared_ptr<const LayoutGroup> group = *iter;
+      std::shared_ptr<const LayoutGroup> portal = std::dynamic_pointer_cast<const LayoutItem_Portal>(group);
       if(group && !portal)
         add_group(Gtk::TreeModel::iterator() /* null == top-level */, group);
     }
@@ -431,9 +431,9 @@ void Dialog_Layout_Details::enable_buttons()
       m_button_field_delete->set_sensitive(true);
 
       //Only some items have formatting:
-      sharedptr<LayoutItem> layout_item = (*iter)[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutItem_WithFormatting> layoutitem_withformatting = 
sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
-      const bool is_field = layoutitem_withformatting;
+      std::shared_ptr<LayoutItem> layout_item = (*iter)[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem_WithFormatting> layoutitem_withformatting = 
std::dynamic_pointer_cast<LayoutItem_WithFormatting>(layout_item);
+      const bool is_field = (bool)layoutitem_withformatting;
       m_button_formatting->set_sensitive(is_field);
     }
     else
@@ -533,7 +533,7 @@ void Dialog_Layout_Details::on_button_add_field()
   type_list_field_items fields_list = offer_field_list(m_table_name, this);
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen)
   {
-    sharedptr<LayoutItem_Field> layout_item = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> layout_item = *iter_chosen;
     if(!layout_item)
       continue;
 
@@ -559,9 +559,9 @@ void Dialog_Layout_Details::on_button_add_field()
 }
 
 
-sharedptr<LayoutItem_Button> Dialog_Layout_Details::offer_button_script_edit(const sharedptr<const 
LayoutItem_Button>& button)
+std::shared_ptr<LayoutItem_Button> Dialog_Layout_Details::offer_button_script_edit(const 
std::shared_ptr<const LayoutItem_Button>& button)
 {
-  sharedptr<LayoutItem_Button> result;
+  std::shared_ptr<LayoutItem_Button> result;
 
   Dialog_ButtonScript* dialog = 0;
   Glom::Utils::get_glade_widget_derived_with_warning(dialog);
@@ -583,14 +583,14 @@ sharedptr<LayoutItem_Button> Dialog_Layout_Details::offer_button_script_edit(con
   return result;
 }
 
-sharedptr<Relationship> Dialog_Layout_Details::offer_relationship_list()
+std::shared_ptr<Relationship> Dialog_Layout_Details::offer_relationship_list()
 {
-  return offer_relationship_list(sharedptr<Relationship>());
+  return offer_relationship_list(std::shared_ptr<Relationship>());
 }
 
-sharedptr<Relationship> Dialog_Layout_Details::offer_relationship_list(const sharedptr<const Relationship>& 
item)
+std::shared_ptr<Relationship> Dialog_Layout_Details::offer_relationship_list(const std::shared_ptr<const 
Relationship>& item)
 {
-  sharedptr<Relationship> result = glom_sharedptr_clone(item);
+  std::shared_ptr<Relationship> result = glom_sharedptr_clone(item);
 
   Dialog_ChooseRelationship* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -632,9 +632,9 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::append_appropriate_row()
     {
       Gtk::TreeModel::Row row = *iter_first;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
 
       if(layout_group && !layout_portal)
         result = m_model_items->append(iter_first->children());
@@ -658,7 +658,7 @@ void Dialog_Layout_Details::on_button_add_button()
     Gtk::TreeModel::Row row = *iter;
 
     //Add a new button:
-    sharedptr<LayoutItem_Button> button = sharedptr<LayoutItem_Button>::create();
+    std::shared_ptr<LayoutItem_Button> button = std::shared_ptr<LayoutItem_Button>(new LayoutItem_Button());
     button->set_title_original(_("New Button")); //Give the button a default title, so it is big enough, and 
so people see that they should change it.
     row[m_model_items->m_columns.m_col_layout_item] = button;
 
@@ -683,7 +683,7 @@ void Dialog_Layout_Details::on_button_add_text()
     Gtk::TreeModel::Row row = *iter;
 
     //Add a new button:
-    sharedptr<LayoutItem_Text> textobject = sharedptr<LayoutItem_Text>::create();
+    std::shared_ptr<LayoutItem_Text> textobject = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
     textobject->set_title_original(_("Text Title")); //Give the button a default title, so it is big enough, 
and so people see that they should change it.
     row[m_model_items->m_columns.m_col_layout_item] = textobject;
 
@@ -708,7 +708,7 @@ void Dialog_Layout_Details::on_button_add_image()
     Gtk::TreeModel::Row row = *iter;
 
     //Add a new button:
-    sharedptr<LayoutItem_Image> imageobject = sharedptr<LayoutItem_Image>::create();
+    std::shared_ptr<LayoutItem_Image> imageobject = std::shared_ptr<LayoutItem_Image>(new 
LayoutItem_Image());
     imageobject->set_title_original(_("Image Title")); //Give the item a default title, so it is big enough, 
and so people see that they should change it.
     row[m_model_items->m_columns.m_col_layout_item] = imageobject;
 
@@ -732,7 +732,7 @@ void Dialog_Layout_Details::on_button_add_notebook()
   {
     Gtk::TreeModel::Row row = *iter;
 
-    sharedptr<LayoutItem_Notebook> notebook = sharedptr<LayoutItem_Notebook>::create();
+    std::shared_ptr<LayoutItem_Notebook> notebook = std::shared_ptr<LayoutItem_Notebook>(new 
LayoutItem_Notebook());
     notebook->set_name(_("notebook"));
     row[m_model_items->m_columns.m_col_layout_item] = notebook;
 
@@ -752,7 +752,7 @@ void Dialog_Layout_Details::on_button_add_notebook()
 void Dialog_Layout_Details::on_button_add_related()
 {
   /* We don't need to ask this because the portal layout dialog can now handle an empty portal:
-  sharedptr<Relationship> relationship = offer_relationship_list();
+  std::shared_ptr<Relationship> relationship = offer_relationship_list();
   if(relationship)
   {
   */
@@ -761,7 +761,7 @@ void Dialog_Layout_Details::on_button_add_related()
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::create();
+      std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_Portal>(new 
LayoutItem_Portal());
       //portal->set_relationship(relationship);
       row[m_model_items->m_columns.m_col_layout_item] = portal;
 
@@ -784,7 +784,7 @@ void Dialog_Layout_Details::on_button_add_related()
 void Dialog_Layout_Details::on_button_add_related_calendar()
 {
   /* We don't need to ask this because the portal layout dialog can now handle an empty portal:
-  sharedptr<Relationship> relationship = offer_relationship_list();
+  std::shared_ptr<Relationship> relationship = offer_relationship_list();
   if(relationship)
   {
   */
@@ -793,7 +793,7 @@ void Dialog_Layout_Details::on_button_add_related_calendar()
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_CalendarPortal>::create();
+      std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_CalendarPortal>(new 
LayoutItem_CalendarPortal());
       //portal->set_relationship(relationship);
       row[m_model_items->m_columns.m_col_layout_item] = portal;
 
@@ -825,9 +825,9 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::get_selected_group_parent() cons
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
 
       if(layout_group && !layout_portal)
       {
@@ -863,7 +863,7 @@ void Dialog_Layout_Details::on_button_add_group()
   if(iterNewGroup)
   {
     Gtk::TreeModel::Row row = *iterNewGroup;
-    sharedptr<LayoutGroup> layout_item = sharedptr<LayoutGroup>::create();
+    std::shared_ptr<LayoutGroup> layout_item = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     layout_item->set_name(_("group"));
     row[m_model_items->m_columns.m_col_layout_item] = layout_item;
 
@@ -893,12 +893,12 @@ void Dialog_Layout_Details::on_button_formatting()
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
       if(field)
       {
         //Handle field formatting, which includes more than the generic formatting stuff:
-        sharedptr<LayoutItem_Field> chosenitem = offer_field_formatting(field, get_fields_table(), this, 
m_editable_layout);
+        std::shared_ptr<LayoutItem_Field> chosenitem = offer_field_formatting(field, get_fields_table(), 
this, m_editable_layout);
         if(chosenitem)
         {
           *field = *chosenitem; //TODO_Performance.
@@ -909,7 +909,7 @@ void Dialog_Layout_Details::on_button_formatting()
       else
       {
         //Handle any other items that can have formatting:
-        sharedptr<LayoutItem_WithFormatting> withformatting = 
sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_WithFormatting> withformatting = 
std::dynamic_pointer_cast<LayoutItem_WithFormatting>(layout_item);
         if(withformatting)
         {
           const bool changed = offer_non_field_item_formatting(withformatting, this);
@@ -935,12 +935,12 @@ void Dialog_Layout_Details::on_button_edit()
       //This whole dialog is just a temporary way to edit the layout before we have a visual DnD way.
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
 
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layout_portal)
       {
-        sharedptr<Relationship> relationship = offer_relationship_list(layout_portal->get_relationship());
+        std::shared_ptr<Relationship> relationship = 
offer_relationship_list(layout_portal->get_relationship());
         if(relationship)
         {
           layout_portal->set_relationship(relationship);
@@ -953,12 +953,12 @@ void Dialog_Layout_Details::on_button_edit()
       }
       else
       {
-        sharedptr<LayoutItem_Notebook> layout_notebook = 
sharedptr<LayoutItem_Notebook>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_Notebook> layout_notebook = 
std::dynamic_pointer_cast<LayoutItem_Notebook>(layout_item);
         if(layout_notebook)
         {
           Frame_Glom::show_ok_dialog(_("Notebook Tabs"), _("Add child groups to the notebook to add tabs."), 
*this);
           /*
-          sharedptr<LayoutItem_Notebook> chosen = offer_notebook(layout_notebook);
+          std::shared_ptr<LayoutItem_Notebook> chosen = offer_notebook(layout_notebook);
           if(chosen)
           {
             row[m_model_items->m_columns.m_col_layout_item] = chosen;
@@ -968,7 +968,7 @@ void Dialog_Layout_Details::on_button_edit()
         }
         else
         {
-          sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
+          std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
           if(layout_group)
           {
             Gtk::TreeModel::Path path = m_model_items->get_path(iter);
@@ -976,10 +976,10 @@ void Dialog_Layout_Details::on_button_edit()
           }
           else
           {
-            sharedptr<LayoutItem_Field> layout_item_field = 
sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+            std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
             if(layout_item_field)
             {
-              sharedptr<LayoutItem_Field> chosenitem = offer_field_list_select_one_field(layout_item_field, 
m_table_name, this);
+              std::shared_ptr<LayoutItem_Field> chosenitem = 
offer_field_list_select_one_field(layout_item_field, m_table_name, this);
               if(chosenitem)
               {
                 *layout_item_field = *chosenitem;
@@ -989,10 +989,10 @@ void Dialog_Layout_Details::on_button_edit()
             }
             else
             {
-              sharedptr<LayoutItem_Button> layout_item_button = 
sharedptr<LayoutItem_Button>::cast_dynamic(layout_item);
+              std::shared_ptr<LayoutItem_Button> layout_item_button = 
std::dynamic_pointer_cast<LayoutItem_Button>(layout_item);
               if(layout_item_button)
               {
-                sharedptr<LayoutItem_Button> chosen = offer_button_script_edit(layout_item_button);
+                std::shared_ptr<LayoutItem_Button> chosen = offer_button_script_edit(layout_item_button);
                 if(chosen)
                 {
                   *layout_item_button = *chosen;
@@ -1003,10 +1003,10 @@ void Dialog_Layout_Details::on_button_edit()
               }
               else
               {
-                sharedptr<LayoutItem_Text> layout_item_text = 
sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+                std::shared_ptr<LayoutItem_Text> layout_item_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
                 if(layout_item_text)
                 {
-                  sharedptr<LayoutItem_Text> chosen = offer_textobject(layout_item_text);
+                  std::shared_ptr<LayoutItem_Text> chosen = offer_textobject(layout_item_text);
                   if(chosen)
                   {
                     *layout_item_text = *chosen;
@@ -1017,10 +1017,10 @@ void Dialog_Layout_Details::on_button_edit()
                 }
                 else
                 {
-                  sharedptr<LayoutItem_Image> layout_item_image = 
sharedptr<LayoutItem_Image>::cast_dynamic(layout_item);
+                  std::shared_ptr<LayoutItem_Image> layout_item_image = 
std::dynamic_pointer_cast<LayoutItem_Image>(layout_item);
                   if(layout_item_image)
                   {
-                    sharedptr<LayoutItem_Image> chosen = offer_imageobject(layout_item_image);
+                    std::shared_ptr<LayoutItem_Image> chosen = offer_imageobject(layout_item_image);
                     if(chosen)
                     {
                       *layout_item_image = *chosen;
@@ -1070,12 +1070,12 @@ void Dialog_Layout_Details::save_to_document()
     {
       Gtk::TreeModel::Row row = *iterFields;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layout_group && !layout_portal) //There may be top-level groups, but no top-level fields, because 
the fields must be in a group (so that they are in columns)
       {
-        sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
+        std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
         fill_group(iterFields, group);
 
         list_groups.push_back(group);
@@ -1107,17 +1107,17 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
 
       //Use the markup property instead of the text property, so that we can give the text some style:
       Glib::ustring markup;
 
       bool is_group = false;
 
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layout_portal)
       {
-        sharedptr<LayoutItem_CalendarPortal> layout_calendar = 
sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(layout_portal);
+        std::shared_ptr<LayoutItem_CalendarPortal> layout_calendar = 
std::dynamic_pointer_cast<LayoutItem_CalendarPortal>(layout_portal);
         if(layout_calendar)
           markup = Glib::ustring::compose(_("Related Calendar: %1"), layout_portal->get_relationship_name());
         else
@@ -1125,7 +1125,7 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
       }
       else
       {
-        sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
         if(layout_group)
         {
           is_group = true;
@@ -1135,7 +1135,7 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
         }
         else
         {
-          sharedptr<LayoutItem_Field> layout_item_field = 
sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+          std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
           if(layout_item_field)
           {
             markup = Glib::ustring::compose(_("Field: %1"), layout_item_field->get_layout_display_name());
@@ -1146,21 +1146,21 @@ void Dialog_Layout_Details::on_cell_data_name(Gtk::CellRenderer* renderer, const
           }
           else
           {
-            sharedptr<LayoutItem_Button> layout_item_button = 
sharedptr<LayoutItem_Button>::cast_dynamic(layout_item);
+            std::shared_ptr<LayoutItem_Button> layout_item_button = 
std::dynamic_pointer_cast<LayoutItem_Button>(layout_item);
             if(layout_item_button)
             {
               markup = _("Button"); //Buttons don't have names - just titles. TODO: Would they be useful?
             }
             else
             {
-              sharedptr<LayoutItem_Text> layout_item_text = 
sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+              std::shared_ptr<LayoutItem_Text> layout_item_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
               if(layout_item_text)
               {
                 markup = _("Text"); //Text objects don't have names - just titles. TODO: Would they be 
useful?
               }
               else
               {
-                sharedptr<LayoutItem_Image> layout_item_image = 
sharedptr<LayoutItem_Image>::cast_dynamic(layout_item);
+                std::shared_ptr<LayoutItem_Image> layout_item_image = 
std::dynamic_pointer_cast<LayoutItem_Image>(layout_item);
                 if(layout_item_image)
                 {
                   markup = _("Image"); //Image objects don't have names - just titles. TODO: Would they be 
useful?
@@ -1194,8 +1194,8 @@ void Dialog_Layout_Details::on_cell_data_title(Gtk::CellRenderer* renderer, cons
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutItem_Notebook> layout_notebook = 
sharedptr<LayoutItem_Notebook>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Notebook> layout_notebook = 
std::dynamic_pointer_cast<LayoutItem_Notebook>(layout_item);
       if(layout_notebook)
         renderer_text->property_text() = _("(Notebook)");
       else if(layout_item)
@@ -1203,10 +1203,10 @@ void Dialog_Layout_Details::on_cell_data_title(Gtk::CellRenderer* renderer, cons
       else
         renderer_text->property_text() = Glib::ustring();
 
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Button> layout_button = sharedptr<LayoutItem_Button>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Text> layout_text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
+      std::shared_ptr<LayoutItem_Button> layout_button = 
std::dynamic_pointer_cast<LayoutItem_Button>(layout_item);
+      std::shared_ptr<LayoutItem_Text> layout_text = std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
       const bool editable = (layout_group && !layout_portal) || layout_button || layout_text; //Only groups, 
buttons, and text objects have titles that can be edited.
       renderer_text->property_editable() = editable;
     }
@@ -1222,14 +1222,14 @@ void Dialog_Layout_Details::on_cell_data_column_width(Gtk::CellRenderer* rendere
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
 
       guint column_width = 0;
       if(layout_item)
       {
-        sharedptr<LayoutItem_Button> layout_button = sharedptr<LayoutItem_Button>::cast_dynamic(layout_item);
-        sharedptr<LayoutItem_Text> layout_text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
-        sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_Button> layout_button = 
std::dynamic_pointer_cast<LayoutItem_Button>(layout_item);
+        std::shared_ptr<LayoutItem_Text> layout_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
+        std::shared_ptr<LayoutItem_Field> layout_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
         const bool editable = (layout_field || layout_button || layout_text); //Only these have column 
widths that can be edited.
         renderer_text->property_editable() = editable;
 
@@ -1254,10 +1254,10 @@ void Dialog_Layout_Details::on_cell_data_group_columns(Gtk::CellRenderer* render
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
 
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
 
       const bool is_group = layout_group && !layout_portal; //Only groups have column_counts.
 
@@ -1289,7 +1289,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_title(const Glib::ustring& p
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
       if(layout_item)
       {
         //Store the user's new text in the model:
@@ -1313,7 +1313,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_name(const Glib::ustring& pa
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
       if(layout_item)
       {
         //Store the user's new text in the model:
@@ -1336,7 +1336,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_column_width(const Glib::ust
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
       if(layout_item)
       {
         //Convert the text to a number, using the same logic used by GtkCellRendererText when it stores 
numbers.
@@ -1365,9 +1365,9 @@ void Dialog_Layout_Details::on_treeview_cell_edited_group_columns(const Glib::us
   if(iter)
   {
     Gtk::TreeModel::Row row = *iter;
-    sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-    sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-    sharedptr<LayoutItem_Portal> layout_portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+    std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+    std::shared_ptr<LayoutItem_Portal> layout_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
     if(layout_group && !layout_portal)
     {
       //std::istringstream astream(new_text); //Put it in a stream.
diff --git a/glom/mode_design/layout/dialog_layout_details.h b/glom/mode_design/layout/dialog_layout_details.h
index 825ca9c..f8da02e 100644
--- a/glom/mode_design/layout/dialog_layout_details.h
+++ b/glom/mode_design/layout/dialog_layout_details.h
@@ -49,19 +49,19 @@ public:
 
 protected:
 
-  virtual void add_group(const Gtk::TreeModel::iterator& parent, const sharedptr<const LayoutGroup>& group);
-  virtual void fill_group(const Gtk::TreeModel::iterator& iter, sharedptr<LayoutGroup>& group);
+  virtual void add_group(const Gtk::TreeModel::iterator& parent, const std::shared_ptr<const LayoutGroup>& 
group);
+  virtual void fill_group(const Gtk::TreeModel::iterator& iter, std::shared_ptr<LayoutGroup>& group);
 
   //Enable/disable buttons, depending on treeview selection:
   virtual void enable_buttons();
 
   virtual void save_to_document();
 
-  sharedptr<Relationship> offer_relationship_list();
-  sharedptr<Relationship> offer_relationship_list(const sharedptr<const Relationship>& relationship);
+  std::shared_ptr<Relationship> offer_relationship_list();
+  std::shared_ptr<Relationship> offer_relationship_list(const std::shared_ptr<const Relationship>& 
relationship);
 
   Gtk::TreeModel::iterator get_selected_group_parent() const;
-  sharedptr<LayoutItem_Button> offer_button_script_edit(const sharedptr<const LayoutItem_Button>& button);
+  std::shared_ptr<LayoutItem_Button> offer_button_script_edit(const std::shared_ptr<const 
LayoutItem_Button>& button);
 
   /** Get the table that the fields belong to.
    * This is usually the regular table name (m_table_name),
diff --git a/glom/mode_design/layout/dialog_layout_export.cc b/glom/mode_design/layout/dialog_layout_export.cc
index 677c5f9..8fedf89 100644
--- a/glom/mode_design/layout/dialog_layout_export.cc
+++ b/glom/mode_design/layout/dialog_layout_export.cc
@@ -143,7 +143,7 @@ void Dialog_Layout_Export::set_layout_groups(Document::type_list_layout_groups&
     guint field_sequence = 1; //0 means no sequence
     for(Document::type_list_layout_groups::const_iterator iter = mapGroups.begin(); iter != mapGroups.end(); 
++iter)
     {
-      sharedptr<const LayoutGroup> group = *iter;
+      std::shared_ptr<const LayoutGroup> group = *iter;
       if(!group)
         continue;
 
@@ -151,7 +151,7 @@ void Dialog_Layout_Export::set_layout_groups(Document::type_list_layout_groups&
       LayoutGroup::type_list_const_items items = group->get_items();
       for(LayoutGroup::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); 
++iter)
       {
-        sharedptr<const LayoutItem_Field> item = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter); 
+        std::shared_ptr<const LayoutItem_Field> item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(*iter); 
         if(item)
         {
           Gtk::TreeModel::iterator iterTree = m_model_fields->append();
@@ -230,7 +230,7 @@ void Dialog_Layout_Export::get_layout_groups(Document::type_list_layout_groups&
   Document::type_list_layout_groups groups;
 
   //Add the fields to the one group:
-  sharedptr<LayoutGroup> others = sharedptr<LayoutGroup>::create();
+  std::shared_ptr<LayoutGroup> others = std::shared_ptr<LayoutGroup>(new LayoutGroup());
   others->set_name("main");
 
   guint field_sequence = 1; //0 means no sequence
@@ -238,7 +238,7 @@ void Dialog_Layout_Export::get_layout_groups(Document::type_list_layout_groups&
   {
     Gtk::TreeModel::Row row = *iterFields;
 
-    sharedptr<LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
+    std::shared_ptr<LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
     const Glib::ustring field_name = item->get_name();
     if(!field_name.empty())
     {
@@ -263,7 +263,7 @@ void Dialog_Layout_Export::on_button_add_field()
   type_list_field_items fields_list = offer_field_list(m_table_name, this);
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen) 
   {
-    sharedptr<LayoutItem_Field> field = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> field = *iter_chosen;
     if(!field)
       continue;
 
@@ -319,7 +319,7 @@ void Dialog_Layout_Export::on_cell_data_name(Gtk::CellRenderer* renderer, const
       Gtk::TreeModel::Row row = *iter;
 
       //Indicate that it's a field in another table.
-      sharedptr<LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
 
       //Names can never be edited.
       renderer_text->property_markup() = item->get_layout_display_name();
@@ -338,10 +338,10 @@ void Dialog_Layout_Export::on_button_edit_field()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
 
       //Get the chosen field:
-      sharedptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, m_table_name, 
this);
+      std::shared_ptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, 
m_table_name, this);
       if(field_chosen)
       {
         //Set the field details in the layout treeview:
diff --git a/glom/mode_design/layout/dialog_layout_export.h b/glom/mode_design/layout/dialog_layout_export.h
index 3511059..9aa0a34 100644
--- a/glom/mode_design/layout/dialog_layout_export.h
+++ b/glom/mode_design/layout/dialog_layout_export.h
@@ -67,7 +67,7 @@ private:
     ModelColumns_Fields()
     { add(m_col_layout_item); add(m_col_sequence); }
 
-    Gtk::TreeModelColumn< sharedptr<LayoutItem_Field> > m_col_layout_item;
+    Gtk::TreeModelColumn< std::shared_ptr<LayoutItem_Field> > m_col_layout_item;
     Gtk::TreeModelColumn<guint> m_col_sequence;
   };
 
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc 
b/glom/mode_design/layout/dialog_layout_list_related.cc
index fc5e83a..076ef33 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -114,7 +114,7 @@ Dialog_Layout_List_Related::~Dialog_Layout_List_Related()
 }
 
 
-void Dialog_Layout_List_Related::init_with_portal(const Glib::ustring& layout_name, const Glib::ustring& 
layout_platform, Document* document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& 
from_table, bool for_print_layout)
+void Dialog_Layout_List_Related::init_with_portal(const Glib::ustring& layout_name, const Glib::ustring& 
layout_platform, Document* document, const std::shared_ptr<const LayoutItem_Portal>& portal, const 
Glib::ustring& from_table, bool for_print_layout)
 {
   m_for_print_layout = for_print_layout;
 
@@ -133,7 +133,7 @@ void Dialog_Layout_List_Related::init_with_portal(const Glib::ustring& layout_na
   if(portal)
     m_portal = glom_sharedptr_clone(portal);
   else
-    m_portal = sharedptr<LayoutItem_Portal>::create(); //The rest of the class assumes that this is not null.
+    m_portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal()); //The rest of the class assumes 
that this is not null.
 
   gulong rows_count_min = 0;
   gulong rows_count_max = 0;
@@ -205,7 +205,7 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
     }
 
     //Set the table name and title:
-    //sharedptr<LayoutItem_Portal> portal_temp = m_portal;
+    //std::shared_ptr<LayoutItem_Portal> portal_temp = m_portal;
     Document::type_list_layout_groups mapGroups;
     if(m_portal)
     {
@@ -222,14 +222,14 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
 
     for(Document::type_list_layout_groups::const_iterator iter = mapGroups.begin(); iter != mapGroups.end(); 
++iter)
     {
-      sharedptr<const LayoutGroup> group = *iter;
-      sharedptr<const LayoutGroup> portal = sharedptr<const LayoutItem_Portal>::cast_dynamic(group);
+      std::shared_ptr<const LayoutGroup> group = *iter;
+      std::shared_ptr<const LayoutGroup> portal = std::dynamic_pointer_cast<const LayoutItem_Portal>(group);
       if(portal)
       {
         for(LayoutGroup::type_list_items::const_iterator iterInner = group->m_list_items.begin(); iterInner 
!= group->m_list_items.end(); ++iterInner)
         {
-          sharedptr<const LayoutItem> item = *iterInner;
-          sharedptr<const LayoutGroup> groupInner = sharedptr<const LayoutGroup>::cast_dynamic(item);
+          std::shared_ptr<const LayoutItem> item = *iterInner;
+          std::shared_ptr<const LayoutGroup> groupInner = std::dynamic_pointer_cast<const LayoutGroup>(item);
 
           if(groupInner)
             add_group(Gtk::TreeModel::iterator() /* null == top-level */, groupInner);
@@ -252,13 +252,13 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
 
   if(m_portal->get_navigation_type() == LayoutItem_Portal::NAVIGATION_SPECIFIC)
   {
-    sharedptr<UsesRelationship> navrel = m_portal->get_navigation_relationship_specific();
+    std::shared_ptr<UsesRelationship> navrel = m_portal->get_navigation_relationship_specific();
     //std::cout << "debug navrel=" << navrel->get_relationship()->get_name() << std::endl;
     m_combo_navigation_specify->set_selected_relationship(navrel->get_relationship(), 
navrel->get_related_relationship());
   }
   else
   {
-    sharedptr<const Relationship> none;
+    std::shared_ptr<const Relationship> none;
     m_combo_navigation_specify->set_selected_relationship(none);
   }
 
@@ -280,7 +280,7 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
   }
 
   //Describe the automatic navigation:
-  sharedptr<const UsesRelationship> relationship_navigation_automatic = 
+  std::shared_ptr<const UsesRelationship> relationship_navigation_automatic = 
     m_portal->get_portal_navigation_relationship_automatic(document);
   Glib::ustring automatic_navigation_description = 
     m_portal->get_relationship_name_used(); //TODO: Use get_relationship_display_name() instead?
@@ -320,7 +320,7 @@ void Dialog_Layout_List_Related::save_to_document()
     {
       Gtk::TreeModel::Row row = *iterFields;
 
-      sharedptr<LayoutItem> item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem> item = row[m_model_items->m_columns.m_col_layout_item];
       const Glib::ustring field_name = item->get_name();
       if(!field_name.empty())
       {
@@ -332,10 +332,10 @@ void Dialog_Layout_List_Related::save_to_document()
 
     if(m_radio_navigation_specify->get_active())
     {
-      sharedptr<Relationship> rel, rel_related;
+      std::shared_ptr<Relationship> rel, rel_related;
       rel = m_combo_navigation_specify->get_selected_relationship(rel_related);
 
-      sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::create();
+      std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
       uses_rel->set_relationship(rel);
       uses_rel->set_related_relationship(rel_related);
 
@@ -349,7 +349,7 @@ void Dialog_Layout_List_Related::save_to_document()
       // go into the Glom::LayoutItem_Portal::set_navigation_relationship_type_* functions.
 
       //std::cout << "debug: set_navigation_relationship_specific(false, none)" << std::endl;
-      sharedptr<UsesRelationship> none;
+      std::shared_ptr<UsesRelationship> none;
       m_portal->set_navigation_relationship_specific(none);
     }
 
@@ -358,8 +358,8 @@ void Dialog_Layout_List_Related::save_to_document()
 
     if(m_radio_navigation_none->get_active())
     {
-      sharedptr<UsesRelationship> uses_rel = sharedptr<UsesRelationship>::create();
-      uses_rel->set_related_relationship(sharedptr<Relationship>());
+      std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
+      uses_rel->set_related_relationship(std::shared_ptr<Relationship>());
       m_portal->set_navigation_type(LayoutItem_Portal::NAVIGATION_NONE);
     }
     
@@ -389,15 +389,15 @@ void Dialog_Layout_List_Related::on_combo_relationship_changed()
   if(!m_portal)
     return;
 
-  sharedptr<Relationship> relationship_related;
-  sharedptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(relationship_related);
+  std::shared_ptr<Relationship> relationship_related;
+  std::shared_ptr<Relationship> relationship = 
m_combo_relationship->get_selected_relationship(relationship_related);
   if(!relationship)
     return;
 
   //Check that the relationship is appropriate for use in a related records portal.
   //The relationship's to field may not be a unique field, because that would
   //prevent the portal from having multiple records.
-  sharedptr<Field> to_key_field =
+  std::shared_ptr<Field> to_key_field =
     DbUtils::get_fields_for_table_one_field(get_document(), 
       relationship->get_to_table(), relationship->get_to_field());
   bool relationship_invalid = false;
@@ -460,13 +460,13 @@ void Dialog_Layout_List_Related::on_spinbutton_changed()
   m_modified = true;
 }
 
-sharedptr<Relationship> Dialog_Layout_List_Related::get_relationship() const
+std::shared_ptr<Relationship> Dialog_Layout_List_Related::get_relationship() const
 {
   std::cout << "debug: I wonder if this function is used." << std::endl;
   return m_combo_relationship->get_selected_relationship();
 }
 
-sharedptr<LayoutItem_Portal> Dialog_Layout_List_Related::get_portal_layout()
+std::shared_ptr<LayoutItem_Portal> Dialog_Layout_List_Related::get_portal_layout()
 {
   return m_portal;
 }
@@ -486,7 +486,7 @@ void Dialog_Layout_List_Related::on_button_add_field()
   type_list_field_items fields_list = offer_field_list(m_portal->get_table_used(m_table_name), this);
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen)
   {
-    sharedptr<LayoutItem_Field> field = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> field = *iter_chosen;
     if(!field)
       continue;
 
@@ -517,11 +517,11 @@ void Dialog_Layout_List_Related::on_button_edit()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
 
       //Get the chosen field:
-      sharedptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, 
m_portal->get_table_used(m_table_name), this);
+      std::shared_ptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, 
m_portal->get_table_used(m_table_name), this);
       if(field_chosen)
       {
         //Set the field details in the layout treeview:
diff --git a/glom/mode_design/layout/dialog_layout_list_related.h 
b/glom/mode_design/layout/dialog_layout_list_related.h
index b25b89d..66f47ba 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.h
+++ b/glom/mode_design/layout/dialog_layout_list_related.h
@@ -46,12 +46,12 @@ public:
    * @param portal The layout item, which knows its from_table, for instance.
    * @apram for_print_layout If true, don't show the navigation options, for instance.
    */
-  void init_with_portal(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* 
document, const sharedptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table, bool 
for_print_layout = false);
+  void init_with_portal(const Glib::ustring& layout_name, const Glib::ustring& layout_platform, Document* 
document, const std::shared_ptr<const LayoutItem_Portal>& portal, const Glib::ustring& from_table, bool 
for_print_layout = false);
 
   virtual void update_ui(bool including_relationships_list = true);
 
-  sharedptr<Relationship> get_relationship() const;
-  sharedptr<LayoutItem_Portal>  get_portal_layout();
+  std::shared_ptr<Relationship> get_relationship() const;
+  std::shared_ptr<LayoutItem_Portal>  get_portal_layout();
 
 protected:
 
@@ -72,7 +72,7 @@ protected:
 
   ComboBox_Relationship* m_combo_relationship;
   Gtk::CheckButton* m_checkbutton_show_child_relationships;
-  sharedptr<LayoutItem_Portal> m_portal;
+  std::shared_ptr<LayoutItem_Portal> m_portal;
 
   Gtk::RadioButton* m_radio_navigation_automatic;
   Gtk::RadioButton* m_radio_navigation_none;
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc 
b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
index dc73568..4cb6da3 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -211,7 +211,7 @@ void Box_Formatting::set_is_for_non_editable()
   enforce_constraints();
 }
 
-void Box_Formatting::set_formatting_for_field(const Formatting& format, const Glib::ustring& table_name, 
const sharedptr<const Field>& field)
+void Box_Formatting::set_formatting_for_field(const Formatting& format, const Glib::ustring& table_name, 
const std::shared_ptr<const Field>& field)
 {
   //Used for choices and some extra text formatting:
   m_table_name = table_name;
@@ -287,9 +287,9 @@ void Box_Formatting::set_formatting_for_non_field(const Formatting& format, bool
     const Document::type_vec_relationships vecRelationships = document->get_relationships(m_table_name);
     m_combo_choices_relationship->set_relationships(vecRelationships);
 
-    sharedptr<const Relationship> choices_relationship;
-    sharedptr<const LayoutItem_Field> choices_field;
-    sharedptr<const LayoutGroup> choices_field_extras;
+    std::shared_ptr<const Relationship> choices_relationship;
+    std::shared_ptr<const LayoutItem_Field> choices_field;
+    std::shared_ptr<const LayoutGroup> choices_field_extras;
     Formatting::type_list_sort_fields choices_sort_fields;
     bool choices_show_all = false;
     format.get_choices_related(choices_relationship, choices_field, choices_field_extras, 
choices_sort_fields, choices_show_all);
@@ -329,7 +329,7 @@ void Box_Formatting::set_formatting_for_non_field(const Formatting& format, bool
     Formatting::type_list_values list_choice_values = format.get_choices_custom();
     for(Formatting::type_list_values::const_iterator iter = list_choice_values.begin(); iter != 
list_choice_values.end(); ++iter)
     {
-      const sharedptr<ChoiceValue> choicevalue = *iter;
+      const std::shared_ptr<ChoiceValue> choicevalue = *iter;
       Gnome::Gda::Value value;
       if(choicevalue)
         value = choicevalue->get_value();
@@ -394,11 +394,11 @@ bool Box_Formatting::get_formatting(Formatting& format) const
       m_checkbutton_choices_restricted->get_active(),
       m_checkbutton_choices_restricted_as_radio_buttons->get_active());
 
-    const sharedptr<const Relationship> choices_relationship = 
m_combo_choices_relationship->get_selected_relationship();
-    sharedptr<LayoutItem_Field> layout_choice_first = sharedptr<LayoutItem_Field>::create();
+    const std::shared_ptr<const Relationship> choices_relationship = 
m_combo_choices_relationship->get_selected_relationship();
+    std::shared_ptr<LayoutItem_Field> layout_choice_first = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_choice_first->set_name(m_combo_choices_field->get_selected_field_name());
 
-    sharedptr<LayoutGroup> layout_choice_extra = sharedptr<LayoutGroup>::create();
+    std::shared_ptr<LayoutGroup> layout_choice_extra = std::shared_ptr<LayoutGroup>(new LayoutGroup());
     layout_choice_extra->m_list_items = m_dialog_choices_extra_fields->get_fields();
 
     const Formatting::type_list_sort_fields sort_fields = m_dialog_choices_sortby->get_fields();
@@ -423,7 +423,7 @@ bool Box_Formatting::get_formatting(Formatting& format) const
 
           if(success)
           {
-            sharedptr<ChoiceValue> choicevalue = sharedptr<ChoiceValue>::create();
+            std::shared_ptr<ChoiceValue> choicevalue = std::shared_ptr<ChoiceValue>(new ChoiceValue());
             choicevalue->set_value(value);
             list_choice_values.push_back(choicevalue);
           }
@@ -442,7 +442,7 @@ bool Box_Formatting::get_formatting(Formatting& format) const
 
 void Box_Formatting::on_combo_choices_relationship_changed()
 {
-  sharedptr<Relationship> relationship = m_combo_choices_relationship->get_selected_relationship();
+  std::shared_ptr<Relationship> relationship = m_combo_choices_relationship->get_selected_relationship();
 
   Document* pDocument = get_document();
   if(pDocument)
@@ -456,7 +456,7 @@ void Box_Formatting::on_combo_choices_relationship_changed()
 
       //Default to using the Primary Key field from the related table,
       //because this is almost always what people want to use:
-      const sharedptr<Field> related_primary_key = pDocument->get_field_primary_key(related_table);
+      const std::shared_ptr<Field> related_primary_key = pDocument->get_field_primary_key(related_table);
       if(related_primary_key)
         m_combo_choices_field->set_selected_field(related_primary_key);
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.h 
b/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
index 0c86485..8395a4b 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
@@ -62,7 +62,7 @@ public:
    * @param table_name The field's table.
    * @param The field that will have this formatting, so we know what formatting options to allow.
    */
-  void set_formatting_for_field(const Formatting& format, const Glib::ustring& table_name, const 
sharedptr<const Field>& field);
+  void set_formatting_for_field(const Formatting& format, const Glib::ustring& table_name, const 
std::shared_ptr<const Field>& field);
   bool get_formatting(Formatting& format) const;
 
   /** When used, for instance, for print layout items or choice lists,
@@ -126,7 +126,7 @@ private:
   mutable Formatting m_format;
 
   Glib::ustring m_table_name;
-  sharedptr<const Field> m_field;
+  std::shared_ptr<const Field> m_field;
 
   //We show different options when
   //showing this on a print layout.
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
index 7c929e0..37472fa 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
@@ -72,7 +72,7 @@ Dialog_ButtonScript::~Dialog_ButtonScript()
 {
 }
 
-void Dialog_ButtonScript::set_script(const sharedptr<const LayoutItem_Button>& script, const Glib::ustring& 
table_name)
+void Dialog_ButtonScript::set_script(const std::shared_ptr<const LayoutItem_Button>& script, const 
Glib::ustring& table_name)
 {
   //set_blocked();
 
@@ -87,16 +87,16 @@ void Dialog_ButtonScript::set_script(const sharedptr<const LayoutItem_Button>& s
   //Dialog_Properties::set_modified(false);
 }
 
-sharedptr<LayoutItem_Button> Dialog_ButtonScript::get_script() const
+std::shared_ptr<LayoutItem_Button> Dialog_ButtonScript::get_script() const
 {
-  sharedptr<LayoutItem_Button> result = glom_sharedptr_clone(m_script); //Start with the old details, to 
preserve anything that is not in our UI.
+  std::shared_ptr<LayoutItem_Button> result = glom_sharedptr_clone(m_script); //Start with the old details, 
to preserve anything that is not in our UI.
 
   get_script(result);
 
   return result;
 }
 
-void Dialog_ButtonScript::get_script(const sharedptr<LayoutItem_Button>& script) const
+void Dialog_ButtonScript::get_script(const std::shared_ptr<LayoutItem_Button>& script) const
 {
   script->set_script(m_text_view_script->get_buffer()->get_text() );
   script->set_title(m_entry_title->get_text(), AppWindow::get_current_locale());
@@ -116,14 +116,14 @@ void Dialog_ButtonScript::on_button_test_script()
     const Document::type_vec_fields fields = document->get_table_fields(m_table_name);
     for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      const sharedptr<const Field> field = *iter;
+      const std::shared_ptr<const Field> field = *iter;
       const Gnome::Gda::Value example_value = Conversions::get_example_value(field->get_glom_type());
       field_values[field->get_name()] = example_value;
     }
   }
 
   //We need the connection when we run the script, so that the script may use it.
-  sharedptr<SharedConnection> sharedconnection = ConnectionPool::get_and_connect();
+  std::shared_ptr<SharedConnection> sharedconnection = ConnectionPool::get_and_connect();
 
   Glib::ustring error_message;
   PythonUICallbacks callbacks;
@@ -131,7 +131,7 @@ void Dialog_ButtonScript::on_button_test_script()
     field_values, //TODO: Maybe use the field's type here.
     document,
     m_table_name,
-    sharedptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB, which 
we would not encourage in a test.
+    std::shared_ptr<Field>(), Gnome::Gda::Value(), // primary key - only used when setting values in the DB, 
which we would not encourage in a test.
     sharedconnection->get_gda_connection(),
     callbacks,
     error_message);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.h
index 5e7b4ed..2003076 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.h
@@ -44,9 +44,9 @@ public:
   Dialog_ButtonScript(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_ButtonScript();
 
-  void set_script(const sharedptr<const LayoutItem_Button>& script, const Glib::ustring& table_name);
-  sharedptr<LayoutItem_Button> get_script() const;
-  void get_script (const sharedptr<LayoutItem_Button>& script) const;
+  void set_script(const std::shared_ptr<const LayoutItem_Button>& script, const Glib::ustring& table_name);
+  std::shared_ptr<LayoutItem_Button> get_script() const;
+  void get_script (const std::shared_ptr<LayoutItem_Button>& script) const;
 
 private:
   void on_button_test_script();
@@ -55,7 +55,7 @@ private:
   Gsv::View* m_text_view_script;
   Gtk::Button* m_button_test_script;
 
-  sharedptr<LayoutItem_Button> m_script;
+  std::shared_ptr<LayoutItem_Button> m_script;
   Glib::ustring m_table_name;
 };
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
index af493f8..8fc7868 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
@@ -69,7 +69,7 @@ Dialog_FieldLayout::~Dialog_FieldLayout()
   remove_view(m_box_formatting);
 }
 
-void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& 
table_name, bool show_editable_options)
+void Dialog_FieldLayout::set_field(const std::shared_ptr<const LayoutItem_Field>& field, const 
Glib::ustring& table_name, bool show_editable_options)
 {
   m_layout_item = glom_sharedptr_clone(field);
 
@@ -80,7 +80,7 @@ void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& fiel
   m_checkbutton_editable->set_active( field->get_editable() );
 
   //Calculated fields can never be edited:
-  sharedptr<const Field> field_details = field->get_full_field_details();
+  std::shared_ptr<const Field> field_details = field->get_full_field_details();
   const bool editable_allowed = field_details && !field_details->get_has_calculation();
   m_checkbutton_editable->set_sensitive(editable_allowed);
 
@@ -105,14 +105,14 @@ void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& fiel
   enforce_constraints();
 }
 
-sharedptr<LayoutItem_Field> Dialog_FieldLayout::get_field_chosen() const
+std::shared_ptr<LayoutItem_Field> Dialog_FieldLayout::get_field_chosen() const
 {
   m_layout_item->set_editable( m_checkbutton_editable->get_active() );
 
   m_layout_item->set_formatting_use_default( !m_radiobutton_custom_formatting->get_active() );
   m_box_formatting->get_formatting(m_layout_item->m_formatting);
 
-  sharedptr<CustomTitle> title_custom = sharedptr<CustomTitle>::create();
+  std::shared_ptr<CustomTitle> title_custom = std::shared_ptr<CustomTitle>(new CustomTitle());
   title_custom->set_use_custom_title(m_radiobutton_title_custom->get_active()); //For instance, tell it to 
really use a blank title.
   title_custom->set_title(m_entry_title_custom->get_text(), AppWindow::get_current_locale());
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
index f30dffe..6d681aa 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
@@ -49,9 +49,9 @@ public:
    * @param field The starting field information.
    * @param table_name The field's table.
    */
-  virtual void set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& table_name, 
bool show_editable_options = true);
+  virtual void set_field(const std::shared_ptr<const LayoutItem_Field>& field, const Glib::ustring& 
table_name, bool show_editable_options = true);
 
-  sharedptr<LayoutItem_Field> get_field_chosen() const;
+  std::shared_ptr<LayoutItem_Field> get_field_chosen() const;
 
 private:
   void on_radiobutton_custom_formatting();
@@ -70,7 +70,7 @@ private:
   Gtk::RadioButton* m_radiobutton_custom_formatting;
   Box_Formatting* m_box_formatting;
 
-  mutable sharedptr<LayoutItem_Field> m_layout_item;
+  mutable std::shared_ptr<LayoutItem_Field> m_layout_item;
 
   Glib::ustring m_table_name;
 };
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.cc
index 1227c99..be07a52 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.cc
@@ -49,7 +49,7 @@ Dialog_FieldSummary::~Dialog_FieldSummary()
 {
 }
 
-void Dialog_FieldSummary::set_item(const sharedptr<const LayoutItem_FieldSummary>& item, const 
Glib::ustring& table_name)
+void Dialog_FieldSummary::set_item(const std::shared_ptr<const LayoutItem_FieldSummary>& item, const 
Glib::ustring& table_name)
 {
   m_layout_item = glom_sharedptr_clone(item);
   m_table_name = table_name;
@@ -58,9 +58,9 @@ void Dialog_FieldSummary::set_item(const sharedptr<const LayoutItem_FieldSummary
   m_combo_summarytype->set_summary_type( item->get_summary_type() );
 }
 
-sharedptr<LayoutItem_FieldSummary> Dialog_FieldSummary::get_item() const
+std::shared_ptr<LayoutItem_FieldSummary> Dialog_FieldSummary::get_item() const
 {
-  sharedptr<LayoutItem_FieldSummary> result = glom_sharedptr_clone(m_layout_item);
+  std::shared_ptr<LayoutItem_FieldSummary> result = glom_sharedptr_clone(m_layout_item);
   result->set_summary_type( m_combo_summarytype->get_summary_type() );
 
   return result;
@@ -68,7 +68,7 @@ sharedptr<LayoutItem_FieldSummary> Dialog_FieldSummary::get_item() const
 
 void Dialog_FieldSummary::on_button_field()
 {
-  sharedptr<LayoutItem_Field> field = offer_field_list_select_one_field(m_layout_item, m_table_name, this);
+  std::shared_ptr<LayoutItem_Field> field = offer_field_list_select_one_field(m_layout_item, m_table_name, 
this);
   if(field)
   {
     m_layout_item->set_field(field);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.h
index be09823..9adb79c 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_summary.h
@@ -48,10 +48,10 @@ public:
    * @param item The starting information.
    * @param table_name The item's table.
    */
-  virtual void set_item(const sharedptr<const LayoutItem_FieldSummary>& item, const Glib::ustring& 
table_name);
+  virtual void set_item(const std::shared_ptr<const LayoutItem_FieldSummary>& item, const Glib::ustring& 
table_name);
 
 
-  sharedptr<LayoutItem_FieldSummary> get_item() const;
+  std::shared_ptr<LayoutItem_FieldSummary> get_item() const;
 
 private:
   //Signal handlers:
@@ -61,7 +61,7 @@ private:
   Combo_SummaryType* m_combo_summarytype;
   Gtk::Button* m_button_field;
 
-  mutable sharedptr<LayoutItem_FieldSummary> m_layout_item;
+  mutable std::shared_ptr<LayoutItem_FieldSummary> m_layout_item;
 
   Glib::ustring m_table_name;
 };
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index 4da9bbe..1ab872c 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -119,7 +119,7 @@ void Dialog_FieldsList::set_fields(const Glib::ustring& table_name, const Layout
     guint field_sequence = 0;
     for(LayoutGroup::type_list_items::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
-      sharedptr<const LayoutItem_Field> item = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+      std::shared_ptr<const LayoutItem_Field> item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(*iter);
       if(!item)
         continue;
 
@@ -200,11 +200,11 @@ LayoutGroup::type_list_items Dialog_FieldsList::get_fields() const
   {
     Gtk::TreeModel::Row row = *iterFields;
 
-    sharedptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
+    std::shared_ptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
     const Glib::ustring field_name = item->get_name();
     if(!field_name.empty())
     {
-      sharedptr<LayoutItem_Field> field_copy = glom_sharedptr_clone(item);
+      std::shared_ptr<LayoutItem_Field> field_copy = glom_sharedptr_clone(item);
 
       //TODO: This seems to overwrite the sequence set when the user reorders an item.
       result[field_sequence] = field_copy;
@@ -248,7 +248,7 @@ void Dialog_FieldsList::on_button_add_field()
   type_list_field_items fields_list = offer_field_list(m_table_name, this);
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen)
   {
-    sharedptr<LayoutItem_Field> field = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> field = *iter_chosen;
     if(!field)
       continue;
 
@@ -299,7 +299,7 @@ void Dialog_FieldsList::on_cell_data_name(Gtk::CellRenderer* renderer, const Gtk
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item]; //TODO_performance: 
Reduce copying.
+      std::shared_ptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item]; 
//TODO_performance: Reduce copying.
       if(item)
       {
         renderer_text->property_markup() = item->get_layout_display_name();
@@ -326,10 +326,10 @@ void Dialog_FieldsList::on_button_edit_field()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
+      std::shared_ptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
 
       //Get the chosen field:
-      sharedptr<LayoutItem_Field> field_chosen =
+      std::shared_ptr<LayoutItem_Field> field_chosen =
         offer_field_list_select_one_field(field, m_table_name, this);
 
       //Set the field details in the layout treeview:
@@ -360,7 +360,7 @@ void Dialog_FieldsList::on_button_formatting()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
+      std::shared_ptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
       if(field)
       {
         field = offer_field_formatting(field, m_table_name, this, false /* no editing options */);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
index 1b4b023..69b6d67 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
@@ -71,7 +71,7 @@ private:
     ModelColumns_Fields()
     { add(m_col_layout_item); add(m_col_sequence); }
 
-    Gtk::TreeModelColumn< sharedptr<const LayoutItem_Field> > m_col_layout_item;
+    Gtk::TreeModelColumn< std::shared_ptr<const LayoutItem_Field> > m_col_layout_item;
     Gtk::TreeModelColumn<guint> m_col_sequence;
   };
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
index 82ae1fb..e7a4f5c 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
@@ -50,14 +50,14 @@ Dialog_Formatting::~Dialog_Formatting()
   remove_view(m_box_formatting);
 }
 
-void Dialog_Formatting::set_item(const sharedptr<const LayoutItem_WithFormatting>& layout_item, bool 
show_numeric)
+void Dialog_Formatting::set_item(const std::shared_ptr<const LayoutItem_WithFormatting>& layout_item, bool 
show_numeric)
 {
   m_box_formatting->set_formatting_for_non_field(layout_item->m_formatting, show_numeric);
 
   enforce_constraints();
 }
 
-void Dialog_Formatting::use_item_chosen(const sharedptr<LayoutItem_WithFormatting>& layout_item)
+void Dialog_Formatting::use_item_chosen(const std::shared_ptr<LayoutItem_WithFormatting>& layout_item)
 {
   if(!layout_item)
     return;
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
index 8f2c9cd..baef507 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
@@ -46,12 +46,12 @@ public:
    * @param document The document, so that the dialog can load the previous layout, and save changes.
    * @param field The starting item information.
    */
-  void set_item(const sharedptr<const LayoutItem_WithFormatting>& field, bool show_numeric);
+  void set_item(const std::shared_ptr<const LayoutItem_WithFormatting>& field, bool show_numeric);
 
   /** Set the @a layout_item's formatting to the formatting specified in the
    * dialog by the user.
    */
-  void use_item_chosen(const sharedptr<LayoutItem_WithFormatting>& layout_item);
+  void use_item_chosen(const std::shared_ptr<LayoutItem_WithFormatting>& layout_item);
 
 private:
   void enforce_constraints();
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
index e894fe8..5ee2a83 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
@@ -79,7 +79,7 @@ Dialog_GroupBy::~Dialog_GroupBy()
   }
 }
 
-void Dialog_GroupBy::set_item(const sharedptr<const LayoutItem_GroupBy>& item, const Glib::ustring& 
table_name)
+void Dialog_GroupBy::set_item(const std::shared_ptr<const LayoutItem_GroupBy>& item, const Glib::ustring& 
table_name)
 {
   m_layout_item = glom_sharedptr_clone(item);
   m_table_name = table_name;
@@ -94,7 +94,7 @@ void Dialog_GroupBy::set_item(const sharedptr<const LayoutItem_GroupBy>& item, c
   m_comboboxentry_border_width->get_entry()->set_text(border_width_as_text);
 }
 
-sharedptr<LayoutItem_GroupBy> Dialog_GroupBy::get_item() const
+std::shared_ptr<LayoutItem_GroupBy> Dialog_GroupBy::get_item() const
 {
   std::stringstream the_stream;
   the_stream.imbue(std::locale("")); //Current locale.
@@ -108,7 +108,7 @@ sharedptr<LayoutItem_GroupBy> Dialog_GroupBy::get_item() const
 
 void Dialog_GroupBy::on_button_field_group_by()
 {
-  sharedptr<LayoutItem_Field> field = offer_field_list_select_one_field(m_layout_item->get_field_group_by(), 
m_table_name, this);
+  std::shared_ptr<LayoutItem_Field> field = 
offer_field_list_select_one_field(m_layout_item->get_field_group_by(), m_table_name, this);
   if(field)
   {
     m_layout_item->set_field_group_by(field);
@@ -120,7 +120,7 @@ void Dialog_GroupBy::on_button_formatting_group_by()
 {
   if(m_layout_item)
   {
-    sharedptr<LayoutItem_Field> field = offer_field_formatting(m_layout_item->get_field_group_by(), 
m_table_name, this, false /* no editing options. */);
+    std::shared_ptr<LayoutItem_Field> field = offer_field_formatting(m_layout_item->get_field_group_by(), 
m_table_name, this, false /* no editing options. */);
     if(field)
     {
       m_layout_item->set_field_group_by(field);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.h
index 8c95ba7..bf74fb9 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.h
@@ -50,10 +50,10 @@ public:
    * @param item The starting information.
    * @param table_name The item's table.
    */
-  virtual void set_item(const sharedptr<const LayoutItem_GroupBy>& item, const Glib::ustring& table_name);
+  virtual void set_item(const std::shared_ptr<const LayoutItem_GroupBy>& item, const Glib::ustring& 
table_name);
 
 
-  sharedptr<LayoutItem_GroupBy> get_item() const;
+  std::shared_ptr<LayoutItem_GroupBy> get_item() const;
 
 private:
   //Signal handlers:
@@ -77,7 +77,7 @@ private:
   Dialog_FieldsList* m_dialog_choose_secondary_fields;
   Dialog_SortFields* m_dialog_choose_sort_fields;
 
-  mutable sharedptr<LayoutItem_GroupBy> m_layout_item;
+  mutable std::shared_ptr<LayoutItem_GroupBy> m_layout_item;
 
   Glib::ustring m_table_name;
 };
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
index a6296a6..592c914 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
@@ -63,7 +63,7 @@ void Dialog_ImageObject::on_button_choose()
 }
 
 
-void Dialog_ImageObject::set_imageobject(const sharedptr<const LayoutItem_Image>& imageobject, const 
Glib::ustring& table_name, bool show_title)
+void Dialog_ImageObject::set_imageobject(const std::shared_ptr<const LayoutItem_Image>& imageobject, const 
Glib::ustring& table_name, bool show_title)
 {
   //set_blocked();
 
@@ -83,9 +83,9 @@ void Dialog_ImageObject::set_imageobject(const sharedptr<const LayoutItem_Image>
   //Dialog_Properties::set_modified(false);
 }
 
-sharedptr<LayoutItem_Image> Dialog_ImageObject::get_imageobject() const
+std::shared_ptr<LayoutItem_Image> Dialog_ImageObject::get_imageobject() const
 {
-  sharedptr<LayoutItem_Image> result = glom_sharedptr_clone(m_imageobject); //Start with the old details, to 
preserve anything that is not in our UI.
+  std::shared_ptr<LayoutItem_Image> result = glom_sharedptr_clone(m_imageobject); //Start with the old 
details, to preserve anything that is not in our UI.
 
   result->set_title(m_entry_title->get_text(), AppWindow::get_current_locale());
   result->set_image( m_image->get_value() );
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.h
index 2c5bd60..075f898 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.h
@@ -44,8 +44,8 @@ public:
   Dialog_ImageObject(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_ImageObject();
 
-  void set_imageobject(const sharedptr<const LayoutItem_Image>& imageobject, const Glib::ustring& 
table_name, bool show_title = true);
-  sharedptr<LayoutItem_Image> get_imageobject() const;
+  void set_imageobject(const std::shared_ptr<const LayoutItem_Image>& imageobject, const Glib::ustring& 
table_name, bool show_title = true);
+  std::shared_ptr<LayoutItem_Image> get_imageobject() const;
 
 private:
   void on_button_choose();
@@ -55,7 +55,7 @@ private:
   ImageGlom* m_image;
   Gtk::Button* m_button_choose_image;
 
-  sharedptr<LayoutItem_Image> m_imageobject;
+  std::shared_ptr<LayoutItem_Image> m_imageobject;
   Glib::ustring m_table_name;
 };
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_line.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_line.cc
index 9fa1271..12a250a 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_line.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_line.cc
@@ -51,7 +51,7 @@ Dialog_Line::~Dialog_Line()
 {
 }
 
-void Dialog_Line::set_line(const sharedptr<const LayoutItem_Line>& line)
+void Dialog_Line::set_line(const std::shared_ptr<const LayoutItem_Line>& line)
 {
   if(!line)
   {
@@ -72,14 +72,14 @@ void Dialog_Line::set_line(const sharedptr<const LayoutItem_Line>& line)
   //Dialog_Properties::set_modified(false);
 }
 
-sharedptr<LayoutItem_Line> Dialog_Line::get_line() const
+std::shared_ptr<LayoutItem_Line> Dialog_Line::get_line() const
 {
   if(!m_line)
   {
     std::cerr << G_STRFUNC <<  ": m_line is null" << std::endl;
   }
   
-  sharedptr<LayoutItem_Line> result = glom_sharedptr_clone(m_line); //Start with the old details, to 
preserve anything that is not in our UI.
+  std::shared_ptr<LayoutItem_Line> result = glom_sharedptr_clone(m_line); //Start with the old details, to 
preserve anything that is not in our UI.
 
   if(!result)
   {
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_line.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_line.h
index 857d5aa..0159fc5 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_line.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_line.h
@@ -43,14 +43,14 @@ public:
   Dialog_Line(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_Line();
 
-  void set_line(const sharedptr<const LayoutItem_Line>& line);
-  sharedptr<LayoutItem_Line> get_line() const;
+  void set_line(const std::shared_ptr<const LayoutItem_Line>& line);
+  std::shared_ptr<LayoutItem_Line> get_line() const;
 
 private:
   Gtk::SpinButton* m_spinbutton_line_width;
   Gtk::ColorButton* m_colorbutton;
 
-  sharedptr<LayoutItem_Line> m_line;
+  std::shared_ptr<LayoutItem_Line> m_line;
 };
 
 } //namespace Glom
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
index 7adcc87..96240a8 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
@@ -84,7 +84,7 @@ Dialog_Notebook::~Dialog_Notebook()
 {
 }
 
-void Dialog_Notebook::set_notebook(const sharedptr<const LayoutItem_Notebook>& start_notebook)
+void Dialog_Notebook::set_notebook(const std::shared_ptr<const LayoutItem_Notebook>& start_notebook)
 {
   m_layout_item = start_notebook; //So we can preserve information for later.
   m_modified = false;
@@ -94,7 +94,7 @@ void Dialog_Notebook::set_notebook(const sharedptr<const LayoutItem_Notebook>& s
   guint sequence = 1;
   for(LayoutGroup::type_list_items::const_iterator iter = start_notebook->m_list_items.begin(); iter != 
start_notebook->m_list_items.end(); ++iter)
   {
-    sharedptr<const LayoutGroup> item = sharedptr<const LayoutGroup>::cast_dynamic(*iter);
+    std::shared_ptr<const LayoutGroup> item = std::dynamic_pointer_cast<const LayoutGroup>(*iter);
     if(item)
     {
       Gtk::TreeModel::iterator iterTree = m_model->append();
@@ -165,9 +165,9 @@ void Dialog_Notebook::on_button_down()
   move_treeview_selection_down(m_treeview, m_ColumnsTabs.m_col_sequence);
 }
 
-sharedptr<LayoutItem_Notebook> Dialog_Notebook::get_notebook() const
+std::shared_ptr<LayoutItem_Notebook> Dialog_Notebook::get_notebook() const
 {
-  sharedptr<LayoutItem_Notebook> result = glom_sharedptr_clone(m_layout_item);
+  std::shared_ptr<LayoutItem_Notebook> result = glom_sharedptr_clone(m_layout_item);
   result->remove_all_items();
 
   for(Gtk::TreeModel::iterator iterFields = m_model->children().begin(); iterFields != 
m_model->children().end(); ++iterFields)
@@ -177,12 +177,12 @@ sharedptr<LayoutItem_Notebook> Dialog_Notebook::get_notebook() const
     const Glib::ustring name = row[m_ColumnsTabs.m_col_name];
     if(!name.empty())
     {
-      sharedptr<LayoutGroup> item = row[m_ColumnsTabs.m_col_item];
-      sharedptr<LayoutGroup> group_copy;
+      std::shared_ptr<LayoutGroup> item = row[m_ColumnsTabs.m_col_item];
+      std::shared_ptr<LayoutGroup> group_copy;
       if(item)
         group_copy = glom_sharedptr_clone(item);
       else
-        group_copy = sharedptr<LayoutGroup>::create();
+        group_copy = std::shared_ptr<LayoutGroup>(new LayoutGroup());
 
       group_copy->set_name(name);
       group_copy->set_title( row[m_ColumnsTabs.m_col_title] , AppWindow::get_current_locale());
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.h
index afafddd..e636b0a 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.h
@@ -40,8 +40,8 @@ public:
   virtual ~Dialog_Notebook();
 
 
-  void set_notebook(const sharedptr<const LayoutItem_Notebook>& start_notebook);
-  sharedptr<LayoutItem_Notebook> get_notebook() const;
+  void set_notebook(const std::shared_ptr<const LayoutItem_Notebook>& start_notebook);
+  std::shared_ptr<LayoutItem_Notebook> get_notebook() const;
 
 private:
 
@@ -66,7 +66,7 @@ private:
     Gtk::TreeModelColumn<Glib::ustring> m_col_name;
     Gtk::TreeModelColumn<Glib::ustring> m_col_title;
     Gtk::TreeModelColumn<guint> m_col_sequence;
-    Gtk::TreeModelColumn< sharedptr<LayoutGroup> > m_col_item;
+    Gtk::TreeModelColumn< std::shared_ptr<LayoutGroup> > m_col_item;
   };
 
   ModelColumns_Tabs m_ColumnsTabs;
@@ -80,7 +80,7 @@ private:
 
   Glib::RefPtr<Gtk::ListStore> m_model;
 
-  sharedptr<const LayoutItem_Notebook> m_layout_item;
+  std::shared_ptr<const LayoutItem_Notebook> m_layout_item;
 };
 
 } //namespace Glom
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
index 71dfd50..4810ab2 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
@@ -116,7 +116,7 @@ void Dialog_SortFields::set_fields(const Glib::ustring& table_name, const Layout
     guint field_sequence = 0;
     for(LayoutItem_GroupBy::type_list_sort_fields::const_iterator iter = fields.begin(); iter != 
fields.end(); ++iter)
     {
-      sharedptr<const LayoutItem_Field> item = sharedptr<const LayoutItem_Field>::cast_dynamic(iter->first);
+      std::shared_ptr<const LayoutItem_Field> item = std::dynamic_pointer_cast<const 
LayoutItem_Field>(iter->first);
 
       Gtk::TreeModel::iterator iterTree = m_model_fields->append();
       Gtk::TreeModel::Row row = *iterTree;
@@ -194,11 +194,11 @@ LayoutItem_GroupBy::type_list_sort_fields Dialog_SortFields::get_fields() const
   {
     Gtk::TreeModel::Row row = *iterFields;
 
-    sharedptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
+    std::shared_ptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item];
     const Glib::ustring field_name = item->get_name();
     if(!field_name.empty())
     {
-      sharedptr<LayoutItem_Field> field_copy = glom_sharedptr_clone(item);
+      std::shared_ptr<LayoutItem_Field> field_copy = glom_sharedptr_clone(item);
 
       const bool ascending = row[m_ColumnsFields.m_col_ascending];
       result.push_back( LayoutItem_GroupBy::type_pair_sort_field(field_copy, ascending) );
@@ -222,7 +222,7 @@ void Dialog_SortFields::on_button_add_field()
   for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); 
++iter_chosen) 
   {
 
-    sharedptr<LayoutItem_Field> field = *iter_chosen;
+    std::shared_ptr<LayoutItem_Field> field = *iter_chosen;
     if(!field)
       continue;
 
@@ -274,7 +274,7 @@ void Dialog_SortFields::on_cell_data_name(Gtk::CellRenderer* renderer, const Gtk
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item]; //TODO_performance: 
Reduce copying.
+      std::shared_ptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item]; 
//TODO_performance: Reduce copying.
       renderer_text->property_markup() = item->get_layout_display_name();
       renderer_text->property_editable() = false; //Names can never be edited.
     }
@@ -292,10 +292,10 @@ void Dialog_SortFields::on_button_edit_field()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
+      std::shared_ptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
 
       //Get the chosen field:
-      sharedptr<LayoutItem_Field> field_chosen = 
+      std::shared_ptr<LayoutItem_Field> field_chosen = 
         offer_field_list_select_one_field(field, m_table_name, this);
       if(field_chosen)
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.h
index e4ce0ec..295b398 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.h
@@ -64,7 +64,7 @@ private:
     ModelColumns_Fields()
     { add(m_col_layout_item); add(m_col_ascending); add(m_col_sequence); }
 
-    Gtk::TreeModelColumn< sharedptr<const LayoutItem_Field> > m_col_layout_item;
+    Gtk::TreeModelColumn< std::shared_ptr<const LayoutItem_Field> > m_col_layout_item;
     Gtk::TreeModelColumn<bool> m_col_ascending;
     Gtk::TreeModelColumn<guint> m_col_sequence;
   };
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc 
b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
index e70d77a..c6a786c 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
@@ -53,7 +53,7 @@ Dialog_TextObject::~Dialog_TextObject()
 {
 }
 
-void Dialog_TextObject::set_textobject(const sharedptr<const LayoutItem_Text>& textobject, const 
Glib::ustring& table_name, bool show_title)
+void Dialog_TextObject::set_textobject(const std::shared_ptr<const LayoutItem_Text>& textobject, const 
Glib::ustring& table_name, bool show_title)
 {
   //set_blocked();
 
@@ -73,16 +73,16 @@ void Dialog_TextObject::set_textobject(const sharedptr<const LayoutItem_Text>& t
   //Dialog_Properties::set_modified(false);
 }
 
-sharedptr<LayoutItem_Text> Dialog_TextObject::get_textobject() const
+std::shared_ptr<LayoutItem_Text> Dialog_TextObject::get_textobject() const
 {
-  sharedptr<LayoutItem_Text> result = glom_sharedptr_clone(m_textobject); //Start with the old details, to 
preserve anything that is not in our UI.
+  std::shared_ptr<LayoutItem_Text> result = glom_sharedptr_clone(m_textobject); //Start with the old 
details, to preserve anything that is not in our UI.
 
   get_textobject(result);
 
   return result;
 }
 
-void Dialog_TextObject::get_textobject(sharedptr<LayoutItem_Text>& textobject) const
+void Dialog_TextObject::get_textobject(std::shared_ptr<LayoutItem_Text>& textobject) const
 {
   textobject->set_title(m_entry_title->get_text(), AppWindow::get_current_locale());
   textobject->set_text( m_text_view->get_buffer()->get_text(), AppWindow::get_current_locale());
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.h 
b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.h
index 98813cc..e268a6f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.h
@@ -43,16 +43,16 @@ public:
   Dialog_TextObject(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_TextObject();
 
-  void set_textobject(const sharedptr<const LayoutItem_Text>& textobject, const Glib::ustring& table_name, 
bool show_title = true);
-  sharedptr<LayoutItem_Text> get_textobject() const;
-  void get_textobject(sharedptr<LayoutItem_Text>& textobject) const;
+  void set_textobject(const std::shared_ptr<const LayoutItem_Text>& textobject, const Glib::ustring& 
table_name, bool show_title = true);
+  std::shared_ptr<LayoutItem_Text> get_textobject() const;
+  void get_textobject(std::shared_ptr<LayoutItem_Text>& textobject) const;
 
 private:
   Gtk::Box* m_box_title;
   Gtk::Entry* m_entry_title;
   Gtk::TextView* m_text_view;
 
-  sharedptr<LayoutItem_Text> m_textobject;
+  std::shared_ptr<LayoutItem_Text> m_textobject;
   Glib::ustring m_table_name;
 };
 
diff --git a/glom/mode_design/layout/treestore_layout.cc b/glom/mode_design/layout/treestore_layout.cc
index cc39d75..d2633fc 100644
--- a/glom/mode_design/layout/treestore_layout.cc
+++ b/glom/mode_design/layout/treestore_layout.cc
@@ -80,9 +80,9 @@ bool TreeStore_Layout::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest,
     {
       Gtk::TreeModel::Row row = *iter_dragged;
 
-      sharedptr<LayoutItem> layout_item = row[m_columns.m_col_layout_item];
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      const bool is_group = layout_group;
+      std::shared_ptr<LayoutItem> layout_item = row[m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      const bool is_group = (bool)layout_group;
 
       return is_group; //Only groups can be dragged to the top-level.
     }
@@ -101,9 +101,9 @@ bool TreeStore_Layout::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest,
     {
       Gtk::TreeModel::Row row_parent = *iter_dest_parent;
 
-      sharedptr<LayoutItem> layout_item = row_parent[m_columns.m_col_layout_item];
-      sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::cast_dynamic(layout_item);
-      const bool is_group = layout_group;
+      std::shared_ptr<LayoutItem> layout_item = row_parent[m_columns.m_col_layout_item];
+      std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
+      const bool is_group = (bool)layout_group;
 
       return is_group; //Only groups can contain other items.
     }
diff --git a/glom/mode_design/layout/treestore_layout.h b/glom/mode_design/layout/treestore_layout.h
index 43527bf..4bff534 100644
--- a/glom/mode_design/layout/treestore_layout.h
+++ b/glom/mode_design/layout/treestore_layout.h
@@ -43,7 +43,7 @@ public:
     ModelColumns()
     { add(m_col_layout_item); add(m_col_sequence); }
 
-    Gtk::TreeModelColumn< sharedptr<LayoutItem> > m_col_layout_item;
+    Gtk::TreeModelColumn< std::shared_ptr<LayoutItem> > m_col_layout_item;
     Gtk::TreeModelColumn<guint> m_col_sequence;
   };
 
diff --git a/glom/mode_design/print_layouts/box_print_layouts.cc 
b/glom/mode_design/print_layouts/box_print_layouts.cc
index b51e156..76d307e 100644
--- a/glom/mode_design/print_layouts/box_print_layouts.cc
+++ b/glom/mode_design/print_layouts/box_print_layouts.cc
@@ -60,7 +60,7 @@ Box_Print_Layouts::~Box_Print_Layouts()
 {
 }
 
-void Box_Print_Layouts::fill_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const PrintLayout>& 
item)
+void Box_Print_Layouts::fill_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
PrintLayout>& item)
 {
   if(iter)
   {
@@ -106,7 +106,7 @@ bool Box_Print_Layouts::fill_from_database()
     listItems = document->get_print_layout_names(m_table_name);
     for(std::vector<Glib::ustring>::const_iterator iter = listItems.begin(); iter != listItems.end(); ++iter)
     {
-      sharedptr<PrintLayout> item = document->get_print_layout(m_table_name, *iter);
+      std::shared_ptr<PrintLayout> item = document->get_print_layout(m_table_name, *iter);
       if(item)
       {
         Gtk::TreeModel::iterator row = m_AddDel.add_item(item->get_name());
@@ -127,7 +127,7 @@ bool Box_Print_Layouts::fill_from_database()
 
 void Box_Print_Layouts::on_adddel_user_added(const Gtk::TreeModel::iterator& row)
 {
-  sharedptr<PrintLayout> item = sharedptr<PrintLayout>::create();
+  std::shared_ptr<PrintLayout> item = std::shared_ptr<PrintLayout>(new PrintLayout());
 
   const Glib::ustring name = m_AddDel.get_value(row, m_colName);
   if(!name.empty())
@@ -187,7 +187,7 @@ void Box_Print_Layouts::save_to_document()
 
       if(!name.empty() && std::find(listItems.begin(), listItems.end(), name) == listItems.end())
       {
-        sharedptr<PrintLayout> item(new PrintLayout());
+        std::shared_ptr<PrintLayout> item(new PrintLayout());
         item->set_name(name);
 
         item->set_title( m_AddDel.get_value(iter, m_colTitle) , AppWindow::get_current_locale()); //TODO: 
Translations: Store the original in the TreeView.
@@ -209,7 +209,7 @@ void Box_Print_Layouts::on_adddel_user_changed(const Gtk::TreeModel::iterator& r
     const Glib::ustring name = m_AddDel.get_value_key(row);
     Document* document = get_document();
 
-    sharedptr<PrintLayout> item = document->get_print_layout(m_table_name, name);
+    std::shared_ptr<PrintLayout> item = document->get_print_layout(m_table_name, name);
     if(item)
     {
       if(column == m_colTitle)
diff --git a/glom/mode_design/print_layouts/box_print_layouts.h 
b/glom/mode_design/print_layouts/box_print_layouts.h
index 335ef7f..eccaa3c 100644
--- a/glom/mode_design/print_layouts/box_print_layouts.h
+++ b/glom/mode_design/print_layouts/box_print_layouts.h
@@ -40,7 +40,7 @@ public:
 private:
   virtual bool fill_from_database(); //override
 
-  virtual void fill_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const PrintLayout>& 
print_layout);
+  virtual void fill_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const PrintLayout>& 
print_layout);
 
   virtual void save_to_document();
 
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc 
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index c3038c3..4d14def 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -435,13 +435,13 @@ bool Window_PrintLayout_Edit::on_canvas_drag_motion(const Glib::RefPtr<Gdk::Drag
   return true; //Allow the drop.
 }
 
-sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutToolbarButton::enumItems 
item_type)
+std::shared_ptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutToolbarButton::enumItems 
item_type)
 {
-  sharedptr<LayoutItem> layout_item;
+  std::shared_ptr<LayoutItem> layout_item;
 
   if(item_type == PrintLayoutToolbarButton::ITEM_FIELD)
   {
-    sharedptr<LayoutItem_Field> layout_item_derived  = sharedptr<LayoutItem_Field>::create();
+    std::shared_ptr<LayoutItem_Field> layout_item_derived  = std::shared_ptr<LayoutItem_Field>(new 
LayoutItem_Field());
     layout_item = layout_item_derived;
     layout_item->set_print_layout_position(0, 0,
       PrintLayoutUtils::ITEM_WIDTH_WIDE, PrintLayoutUtils::ITEM_HEIGHT);
@@ -451,7 +451,7 @@ sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutTool
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_TEXT)
   {
-    sharedptr<LayoutItem_Text> layout_item_derived = sharedptr<LayoutItem_Text>::create();
+    std::shared_ptr<LayoutItem_Text> layout_item_derived = std::shared_ptr<LayoutItem_Text>(new 
LayoutItem_Text());
 
     // Note to translators: This is the default contents of a text item on a print layout: 
     layout_item_derived->set_text_original(_("text")); //TODO: Choose some other longer default because this 
is hidden under the drag icon?
@@ -461,26 +461,26 @@ sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutTool
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_IMAGE)
   {
-    layout_item = sharedptr<LayoutItem_Image>::create();
+    layout_item = std::shared_ptr<LayoutItem_Image>(new LayoutItem_Image());
     layout_item->set_print_layout_position(0, 0,
       PrintLayoutUtils::ITEM_WIDTH_WIDE, PrintLayoutUtils::ITEM_WIDTH_WIDE);
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL)
   {
-    sharedptr<LayoutItem_Line> layout_item_derived = sharedptr<LayoutItem_Line>::create();
+    std::shared_ptr<LayoutItem_Line> layout_item_derived = std::shared_ptr<LayoutItem_Line>(new 
LayoutItem_Line());
     layout_item_derived->set_coordinates(0, 0,
       PrintLayoutUtils::ITEM_WIDTH_WIDE * 2, 0);
     layout_item = layout_item_derived;
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_VERTICAL)
   {
-    sharedptr<LayoutItem_Line> layout_item_derived = sharedptr<LayoutItem_Line>::create();
+    std::shared_ptr<LayoutItem_Line> layout_item_derived = std::shared_ptr<LayoutItem_Line>(new 
LayoutItem_Line());
     layout_item_derived->set_coordinates(0, 0, 0, PrintLayoutUtils::ITEM_WIDTH_WIDE * 2);
     layout_item = layout_item_derived;
   }
   else if(item_type == PrintLayoutToolbarButton::ITEM_PORTAL)
   {
-    sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::create();
+    std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal());
     portal->set_print_layout_row_height(10); //Otherwise it will be 0, which is useless.
     layout_item = portal;
     layout_item->set_print_layout_position(0, 0,
@@ -494,8 +494,8 @@ sharedptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayoutTool
   //Set a default text style and size:
   //12pt text seems sane. It is what OpenOffice/LibreOffice and Abiword use:
   //Serif (rather than sans-serif) is sane for body text:
-  sharedptr<LayoutItem_WithFormatting> with_formatting = 
-    sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem_WithFormatting> with_formatting = 
+    std::dynamic_pointer_cast<LayoutItem_WithFormatting>(layout_item);
   if(with_formatting)
     with_formatting->m_formatting.set_text_format_font("Serif 12");
 
@@ -563,7 +563,7 @@ void Window_PrintLayout_Edit::on_canvas_drag_data_received(const Glib::RefPtr<Gd
     //Create the temporary drag item if necessary:
     if(!m_layout_item_dropping)
     {
-      sharedptr<LayoutItem> layout_item = create_empty_item(item_type);
+      std::shared_ptr<LayoutItem> layout_item = create_empty_item(item_type);
 
       //Show it on the canvas, at the position:
       if(layout_item)
@@ -586,7 +586,7 @@ void Window_PrintLayout_Edit::on_canvas_drag_data_received(const Glib::RefPtr<Gd
     m_canvas.drag_unhighlight();
 
     //Add the item to the canvas:
-    sharedptr<LayoutItem> layout_item = create_empty_item(item_type);
+    std::shared_ptr<LayoutItem> layout_item = create_empty_item(item_type);
     if(!layout_item)
     {
       std::cerr << G_STRFUNC << ": layout_item is null." << std::endl;
@@ -667,12 +667,12 @@ Glib::ustring Window_PrintLayout_Edit::get_original_name() const
   return m_name_original;
 }
 
-void Window_PrintLayout_Edit::set_print_layout(const Glib::ustring& table_name, const sharedptr<const 
PrintLayout>& print_layout)
+void Window_PrintLayout_Edit::set_print_layout(const Glib::ustring& table_name, const std::shared_ptr<const 
PrintLayout>& print_layout)
 {
   m_modified = false;
 
   m_name_original = print_layout->get_name();
-  m_print_layout = sharedptr<PrintLayout>(new PrintLayout(*print_layout)); //Copy it, so we only use the 
changes when we want to.
+  m_print_layout = std::shared_ptr<PrintLayout>(new PrintLayout(*print_layout)); //Copy it, so we only use 
the changes when we want to.
   m_canvas.set_print_layout(table_name, m_print_layout);
   m_table_name = table_name;
 
@@ -700,7 +700,7 @@ void Window_PrintLayout_Edit::enable_buttons()
 
 }
 
-sharedptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
+std::shared_ptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
 {
   m_print_layout = m_canvas.get_print_layout();
   m_print_layout->set_name( m_entry_name->get_text() );
@@ -717,15 +717,15 @@ sharedptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
   m_print_layout->get_layout_group()->remove_all_items();
 
   //The Header and Footer parts are implicit (they are the whole header or footer treeview)
-  sharedptr<LayoutItem_Header> header = sharedptr<LayoutItem_Header>::create();
-  sharedptr<LayoutGroup> group_temp = header;
+  std::shared_ptr<LayoutItem_Header> header = std::shared_ptr<LayoutItem_Header>(new LayoutItem_Header());
+  std::shared_ptr<LayoutGroup> group_temp = header;
   fill_print_layout_parts(group_temp, m_model_parts_header);
   if(header->get_items_count())
     m_print_layout->get_layout_group()->add_item(header);
 
   fill_print_layout_parts(m_print_layout->get_layout_group(), m_model_parts_main);
 
-  sharedptr<LayoutItem_Footer> footer = sharedptr<LayoutItem_Footer>::create();
+  std::shared_ptr<LayoutItem_Footer> footer = std::shared_ptr<LayoutItem_Footer>(new LayoutItem_Footer());
   group_temp = footer;
   fill_print_layout_parts(group_temp, m_model_parts_footer);
   if(footer->get_items_count())
@@ -822,7 +822,7 @@ bool Window_PrintLayout_Edit::get_is_item_at(double x, double y)
   return layout_item;
 }
 
-void Window_PrintLayout_Edit::set_default_position(const sharedptr<LayoutItem>& item)
+void Window_PrintLayout_Edit::set_default_position(const std::shared_ptr<LayoutItem>& item)
 {
   if(!item)
     return;
@@ -850,7 +850,7 @@ void Window_PrintLayout_Edit::set_default_position(const sharedptr<LayoutItem>&
 
 void Window_PrintLayout_Edit::on_menu_insert_field()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_FIELD);
+  std::shared_ptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_FIELD);
 
   // Note to translators: This is the default contents of a text item on a print layout: 
   set_default_position(layout_item);
@@ -860,7 +860,7 @@ void Window_PrintLayout_Edit::on_menu_insert_field()
 
 void Window_PrintLayout_Edit::on_menu_insert_text()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_TEXT);
+  std::shared_ptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_TEXT);
   set_default_position(layout_item);
 
   create_canvas_layout_item_and_add(layout_item);
@@ -868,7 +868,7 @@ void Window_PrintLayout_Edit::on_menu_insert_text()
 
 void Window_PrintLayout_Edit::on_menu_insert_image()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_IMAGE);
+  std::shared_ptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_IMAGE);
   // Note to translators: This is the default contents of a text item on a print layout: 
   //layout_item->set_text_original(_("text"));
   set_default_position(layout_item);
@@ -878,7 +878,7 @@ void Window_PrintLayout_Edit::on_menu_insert_image()
 
 void Window_PrintLayout_Edit::on_menu_insert_relatedrecords()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_PORTAL);
+  std::shared_ptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_PORTAL);
   set_default_position(layout_item);
 
   create_canvas_layout_item_and_add(layout_item);
@@ -886,7 +886,7 @@ void Window_PrintLayout_Edit::on_menu_insert_relatedrecords()
 
 void Window_PrintLayout_Edit::on_menu_insert_line_horizontal()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL);
+  std::shared_ptr<LayoutItem> layout_item = 
create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL);
 
   /*
   double item_x = m_drop_x;
@@ -903,7 +903,7 @@ void Window_PrintLayout_Edit::on_menu_insert_line_horizontal()
 
 void Window_PrintLayout_Edit::on_menu_insert_line_vertical()
 {
-  sharedptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_VERTICAL);
+  std::shared_ptr<LayoutItem> layout_item = create_empty_item(PrintLayoutToolbarButton::ITEM_LINE_VERTICAL);
 
   create_canvas_layout_item_and_add(layout_item);
 }
@@ -1065,7 +1065,7 @@ void Window_PrintLayout_Edit::on_menu_file_print_preview()
     return;
 
   const Glib::ustring original_name = get_original_name();
-  sharedptr<PrintLayout> print_layout = get_print_layout();
+  std::shared_ptr<PrintLayout> print_layout = get_print_layout();
   if(print_layout && (original_name != get_name()))
     document->remove_print_layout(m_table_name, original_name);
 
@@ -1097,7 +1097,7 @@ void Window_PrintLayout_Edit::on_menu_edit_copy()
     if(item)
       item->update_layout_position_from_canvas();
 
-    sharedptr<LayoutItem> cloned = 
+    std::shared_ptr<LayoutItem> cloned = 
       glom_sharedptr_clone(item->get_layout_item());
 
     m_layout_items_to_paste.push_back(cloned);
@@ -1114,7 +1114,7 @@ void Window_PrintLayout_Edit::on_menu_edit_paste()
   for(type_list_items::iterator iter = m_layout_items_to_paste.begin();
     iter != m_layout_items_to_paste.end(); ++iter)
   {
-    sharedptr<LayoutItem> item = *iter;
+    std::shared_ptr<LayoutItem> item = *iter;
     if(!item)
       continue;
 
@@ -1136,7 +1136,7 @@ void Window_PrintLayout_Edit::on_menu_edit_paste()
   }
 }
 
-Glib::RefPtr<CanvasLayoutItem> Window_PrintLayout_Edit::create_canvas_layout_item_and_add(const 
sharedptr<LayoutItem>& layout_item)
+Glib::RefPtr<CanvasLayoutItem> Window_PrintLayout_Edit::create_canvas_layout_item_and_add(const 
std::shared_ptr<LayoutItem>& layout_item)
 {
   Glib::RefPtr<CanvasLayoutItem> canvas_item = CanvasLayoutItem::create();
   m_canvas.add_canvas_layout_item(canvas_item);
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.h 
b/glom/mode_design/print_layouts/window_print_layout_edit.h
index be6123a..62d5155 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.h
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.h
@@ -53,16 +53,16 @@ public:
 
   virtual bool init_db_details(const Glib::ustring& table_name);
 
-  void set_print_layout(const Glib::ustring& table_name, const sharedptr<const PrintLayout>& print_layout);
+  void set_print_layout(const Glib::ustring& table_name, const std::shared_ptr<const PrintLayout>& 
print_layout);
   Glib::ustring get_original_name() const;
-  sharedptr<PrintLayout> get_print_layout();
+  std::shared_ptr<PrintLayout> get_print_layout();
 
 private:
 
   void enable_buttons();
   void init_menu();
 
-  sharedptr<LayoutItem> create_empty_item(PrintLayoutToolbarButton::enumItems item_type);
+  std::shared_ptr<LayoutItem> create_empty_item(PrintLayoutToolbarButton::enumItems item_type);
 
   void on_menu_file_page_setup();
   void on_menu_file_print_preview();
@@ -128,19 +128,19 @@ private:
   void set_ruler_sizes();
 
   bool get_is_item_at(double x, double y);
-  void set_default_position(const sharedptr<LayoutItem>& item);
+  void set_default_position(const std::shared_ptr<LayoutItem>& item);
   
   void canvas_convert_from_drag_pixels(double& x, double& y, bool adjust_for_scrolling = false) const;
   void get_dimensions_of_multiple_selected_items(double& x, double& y, double& width, double& height);
 
-  Glib::RefPtr<CanvasLayoutItem> create_canvas_layout_item_and_add(const sharedptr<LayoutItem>& layout_item);
+  Glib::RefPtr<CanvasLayoutItem> create_canvas_layout_item_and_add(const std::shared_ptr<LayoutItem>& 
layout_item);
 
   //Box_DB_Table_Definition* m_box;
   Glib::ustring m_name_original;
   Glib::ustring m_table_name;
   bool m_modified;
 
-  sharedptr<PrintLayout> m_print_layout;
+  std::shared_ptr<PrintLayout> m_print_layout;
 
   Gtk::Entry* m_entry_name;
   Gtk::Entry* m_entry_title;
diff --git a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc 
b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
index 43de572..0b2a3e9 100644
--- a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
+++ b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
@@ -82,7 +82,7 @@ CanvasGroupDbTable::CanvasGroupDbTable(const Glib::ustring& table_name, const Gl
   double field_y = field_height;
   for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
   {
-    sharedptr<Field> field = *iter;
+    std::shared_ptr<Field> field = *iter;
 
     //Show the primary key as bold:
     Glib::ustring title;
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc 
b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index 9fb585f..b2f8c2f 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -178,7 +178,7 @@ void Dialog_RelationshipsOverview::draw_tables()
     Document::type_listTableInfo tables = document->get_tables();
     for(Document::type_listTableInfo::iterator iter = tables.begin(); iter != tables.end(); ++iter)
     {
-      sharedptr<TableInfo> info = *iter;
+      std::shared_ptr<TableInfo> info = *iter;
       const Glib::ustring table_name = info->get_name();
 
       float table_x = 0;
@@ -232,7 +232,7 @@ void Dialog_RelationshipsOverview::draw_lines()
     Document::type_listTableInfo tables = document->get_tables();
     for(Document::type_listTableInfo::iterator iter = tables.begin(); iter != tables.end(); ++iter)
     {
-      sharedptr<TableInfo> info = *iter;
+      std::shared_ptr<TableInfo> info = *iter;
       const Glib::ustring table_name = info->get_name();
 
       Document::type_vec_relationships m_relationships = document->get_relationships(table_name);
@@ -240,7 +240,7 @@ void Dialog_RelationshipsOverview::draw_lines()
 
       for(Document::type_vec_relationships::const_iterator rit = m_relationships.begin(); rit != 
m_relationships.end(); ++rit)
       {
-        sharedptr<const Relationship> relationship = *rit;
+        std::shared_ptr<const Relationship> relationship = *rit;
         if(!relationship)
           continue;
 
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc 
b/glom/mode_design/report_layout/dialog_layout_report.cc
index 8d6fc1f..8ed9086 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -102,30 +102,30 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
       m_model_available_parts_main = type_model::create();
 
   //     Gtk::TreeModel::iterator iterHeader = m_model_available_parts_main->append();
-  //     (*iterHeader)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Header()));
+  //     (*iterHeader)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Header()));
 
       Gtk::TreeModel::iterator iter = m_model_available_parts_main->append();
-      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_GroupBy()));
+      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_GroupBy()));
 
       Gtk::TreeModel::iterator iterField = m_model_available_parts_main->append(iter->children()); //Place 
Field under GroupBy to indicate that that's where it belongs in the actual layout.
-      (*iterField)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
+      (*iterField)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
 
       Gtk::TreeModel::iterator iterText = m_model_available_parts_main->append(iter->children());
-      (*iterText)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
+      (*iterText)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
 
       Gtk::TreeModel::iterator iterImage = m_model_available_parts_main->append(iter->children());
-      (*iterImage)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
+      (*iterImage)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
 
       Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_main->append(iter->children());
-      (*iterVerticalGroup)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
+      (*iterVerticalGroup)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
 
       iter = m_model_available_parts_main->append();
-      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Summary()));
+      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Summary()));
       iter = m_model_available_parts_main->append(iter->children());
-      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_FieldSummary()));
+      (*iter)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_FieldSummary()));
 
 //     Gtk::TreeModel::iterator iterFooter = m_model_available_parts_main->append();
-//     (*iterFooter)[m_model_available_parts_main->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Footer()));
+//     (*iterFooter)[m_model_available_parts_main->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Footer()));
     }
 
     //Header/Footer parts:
@@ -133,16 +133,16 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
       m_model_available_parts_headerfooter = type_model::create();
 
       Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_headerfooter->append();
-      (*iterVerticalGroup)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
+      (*iterVerticalGroup)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
 
       Gtk::TreeModel::iterator iterField = 
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
-      (*iterField)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
+      (*iterField)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
 
       Gtk::TreeModel::iterator iterText = 
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
-      (*iterText)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
+      (*iterText)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
 
       Gtk::TreeModel::iterator iterImage = 
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
-      (*iterImage)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
sharedptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
+      (*iterImage)[m_model_available_parts_headerfooter->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
     }
 
     m_treeview_available_parts->set_model(m_model_available_parts_main);
@@ -235,14 +235,14 @@ void Dialog_Layout_Report::setup_model(Gtk::TreeView& treeview, Glib::RefPtr<typ
   //m_model_parts_main->signal_row_changed().connect( sigc::mem_fun(*this, 
&Dialog_Layout_Report::on_treemodel_row_changed) );
 }
 
-sharedptr<LayoutGroup> Dialog_Layout_Report::fill_group(const Gtk::TreeModel::iterator& iter, const 
Glib::RefPtr<const type_model> model)
+std::shared_ptr<LayoutGroup> Dialog_Layout_Report::fill_group(const Gtk::TreeModel::iterator& iter, const 
Glib::RefPtr<const type_model> model)
 {
   if(iter)
   {
     Gtk::TreeModel::Row row = *iter;
 
-    sharedptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
-    sharedptr<LayoutGroup> pGroup = sharedptr<LayoutGroup>::cast_dynamic(pItem);
+    std::shared_ptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
+    std::shared_ptr<LayoutGroup> pGroup = std::dynamic_pointer_cast<LayoutGroup>(pItem);
     if(pGroup)
     {
       //Make sure that it contains the child items:
@@ -252,10 +252,10 @@ sharedptr<LayoutGroup> Dialog_Layout_Report::fill_group(const Gtk::TreeModel::it
 
   }
 
-  return  sharedptr<LayoutGroup>();
+  return  std::shared_ptr<LayoutGroup>();
 }
 
-void Dialog_Layout_Report::fill_group_children(const sharedptr<LayoutGroup>& group, const 
Gtk::TreeModel::iterator& iter, const Glib::RefPtr<const type_model> model)
+void Dialog_Layout_Report::fill_group_children(const std::shared_ptr<LayoutGroup>& group, const 
Gtk::TreeModel::iterator& iter, const Glib::RefPtr<const type_model> model)
 {
   if(iter)
   {
@@ -265,10 +265,10 @@ void Dialog_Layout_Report::fill_group_children(const sharedptr<LayoutGroup>& gro
     for(Gtk::TreeModel::iterator iterChild = row.children().begin(); iterChild != row.children().end(); 
++iterChild)
     {
       Gtk::TreeModel::Row row = *iterChild;
-      sharedptr<LayoutItem> item = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> item = row[model->m_columns.m_col_item];
 
       //Recurse:
-      sharedptr<LayoutGroup> child_group = sharedptr<LayoutGroup>::cast_dynamic(item);
+      std::shared_ptr<LayoutGroup> child_group = std::dynamic_pointer_cast<LayoutGroup>(item);
       if(child_group)
         fill_group_children(child_group, iterChild, model);
 
@@ -279,16 +279,16 @@ void Dialog_Layout_Report::fill_group_children(const sharedptr<LayoutGroup>& gro
   }
 }
 
-void Dialog_Layout_Report::add_group_children(const Glib::RefPtr<type_model>& model_parts, const 
Gtk::TreeModel::iterator& parent, const sharedptr<const LayoutGroup>& group)
+void Dialog_Layout_Report::add_group_children(const Glib::RefPtr<type_model>& model_parts, const 
Gtk::TreeModel::iterator& parent, const std::shared_ptr<const LayoutGroup>& group)
 {
   for(LayoutGroup::type_list_items::const_iterator iter = group->m_list_items.begin(); iter != 
group->m_list_items.end(); ++iter)
   {
-    sharedptr<const LayoutItem> item = *iter;
-    sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<const LayoutItem> item = *iter;
+    std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
     if(group)
     {
-      sharedptr<const LayoutItem_Header> header = sharedptr<const LayoutItem_Header>::cast_dynamic(item);
-      sharedptr<const LayoutItem_Footer> footer = sharedptr<const LayoutItem_Footer>::cast_dynamic(item);
+      std::shared_ptr<const LayoutItem_Header> header = std::dynamic_pointer_cast<const 
LayoutItem_Header>(item);
+      std::shared_ptr<const LayoutItem_Footer> footer = std::dynamic_pointer_cast<const 
LayoutItem_Footer>(item);
 
       //Special-case the header and footer so that their items go into the separate treeviews:
       if(header)
@@ -311,7 +311,7 @@ void Dialog_Layout_Report::add_group_children(const Glib::RefPtr<type_model>& mo
   m_modified = true;
 }
 
-void Dialog_Layout_Report::add_group(const Glib::RefPtr<type_model>& model_parts, const 
Gtk::TreeModel::iterator& parent, const sharedptr<const LayoutGroup>& group)
+void Dialog_Layout_Report::add_group(const Glib::RefPtr<type_model>& model_parts, const 
Gtk::TreeModel::iterator& parent, const std::shared_ptr<const LayoutGroup>& group)
 {
   Gtk::TreeModel::iterator iterNewItem;
   if(!parent)
@@ -328,7 +328,7 @@ void Dialog_Layout_Report::add_group(const Glib::RefPtr<type_model>& model_parts
   {
     Gtk::TreeModel::Row row = *iterNewItem;
 
-    row[model_parts->m_columns.m_col_item] = sharedptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
+    row[model_parts->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
 
     add_group_children(model_parts, iterNewItem /* parent */, group);
 
@@ -337,12 +337,12 @@ void Dialog_Layout_Report::add_group(const Glib::RefPtr<type_model>& model_parts
 }
 
 //void Dialog_Layout_Report::set_document(const Glib::ustring& layout, Document* document, const 
Glib::ustring& table_name, const type_vecLayoutFields& table_fields)
-void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const sharedptr<const Report>& report)
+void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const std::shared_ptr<const Report>& 
report)
 {
   m_modified = false;
 
   m_name_original = report->get_name();
-  m_report = sharedptr<Report>(new Report(*report)); //Copy it, so we only use the changes when we want to.
+  m_report = std::shared_ptr<Report>(new Report(*report)); //Copy it, so we only use the changes when we 
want to.
   m_table_name = table_name;
 
   //Dialog_Layout::set_document(layout, document, table_name, table_fields);
@@ -389,7 +389,7 @@ void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const sha
 
 void Dialog_Layout_Report::enable_buttons()
 {
-  sharedptr<LayoutItem> layout_item_available;
+  std::shared_ptr<LayoutItem> layout_item_available;
   bool enable_add = false;
 
   //Available Parts:
@@ -409,7 +409,7 @@ void Dialog_Layout_Report::enable_buttons()
     }
   }
 
-  sharedptr<LayoutItem> layout_item_parent;
+  std::shared_ptr<LayoutItem> layout_item_parent;
 
   Gtk::TreeView* treeview = get_selected_treeview();
   if(!treeview)
@@ -448,7 +448,7 @@ void Dialog_Layout_Report::enable_buttons()
 
       //The [Formatting] button:
       bool enable_formatting = false;
-      sharedptr<LayoutItem_Field> item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item_parent);
+      std::shared_ptr<LayoutItem_Field> item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item_parent);
       if(item_field)
         enable_formatting = true;
 
@@ -474,7 +474,7 @@ void Dialog_Layout_Report::enable_buttons()
       if(!may_be_child_of_parent)
       {
         //Maybe it can be a sibling of the parent instead (and that's what would happen if Add was clicked).
-        sharedptr<LayoutItem> layout_item_parent_of_parent;
+        std::shared_ptr<LayoutItem> layout_item_parent_of_parent;
 
         Gtk::TreeModel::iterator iterParent = iter->parent();
         if(iterParent)
@@ -639,18 +639,18 @@ void Dialog_Layout_Report::on_button_add()
   Glib::RefPtr<type_model> model_available = 
Glib::RefPtr<type_model>::cast_dynamic(m_treeview_available_parts->get_model());
 
   Gtk::TreeModel::iterator parent = get_selected_group_parent();
-  sharedptr<const LayoutItem> pParentPart;
+  std::shared_ptr<const LayoutItem> pParentPart;
   if(parent)
   {
-    sharedptr<LayoutItem> temp = (*parent)[m_model_available_parts_main->m_columns.m_col_item];
+    std::shared_ptr<LayoutItem> temp = (*parent)[m_model_available_parts_main->m_columns.m_col_item];
     pParentPart = temp;
   }
 
   Gtk::TreeModel::iterator available = get_selected_available();
-  sharedptr<const LayoutItem> pAvailablePart;
+  std::shared_ptr<const LayoutItem> pAvailablePart;
   if(available)
   {
-    sharedptr<LayoutItem> temp = (*available)[model_available->m_columns.m_col_item];
+    std::shared_ptr<LayoutItem> temp = (*available)[model_available->m_columns.m_col_item];
     pAvailablePart = temp;
   }
 
@@ -663,7 +663,7 @@ void Dialog_Layout_Report::on_button_add()
     parent = (*parent).parent();
     if(parent)
     {
-      sharedptr<LayoutItem> temp = (*parent)[model_available->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> temp = (*parent)[model_available->m_columns.m_col_item];
       pParentPart = temp;
 
       if(!TreeStore_ReportLayout::may_be_child_of(pParentPart, pAvailablePart))
@@ -683,7 +683,7 @@ void Dialog_Layout_Report::on_button_add()
     else
       iter = model->append();
 
-    (*iter)[model->m_columns.m_col_item] = sharedptr<LayoutItem>(pAvailablePart->clone());
+    (*iter)[model->m_columns.m_col_item] = std::shared_ptr<LayoutItem>(pAvailablePart->clone());
   }
 
   if(parent)
@@ -693,9 +693,9 @@ void Dialog_Layout_Report::on_button_add()
 }
 
 
-sharedptr<Relationship> Dialog_Layout_Report::offer_relationship_list()
+std::shared_ptr<Relationship> Dialog_Layout_Report::offer_relationship_list()
 {
-  sharedptr<Relationship> result;
+  std::shared_ptr<Relationship> result;
 
   Dialog_ChooseRelationship* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -737,8 +737,8 @@ Gtk::TreeModel::iterator Dialog_Layout_Report::get_selected_group_parent() const
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> layout_item = row[model->m_columns.m_col_item];
-      if(sharedptr<LayoutGroup>::cast_dynamic(layout_item))
+      std::shared_ptr<LayoutItem> layout_item = row[model->m_columns.m_col_item];
+      if(std::dynamic_pointer_cast<LayoutGroup>(layout_item))
       {
         //Add a group under this group:
         parent = iter;
@@ -786,12 +786,12 @@ void Dialog_Layout_Report::on_button_formatting()
     if(iter)
     {
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> item = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> item = row[model->m_columns.m_col_item];
 
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
       if(field)
       {
-        sharedptr<LayoutItem_Field> field_chosen = offer_field_formatting(field, m_table_name, this, false 
/* no editing options */);
+        std::shared_ptr<LayoutItem_Field> field_chosen = offer_field_formatting(field, m_table_name, this, 
false /* no editing options */);
         if(field_chosen)
         {
           *field = *field_chosen;
@@ -819,9 +819,9 @@ void Dialog_Layout_Report::on_button_edit()
     {
       //Do something different for each type of item:
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> item = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> item = row[model->m_columns.m_col_item];
 
-      sharedptr<LayoutItem_FieldSummary> fieldsummary = 
sharedptr<LayoutItem_FieldSummary>::cast_dynamic(item);
+      std::shared_ptr<LayoutItem_FieldSummary> fieldsummary = 
std::dynamic_pointer_cast<LayoutItem_FieldSummary>(item);
       if(fieldsummary)
       {
         Dialog_FieldSummary* dialog = 0;
@@ -836,7 +836,7 @@ void Dialog_Layout_Report::on_button_edit()
         if(response == Gtk::RESPONSE_OK)
         {
           //Get the chosen relationship:
-          sharedptr<LayoutItem_FieldSummary> chosenitem = dialog->get_item();
+          std::shared_ptr<LayoutItem_FieldSummary> chosenitem = dialog->get_item();
           if(chosenitem)
           {
             *fieldsummary = *chosenitem; //TODO_Performance.
@@ -851,10 +851,10 @@ void Dialog_Layout_Report::on_button_edit()
       }
       else
       {
-        sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+        std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
         if(field)
         {
-          sharedptr<LayoutItem_Field> chosenitem = offer_field_list_select_one_field(field, m_table_name, 
this);
+          std::shared_ptr<LayoutItem_Field> chosenitem = offer_field_list_select_one_field(field, 
m_table_name, this);
           if(chosenitem)
           {
             *field = *chosenitem; //TODO_Performance.
@@ -864,10 +864,10 @@ void Dialog_Layout_Report::on_button_edit()
         }
         else
         {
-          sharedptr<LayoutItem_Text> layout_item_text = sharedptr<LayoutItem_Text>::cast_dynamic(item);
+          std::shared_ptr<LayoutItem_Text> layout_item_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(item);
           if(layout_item_text)
           {
-            sharedptr<LayoutItem_Text> chosen = offer_textobject(layout_item_text);
+            std::shared_ptr<LayoutItem_Text> chosen = offer_textobject(layout_item_text);
             if(chosen)
             {
               *layout_item_text = *chosen;
@@ -877,10 +877,10 @@ void Dialog_Layout_Report::on_button_edit()
           }
           else
           {
-            sharedptr<LayoutItem_Image> layout_item_image = sharedptr<LayoutItem_Image>::cast_dynamic(item);
+            std::shared_ptr<LayoutItem_Image> layout_item_image = 
std::dynamic_pointer_cast<LayoutItem_Image>(item);
             if(layout_item_image)
             {
-              sharedptr<LayoutItem_Image> chosen = offer_imageobject(layout_item_image);
+              std::shared_ptr<LayoutItem_Image> chosen = offer_imageobject(layout_item_image);
               if(chosen)
               {
                 *layout_item_image = *chosen;
@@ -890,7 +890,7 @@ void Dialog_Layout_Report::on_button_edit()
             }
             else
             {
-              sharedptr<LayoutItem_GroupBy> group_by = sharedptr<LayoutItem_GroupBy>::cast_dynamic(item);
+              std::shared_ptr<LayoutItem_GroupBy> group_by = 
std::dynamic_pointer_cast<LayoutItem_GroupBy>(item);
               if(group_by)
               {
                 Dialog_GroupBy* dialog = 0;
@@ -905,7 +905,7 @@ void Dialog_Layout_Report::on_button_edit()
                 if(response == Gtk::RESPONSE_OK)
                 {
                   //Get the chosen relationship:
-                  sharedptr<LayoutItem_GroupBy> chosenitem = dialog->get_item();
+                  std::shared_ptr<LayoutItem_GroupBy> chosenitem = dialog->get_item();
                   if(chosenitem)
                   {
                     *group_by = *chosenitem;
@@ -952,7 +952,7 @@ void Dialog_Layout_Report::on_cell_data_part(Gtk::CellRenderer* renderer, const
     {
       Gtk::TreeModel::Row row = *iter;
 
-      sharedptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
       const Glib::ustring part = pItem->get_part_type_name();
 
       renderer_text->property_text() = part;
@@ -972,7 +972,7 @@ void Dialog_Layout_Report::on_cell_data_details(Gtk::CellRenderer* renderer, con
       Glib::ustring text;
 
       Gtk::TreeModel::Row row = *iter;
-      sharedptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
       renderer_text->property_text() = pItem->get_layout_display_name();
       renderer_text->property_editable() = false;
     }
@@ -992,7 +992,7 @@ void Dialog_Layout_Report::on_cell_data_available_part(Gtk::CellRenderer* render
     {
       Gtk::TreeModel::Row row = *iter;
       Glib::RefPtr<type_model> model = 
Glib::RefPtr<type_model>::cast_dynamic(m_treeview_available_parts->get_model());
-      sharedptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> pItem = row[model->m_columns.m_col_item];
       Glib::ustring part = pItem->get_part_type_name();
 
       renderer_text->property_text() = part;
@@ -1006,25 +1006,25 @@ Glib::ustring Dialog_Layout_Report::get_original_report_name() const
   return m_name_original;
 }
 
-sharedptr<Report> Dialog_Layout_Report::get_report()
+std::shared_ptr<Report> Dialog_Layout_Report::get_report()
 {
   m_report->set_name( m_entry_name->get_text() );
   m_report->set_title( m_entry_title->get_text() , AppWindow::get_current_locale());
   m_report->set_show_table_title( m_checkbutton_table_title->get_active() );
 
-  sharedptr<LayoutGroup> group = m_report->get_layout_group();
+  std::shared_ptr<LayoutGroup> group = m_report->get_layout_group();
   group->remove_all_items();
 
   //The Header and Footer parts are implicit (they are the whole header or footer treeview)
-  sharedptr<LayoutItem_Header> header = sharedptr<LayoutItem_Header>::create();
-  sharedptr<LayoutGroup> group_temp = header;
+  std::shared_ptr<LayoutItem_Header> header = std::shared_ptr<LayoutItem_Header>(new LayoutItem_Header());
+  std::shared_ptr<LayoutGroup> group_temp = header;
   fill_report_parts(group_temp, m_model_parts_header);
   if(header->get_items_count())
     group->add_item(header);
 
   fill_report_parts(group, m_model_parts_main);
 
-  sharedptr<LayoutItem_Footer> footer = sharedptr<LayoutItem_Footer>::create();
+  std::shared_ptr<LayoutItem_Footer> footer = std::shared_ptr<LayoutItem_Footer>(new LayoutItem_Footer());
   group_temp = footer;
   fill_report_parts(group_temp, m_model_parts_footer);
   if(footer->get_items_count())
@@ -1033,12 +1033,12 @@ sharedptr<Report> Dialog_Layout_Report::get_report()
   return m_report;
 }
 
-void Dialog_Layout_Report::fill_report_parts(sharedptr<LayoutGroup>& group, const Glib::RefPtr<const 
type_model> parts_model)
+void Dialog_Layout_Report::fill_report_parts(std::shared_ptr<LayoutGroup>& group, const Glib::RefPtr<const 
type_model> parts_model)
 {
   for(Gtk::TreeModel::iterator iter = parts_model->children().begin(); iter != 
parts_model->children().end(); ++iter)
   {
     //Recurse into a group if necessary:
-    sharedptr<LayoutGroup> group_child = fill_group(iter, parts_model);
+    std::shared_ptr<LayoutGroup> group_child = fill_group(iter, parts_model);
     if(group_child)
     {
       //Add the group:
@@ -1046,7 +1046,7 @@ void Dialog_Layout_Report::fill_report_parts(sharedptr<LayoutGroup>& group, cons
     }
     else
     {
-      sharedptr<LayoutItem> item = (*iter)[parts_model->m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> item = (*iter)[parts_model->m_columns.m_col_item];
       if(item)
       {
         group->add_item(item);
diff --git a/glom/mode_design/report_layout/dialog_layout_report.h 
b/glom/mode_design/report_layout/dialog_layout_report.h
index e1a040d..b4712d8 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.h
+++ b/glom/mode_design/report_layout/dialog_layout_report.h
@@ -43,8 +43,8 @@ public:
   Dialog_Layout_Report(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_Layout_Report();
 
-  void set_report(const Glib::ustring& table_name, const sharedptr<const Report>& report);
-  sharedptr<Report> get_report();
+  void set_report(const Glib::ustring& table_name, const std::shared_ptr<const Report>& report);
+  std::shared_ptr<Report> get_report();
 
   Glib::ustring get_original_report_name() const;
 
@@ -52,19 +52,19 @@ private:
 
   typedef TreeStore_ReportLayout type_model;
 
-  virtual void add_group(const Glib::RefPtr<type_model>& model_parts, const Gtk::TreeModel::iterator& 
parent, const sharedptr<const LayoutGroup>& group);
+  virtual void add_group(const Glib::RefPtr<type_model>& model_parts, const Gtk::TreeModel::iterator& 
parent, const std::shared_ptr<const LayoutGroup>& group);
 
-  void add_group_children(const Glib::RefPtr<type_model>& model_parts, const Gtk::TreeModel::iterator& 
parent, const sharedptr<const LayoutGroup>& group);
+  void add_group_children(const Glib::RefPtr<type_model>& model_parts, const Gtk::TreeModel::iterator& 
parent, const std::shared_ptr<const LayoutGroup>& group);
 
-  void fill_group_children(const sharedptr<LayoutGroup>& group, const Gtk::TreeModel::iterator& iter, const 
Glib::RefPtr<const type_model> model);
-  sharedptr<LayoutGroup> fill_group(const Gtk::TreeModel::iterator& iter, const Glib::RefPtr<const 
type_model> model);
+  void fill_group_children(const std::shared_ptr<LayoutGroup>& group, const Gtk::TreeModel::iterator& iter, 
const Glib::RefPtr<const type_model> model);
+  std::shared_ptr<LayoutGroup> fill_group(const Gtk::TreeModel::iterator& iter, const Glib::RefPtr<const 
type_model> model);
 
   //Enable/disable buttons, depending on treeview selection:
   virtual void enable_buttons();
 
   virtual void save_to_document();
 
-  sharedptr<Relationship> offer_relationship_list();
+  std::shared_ptr<Relationship> offer_relationship_list();
 
   ///Depends on the active notebook tab.
   Glib::RefPtr<type_model> get_selected_model();
@@ -98,7 +98,7 @@ private:
 
   void on_notebook_switch_page(Gtk::Widget*, guint);
 
-  void fill_report_parts(sharedptr<LayoutGroup>& group, const Glib::RefPtr<const type_model> parts_model);
+  void fill_report_parts(std::shared_ptr<LayoutGroup>& group, const Glib::RefPtr<const type_model> 
parts_model);
 
   Gtk::Notebook* m_notebook_parts;
   Gtk::TreeView* m_treeview_parts_header;
@@ -127,7 +127,7 @@ private:
   Glib::RefPtr<type_model> m_model_available_parts_main;
 
   Glib::ustring m_name_original;
-  sharedptr<Report> m_report;
+  std::shared_ptr<Report> m_report;
   sigc::connection m_signal_connection;
 };
 
diff --git a/glom/mode_design/report_layout/treestore_report_layout.cc 
b/glom/mode_design/report_layout/treestore_report_layout.cc
index e9877d1..a2dce3e 100644
--- a/glom/mode_design/report_layout/treestore_report_layout.cc
+++ b/glom/mode_design/report_layout/treestore_report_layout.cc
@@ -71,7 +71,7 @@ bool TreeStore_ReportLayout::row_drop_possible_vfunc(const Gtk::TreeModel::Path&
   if(!iter_dragged_row)
     return false;
 
-  sharedptr<LayoutItem> item_dragged_row = (*iter_dragged_row)[m_columns.m_col_item];
+  std::shared_ptr<LayoutItem> item_dragged_row = (*iter_dragged_row)[m_columns.m_col_item];
 
   //dest is the path that the row would have after it has been dropped:
   //But in this case we are more interested in the parent row:
@@ -79,7 +79,7 @@ bool TreeStore_ReportLayout::row_drop_possible_vfunc(const Gtk::TreeModel::Path&
   bool dest_is_not_top_level = dest_parent.up();
   if(!dest_is_not_top_level || dest_parent.empty())
   {
-    return may_be_child_of(sharedptr<const LayoutItem>() /* parent */, item_dragged_row);
+    return may_be_child_of(std::shared_ptr<const LayoutItem>() /* parent */, item_dragged_row);
   }
   else
   {
@@ -94,7 +94,7 @@ bool TreeStore_ReportLayout::row_drop_possible_vfunc(const Gtk::TreeModel::Path&
     if(iter_dest_parent)
     {
       Gtk::TreeModel::Row row_parent = *iter_dest_parent;
-      sharedptr<LayoutItem> item_parent = (row_parent)[m_columns.m_col_item];
+      std::shared_ptr<LayoutItem> item_parent = (row_parent)[m_columns.m_col_item];
 
       return may_be_child_of(item_parent, item_dragged_row);
     }
@@ -132,20 +132,20 @@ void TreeStore_ReportLayout::fill_sequences(const iterator& iter)
   }
 }
 
-bool TreeStore_ReportLayout::may_be_child_of(const sharedptr<const LayoutItem>& parent, const 
sharedptr<const LayoutItem>& suggested_child)
+bool TreeStore_ReportLayout::may_be_child_of(const std::shared_ptr<const LayoutItem>& parent, const 
std::shared_ptr<const LayoutItem>& suggested_child)
 {
   if(!parent)
     return true; //Anything may be at the top-level.
 
-  if(!(sharedptr<const LayoutGroup>::cast_dynamic(parent)))
+  if(!(std::dynamic_pointer_cast<const LayoutGroup>(parent)))
     return false; //Only LayoutGroup (and derived types) may have children.
 
-  const bool child_fieldsummary = sharedptr<const LayoutItem_FieldSummary>::cast_dynamic(suggested_child);
+  const bool child_fieldsummary = (bool)std::dynamic_pointer_cast<const 
LayoutItem_FieldSummary>(suggested_child);
 
-  sharedptr<const LayoutItem_Summary> summary =  sharedptr<const LayoutItem_Summary>::cast_dynamic(parent);
+  std::shared_ptr<const LayoutItem_Summary> summary = std::dynamic_pointer_cast<const 
LayoutItem_Summary>(parent);
 
   //A Summary may only have FieldSummary children:
-  if(summary && !child_fieldsummary)
+  if(summary && !(bool)child_fieldsummary)
       return false;
 
   //FieldSummary may only be a member of Summary:
@@ -153,12 +153,12 @@ bool TreeStore_ReportLayout::may_be_child_of(const sharedptr<const LayoutItem>&
     return false;
 
 
-  const bool header = sharedptr<const LayoutItem_Header>::cast_dynamic(parent);
+  const bool header = (bool)std::dynamic_pointer_cast<const LayoutItem_Header>(parent);
 
-  const bool footer = sharedptr<const LayoutItem_Footer>::cast_dynamic(parent);
+  const bool footer = (bool)std::dynamic_pointer_cast<const LayoutItem_Footer>(parent);
 
-  const bool child_groupby = sharedptr<const LayoutItem_GroupBy>::cast_dynamic(suggested_child);
-  const bool child_summary = sharedptr<const LayoutItem_Summary>::cast_dynamic(suggested_child);
+  const bool child_groupby = (bool)std::dynamic_pointer_cast<const LayoutItem_GroupBy>(suggested_child);
+  const bool child_summary = (bool)std::dynamic_pointer_cast<const LayoutItem_Summary>(suggested_child);
 
   if((header || footer) && (child_summary || child_groupby))
     return false; //Nothing that needs data can be in a Header or Footer. A field is allowed because it 
could show constans from System Preferences.
diff --git a/glom/mode_design/report_layout/treestore_report_layout.h 
b/glom/mode_design/report_layout/treestore_report_layout.h
index c5c99ef..26fe28a 100644
--- a/glom/mode_design/report_layout/treestore_report_layout.h
+++ b/glom/mode_design/report_layout/treestore_report_layout.h
@@ -42,7 +42,7 @@ public:
     ModelColumns()
     { add(m_col_item); add(m_col_sequence); }
 
-    Gtk::TreeModelColumn< sharedptr<LayoutItem> > m_col_item;
+    Gtk::TreeModelColumn< std::shared_ptr<LayoutItem> > m_col_item;
     Gtk::TreeModelColumn<guint> m_col_sequence;
   };
 
@@ -53,7 +53,7 @@ public:
   void fill_sequences();
   void fill_sequences(const iterator& iter);
 
-  static bool may_be_child_of(const sharedptr<const LayoutItem>& parent, const sharedptr<const LayoutItem>& 
suggested_child);
+  static bool may_be_child_of(const std::shared_ptr<const LayoutItem>& parent, const std::shared_ptr<const 
LayoutItem>& suggested_child);
 
 private:
   //Overridden virtual functions:
diff --git a/glom/mode_design/translation/window_translations.cc 
b/glom/mode_design/translation/window_translations.cc
index f1e5bad..7c50917 100644
--- a/glom/mode_design/translation/window_translations.cc
+++ b/glom/mode_design/translation/window_translations.cc
@@ -168,7 +168,7 @@ void Window_Translations::on_cell_data_original(Gtk::CellRenderer* renderer, con
       Gtk::TreeModel::Row row = *iter;
 
       Glib::ustring text;
-      sharedptr<TranslatableItem> item = row[m_columns.m_col_item];
+      std::shared_ptr<TranslatableItem> item = row[m_columns.m_col_item];
       if(item)
         text = item->get_title_original();
 
@@ -196,7 +196,7 @@ void Window_Translations::on_cell_data_item_itemhint(Gtk::CellRenderer* renderer
   Gtk::TreeModel::Row row = *iter;
 
   Glib::ustring item_type_name;
-  sharedptr<TranslatableItem> item = row[m_columns.m_col_item];
+  std::shared_ptr<TranslatableItem> item = row[m_columns.m_col_item];
   const Glib::ustring hint = row[m_columns.m_col_hint];
 
   renderer_text->property_text() = get_po_context_for_item(item, hint);
@@ -220,7 +220,7 @@ void Window_Translations::load_from_document()
   Document::type_list_translatables list_layout_items = document->get_translatable_items();
   for(Document::type_list_translatables::iterator iter = list_layout_items.begin(); iter != 
list_layout_items.end(); ++iter)
   {
-    sharedptr<TranslatableItem> item = iter->first;
+    std::shared_ptr<TranslatableItem> item = iter->first;
     if(!item)
       continue;
 
@@ -248,8 +248,8 @@ void Window_Translations::save_to_document()
   {
     Gtk::TreeModel::Row row = *iter;
 
-    //We have stored a sharedptr to the original item, so we can just change it directly:
-    sharedptr<TranslatableItem> item = row[m_columns.m_col_item];
+    //We have stored a std::shared_ptr to the original item, so we can just change it directly:
+    std::shared_ptr<TranslatableItem> item = row[m_columns.m_col_item];
     if(item)
     {
       const Glib::ustring translation = row[m_columns.m_col_translation];
@@ -295,7 +295,7 @@ void Window_Translations::on_button_copy_translation()
       {
         Gtk::TreeModel::Row row = *iter;
 
-        sharedptr<TranslatableItem> item = row[m_columns.m_col_item];
+        std::shared_ptr<TranslatableItem> item = row[m_columns.m_col_item];
         if(item)
         {
           //Copy the translation from the chosen locale to the current locale:
diff --git a/glom/mode_design/translation/window_translations.h 
b/glom/mode_design/translation/window_translations.h
index 410b7e1..6b801b3 100644
--- a/glom/mode_design/translation/window_translations.h
+++ b/glom/mode_design/translation/window_translations.h
@@ -76,7 +76,7 @@ private:
     ModelColumns()
     { add(m_col_item); add(m_col_translation); add(m_col_hint); }
 
-    Gtk::TreeModelColumn< sharedptr<TranslatableItem> > m_col_item; //The table name, field name, etc.
+    Gtk::TreeModelColumn< std::shared_ptr<TranslatableItem> > m_col_item; //The table name, field name, etc.
     Gtk::TreeModelColumn<Glib::ustring> m_col_translation;
     Gtk::TreeModelColumn<Glib::ustring> m_col_hint;
   };
diff --git a/glom/mode_design/users/dialog_groups_list.cc b/glom/mode_design/users/dialog_groups_list.cc
index fe318bb..027a9c8 100644
--- a/glom/mode_design/users/dialog_groups_list.cc
+++ b/glom/mode_design/users/dialog_groups_list.cc
@@ -161,7 +161,7 @@ void Dialog_GroupsList::set_document(const Glib::ustring& layout, Document* docu
 
     for(Document::type_list_layout_groups::const_iterator iter = mapGroups.begin(); iter != mapGroups.end(); 
++iter)
     {
-      sharedptr<const LayoutGroup> group = iter->second;
+      std::shared_ptr<const LayoutGroup> group = iter->second;
 
       add_group(Gtk::TreeModel::iterator(), group);
     }
diff --git a/glom/mode_find/box_data_details_find.cc b/glom/mode_find/box_data_details_find.cc
index 71bfc2e..bc54709 100644
--- a/glom/mode_find/box_data_details_find.cc
+++ b/glom/mode_find/box_data_details_find.cc
@@ -110,7 +110,7 @@ void Box_Data_Details_Find::fill_related()
 }
 
 
-void Box_Data_Details_Find::on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& /* id */, 
const Gnome::Gda::Value& /* value */)
+void Box_Data_Details_Find::on_flowtable_field_edited(const std::shared_ptr<const LayoutItem_Field>& /* id 
*/, const Gnome::Gda::Value& /* value */)
 {
   //Don't do anything.
   //This just blocks the method in the base class.
diff --git a/glom/mode_find/box_data_details_find.h b/glom/mode_find/box_data_details_find.h
index 628251b..8bb7253 100644
--- a/glom/mode_find/box_data_details_find.h
+++ b/glom/mode_find/box_data_details_find.h
@@ -41,7 +41,7 @@ private:
   virtual bool fill_from_database(); //override.
   virtual void fill_related(); //override.
 
-  virtual void on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& id, const 
Gnome::Gda::Value& value);
+  virtual void on_flowtable_field_edited(const std::shared_ptr<const LayoutItem_Field>& id, const 
Gnome::Gda::Value& value);
 
 };
 
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 7d715b1..0a6426e 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -71,7 +71,7 @@ Box_Tables::~Box_Tables()
 {
 }
 
-void Box_Tables::fill_table_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const TableInfo>& 
table_info)
+void Box_Tables::fill_table_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const 
TableInfo>& table_info)
 {
   if(!table_info)
   {
@@ -154,7 +154,7 @@ bool Box_Tables::fill_from_database()
     std::cerr << G_STRFUNC << ": document is null" << std::endl;
 
   //Get the list of tables in the database, from the server:
-  sharedptr<SharedConnection> sharedconnection = connect_to_server(AppWindow::get_appwindow());
+  std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(AppWindow::get_appwindow());
 
   if(sharedconnection)
   {
@@ -167,7 +167,7 @@ bool Box_Tables::fill_from_database()
     {
       const Glib::ustring strName = *iter;
 
-      sharedptr<TableInfo> table_info;
+      std::shared_ptr<TableInfo> table_info;
 
       //Check whether it should be hidden:
       Document::type_listTableInfo::const_iterator iterFind = std::find_if(listTablesDocument.begin(), 
listTablesDocument.end(), predicate_FieldHasName<TableInfo>(strName));
@@ -181,7 +181,7 @@ bool Box_Tables::fill_from_database()
       {
         //This table is in the database, but not in the document.
         //Show it as hidden:
-        table_info = sharedptr<TableInfo>(new TableInfo());
+        table_info = std::shared_ptr<TableInfo>(new TableInfo());
         table_info->set_name(strName);
         table_info->set_hidden(true);
       }
@@ -258,7 +258,7 @@ void Box_Tables::on_adddel_Add(const Gtk::TreeModel::iterator& row)
     Document* document = get_document();
     if(document)
     {
-      sharedptr<TableInfo> table_info = document->get_table(table_name);
+      std::shared_ptr<TableInfo> table_info = document->get_table(table_name);
       fill_table_row(row, table_info);
 
       //Save the field information directly into the database, because we cannot get all the correct 
information from the database.
@@ -329,7 +329,7 @@ void Box_Tables::on_adddel_Delete(const Gtk::TreeModel::iterator& rowStart, cons
             //Otherwise it would not start at 0 if a table with the same name, and same field, is added 
again later.
             for(Glom::Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); 
++iter)
             {
-              const Glom::sharedptr<const Glom::Field> field = *iter;
+              const std::shared_ptr<const Glom::Field> field = *iter;
               if(!field || !field->get_auto_increment())
                 continue;
                 
@@ -470,7 +470,7 @@ void Box_Tables::save_to_document()
     for(Gtk::TreeModel::iterator iter = m_AddDel.get_model()->children().begin(); iter != 
m_AddDel.get_model()->children().end(); ++iter)
     {
       const Glib::ustring table_name = m_AddDel.get_value(iter, m_colTableName); //The name has already been 
changed in the document.
-      sharedptr<TableInfo> table_info = document->get_table(table_name); //Start with the existing 
table_info, to preserve extra information, such as translations.
+      std::shared_ptr<TableInfo> table_info = document->get_table(table_name); //Start with the existing 
table_info, to preserve extra information, such as translations.
       if(table_info)
       {
         table_info->set_name( m_AddDel.get_value(iter, m_colTableName) );
diff --git a/glom/navigation/box_tables.h b/glom/navigation/box_tables.h
index 76ad74b..93b798c 100644
--- a/glom/navigation/box_tables.h
+++ b/glom/navigation/box_tables.h
@@ -48,7 +48,7 @@ public:
 private:
   bool fill_from_database(); //override
 
-  void fill_table_row(const Gtk::TreeModel::iterator& iter, const sharedptr<const TableInfo>& table_info);
+  void fill_table_row(const Gtk::TreeModel::iterator& iter, const std::shared_ptr<const TableInfo>& 
table_info);
 
   //Signal handlers:
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/print_layout/canvas_layout_item.cc b/glom/print_layout/canvas_layout_item.cc
index 4c9e381..19c9848 100644
--- a/glom/print_layout/canvas_layout_item.cc
+++ b/glom/print_layout/canvas_layout_item.cc
@@ -58,12 +58,12 @@ Glib::RefPtr<CanvasLayoutItem> CanvasLayoutItem::create()
   return Glib::RefPtr<CanvasLayoutItem>(new CanvasLayoutItem());
 }
 
-sharedptr<LayoutItem> CanvasLayoutItem::get_layout_item()
+std::shared_ptr<LayoutItem> CanvasLayoutItem::get_layout_item()
 {
   return m_layout_item;
 }
 
-void CanvasLayoutItem::apply_formatting(const Glib::RefPtr<CanvasTextMovable>& canvas_item, const 
sharedptr<const LayoutItem_WithFormatting>& layout_item)
+void CanvasLayoutItem::apply_formatting(const Glib::RefPtr<CanvasTextMovable>& canvas_item, const 
std::shared_ptr<const LayoutItem_WithFormatting>& layout_item)
 {
   if(!canvas_item)
     return;
@@ -113,7 +113,7 @@ void CanvasLayoutItem::on_resized()
     canvas_image->scale_to_size();
 }
 
-void CanvasLayoutItem::set_layout_item(const sharedptr<LayoutItem>& layout_item)
+void CanvasLayoutItem::set_layout_item(const std::shared_ptr<LayoutItem>& layout_item)
 {
   //TODO: If we can ever avoid this the also update the CanvasLayoutItem class documentation.
   if(!get_canvas())
@@ -158,7 +158,7 @@ void CanvasLayoutItem::set_layout_item(const sharedptr<LayoutItem>& layout_item)
 }
 
 //TODO: Remove this?
-int CanvasLayoutItem::get_rows_count_for_portal(const sharedptr<const LayoutItem_Portal>& portal, double& 
row_height)
+int CanvasLayoutItem::get_rows_count_for_portal(const std::shared_ptr<const LayoutItem_Portal>& portal, 
double& row_height)
 {
   if(!portal)
   {
@@ -182,11 +182,11 @@ int CanvasLayoutItem::get_rows_count_for_portal(const sharedptr<const LayoutItem
   return max_rows;
 }
 
-Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_item(const 
sharedptr<LayoutItem>& layout_item)
+Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_item(const 
std::shared_ptr<LayoutItem>& layout_item)
 {
   Glib::RefPtr<CanvasItemMovable> child;
   Glib::RefPtr<Goocanvas::Item> child_item;
-  sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem_Text> text = std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
   if(text)
   {
     Glib::RefPtr<CanvasTextMovable> canvas_item = CanvasTextMovable::create();
@@ -200,7 +200,7 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
   }
   else
   {
-    sharedptr<LayoutItem_Image> image = sharedptr<LayoutItem_Image>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Image> image = std::dynamic_pointer_cast<LayoutItem_Image>(layout_item);
     if(image)
     {
       Glib::RefPtr<CanvasImageMovable> canvas_item = CanvasImageMovable::create();
@@ -218,7 +218,7 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
     }
     else
     {
-      sharedptr<LayoutItem_Line> line = sharedptr<LayoutItem_Line>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Line> line = std::dynamic_pointer_cast<LayoutItem_Line>(layout_item);
       if(line)
       {
         double start_x = 0;
@@ -240,7 +240,7 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
       }
       else
       {
-        sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
         if(field)
         {
           //Create an appropriate canvas item for the field type:
@@ -270,7 +270,7 @@ Glib::RefPtr<CanvasItemMovable> CanvasLayoutItem::create_canvas_item_for_layout_
         }
         else
         {
-          sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+          std::shared_ptr<LayoutItem_Portal> portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
           if(portal)
           {
             Glib::RefPtr<CanvasTableMovable> canvas_item = CanvasTableMovable::create();
@@ -343,8 +343,8 @@ void CanvasLayoutItem::add_portal_rows_if_necessary(guint rows_count)
   if(!canvas_table)
     return;
 
-  sharedptr<LayoutItem_Portal> portal = 
-    sharedptr<LayoutItem_Portal>::cast_dynamic(get_layout_item());
+  std::shared_ptr<LayoutItem_Portal> portal = 
+    std::dynamic_pointer_cast<LayoutItem_Portal>(get_layout_item());
   if(!portal)
   {
     std::cerr << G_STRFUNC << ": The layout item was not a portal." << std::endl;
@@ -354,7 +354,7 @@ void CanvasLayoutItem::add_portal_rows_if_necessary(guint rows_count)
   add_portal_rows_if_necessary(canvas_table, portal, rows_count);
 }
 
-void CanvasLayoutItem::add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTableMovable>& canvas_table, 
const sharedptr<LayoutItem_Portal>& portal, guint rows_count)
+void CanvasLayoutItem::add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTableMovable>& canvas_table, 
const std::shared_ptr<LayoutItem_Portal>& portal, guint rows_count)
 {
   const double row_height = portal->get_print_layout_row_height();
   const LayoutGroup::type_list_items child_items = portal->get_items();
@@ -367,7 +367,7 @@ void CanvasLayoutItem::add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTab
     for(LayoutGroup::type_list_items::const_iterator iter = child_items.begin(); iter != child_items.end(); 
++iter)
     {
       //std::cout << "  row=" << row << ", col=" << col << std::endl;
-      sharedptr<LayoutItem> layout_item = *iter;
+      std::shared_ptr<LayoutItem> layout_item = *iter;
 
       //Check if a child already exists:
       Glib::RefPtr<Goocanvas::Item> existing_child = 
@@ -444,7 +444,7 @@ void CanvasLayoutItem::add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTab
 
 void CanvasLayoutItem::set_db_data(const Gnome::Gda::Value& value)
 {
-  sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(m_layout_item);
+  std::shared_ptr<LayoutItem_Field> field = std::dynamic_pointer_cast<LayoutItem_Field>(m_layout_item);
   if(!field)
     return;
 
@@ -468,7 +468,7 @@ void CanvasLayoutItem::set_db_data(const Gnome::Gda::Value& value)
       Glib::ustring text_value = Conversions::get_text_for_gda_value(field_type, value, 
field->get_formatting_used().m_numeric_format);
 
       //The Postgres summary functions return NULL when summarising NULL records, but 0 is more sensible:
-      if(text_value.empty() && sharedptr<const LayoutItem_FieldSummary>::cast_dynamic(field) && (field_type 
== Field::TYPE_NUMERIC))
+      if(text_value.empty() && std::dynamic_pointer_cast<const LayoutItem_FieldSummary>(field) && 
(field_type == Field::TYPE_NUMERIC))
       {
         //Use get_text_for_gda_value() instead of "0" so we get the correct numerical formatting:
         const Gnome::Gda::Value value = Conversions::parse_value(0);
@@ -521,7 +521,7 @@ void CanvasLayoutItem::remove_empty_indicators()
 
 void CanvasLayoutItem::update_layout_position_from_canvas()
 {
-  sharedptr<LayoutItem> layout_item = get_layout_item();
+  std::shared_ptr<LayoutItem> layout_item = get_layout_item();
   if(!layout_item)
     return;
 
diff --git a/glom/print_layout/canvas_layout_item.h b/glom/print_layout/canvas_layout_item.h
index 2a4434a..005e70c 100644
--- a/glom/print_layout/canvas_layout_item.h
+++ b/glom/print_layout/canvas_layout_item.h
@@ -54,13 +54,13 @@ public:
 
   //Creates a new canvas item, with an appropriate child canvas item,
   //and sets the position and size of this canvas item to the position in the LayoutItem.
-  static Glib::RefPtr<CanvasLayoutItem> create(const sharedptr<LayoutItem>& layout_item);
+  static Glib::RefPtr<CanvasLayoutItem> create(const std::shared_ptr<LayoutItem>& layout_item);
 
-  sharedptr<LayoutItem> get_layout_item();
+  std::shared_ptr<LayoutItem> get_layout_item();
 
   //Create an appropriate child canvas item,
   //and sets the position and size of this canvas item to the position in the LayoutItem.
-  void set_layout_item(const sharedptr<LayoutItem>& layout_item);
+  void set_layout_item(const std::shared_ptr<LayoutItem>& layout_item);
   
   /// Make the canvas item show actual data instead of, for instance, a field name.
   void set_db_data(const Gnome::Gda::Value& value);
@@ -68,7 +68,7 @@ public:
   /// Hide the missing-image pixbuf from images, for instance.
   void remove_empty_indicators();
 
-  static int get_rows_count_for_portal(const sharedptr<const LayoutItem_Portal>& portal, double& row_height);
+  static int get_rows_count_for_portal(const std::shared_ptr<const LayoutItem_Portal>& portal, double& 
row_height);
 
   /** Make sure that the LayoutItem has the same position info as the CanvasItem that represents it.
    */
@@ -83,15 +83,15 @@ public:
 
 private:
   /// Create the appropriate inner canvas item to represent the layout item.
-  static Glib::RefPtr<CanvasItemMovable> create_canvas_item_for_layout_item(const sharedptr<LayoutItem>& 
layout_item);
+  static Glib::RefPtr<CanvasItemMovable> create_canvas_item_for_layout_item(const 
std::shared_ptr<LayoutItem>& layout_item);
 
-  static void apply_formatting(const Glib::RefPtr<CanvasTextMovable>& canvas_item, const sharedptr<const 
LayoutItem_WithFormatting>& layout_item);
+  static void apply_formatting(const Glib::RefPtr<CanvasTextMovable>& canvas_item, const 
std::shared_ptr<const LayoutItem_WithFormatting>& layout_item);
   
-  static void add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTableMovable>& canvas_table, const 
sharedptr<LayoutItem_Portal>& portal, guint rows_count);
+  static void add_portal_rows_if_necessary(const Glib::RefPtr<CanvasTableMovable>& canvas_table, const 
std::shared_ptr<LayoutItem_Portal>& portal, guint rows_count);
 
   void on_resized();
 
-  sharedptr<LayoutItem> m_layout_item;
+  std::shared_ptr<LayoutItem> m_layout_item;
 };
 
 } //namespace Glom
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 5383c58..426bd8a 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -70,7 +70,7 @@ Canvas_PrintLayout::~Canvas_PrintLayout()
 {
 }
 
-void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& 
print_layout)
+void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const 
std::shared_ptr<PrintLayout>& print_layout)
 {
   m_table_name = table_name;
   m_modified = false;
@@ -118,9 +118,9 @@ void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const
   m_modified = false;
 }
 
-sharedptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
+std::shared_ptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
 {
-  sharedptr<PrintLayout> result = sharedptr<PrintLayout>::create();
+  std::shared_ptr<PrintLayout> result = std::shared_ptr<PrintLayout>(new PrintLayout());
   fill_layout_group(result->get_layout_group());
 
   //Page Setup:
@@ -142,7 +142,7 @@ sharedptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
 }
 
 /*
-Glib::RefPtr<CanvasLayoutItem> Canvas_PrintLayout::create_canvas_item(const sharedptr<LayoutItem>& item)
+Glib::RefPtr<CanvasLayoutItem> Canvas_PrintLayout::create_canvas_item(const std::shared_ptr<LayoutItem>& 
item)
 {
   Glib::RefPtr<CanvasLayoutItem> result = CanvasLayoutItem::create();
   //TODO: Add to the canvas.
@@ -153,15 +153,15 @@ Glib::RefPtr<CanvasLayoutItem> Canvas_PrintLayout::create_canvas_item(const shar
 */
 
 
-void Canvas_PrintLayout::add_layout_group_children(const sharedptr<LayoutGroup>& group)
+void Canvas_PrintLayout::add_layout_group_children(const std::shared_ptr<LayoutGroup>& group)
 {
   //TODO: Add them inside the group item (when we actually use this code):
   for(LayoutGroup::type_list_items::const_iterator iter = group->m_list_items.begin(); iter != 
group->m_list_items.end(); ++iter)
   {
-    sharedptr<LayoutItem> item = *iter;
+    std::shared_ptr<LayoutItem> item = *iter;
 
-    sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(item);
-    sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(item);
+    std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(item);
+    std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(item);
     if(group && !portal)
     {
       add_layout_group(group);
@@ -176,7 +176,7 @@ void Canvas_PrintLayout::add_layout_group_children(const sharedptr<LayoutGroup>&
   m_modified = true;
 }
 
-void Canvas_PrintLayout::create_canvas_layout_item_and_add(const sharedptr<LayoutItem>& layout_item)
+void Canvas_PrintLayout::create_canvas_layout_item_and_add(const std::shared_ptr<LayoutItem>& layout_item)
 {
   Glib::RefPtr<CanvasLayoutItem> canvas_item = CanvasLayoutItem::create();
   add_canvas_layout_item(canvas_item);
@@ -216,9 +216,9 @@ void Canvas_PrintLayout::remove_canvas_layout_item(const Glib::RefPtr<CanvasLayo
   CanvasEditable::remove_item(item, m_items_group);
 }
 
-void Canvas_PrintLayout::add_layout_group(const sharedptr<LayoutGroup>& group, bool is_top_level)
+void Canvas_PrintLayout::add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool is_top_level)
 {
-  //row[model_parts->m_columns.m_col_item] = sharedptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
+  //row[model_parts->m_columns.m_col_item] = 
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
 
   //Add the group item:
   if(!is_top_level)
@@ -233,7 +233,7 @@ void Canvas_PrintLayout::add_layout_group(const sharedptr<LayoutGroup>& group, b
 }
 
 
-void Canvas_PrintLayout::fill_layout_group(const sharedptr<LayoutGroup>& group)
+void Canvas_PrintLayout::fill_layout_group(const std::shared_ptr<LayoutGroup>& group)
 {
   const int count = m_items_group->get_n_children();
   for(int i = 0; i < count; ++i)
@@ -326,9 +326,9 @@ void Canvas_PrintLayout::on_item_show_context_menu(guint button, guint32 activat
   m_context_item = item;
   
   //Do not enable the Formatting menu item for all types of items:
-  sharedptr<LayoutItem> layout_item = m_context_item->get_layout_item();
+  std::shared_ptr<LayoutItem> layout_item = m_context_item->get_layout_item();
   bool enable_formatting = false;
-  if(sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item))
+  if(std::dynamic_pointer_cast<LayoutItem_WithFormatting>(layout_item))
   {
     enable_formatting = true;
   }
@@ -345,9 +345,9 @@ bool Canvas_PrintLayout::on_background_button_press_event(const Glib::RefPtr<Goo
   return false;
 }
 
-sharedptr<LayoutItem_Portal> Canvas_PrintLayout::offer_related_records(const sharedptr<LayoutItem_Portal>& 
portal, Gtk::Window* parent)
+std::shared_ptr<LayoutItem_Portal> Canvas_PrintLayout::offer_related_records(const 
std::shared_ptr<LayoutItem_Portal>& portal, Gtk::Window* parent)
 {
-  sharedptr<LayoutItem_Portal> result = portal;
+  std::shared_ptr<LayoutItem_Portal> result = portal;
 
   Dialog_Layout_List_Related* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -373,9 +373,9 @@ sharedptr<LayoutItem_Portal> Canvas_PrintLayout::offer_related_records(const sha
   return result;
 }
 
-sharedptr<LayoutItem_Line> Canvas_PrintLayout::offer_line(const sharedptr<LayoutItem_Line>& line, 
Gtk::Window* parent)
+std::shared_ptr<LayoutItem_Line> Canvas_PrintLayout::offer_line(const std::shared_ptr<LayoutItem_Line>& 
line, Gtk::Window* parent)
 {
-  sharedptr<LayoutItem_Line> result = line;
+  std::shared_ptr<LayoutItem_Line> result = line;
 
   Dialog_Line* dialog = 0;
   Utils::get_glade_widget_derived_with_warning(dialog);
@@ -406,12 +406,12 @@ void Canvas_PrintLayout::on_context_menu_edit()
 
   m_context_item->update_layout_position_from_canvas();
 
-  sharedptr<LayoutItem> layout_item = m_context_item->get_layout_item();
-  sharedptr<LayoutItem_Field> field = 
-    sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem> layout_item = m_context_item->get_layout_item();
+  std::shared_ptr<LayoutItem_Field> field = 
+    std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
   if(field)
   {
-    sharedptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, m_table_name, 
parent);
+    std::shared_ptr<LayoutItem_Field> field_chosen = offer_field_list_select_one_field(field, m_table_name, 
parent);
     if(field_chosen)
     {
       //Never use the default formatting for print layouts:
@@ -423,7 +423,7 @@ void Canvas_PrintLayout::on_context_menu_edit()
   }
   else
   {
-    sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Text> text = std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
     if(text)
     {
       text = Base_DB::offer_textobject(text, parent, false /* don't show title */);
@@ -431,7 +431,7 @@ void Canvas_PrintLayout::on_context_menu_edit()
     }
     else
     {
-      sharedptr<LayoutItem_Image> image = sharedptr<LayoutItem_Image>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Image> image = std::dynamic_pointer_cast<LayoutItem_Image>(layout_item);
       if(image)
       {
         image = Base_DB::offer_imageobject(image, parent, false /* don't show title */);
@@ -439,7 +439,7 @@ void Canvas_PrintLayout::on_context_menu_edit()
       }
       else
       {
-        sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+        std::shared_ptr<LayoutItem_Portal> portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
         if(portal)
         {
           portal = offer_related_records(portal, parent);
@@ -447,7 +447,7 @@ void Canvas_PrintLayout::on_context_menu_edit()
         }
         else
         {
-         sharedptr<LayoutItem_Line> line = sharedptr<LayoutItem_Line>::cast_dynamic(layout_item);
+         std::shared_ptr<LayoutItem_Line> line = std::dynamic_pointer_cast<LayoutItem_Line>(layout_item);
          if(line)
          {
            line = offer_line(line, parent);
@@ -470,9 +470,9 @@ void Canvas_PrintLayout::on_context_menu_formatting()
 
   m_context_item->update_layout_position_from_canvas();
 
-  sharedptr<LayoutItem> layout_item = m_context_item->get_layout_item();
-  sharedptr<LayoutItem_Field> layout_item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
-  sharedptr<LayoutItem_Text> layout_item_text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem> layout_item = m_context_item->get_layout_item();
+  std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
+  std::shared_ptr<LayoutItem_Text> layout_item_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
   if(!layout_item_field && !layout_item_text)
     return;
 
@@ -546,9 +546,9 @@ void Canvas_PrintLayout::on_dialog_format_hide()
   if(!m_dialog_format || !m_context_item)
     return;
 
-  sharedptr<LayoutItem> layout_item = m_context_item->get_layout_item();
-  sharedptr<LayoutItem_Field> layout_item_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
-  sharedptr<LayoutItem_Text> layout_item_text = sharedptr<LayoutItem_Text>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem> layout_item = m_context_item->get_layout_item();
+  std::shared_ptr<LayoutItem_Field> layout_item_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
+  std::shared_ptr<LayoutItem_Text> layout_item_text = 
std::dynamic_pointer_cast<LayoutItem_Text>(layout_item);
   if(!layout_item_field && !layout_item_text)
     return;
 
@@ -730,16 +730,15 @@ void Canvas_PrintLayout::fill_with_data(const FoundSet& found_set, bool avoid_pa
 
 void Canvas_PrintLayout::fill_with_data_system_preferences(const Glib::RefPtr<CanvasLayoutItem>& 
canvas_item, Document* document)
 {
-  sharedptr<LayoutItem_Field> layoutitem_field = 
-    sharedptr<LayoutItem_Field>::cast_dynamic(
-      canvas_item->get_layout_item());
+  std::shared_ptr<LayoutItem_Field> layoutitem_field = 
+    std::dynamic_pointer_cast<LayoutItem_Field>(canvas_item->get_layout_item());
   if(!layoutitem_field)
     return;
   
   bool empty = true;
   if(!layoutitem_field->get_name().empty())
   {
-    const sharedptr<const Relationship> relationship = 
+    const std::shared_ptr<const Relationship> relationship = 
       layoutitem_field->get_relationship();
 
     if(!document)
@@ -774,7 +773,7 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
   typedef std::map<Glib::ustring, guint> type_map_layout_fields_index;
   type_map_layout_fields_index map_fields_index;
 
-  typedef std::list< sharedptr<LayoutItem_Portal> > type_list_portals;
+  typedef std::list< std::shared_ptr<LayoutItem_Portal> > type_list_portals;
   type_list_portals list_portals;
 
   //Get list of fields to get from the database.
@@ -788,11 +787,11 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
     if(!canvas_item)
       continue;
 
-    sharedptr<LayoutItem> layout_item = canvas_item->get_layout_item();
+    std::shared_ptr<LayoutItem> layout_item = canvas_item->get_layout_item();
     if(!layout_item)
       continue;
 
-    sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Field> layoutitem_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
     if(layoutitem_field && !(layoutitem_field->get_name().empty()))
     {
       fieldsToGet.push_back(layoutitem_field);
@@ -804,15 +803,15 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
     }
     else
     {
-      sharedptr<LayoutItem_Portal> layoutitem_portal = 
sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+      std::shared_ptr<LayoutItem_Portal> layoutitem_portal = 
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
       if(layoutitem_portal)
       {
         //Fill the related records table:
-        sharedptr<const Relationship> relationship = layoutitem_portal->get_relationship();
+        std::shared_ptr<const Relationship> relationship = layoutitem_portal->get_relationship();
         if(relationship)
         {
           const Document* document = get_document();
-          const sharedptr<Field> from_field = DbUtils::get_fields_for_table_one_field(document,
+          const std::shared_ptr<Field> from_field = DbUtils::get_fields_for_table_one_field(document,
             relationship->get_from_table(), relationship->get_from_field());
           const Gnome::Gda::Value from_key_value = get_field_value_in_database(from_field, found_set, 0 /* 
TODO: window */);
           fill_with_data_portal(canvas_item, from_key_value);
@@ -826,7 +825,7 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
 
   const Glib::RefPtr<const Gnome::Gda::SqlBuilder> sql_query = 
Utils::build_sql_select_with_where_clause(found_set.m_table_name,
     fieldsToGet,
-    found_set.m_where_clause, sharedptr<const Relationship>() /* extra_join */, found_set.m_sort_clause,
+    found_set.m_where_clause, std::shared_ptr<const Relationship>() /* extra_join */, 
found_set.m_sort_clause,
     1);
 
   bool records_found = false;
@@ -863,11 +862,11 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
     if(!canvas_item)
       continue;
 
-    sharedptr<LayoutItem> layout_item = canvas_item->get_layout_item();
+    std::shared_ptr<LayoutItem> layout_item = canvas_item->get_layout_item();
     if(!layout_item)
       continue;
 
-    sharedptr<LayoutItem_Field> layoutitem_field = sharedptr<LayoutItem_Field>::cast_dynamic(layout_item);
+    std::shared_ptr<LayoutItem_Field> layoutitem_field = 
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
     if(layoutitem_field)
     {
       type_map_layout_fields_index::const_iterator iterFind = map_fields_index.find( 
layoutitem_field->get_layout_display_name() );
@@ -914,8 +913,8 @@ void Canvas_PrintLayout::fill_with_data_portal(const Glib::RefPtr<CanvasLayoutIt
   if(!canvas_item)
     return;
 
-  sharedptr<LayoutItem> layout_item = canvas_item->get_layout_item();
-  sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(layout_item);
+  std::shared_ptr<LayoutItem> layout_item = canvas_item->get_layout_item();
+  std::shared_ptr<LayoutItem_Portal> portal = std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
   if(!portal)
     return;
 
@@ -997,8 +996,8 @@ void Canvas_PrintLayout::fill_with_data_portal(const Glib::RefPtr<CanvasLayoutIt
       if(iter_child_layout_items == child_layout_items.end())
         continue;
 
-      sharedptr<LayoutItem> child_layout_item = *iter_child_layout_items;
-      sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(child_layout_item);
+      std::shared_ptr<LayoutItem> child_layout_item = *iter_child_layout_items;
+      std::shared_ptr<LayoutItem_Field> field = 
std::dynamic_pointer_cast<LayoutItem_Field>(child_layout_item);
       if(field)
       {
         Gnome::Gda::Value db_value; //This default also wipes the placeholder field name text of empty rows.
@@ -1017,7 +1016,7 @@ void Canvas_PrintLayout::fill_with_data_portal(const Glib::RefPtr<CanvasLayoutIt
   }
 }
 
-void Canvas_PrintLayout::set_canvas_item_field_value(const Glib::RefPtr<Goocanvas::Item>& canvas_item, const 
sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
+void Canvas_PrintLayout::set_canvas_item_field_value(const Glib::RefPtr<Goocanvas::Item>& canvas_item, const 
std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value)
 {
   if(!field)
     return;
@@ -1043,8 +1042,8 @@ void Canvas_PrintLayout::set_canvas_item_field_value(const Glib::RefPtr<Goocanva
 
     Glib::ustring text;
 
-    sharedptr<const LayoutItem_WithFormatting> with_formatting = 
-      sharedptr<const LayoutItem_WithFormatting>::cast_dynamic(field);
+    std::shared_ptr<const LayoutItem_WithFormatting> with_formatting = 
+      std::dynamic_pointer_cast<const LayoutItem_WithFormatting>(field);
     if(with_formatting)
     {
       const Formatting& formatting = with_formatting->get_formatting_used();
@@ -1091,7 +1090,7 @@ void Canvas_PrintLayout::set_grid_gap(double gap)
     m_bounds_group->lower();
 }
 
-Base_DB::type_vecConstLayoutFields Canvas_PrintLayout::get_portal_fields_to_show(const 
sharedptr<LayoutItem_Portal>& portal)
+Base_DB::type_vecConstLayoutFields Canvas_PrintLayout::get_portal_fields_to_show(const 
std::shared_ptr<LayoutItem_Portal>& portal)
 {
   const Document* document = get_document();
   if(!document)
@@ -1102,7 +1101,7 @@ Base_DB::type_vecConstLayoutFields Canvas_PrintLayout::get_portal_fields_to_show
     Document::type_list_layout_groups mapGroups;
     mapGroups.push_back(portal);
 
-    sharedptr<const Relationship> relationship = portal->get_relationship();
+    std::shared_ptr<const Relationship> relationship = portal->get_relationship();
     if(relationship)
     {
       type_vecConstLayoutFields result = 
get_table_fields_to_show_for_sequence(portal->get_table_used(Glib::ustring() /* not relevant */), mapGroups);
@@ -1113,7 +1112,7 @@ Base_DB::type_vecConstLayoutFields Canvas_PrintLayout::get_portal_fields_to_show
       {
         for(type_vecConstLayoutFields::iterator iter = result.begin(); iter != result.end(); ++iter)
         {
-          sharedptr<const LayoutItem_Field> item = *iter;
+          std::shared_ptr<const LayoutItem_Field> item = *iter;
           if(item)
             item->set_editable(false);
         }
diff --git a/glom/print_layout/canvas_print_layout.h b/glom/print_layout/canvas_print_layout.h
index 6702109..24af6fd 100644
--- a/glom/print_layout/canvas_print_layout.h
+++ b/glom/print_layout/canvas_print_layout.h
@@ -45,8 +45,8 @@ public:
   Canvas_PrintLayout();
   virtual ~Canvas_PrintLayout();
 
-  void set_print_layout(const Glib::ustring& table_name, const sharedptr<PrintLayout>& print_layout);
-  sharedptr<PrintLayout> get_print_layout();
+  void set_print_layout(const Glib::ustring& table_name, const std::shared_ptr<PrintLayout>& print_layout);
+  std::shared_ptr<PrintLayout> get_print_layout();
 
   void set_page_setup(const Glib::RefPtr<Gtk::PageSetup>& page_setup);
   Glib::RefPtr<Gtk::PageSetup> get_page_setup();
@@ -102,22 +102,22 @@ private:
   void setup_context_menu();
 #endif
 
-  void add_layout_group(const sharedptr<LayoutGroup>& group, bool is_top_level = false);
-  void add_layout_group_children(const sharedptr<LayoutGroup>& group);
-  void fill_layout_group(const sharedptr<LayoutGroup>& group);
+  void add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool is_top_level = false);
+  void add_layout_group_children(const std::shared_ptr<LayoutGroup>& group);
+  void fill_layout_group(const std::shared_ptr<LayoutGroup>& group);
 
   //These are not static, because they need access to the document:
   void fill_with_data(const Glib::RefPtr<Goocanvas::Group>& canvas_group, const FoundSet& found_set, bool 
avoid_page_margins);
   void fill_with_data_portal(const Glib::RefPtr<CanvasLayoutItem>& canvas_item, const Gnome::Gda::Value& 
foreign_key_value);
-  static void set_canvas_item_field_value(const Glib::RefPtr<Goocanvas::Item>& canvas_item, const 
sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
+  static void set_canvas_item_field_value(const Glib::RefPtr<Goocanvas::Item>& canvas_item, const 
std::shared_ptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
   
-  type_vecConstLayoutFields get_portal_fields_to_show(const sharedptr<LayoutItem_Portal>& portal);
+  type_vecConstLayoutFields get_portal_fields_to_show(const std::shared_ptr<LayoutItem_Portal>& portal);
 
-  void create_canvas_layout_item_and_add(const sharedptr<LayoutItem>& layout_item);
+  void create_canvas_layout_item_and_add(const std::shared_ptr<LayoutItem>& layout_item);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-  sharedptr<LayoutItem_Portal> offer_related_records(const sharedptr<LayoutItem_Portal>& portal, 
Gtk::Window* parent);
-  sharedptr<LayoutItem_Line> offer_line(const sharedptr<LayoutItem_Line>& portal, Gtk::Window* parent);
+  std::shared_ptr<LayoutItem_Portal> offer_related_records(const std::shared_ptr<LayoutItem_Portal>& portal, 
Gtk::Window* parent);
+  std::shared_ptr<LayoutItem_Line> offer_line(const std::shared_ptr<LayoutItem_Line>& portal, Gtk::Window* 
parent);
   
   //TODO: Make the signal send the item, so we can pass it by const reference:
   void on_item_show_context_menu(guint button, guint32 activate_time, Glib::RefPtr<CanvasLayoutItem> item);
diff --git a/glom/print_layout/print_layout_utils.cc b/glom/print_layout/print_layout_utils.cc
index a1d1ed3..b08d7b0 100644
--- a/glom/print_layout/print_layout_utils.cc
+++ b/glom/print_layout/print_layout_utils.cc
@@ -152,7 +152,7 @@ bool needs_move_fully_to_page(const Glib::RefPtr<const Gtk::PageSetup>& page_set
 }
 
 /*
-static double move_fully_to_page(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::Unit units, 
const sharedptr<LayoutItem>& item)
+static double move_fully_to_page(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::Unit units, 
const std::shared_ptr<LayoutItem>& item)
 {
   double x = 0;
   double y = 0;
@@ -168,7 +168,7 @@ static double move_fully_to_page(const Glib::RefPtr<const Gtk::PageSetup>& page_
 }
 */
 
-static void create_standard(const sharedptr<const LayoutGroup>& layout_group, const sharedptr<LayoutGroup>& 
print_layout_group, const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::Unit units, double x, double& 
y, bool avoid_page_margins)
+static void create_standard(const std::shared_ptr<const LayoutGroup>& layout_group, const 
std::shared_ptr<LayoutGroup>& print_layout_group, const Glib::RefPtr<const Gtk::PageSetup>& page_setup, 
Gtk::Unit units, double x, double& y, bool avoid_page_margins)
 {
   if(!layout_group || !print_layout_group)
   {
@@ -187,7 +187,7 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
   const Glib::ustring title = item_get_title(layout_group);
   if(!title.empty())
   {
-    sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::create();
+    std::shared_ptr<LayoutItem_Text> text = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
     text->set_text(title, AppWindow::get_current_locale());
     text->m_formatting.set_text_format_font("Sans Bold 10");
 
@@ -201,10 +201,10 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
   }
 
   //Deal with a portal group: 
-  const sharedptr<const LayoutItem_Portal> portal = sharedptr<const 
LayoutItem_Portal>::cast_dynamic(layout_group); 
+  const std::shared_ptr<const LayoutItem_Portal> portal = std::dynamic_pointer_cast<const 
LayoutItem_Portal>(layout_group); 
   if(portal)
   {
-    sharedptr<LayoutItem_Portal> portal_clone = glom_sharedptr_clone(portal);
+    std::shared_ptr<LayoutItem_Portal> portal_clone = glom_sharedptr_clone(portal);
     portal_clone->set_print_layout_row_height(field_height); //Otherwise it will be 0, which is useless.
 
     //We ignore the rows count for the details layout's portal,
@@ -229,11 +229,11 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
   //Recurse into the group's child items:
   for(LayoutGroup::type_list_items::const_iterator iter = layout_group->m_list_items.begin(); iter != 
layout_group->m_list_items.end(); ++iter)
   {
-    const sharedptr<const LayoutItem> item = *iter;
+    const std::shared_ptr<const LayoutItem> item = *iter;
     if(!item)
       continue;
 
-    const sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+    const std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
     if(group && !portal)
     {
       //Recurse:
@@ -242,12 +242,12 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
     else
     {
       //Add field titles, if necessary:
-      sharedptr<LayoutItem_Text> text_title;
+      std::shared_ptr<LayoutItem_Text> text_title;
       const double title_width = ITEM_WIDTH_WIDE; //TODO: Calculate it based on the widest in the column. Or 
just halve the column to start.
-      const sharedptr<const LayoutItem_Field> field = sharedptr<const LayoutItem_Field>::cast_dynamic(item);
+      const std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const 
LayoutItem_Field>(item);
       if(field)
       {
-        text_title = sharedptr<LayoutItem_Text>::create();
+        text_title = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
         const Glib::ustring field_title = item_get_title_or_name(field);
         text_title->set_text(field_title + ":", AppWindow::get_current_locale());
         
@@ -261,7 +261,7 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
       }
 
       //Add the item, such as a field:
-      sharedptr<LayoutItem> clone = glom_sharedptr_clone(item);
+      std::shared_ptr<LayoutItem> clone = glom_sharedptr_clone(item);
 
       double item_x = x;
       if(field)
@@ -311,10 +311,10 @@ guint get_page_for_y(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::
   return pages_integral;
 }
 
-sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, const 
Glib::ustring& table_name, const Document* document, bool avoid_page_margins)
+std::shared_ptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, const 
Glib::ustring& table_name, const Document* document, bool avoid_page_margins)
 {
   const Gtk::Unit units = Gtk::UNIT_MM;
-  sharedptr<PrintLayout> print_layout = sharedptr<PrintLayout>::create();  
+  std::shared_ptr<PrintLayout> print_layout = std::shared_ptr<PrintLayout>(new PrintLayout());  
   
   //Start inside the border, on the next grid line:
   double y = 0;
@@ -332,7 +332,7 @@ sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>&
   const Glib::ustring title = document->get_table_title_singular(table_name, 
AppWindow::get_current_locale());
   if(!title.empty())
   {
-    sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::create();
+    std::shared_ptr<LayoutItem_Text> text = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
     text->set_text(title, AppWindow::get_current_locale());
     text->m_formatting.set_text_format_font("Sans Bold 12");
 
@@ -349,7 +349,7 @@ sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>&
     document->get_data_layout_groups("details", table_name); //TODO: layout_platform.
   for(Document::type_list_layout_groups::const_iterator iter = layout_groups.begin(); iter != 
layout_groups.end(); ++iter)
   {
-    const sharedptr<const LayoutGroup> group = *iter;
+    const std::shared_ptr<const LayoutGroup> group = *iter;
     if(!group)
       continue;
 
@@ -369,7 +369,7 @@ sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>&
   return print_layout;
 }
 
-void do_print_layout(const sharedptr<const PrintLayout>& print_layout, const FoundSet& found_set, bool 
preview, const Document* document, bool avoid_page_margins, Gtk::Window* transient_for)
+void do_print_layout(const std::shared_ptr<const PrintLayout>& print_layout, const FoundSet& found_set, bool 
preview, const Document* document, bool avoid_page_margins, Gtk::Window* transient_for)
 {
   if(!print_layout)
   {
@@ -394,7 +394,7 @@ void do_print_layout(const sharedptr<const PrintLayout>& print_layout, const Fou
   canvas.set_document(const_cast<Document*>(document)); //We const_cast because, for this use, it will not 
be changed.
 
   //We cast to unconst because we know that the layout will not be changed by this use: 
-  sharedptr<PrintLayout> unconst = sharedptr<PrintLayout>::cast_const(print_layout);
+  std::shared_ptr<PrintLayout> unconst = std::const_pointer_cast<PrintLayout>(print_layout);
   canvas.set_print_layout(found_set.m_table_name, unconst);
 
   //Do not show things that are only for editing the print layout:
diff --git a/glom/print_layout/print_layout_utils.h b/glom/print_layout/print_layout_utils.h
index 54b38ac..0b55f01 100644
--- a/glom/print_layout/print_layout_utils.h
+++ b/glom/print_layout/print_layout_utils.h
@@ -45,9 +45,9 @@ const double ITEM_WIDTH_WIDE = GRID_GAP * 10;
 /** Create a print layout based on the on-screen details layout.
  * @param avoid_page_margins If true then do skip page margins.
  */
-sharedptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, const 
Glib::ustring& table_name, const Document* document, bool avoid_page_margins);
+std::shared_ptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, const 
Glib::ustring& table_name, const Document* document, bool avoid_page_margins);
 
-void do_print_layout(const sharedptr<const PrintLayout>& print_layout, const FoundSet& found_set, bool 
preview, const Document* document, bool avoid_page_margins, Gtk::Window* transient_for);
+void do_print_layout(const std::shared_ptr<const PrintLayout>& print_layout, const FoundSet& found_set, bool 
preview, const Document* document, bool avoid_page_margins, Gtk::Window* transient_for);
 
 double get_page_height(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::Unit units);
 double get_page_height(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::Unit units, double& 
margin_top, double& margin_bottom);
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index e6ef81f..5878c1d 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -394,7 +394,7 @@ void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
   const type_map_fields& field_values,
   Document* pDocument,
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
   const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection,
   const PythonUICallbacks& callbacks,
@@ -434,7 +434,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
   const type_map_fields& field_values,
   Document* pDocument,
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
   const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection,
   Glib::ustring& error_message)
diff --git a/glom/python_embed/glom_python.h b/glom/python_embed/glom_python.h
index c4337e6..2ce4099 100644
--- a/glom/python_embed/glom_python.h
+++ b/glom/python_embed/glom_python.h
@@ -54,7 +54,7 @@ void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
   const type_map_fields& field_values,
   Document* pDocument,
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
   const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection,
   const PythonUICallbacks& callbacks,
@@ -69,7 +69,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
   const type_map_fields& field_values,
   Document* pDocument,
   const Glib::ustring& table_name,
-  const sharedptr<const Field>& key_field,
+  const std::shared_ptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
   const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection,
   Glib::ustring& error_message);
diff --git a/glom/utility_widgets/dialog_flowtable.cc b/glom/utility_widgets/dialog_flowtable.cc
index adf6cd5..c3d3dc4 100644
--- a/glom/utility_widgets/dialog_flowtable.cc
+++ b/glom/utility_widgets/dialog_flowtable.cc
@@ -56,7 +56,7 @@ Dialog_FlowTable::~Dialog_FlowTable()
 void Dialog_FlowTable::set_flowtable(FlowTableWithFields* flowtable)
 {
   m_flowtable = flowtable;
-  m_layoutgroup = sharedptr<LayoutGroup>::cast_dynamic(flowtable->get_layout_item());
+  m_layoutgroup = std::dynamic_pointer_cast<LayoutGroup>(flowtable->get_layout_item());
   m_entry_title->set_text(item_get_title(m_layoutgroup));
   m_spin_columns->set_value(m_layoutgroup->get_columns_count());
 }
diff --git a/glom/utility_widgets/dialog_flowtable.h b/glom/utility_widgets/dialog_flowtable.h
index 5fc49d4..adad47b 100644
--- a/glom/utility_widgets/dialog_flowtable.h
+++ b/glom/utility_widgets/dialog_flowtable.h
@@ -58,7 +58,7 @@ private:
   Gtk::SpinButton* m_spin_columns;
    
   FlowTableWithFields* m_flowtable;
-  sharedptr<LayoutGroup> m_layoutgroup;
+  std::shared_ptr<LayoutGroup> m_layoutgroup;
 };
 
 } //namespace Glom
diff --git a/glom/utility_widgets/dialog_image_load_progress.cc 
b/glom/utility_widgets/dialog_image_load_progress.cc
index f679250..798dc7b 100644
--- a/glom/utility_widgets/dialog_image_load_progress.cc
+++ b/glom/utility_widgets/dialog_image_load_progress.cc
@@ -162,7 +162,7 @@ void DialogImageLoadProgress::error(const Glib::ustring& error_message)
   response(Gtk::RESPONSE_REJECT);
 }
 
-std::auto_ptr<GdaBinary> DialogImageLoadProgress::get_image_data()
+std::shared_ptr<GdaBinary> DialogImageLoadProgress::get_image_data()
 {
   return m_data;
 }
diff --git a/glom/utility_widgets/dialog_image_load_progress.h 
b/glom/utility_widgets/dialog_image_load_progress.h
index f07911c..38e7688 100644
--- a/glom/utility_widgets/dialog_image_load_progress.h
+++ b/glom/utility_widgets/dialog_image_load_progress.h
@@ -43,7 +43,7 @@ public:
 
   void load(const Glib::ustring& uri);
 
-  std::auto_ptr<GdaBinary> get_image_data();
+  std::shared_ptr<GdaBinary> get_image_data();
 
 private:
   void error(const Glib::ustring& error_message);
@@ -53,7 +53,7 @@ private:
   void on_stream_read(const Glib::RefPtr<Gio::AsyncResult>& result, unsigned int offset);
   void on_read_next(unsigned int at);
 
-  std::auto_ptr<GdaBinary> m_data;
+  std::shared_ptr<GdaBinary> m_data;
   Gtk::ProgressBar* m_progress_bar;
 
   Glib::RefPtr<Gio::File> m_file;
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 729f97a..bafbb5d 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -98,7 +98,7 @@ ImageGlom::~ImageGlom()
 {
 }
 
-void ImageGlom::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
+void ImageGlom::set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name)
 {
   LayoutWidgetField::set_layout_item(layout_item, table_name);
 #ifdef GTKMM_ATKMM_ENABLED
@@ -737,7 +737,7 @@ bool ImageGlom::save_file(const Glib::ustring& uri)
     return false;
     
   // Automatically delete the dialog when we no longer need it:
-  std::auto_ptr<Gtk::Dialog> dialog_keeper(dialog_save);
+  std::shared_ptr<Gtk::Dialog> dialog_keeper(dialog_save);
 
   AppWindow* pApp = get_appwindow();
   if(pApp)
@@ -783,7 +783,7 @@ void ImageGlom::on_menupopup_activate_select_file()
       if(dialog)
       {
         // Automatically delete the dialog when we no longer need it:
-        std::auto_ptr<Gtk::Dialog> dialog_keeper(dialog);
+        std::shared_ptr<Gtk::Dialog> dialog_keeper(dialog);
 
         if(pApp)
           dialog->set_transient_for(*pApp);
@@ -793,7 +793,7 @@ void ImageGlom::on_menupopup_activate_select_file()
         if(dialog->run() == Gtk::RESPONSE_ACCEPT)
         {
           GdaBinary* bin = g_new(GdaBinary, 1);
-          std::auto_ptr<GdaBinary> image_data = dialog->get_image_data();
+          std::shared_ptr<GdaBinary> image_data = dialog->get_image_data();
           bin->data = image_data->data;
           bin->binary_length = image_data->binary_length;
 
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index d33e0d8..e587604 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -47,7 +47,7 @@ public:
 
   virtual ~ImageGlom();
   
-  virtual void set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name);
+  virtual void set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name);
 
   virtual void set_value(const Gnome::Gda::Value& value);
   virtual Gnome::Gda::Value get_value() const;
diff --git a/glom/utility_widgets/layoutwidgetbase.cc b/glom/utility_widgets/layoutwidgetbase.cc
index ab310a8..3bfe1f9 100644
--- a/glom/utility_widgets/layoutwidgetbase.cc
+++ b/glom/utility_widgets/layoutwidgetbase.cc
@@ -39,18 +39,18 @@ LayoutWidgetBase::~LayoutWidgetBase()
 {
 }
 
-void LayoutWidgetBase::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name)
+void LayoutWidgetBase::set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name)
 {
   m_pLayoutItem = layout_item;
   m_table_name = table_name;
 }
 
-sharedptr<const LayoutItem> LayoutWidgetBase::get_layout_item() const
+std::shared_ptr<const LayoutItem> LayoutWidgetBase::get_layout_item() const
 {
   return m_pLayoutItem;
 }
 
-sharedptr<LayoutItem> LayoutWidgetBase::get_layout_item()
+std::shared_ptr<LayoutItem> LayoutWidgetBase::get_layout_item()
 {
   return m_pLayoutItem;
 }
@@ -86,7 +86,7 @@ void LayoutWidgetBase::set_read_only(bool /* read_only */)
 {
 }
 
-void LayoutWidgetBase::apply_formatting(Gtk::Widget& widget, const sharedptr<const 
LayoutItem_WithFormatting>& layout_item)
+void LayoutWidgetBase::apply_formatting(Gtk::Widget& widget, const std::shared_ptr<const 
LayoutItem_WithFormatting>& layout_item)
 {
   Gtk::Widget* widget_to_change = &widget;
 
diff --git a/glom/utility_widgets/layoutwidgetbase.h b/glom/utility_widgets/layoutwidgetbase.h
index 8508036..a59e329 100644
--- a/glom/utility_widgets/layoutwidgetbase.h
+++ b/glom/utility_widgets/layoutwidgetbase.h
@@ -39,11 +39,11 @@ public:
   virtual ~LayoutWidgetBase();
 
   ///Takes ownership.
-  virtual void set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name);
+  virtual void set_layout_item(const std::shared_ptr<LayoutItem>& layout_item, const Glib::ustring& 
table_name);
 
   //The caller should call clone().
-  sharedptr<const LayoutItem> get_layout_item() const;
-  sharedptr<LayoutItem> get_layout_item();
+  std::shared_ptr<const LayoutItem> get_layout_item() const;
+  std::shared_ptr<LayoutItem> get_layout_item();
 
   enum enumType
   {
@@ -87,10 +87,10 @@ protected:
   virtual AppWindow* get_appwindow() const; // = 0;
 
 
-  static void apply_formatting(Gtk::Widget& widget, const sharedptr<const LayoutItem_WithFormatting>& 
layout_item);
+  static void apply_formatting(Gtk::Widget& widget, const std::shared_ptr<const LayoutItem_WithFormatting>& 
layout_item);
 
 protected: //TODO: Add accessor?
-  sharedptr<LayoutItem> m_pLayoutItem;
+  std::shared_ptr<LayoutItem> m_pLayoutItem;
 
 protected: //TODO: Add accessor?
   Glib::ustring m_table_name;
diff --git a/glom/utility_widgets/layoutwidgetmenu.cc b/glom/utility_widgets/layoutwidgetmenu.cc
index 3028cab..5a909e4 100644
--- a/glom/utility_widgets/layoutwidgetmenu.cc
+++ b/glom/utility_widgets/layoutwidgetmenu.cc
@@ -181,8 +181,8 @@ void LayoutWidgetMenu::on_menupopup_activate_delete()
 
   if(base)
   {
-    sharedptr<LayoutGroup> group = 
-      sharedptr<LayoutGroup>::cast_dynamic(base->get_layout_item());
+    std::shared_ptr<LayoutGroup> group = 
+      std::dynamic_pointer_cast<LayoutGroup>(base->get_layout_item());
     if(!group)
       return; 
  
diff --git a/glom/utility_widgets/layoutwidgetutils.cc b/glom/utility_widgets/layoutwidgetutils.cc
index c7f20b2..9e16bfd 100644
--- a/glom/utility_widgets/layoutwidgetutils.cc
+++ b/glom/utility_widgets/layoutwidgetutils.cc
@@ -104,8 +104,8 @@ void LayoutWidgetUtils::on_menu_delete_activate()
 
   if(base)
   {
-    sharedptr<LayoutGroup> group = 
-      sharedptr<LayoutGroup>::cast_dynamic(base->get_layout_item());
+    std::shared_ptr<LayoutGroup> group = 
+      std::dynamic_pointer_cast<LayoutGroup>(base->get_layout_item());
     if(!group)
       return;
 
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index f143d8f..466cbc9 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -71,11 +71,11 @@ AppWindow* NotebookLabel::get_appwindow()
 
 void NotebookLabel::on_menu_new_group_activate()
 {
-  sharedptr<LayoutGroup> group(new LayoutGroup());
+  std::shared_ptr<LayoutGroup> group(new LayoutGroup());
   group->set_title_original(_("New Group"));
   group->set_name(_("Group"));
   
-  sharedptr<LayoutGroup> notebook_group = sharedptr<LayoutGroup>::cast_dynamic 
(m_notebook->get_layout_item());
+  std::shared_ptr<LayoutGroup> notebook_group = 
std::dynamic_pointer_cast<LayoutGroup>(m_notebook->get_layout_item());
   notebook_group->add_item(group);
   
   m_notebook->signal_layout_changed().emit();
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index 80c57ed..b95d982 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -307,7 +307,7 @@ static int get_width_for_text(Gtk::Widget& widget, const Glib::ustring& text)
   return result;
 }
 
-int Utils::get_suitable_field_width_for_widget(Gtk::Widget& widget, const sharedptr<const LayoutItem_Field>& 
field_layout, bool or_title, bool for_treeview)
+int Utils::get_suitable_field_width_for_widget(Gtk::Widget& widget, const std::shared_ptr<const 
LayoutItem_Field>& field_layout, bool or_title, bool for_treeview)
 {
   int result = 150; //Suitable default.
 
diff --git a/glom/utils_ui.h b/glom/utils_ui.h
index fb12000..7eed877 100644
--- a/glom/utils_ui.h
+++ b/glom/utils_ui.h
@@ -84,7 +84,7 @@ Glib::RefPtr<Gdk::Pixbuf> get_pixbuf_for_gda_value(const Gnome::Gda::Value& valu
  * @or_title If true, check the width of the item's title too, returning the larger of the two values.
  * @result The width in pixels.
  */
-int get_suitable_field_width_for_widget(Gtk::Widget& widget, const sharedptr<const LayoutItem_Field>& 
field_layout, bool or_title = false, bool for_treeview = false);
+int get_suitable_field_width_for_widget(Gtk::Widget& widget, const std::shared_ptr<const LayoutItem_Field>& 
field_layout, bool or_title = false, bool for_treeview = false);
 
 /// Add the @a extension if no extension is there already:
 std::string get_filepath_with_extension(const std::string& filepath, const std::string& extension);
diff --git a/tests/python/test_python_execute_func.cc b/tests/python/test_python_execute_func.cc
index 8c6f5b5..9ee56f5 100644
--- a/tests/python/test_python_execute_func.cc
+++ b/tests/python/test_python_execute_func.cc
@@ -20,7 +20,7 @@ int main()
     value = Glom::glom_evaluate_python_function_implementation(
       Glom::Field::TYPE_NUMERIC, calculation, field_values,
       0 /* document */, "" /* table name */,
-      Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+      std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
       connection,
       error_message);
   }
diff --git a/tests/python/test_python_execute_func_bad_syntax.cc 
b/tests/python/test_python_execute_func_bad_syntax.cc
index ee7a031..0aaf739 100644
--- a/tests/python/test_python_execute_func_bad_syntax.cc
+++ b/tests/python/test_python_execute_func_bad_syntax.cc
@@ -22,7 +22,7 @@ int main()
     value = Glom::glom_evaluate_python_function_implementation(
       Glom::Field::TYPE_NUMERIC, calculation, field_values,
       0 /* document */, "" /* table name */,
-      Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+      std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
       connection,
       error_message);
   }
diff --git a/tests/python/test_python_execute_func_change_result_type.cc 
b/tests/python/test_python_execute_func_change_result_type.cc
index e09edba..11b6e9b 100644
--- a/tests/python/test_python_execute_func_change_result_type.cc
+++ b/tests/python/test_python_execute_func_change_result_type.cc
@@ -22,7 +22,7 @@ int main()
     value = Glom::glom_evaluate_python_function_implementation(
       result_type, calculation, field_values,
       0 /* document */, "" /* table name */,
-      Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+      std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
       connection,
       error_message);
   }
diff --git a/tests/python/test_python_execute_func_date.cc b/tests/python/test_python_execute_func_date.cc
index 68b8954..8040006 100644
--- a/tests/python/test_python_execute_func_date.cc
+++ b/tests/python/test_python_execute_func_date.cc
@@ -19,7 +19,7 @@ void execute_func_with_date_return_value()
   const Gnome::Gda::Value value = Glom::glom_evaluate_python_function_implementation(
     Glom::Field::TYPE_DATE, calculation, field_values,
     0 /* document */, "" /* table name */,
-    Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+    std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
     connection,
     error_message);
 
@@ -54,7 +54,7 @@ void execute_func_with_date_input_value()
   const Gnome::Gda::Value value = Glom::glom_evaluate_python_function_implementation(
     Glom::Field::TYPE_NUMERIC, calculation, field_values,
     0 /* document */, "" /* table name */,
-    Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+    std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
     connection,
     error_message);
 
@@ -91,7 +91,7 @@ void execute_func_with_date_input_value_relativedelta()
   const Gnome::Gda::Value value = Glom::glom_evaluate_python_function_implementation(
     Glom::Field::TYPE_NUMERIC, calculation, field_values,
     0, "",
-    Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+    std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
     connection);
 
   //std::cout << "type=" << g_type_name(value.get_value_type()) << std::endl;
diff --git a/tests/python/test_python_execute_func_with_record.cc 
b/tests/python/test_python_execute_func_with_record.cc
index 76b471f..24ea285 100644
--- a/tests/python/test_python_execute_func_with_record.cc
+++ b/tests/python/test_python_execute_func_with_record.cc
@@ -79,7 +79,7 @@ int main()
   }
   g_assert(started == Glom::ConnectionPool::Backend::STARTUPERROR_NONE);
 
-  Glom::sharedptr<Glom::SharedConnection> connection = connection_pool->connect();
+  std::shared_ptr<Glom::SharedConnection> connection = connection_pool->connect();
   g_assert(connection);
 
   Glib::RefPtr<Gnome::Gda::Connection> gda_connection = connection->get_gda_connection();
@@ -101,7 +101,7 @@ int main()
     value = Glom::glom_evaluate_python_function_implementation(
       Glom::Field::TYPE_BOOLEAN, calculation, field_values,
       0 /* document */, "" /* table name */,
-      Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+      std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
       gda_connection,
       error_message);
   }
diff --git a/tests/python/test_python_execute_script.cc b/tests/python/test_python_execute_script.cc
index 93caf65..e9c1436 100644
--- a/tests/python/test_python_execute_script.cc
+++ b/tests/python/test_python_execute_script.cc
@@ -86,7 +86,7 @@ int main()
     Glom::glom_execute_python_function_implementation(
       script, field_values,
       0 /* document */, table_name_input,
-      Glom::sharedptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
+      std::shared_ptr<Glom::Field>(), Gnome::Gda::Value(), // primary key details. Not used in this test.
       connection,
       callbacks,
       error_message);
diff --git a/tests/test_document_change.cc b/tests/test_document_change.cc
index 97bf0f7..852ff06 100644
--- a/tests/test_document_change.cc
+++ b/tests/test_document_change.cc
@@ -37,7 +37,7 @@ bool contains(const T_Container& container, const Glib::ustring& name)
 template<typename T_Container>
 bool contains_named(const T_Container& container, const Glib::ustring& name)
 {
-  typedef typename T_Container::value_type::object_type type_item;
+  typedef typename T_Container::value_type::element_type type_item;
   typename T_Container::const_iterator iter =
     std::find_if(container.begin(), container.end(),
       Glom::predicate_FieldHasName<type_item>(name));
@@ -82,7 +82,7 @@ int main()
 
 
   const Glib::ustring table_name = "sometable";
-  Glom::sharedptr<Glom::TableInfo> table_info(new Glom::TableInfo());
+  std::shared_ptr<Glom::TableInfo> table_info(new Glom::TableInfo());
   table_info->set_name(table_name);
   
   const Glib::ustring table_title = "sometabletitle";
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 72271cd..ec22fef 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -39,7 +39,7 @@ bool contains(const T_Container& container, const T_Value& name)
 template<typename T_Container>
 bool contains_named(const T_Container& container, const Glib::ustring& name)
 {
-  typedef typename T_Container::value_type::object_type type_item;
+  typedef typename T_Container::value_type::element_type type_item;
   typename T_Container::const_iterator iter =
     std::find_if(container.begin(), container.end(),
       Glom::predicate_FieldHasName<type_item>(name));
@@ -80,17 +80,17 @@ static bool get_group_named(const Glom::Document::type_list_groups& container, c
 
 static bool needs_navigation(Glom::Document& document, const Glib::ustring& table_name, const Glib::ustring& 
field_name)
 {
-  Glom::sharedptr<Glom::LayoutItem_Field> layout_item = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<Glom::LayoutItem_Field> layout_item = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layout_item->set_name(field_name);
   layout_item->set_full_field_details(
     document.get_field(table_name, field_name));
 
-  Glom::sharedptr<Glom::Relationship> field_used_in_relationship_to_one;
+  std::shared_ptr<Glom::Relationship> field_used_in_relationship_to_one;
   return Glom::DbUtils::layout_field_should_have_navigation(table_name, 
     layout_item, &document, field_used_in_relationship_to_one);
 }
 
-static Glom::sharedptr<const Glom::LayoutItem_Portal> get_portal_from_details_layout(const Glom::Document& 
document, const Glib::ustring& table_name, const Glib::ustring& relationship_name)
+static std::shared_ptr<const Glom::LayoutItem_Portal> get_portal_from_details_layout(const Glom::Document& 
document, const Glib::ustring& table_name, const Glib::ustring& relationship_name)
 {
   const Glom::Document::type_list_layout_groups groups = 
     document.get_data_layout_groups("details", table_name);
@@ -101,22 +101,22 @@ static Glom::sharedptr<const Glom::LayoutItem_Portal> get_portal_from_details_la
   
   for(Glom::Document::type_list_layout_groups::const_iterator iter = groups.begin(); iter != groups.end(); 
++iter)
   {
-    const Glom::sharedptr<const Glom::LayoutGroup> group = *iter;
+    const std::shared_ptr<const Glom::LayoutGroup> group = *iter;
 
     const Glom::LayoutGroup::type_list_const_items items = 
       group->get_items_recursive_with_groups();
     for(Glom::LayoutGroup::type_list_const_items::const_iterator iter = items.begin(); 
       iter != items.end(); ++iter)
     {
-      const Glom::sharedptr<const Glom::LayoutItem> layout_item = *iter;
+      const std::shared_ptr<const Glom::LayoutItem> layout_item = *iter;
  
-      const Glom::sharedptr<const Glom::LayoutGroup> group =
-        Glom::sharedptr<const Glom::LayoutGroup>::cast_dynamic(layout_item);
+      const std::shared_ptr<const Glom::LayoutGroup> group =
+        std::dynamic_pointer_cast<const Glom::LayoutGroup>(layout_item);
       if(!group)
         continue;
 
-      const Glom::sharedptr<const Glom::LayoutItem_Portal> portal =
-        Glom::sharedptr<const Glom::LayoutItem_Portal>::cast_dynamic(layout_item);
+      const std::shared_ptr<const Glom::LayoutItem_Portal> portal =
+        std::dynamic_pointer_cast<const Glom::LayoutItem_Portal>(layout_item);
       if(!portal)
         continue;
 
@@ -125,7 +125,7 @@ static Glom::sharedptr<const Glom::LayoutItem_Portal> get_portal_from_details_la
     }
   }
       
-  return Glom::sharedptr<Glom::LayoutItem_Portal>();
+  return std::shared_ptr<Glom::LayoutItem_Portal>();
 }
   
  
@@ -179,7 +179,7 @@ int main()
   g_assert(contains(table_names, "scenes"));
   g_assert(!contains(table_names, "Scenes")); //The title, not the name.
 
-  Glom::sharedptr<Glom::TableInfo> table = document.get_table("scenes");
+  std::shared_ptr<Glom::TableInfo> table = document.get_table("scenes");
   g_assert(table);
   g_assert( table->get_title_original() == "Scenes" );
   g_assert( table->get_title_singular_original() == "Scene" );
@@ -198,7 +198,7 @@ int main()
   g_assert(contains_named(relationships, "scene_cast"));
 
   //Check some fields:
-  Glom::sharedptr<const Glom::Field> field = document.get_field("contacts", "contact_id");
+  std::shared_ptr<const Glom::Field> field = document.get_field("contacts", "contact_id");
   g_assert(field);
   g_assert( field->get_title_original() == "Contact ID" );
   g_assert(field->get_glom_type() == Glom::Field::TYPE_NUMERIC);
@@ -211,7 +211,7 @@ int main()
   g_assert(!field->get_unique_key());
 
   //Check a relationship:
-  const Glom::sharedptr<const Glom::Relationship> relationship = document.get_relationship("characters", 
"contacts_actor");
+  const std::shared_ptr<const Glom::Relationship> relationship = document.get_relationship("characters", 
"contacts_actor");
   g_assert(relationship);
   g_assert(relationship->get_from_field() == "contact_id");
   g_assert(relationship->get_to_table() == "contacts");
@@ -222,7 +222,7 @@ int main()
   const Glom::Document::type_list_layout_groups groups = 
     document.get_data_layout_groups("details", "scenes");
   g_assert(groups.size() == 3);
-  const Glom::sharedptr<const Glom::LayoutGroup> group =
+  const std::shared_ptr<const Glom::LayoutGroup> group =
     groups[1];
   const Glom::LayoutGroup::type_list_const_items items = 
     group->get_items_recursive();
@@ -234,7 +234,7 @@ int main()
   g_assert(items_with_groups.size() == 15);
 
   //Check that expected fields can be found on a layout.
-  Glom::sharedptr<const Glom::LayoutItem_Field> field_on_layout = 
+  std::shared_ptr<const Glom::LayoutItem_Field> field_on_layout = 
     get_field_on_layout(document, "scenes", "locations", "address_town");
   g_assert(field_on_layout);
   g_assert(field_on_layout->get_table_used("scenes") == "locations");
@@ -293,7 +293,7 @@ int main()
     return false;
   }
   
-  const Glom::sharedptr<const Glom::PrintLayout> print_layout = document.get_print_layout("contacts", 
"contact_details");
+  const std::shared_ptr<const Glom::PrintLayout> print_layout = document.get_print_layout("contacts", 
"contact_details");
   if(!print_layout)
   {
     std::cerr << "Failure: Could not get an expected print layout." << std::endl;
@@ -327,7 +327,7 @@ int main()
     return false;
   }
 
-  const Glom::sharedptr<const Glom::Report> report = document.get_report("contacts", "by_country_by_town");
+  const std::shared_ptr<const Glom::Report> report = document.get_report("contacts", "by_country_by_town");
   if(!report)
   {
     std::cerr << "Failure: Could not get an expected report." << std::endl;
@@ -382,7 +382,7 @@ int main()
   //Note that related records portals don't have names.
   //This example portal shows the scenes_cast table, but should navigate though that to the cast table.
   const Glib::ustring portal_relationship_name = "scene_cast";
-  Glom::sharedptr<const Glom::LayoutItem_Portal> portal =
+  std::shared_ptr<const Glom::LayoutItem_Portal> portal =
     get_portal_from_details_layout(document, "scenes", portal_relationship_name);
   if(!portal)
   {
@@ -391,7 +391,7 @@ int main()
   }
 
   Glib::ustring navigation_table_name;
-  Glom::sharedptr<const Glom::UsesRelationship> navigation_relationship;
+  std::shared_ptr<const Glom::UsesRelationship> navigation_relationship;
   portal->get_suitable_table_to_view_details(navigation_table_name, navigation_relationship, &document);
 
   if(navigation_table_name != "characters")
diff --git a/tests/test_document_load_and_change.cc b/tests/test_document_load_and_change.cc
index 8798f0f..f08776c 100644
--- a/tests/test_document_load_and_change.cc
+++ b/tests/test_document_load_and_change.cc
@@ -39,7 +39,7 @@ static bool field_is_on_a_layout(Glom::Document& document, const Glib::ustring&
 
     for(Glom::Document::type_list_layout_groups::const_iterator iter = groups.begin(); iter != groups.end(); 
++iter)
     {
-      const Glom::sharedptr<Glom::LayoutGroup> group = *iter;
+      const std::shared_ptr<Glom::LayoutGroup> group = *iter;
       if(group->has_field(layout_table_name, table_name, field_name))
       {
         //std::cerr << "Failure: The field is still used on a layout for table: " << layout_table_name << 
std::endl;
@@ -119,7 +119,7 @@ int main()
   }
 
   //Check that the original field name is no longer used in the relationship:
-  Glom::sharedptr<const Glom::Relationship> relationship = document.get_relationship("invoice_lines", 
"products");
+  std::shared_ptr<const Glom::Relationship> relationship = document.get_relationship("invoice_lines", 
"products");
   if(!relationship)
   {
     std::cerr << "Failure: The relationship could not be found in the document." << std::endl;
@@ -159,7 +159,7 @@ int main()
     }
 
     //Check that the old relationship name is not used.
-    Glom::sharedptr<const Glom::LayoutItem_Field> field_on_layout = 
+    std::shared_ptr<const Glom::LayoutItem_Field> field_on_layout = 
       get_field_on_layout(document, table_name, "contacts", "name_full");
     g_assert(field_on_layout);
     if(field_on_layout->get_relationship_name() != relationship_name_new)
@@ -217,7 +217,7 @@ int main()
 
  
   //Remove a print layout:
-  Glom::sharedptr<const Glom::PrintLayout> print_layout = 
+  std::shared_ptr<const Glom::PrintLayout> print_layout = 
     document.get_print_layout("contacts", "contact_details");
   if(!print_layout)
   {
diff --git a/tests/test_document_load_image.cc b/tests/test_document_load_image.cc
index 7c01ebc..1ddd5ff 100644
--- a/tests/test_document_load_image.cc
+++ b/tests/test_document_load_image.cc
@@ -72,7 +72,7 @@ int main()
   const Glom::Document::type_list_layout_groups groups = 
     document.get_data_layout_groups("details", "projects");
   g_assert(groups.size() == 3);
-  const Glom::sharedptr<const Glom::LayoutGroup> group =
+  const std::shared_ptr<const Glom::LayoutGroup> group =
     groups[0];
   g_assert(group);
   g_assert(group->get_name() == "overview");
@@ -81,10 +81,10 @@ int main()
     group->get_items();
   //std::cout << "size: " << items.size() << std::endl;
   g_assert(items.size() == 3);
-  Glom::sharedptr<const Glom::LayoutItem> item = items[2];
+  std::shared_ptr<const Glom::LayoutItem> item = items[2];
   g_assert(item);
-  Glom::sharedptr<const Glom::LayoutItem_Image> image_item =
-    Glom::sharedptr<const Glom::LayoutItem_Image>::cast_dynamic(item);
+  std::shared_ptr<const Glom::LayoutItem_Image> image_item =
+    std::dynamic_pointer_cast<const Glom::LayoutItem_Image>(item);
   g_assert(image_item);
 
   const Gnome::Gda::Value value = image_item->get_image();
diff --git a/tests/test_document_load_translations.cc b/tests/test_document_load_translations.cc
index 0630feb..b8644f2 100644
--- a/tests/test_document_load_translations.cc
+++ b/tests/test_document_load_translations.cc
@@ -56,12 +56,12 @@ public:
   {
   }
 
-  bool operator() (const Glom::sharedptr<T_Element>& element)
+  bool operator() (const std::shared_ptr<T_Element>& element)
   {
     return (element->get_title_original() == m_title);
   }
 
-  bool operator() (const Glom::sharedptr<const T_Element>& element)
+  bool operator() (const std::shared_ptr<const T_Element>& element)
   {
     return (element->get_title_original() == m_title);
   }
@@ -86,8 +86,8 @@ public:
 
   bool operator() (const Glom::Document::pair_translatable_item_and_hint& element)
   {
-    Glom::sharedptr<Glom::TranslatableItem> item = element.first;
-    Glom::sharedptr<T_TypeToFind> derived = Glom::sharedptr<T_TypeToFind>::cast_dynamic(item);
+    std::shared_ptr<Glom::TranslatableItem> item = element.first;
+    std::shared_ptr<T_TypeToFind> derived = std::dynamic_pointer_cast<T_TypeToFind>(item);
     if(derived)
       return true;
     else
@@ -102,7 +102,7 @@ typename T_Container::value_type get_titled(const T_Container& container, const
   typedef typename T_Container::value_type type_sharedptr;
   type_sharedptr result;
 
-  typedef typename T_Container::value_type::object_type type_item;
+  typedef typename T_Container::value_type::element_type type_item;
   typename T_Container::const_iterator iter =
     std::find_if(container.begin(), container.end(),
       predicate_ItemHasTitle<type_item>(title));
@@ -124,23 +124,23 @@ bool contains_item_type(const Glom::Document::type_list_translatables& container
   return false;
 }
 
-static Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, 
const Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name)
+static std::shared_ptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, 
const Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name)
 {
   const Glom::Document::type_list_layout_groups groups = 
     document.get_data_layout_groups("details", layout_table_name);
 
   for(Glom::Document::type_list_layout_groups::const_iterator iter = groups.begin(); iter != groups.end(); 
++iter)
   {
-    const Glom::sharedptr<const Glom::LayoutGroup> group = *iter;
+    const std::shared_ptr<const Glom::LayoutGroup> group = *iter;
     if(!group)
       continue;
     
     const Glom::LayoutGroup::type_list_const_items items = group->get_items_recursive();
     for(Glom::LayoutGroup::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); 
++iter)
     {
-      const Glom::sharedptr<const Glom::LayoutItem> layout_item = *iter;
-      const Glom::sharedptr<const Glom::LayoutItem_Field> layout_item_field =
-        Glom::sharedptr<const Glom::LayoutItem_Field>::cast_dynamic(layout_item);
+      const std::shared_ptr<const Glom::LayoutItem> layout_item = *iter;
+      const std::shared_ptr<const Glom::LayoutItem_Field> layout_item_field =
+        std::dynamic_pointer_cast<const Glom::LayoutItem_Field>(layout_item);
       if(!layout_item_field)
         continue;
 
@@ -152,7 +152,7 @@ static Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const G
     }
   }
   
-  return Glom::sharedptr<const Glom::LayoutItem_Field>();
+  return std::shared_ptr<const Glom::LayoutItem_Field>();
 }
 
 static const char* locale_de = "de_DE.UTF-8";
@@ -165,8 +165,8 @@ void check_title(const T_Item& item, const char* title_en, const char* title_de)
   //The get_title_original() and get_title_translation() should not be called 
   //on items that delegate to a child item:
   bool has_own_title = true;
-  Glom::sharedptr<const Glom::LayoutItem_Field> field = 
-    Glom::sharedptr<const Glom::LayoutItem_Field>::cast_dynamic(item);
+  std::shared_ptr<const Glom::LayoutItem_Field> field = 
+    std::dynamic_pointer_cast<const Glom::LayoutItem_Field>(item);
   if(field)
      has_own_title = false;
 
@@ -255,7 +255,7 @@ int main()
   g_assert( document.get_table_title_singular("scenes", locale_de) == "Szene" ); //TODO: Make sure this is 
translated correctly.
 
   //Check a field:
-  Glom::sharedptr<const Glom::Field> field = document.get_field("contacts", "contact_id");
+  std::shared_ptr<const Glom::Field> field = document.get_field("contacts", "contact_id");
   g_assert(field);
   check_title(field, "Contact ID", "Kontaktkennung");
 
@@ -268,7 +268,7 @@ int main()
   g_assert(formatting.get_has_custom_choices());
   Glom::Formatting::type_list_values values = formatting.get_choices_custom();
   //g_assert(contains(values, "Day"));
-  Glom::sharedptr<Glom::ChoiceValue> value = get_titled(values, "Day");
+  std::shared_ptr<Glom::ChoiceValue> value = get_titled(values, "Day");
   g_assert(value);
   check_title(value, "Day", "Tag");
   g_assert(value->get_value() == Gnome::Gda::Value("Day"));
@@ -281,12 +281,12 @@ int main()
   g_assert( value->get_title_original() == "Day" );
 
   //Check a relationship:
-  const Glom::sharedptr<const Glom::Relationship> relationship = document.get_relationship("characters", 
"contacts_actor");
+  const std::shared_ptr<const Glom::Relationship> relationship = document.get_relationship("characters", 
"contacts_actor");
   g_assert(relationship);
   check_title(relationship, "Actor", "Schauspieler");
 
   //Check a LayoutItemField's CustomTitle:
-  Glom::sharedptr<const Glom::LayoutItem_Field> field_on_layout = 
+  std::shared_ptr<const Glom::LayoutItem_Field> field_on_layout = 
     get_field_on_layout(document, "characters", "contacts", "name_full");
   g_assert(field_on_layout);
   g_assert(field_on_layout->get_has_relationship_name());
@@ -306,7 +306,7 @@ int main()
   g_assert(field_on_layout->get_formatting_used_has_translatable_choices());
 
   //Check a print layout:
-  const Glom::sharedptr<const Glom::PrintLayout> print_layout = document.get_print_layout("contacts", 
"contact_details");
+  const std::shared_ptr<const Glom::PrintLayout> print_layout = document.get_print_layout("contacts", 
"contact_details");
   g_assert(print_layout);
   check_title(print_layout, "Contact Details", "Kontakt Details" );
 
diff --git a/tests/test_fake_connection.cc b/tests/test_fake_connection.cc
index e0f9f61..71c794a 100644
--- a/tests/test_fake_connection.cc
+++ b/tests/test_fake_connection.cc
@@ -66,17 +66,17 @@ int main()
 
   //Build a SQL query and get the string for it:
   const Gnome::Gda::Value value("Born To Run");
-  Glom::sharedptr<const Glom::Field> where_field = document.get_field("albums", "name");
+  std::shared_ptr<const Glom::Field> where_field = document.get_field("albums", "name");
   const Gnome::Gda::SqlExpr where_clause = 
     Glom::Utils::build_simple_where_expression("albums", where_field, value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
   field = document.get_field("albums", "name");
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
diff --git a/tests/test_field_file_format.cc b/tests/test_field_file_format.cc
index 0104dc0..9e9048d 100644
--- a/tests/test_field_file_format.cc
+++ b/tests/test_field_file_format.cc
@@ -26,7 +26,7 @@
 
 static void test_text_field()
 {
-  Glom::sharedptr<Glom::Field> field = Glom::sharedptr<Glom::Field>::create();
+  std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
   field->set_glom_type(Glom::Field::TYPE_TEXT);
 
   const Gnome::Gda::Value value_original("text with \" double quote and ' single quote");
@@ -41,7 +41,7 @@ static void test_text_field()
 
 static void test_image_field()
 {
-  Glom::sharedptr<Glom::Field> field = Glom::sharedptr<Glom::Field>::create();
+  std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
   field->set_glom_type(Glom::Field::TYPE_IMAGE);
 
   //TODO: Test an image too:
diff --git a/tests/test_selfhosting_new_from_example_float.cc 
b/tests/test_selfhosting_new_from_example_float.cc
index 0a120c4..e212554 100644
--- a/tests/test_selfhosting_new_from_example_float.cc
+++ b/tests/test_selfhosting_new_from_example_float.cc
@@ -42,7 +42,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
   
   const Glib::ustring table_name = "products";
-  Glom::sharedptr<const Glom::Field> primary_key_field = document.get_field_primary_key(table_name);
+  std::shared_ptr<const Glom::Field> primary_key_field = document.get_field_primary_key(table_name);
   if(!primary_key_field)
   {
     std::cerr << "Failure: primary_key_field is empty." << std::endl;
@@ -55,8 +55,8 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     Glom::Utils::build_simple_where_expression(table_name, primary_key_field, pk_value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field(table_name, "price");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field(table_name, "price");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
diff --git a/tests/test_selfhosting_new_then_change_columns.cc 
b/tests/test_selfhosting_new_then_change_columns.cc
index dab0eaf..a11ea77 100644
--- a/tests/test_selfhosting_new_then_change_columns.cc
+++ b/tests/test_selfhosting_new_then_change_columns.cc
@@ -45,14 +45,14 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   
   const Glib::ustring table_name = "contacts";
   const Glib::ustring field_name_original = "date_of_birth";
-  Glom::sharedptr<const Glom::Field> field = document.get_field(table_name, field_name_original);
+  std::shared_ptr<const Glom::Field> field = document.get_field(table_name, field_name_original);
   if(!field)
   {
     std::cerr << "Failure: Could not get field." << std::endl;
     return false;
   }
 
-  Glom::sharedptr<Glom::Field> field_new = Glom::glom_sharedptr_clone(field);
+  std::shared_ptr<Glom::Field> field_new = Glom::glom_sharedptr_clone(field);
   if(!field_new)
   {
     std::cerr << "Failure: field_new is null." << std::endl;
@@ -156,7 +156,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   try
   {
     //TODO: Avoid the need for this awkward use of set_g_type():
-    Glom::sharedptr<Glom::Field> field = Glom::sharedptr<Glom::Field>::create();
+    std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
     field->set_name("newfield");
     field->set_glom_type(Glom::Field::TYPE_NUMERIC);
     Glib::RefPtr<Gnome::Gda::Column> field_info = field->get_field_info();
diff --git a/tests/test_selfhosting_new_then_choices.cc b/tests/test_selfhosting_new_then_choices.cc
index 6d6c636..cb7df02 100644
--- a/tests/test_selfhosting_new_then_choices.cc
+++ b/tests/test_selfhosting_new_then_choices.cc
@@ -45,7 +45,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   
   const Glib::ustring table_name = "invoice_lines";
  
-  const Glom::sharedptr<const Glom::LayoutItem_Field> field_with_choice = 
+  const std::shared_ptr<const Glom::LayoutItem_Field> field_with_choice = 
     get_field_on_layout(document, table_name, table_name, "product_id");
   if(!field_with_choice)
   {
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
index 59dfd6d..a10d5e1 100644
--- a/tests/test_selfhosting_new_then_image.cc
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -47,10 +47,10 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   //Where clause:
 
   const Glib::ustring table_name = "contacts";
-  const Glom::sharedptr<const Glom::Field> field = document.get_field(table_name, "picture");
+  const std::shared_ptr<const Glom::Field> field = document.get_field(table_name, "picture");
 
   //Where clause:
-  const Glom::sharedptr<const Glom::Field> key_field = document.get_field(table_name, "contact_id");
+  const std::shared_ptr<const Glom::Field> key_field = document.get_field(table_name, "contact_id");
   if(!key_field)
   {
     std::cerr << "Failure: Could not get key field." << std::endl;
@@ -76,7 +76,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
 
   //Get the value:
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
diff --git a/tests/test_selfhosting_new_then_lookup.cc b/tests/test_selfhosting_new_then_lookup.cc
index 73e83fa..5beb672 100644
--- a/tests/test_selfhosting_new_then_lookup.cc
+++ b/tests/test_selfhosting_new_then_lookup.cc
@@ -30,18 +30,18 @@
 #include <iostream>
 #include <cstdlib> //For EXIT_SUCCESS and EXIT_FAILURE
 
-static Glom::sharedptr<const Glom::LayoutItem_Field> get_lookup_field(const 
Glom::Document::type_list_lookups& container, const Glib::ustring& table_name, const Glib::ustring& 
field_name, Glom::sharedptr<const Glom::Relationship>& relationship)
+static std::shared_ptr<const Glom::LayoutItem_Field> get_lookup_field(const 
Glom::Document::type_list_lookups& container, const Glib::ustring& table_name, const Glib::ustring& 
field_name, std::shared_ptr<const Glom::Relationship>& relationship)
 {
-  relationship.clear();
-  Glom::sharedptr<const Glom::LayoutItem_Field> result;
+  relationship.reset();
+  std::shared_ptr<const Glom::LayoutItem_Field> result;
 
   for(Glom::Document::type_list_lookups::const_iterator iter = container.begin(); iter != container.end(); 
++iter)
   {
-    const Glom::sharedptr<const Glom::LayoutItem_Field> layout_item = iter->first;
+    const std::shared_ptr<const Glom::LayoutItem_Field> layout_item = iter->first;
     if(!layout_item)
       return result;
 
-    const Glom::sharedptr<const Glom::Relationship> this_relationship = iter->second;
+    const std::shared_ptr<const Glom::Relationship> this_relationship = iter->second;
     if(!this_relationship)
       return result;
 
@@ -60,8 +60,8 @@ static Glom::sharedptr<const Glom::LayoutItem_Field> get_lookup_field(const Glom
 
 static bool contains_field(const Glom::Document::type_list_lookups& container, const Glib::ustring& 
table_name, const Glib::ustring& field_name)
 {
-  Glom::sharedptr<const Glom::Relationship> relationship;
-  return get_lookup_field(container, table_name, field_name, relationship);
+  std::shared_ptr<const Glom::Relationship> relationship;
+  return (bool)get_lookup_field(container, table_name, field_name, relationship);
 }
 
 static bool test(Glom::Document::HostingMode hosting_mode)
@@ -76,7 +76,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
   
   const Glib::ustring table_name = "invoice_lines";
-  Glom::sharedptr<const Glom::Field> primary_key_field = document.get_field_primary_key(table_name);
+  std::shared_ptr<const Glom::Field> primary_key_field = document.get_field_primary_key(table_name);
   if(!primary_key_field)
   {
     std::cerr << "Failure: primary_key_field is empty." << std::endl;
@@ -111,8 +111,8 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
 
   const Glib::ustring field_name = "product_price";
-  Glom::sharedptr<const Glom::Relationship> relationship;
-  const Glom::sharedptr<const Glom::LayoutItem_Field> layout_field = 
+  std::shared_ptr<const Glom::Relationship> relationship;
+  const std::shared_ptr<const Glom::LayoutItem_Field> layout_field = 
     get_lookup_field(lookups, table_name, field_name, relationship);
   if(!layout_field)
   {
@@ -144,7 +144,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     return false;
   }
 
-  const Glom::sharedptr<const Glom::Field> field = layout_field->get_full_field_details();
+  const std::shared_ptr<const Glom::Field> field = layout_field->get_full_field_details();
   if(!field)
   {
     std::cerr << "Failure: The lookup item's field is empty." << std::endl;
@@ -176,7 +176,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
 
   //Lookup the value from the related record.
-  const Glom::sharedptr<Glom::Field> field_source = 
+  const std::shared_ptr<Glom::Field> field_source = 
     document.get_field(relationship->get_to_table(), field->get_lookup_field());
   const Gnome::Gda::Value value = Glom::DbUtils::get_lookup_value(&document, 
     table_name, relationship, field_source, Gnome::Gda::Value(2));
diff --git a/tests/test_selfhosting_new_then_report.cc b/tests/test_selfhosting_new_then_report.cc
index 9b676d4..b38ff71 100644
--- a/tests/test_selfhosting_new_then_report.cc
+++ b/tests/test_selfhosting_new_then_report.cc
@@ -37,7 +37,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     return false;
   }
 
-  const Glom::sharedptr<const Glom::Report> report_temp = 
+  const std::shared_ptr<const Glom::Report> report_temp = 
     Glom::ReportBuilder::create_standard_list_report(&document, "albums");
 
   Glom::FoundSet found_set; //TODO: Test a where clause.
diff --git a/tests/test_selfhosting_new_then_report_summary.cc 
b/tests/test_selfhosting_new_then_report_summary.cc
index 02dfc80..5b2c568 100644
--- a/tests/test_selfhosting_new_then_report_summary.cc
+++ b/tests/test_selfhosting_new_then_report_summary.cc
@@ -37,7 +37,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     return false;
   }
 
-  const Glom::sharedptr<const Glom::Report> report = 
+  const std::shared_ptr<const Glom::Report> report = 
     document.get_report("invoices", "by_customer");
   if(!report)
   {
diff --git a/tests/test_selfhosting_sqlinjection.cc b/tests/test_selfhosting_sqlinjection.cc
index 32ff5f9..c046057 100644
--- a/tests/test_selfhosting_sqlinjection.cc
+++ b/tests/test_selfhosting_sqlinjection.cc
@@ -33,17 +33,17 @@ static bool check_get_extra_rows(const Glib::ustring& quote_char)
 {
   //Try to get more rows than intended:
   const Gnome::Gda::Value value("Born To Run" + quote_char + " OR " + quote_char + "x" + quote_char + "=" + 
quote_char + "x");
-  Glom::sharedptr<const Glom::Field> where_field = document.get_field("albums", "name");
+  std::shared_ptr<const Glom::Field> where_field = document.get_field("albums", "name");
   const Gnome::Gda::SqlExpr where_clause = 
     Glom::Utils::build_simple_where_expression("albums", where_field, value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
   field = document.get_field("albums", "name");
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
@@ -65,18 +65,18 @@ static bool check_drop_table(const Glib::ustring& quote_char)
 {
   //Try to drop the table in a second SQL statement:
   const Gnome::Gda::Value value("True Blue" + quote_char + "; DROP TABLE songs; --");
-  Glom::sharedptr<const Glom::Field> where_field = 
+  std::shared_ptr<const Glom::Field> where_field = 
     document.get_field("albums", "name");
   const Gnome::Gda::SqlExpr where_clause = 
     Glom::Utils::build_simple_where_expression("albums", where_field, value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
   field = document.get_field("albums", "name");
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
@@ -105,18 +105,18 @@ static bool check_avoid_quotes_and_drop_table_with_false_value_type()
   //Try to drop the table in a second SQL statement,
   //by using a text value for a field whose type should not need quoting:
   const Gnome::Gda::Value value("1;DROP TABLE songs");
-  Glom::sharedptr<const Glom::Field> where_field = 
+  std::shared_ptr<const Glom::Field> where_field = 
     document.get_field("albums", "album_id");
   const Gnome::Gda::SqlExpr where_clause = 
     Glom::Utils::build_simple_where_expression("albums", where_field, value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
   field = document.get_field("albums", "name");
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
@@ -162,7 +162,7 @@ static bool check_avoid_quotes_and_drop_table_with_false_field_type()
   const Gnome::Gda::Value value("\"Born To Run\";DROP TABLE songs");
 
   //Specify a field with incorrect type information:
-  Glom::sharedptr<Glom::Field> where_field = 
+  std::shared_ptr<Glom::Field> where_field = 
     document.get_field("albums", "name");
   where_field->set_glom_type(Glom::Field::TYPE_NUMERIC);
   //const GType gda_type = Glom::Field::get_gda_type_for_glom_type(Glom::TYPE_NUMERIC); 
@@ -171,12 +171,12 @@ static bool check_avoid_quotes_and_drop_table_with_false_field_type()
     Glom::Utils::build_simple_where_expression("albums", where_field, value);
  
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
   field = document.get_field("albums", "name");
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 5b3ca75..94d1998 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -391,14 +391,14 @@ bool test_table_exists(const Glib::ustring& table_name, const Glom::Document& do
 {
   //Try to get more rows than intended:
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document.get_field_primary_key(table_name); //To to get some 
field.
+  std::shared_ptr<const Glom::Field> field = document.get_field_primary_key(table_name); //To to get some 
field.
   if(!field)
   {
     std::cerr << G_STRFUNC << "Failure: Could not get primary key for table=" << table_name << std::endl;
     return false;
   }
 
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
@@ -427,28 +427,28 @@ static bool test_example_musiccollection_data_related(const Glom::Document* docu
   Glom::Utils::type_vecLayoutFields fieldsToGet;
 
   //Normal fields:
-  Glom::sharedptr<const Glom::Field> field_album_id = document->get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field_album_id = document->get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field_album_id);
   fieldsToGet.push_back(layoutitem);
-  Glom::sharedptr<const Glom::Field> field = document->get_field("albums", "name");
+  std::shared_ptr<const Glom::Field> field = document->get_field("albums", "name");
   if(!field)
   {
     std::cerr << G_STRFUNC << "Failure: Could not get field." << std::endl;
     return false;
   }
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
   //Related field:
-  const Glom::sharedptr<Glom::Relationship> relationship = document->get_relationship("albums", "artist");
+  const std::shared_ptr<Glom::Relationship> relationship = document->get_relationship("albums", "artist");
   if(!relationship)
   {
     std::cerr << "Failure: The relationship could not be found." << std::endl;
     return false;
   }
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_relationship(relationship);
   field = document->get_field("artists", "name");
   if(!field)
@@ -487,8 +487,8 @@ bool test_example_musiccollection_data(const Glom::Document* document)
     Glom::Utils::get_find_where_clause_quick(document, "albums", value);
   
   Glom::Utils::type_vecLayoutFields fieldsToGet;
-  Glom::sharedptr<const Glom::Field> field = document->get_field("albums", "album_id");
-  Glom::sharedptr<Glom::LayoutItem_Field> layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  std::shared_ptr<const Glom::Field> field = document->get_field("albums", "album_id");
+  std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new 
Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
@@ -498,7 +498,7 @@ bool test_example_musiccollection_data(const Glom::Document* document)
     std::cerr << G_STRFUNC << "Failure: Could not get field." << std::endl;
     return false;
   }
-  layoutitem = Glom::sharedptr<Glom::LayoutItem_Field>::create();
+  layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
   layoutitem->set_full_field_details(field);
   fieldsToGet.push_back(layoutitem);
 
diff --git a/tests/test_utils.cc b/tests/test_utils.cc
index 3c12ceb..5b736d4 100644
--- a/tests/test_utils.cc
+++ b/tests/test_utils.cc
@@ -23,23 +23,23 @@
 #include <glibmm/fileutils.h>
 #include <iostream>
 
-Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, const 
Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name)
+std::shared_ptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, const 
Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name)
 {
   const Glom::Document::type_list_layout_groups groups = 
     document.get_data_layout_groups("details", layout_table_name);
 
   for(Glom::Document::type_list_layout_groups::const_iterator iter = groups.begin(); iter != groups.end(); 
++iter)
   {
-    const Glom::sharedptr<const Glom::LayoutGroup> group = *iter;
+    const std::shared_ptr<const Glom::LayoutGroup> group = *iter;
     if(!group)
       continue;
     
     const Glom::LayoutGroup::type_list_const_items items = group->get_items_recursive();
     for(Glom::LayoutGroup::type_list_const_items::const_iterator iter = items.begin(); iter != items.end(); 
++iter)
     {
-      const Glom::sharedptr<const Glom::LayoutItem> layout_item = *iter;
-      const Glom::sharedptr<const Glom::LayoutItem_Field> layout_item_field =
-        Glom::sharedptr<const Glom::LayoutItem_Field>::cast_dynamic(layout_item);
+      const std::shared_ptr<const Glom::LayoutItem> layout_item = *iter;
+      const std::shared_ptr<const Glom::LayoutItem_Field> layout_item_field =
+        std::dynamic_pointer_cast<const Glom::LayoutItem_Field>(layout_item);
       if(!layout_item_field)
         continue;
 
@@ -51,7 +51,7 @@ Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Do
     }
   }
   
-  return Glom::sharedptr<const Glom::LayoutItem_Field>();
+  return std::shared_ptr<const Glom::LayoutItem_Field>();
 }
 
 Gnome::Gda::Value get_value_for_image()
diff --git a/tests/test_utils.h b/tests/test_utils.h
index 44eb3c6..62085db 100644
--- a/tests/test_utils.h
+++ b/tests/test_utils.h
@@ -24,7 +24,7 @@
 #include <libglom/document/document.h>
 #include <string>
 
-Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, const 
Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name);
+std::shared_ptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, const 
Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name);
 
 Gnome::Gda::Value get_value_for_image();
 
diff --git a/tests/translations_po/test_document_import_po.cc 
b/tests/translations_po/test_document_import_po.cc
index 825b910..dbd2e60 100644
--- a/tests/translations_po/test_document_import_po.cc
+++ b/tests/translations_po/test_document_import_po.cc
@@ -100,7 +100,7 @@ int main()
 
 
   //Check that some expected translated titles are now in the document:
-  Glom::sharedptr<const Glom::TableInfo> table = document.get_table("scenes");
+  std::shared_ptr<const Glom::TableInfo> table = document.get_table("scenes");
   g_assert(table);
   g_assert( table->get_title_original() == "Scenes" ); //The original title should be unchanged:
 
@@ -111,7 +111,7 @@ int main()
     return EXIT_FAILURE;
   }
 
-  const Glom::sharedptr<const Glom::Report> report = document.get_report("crew", "crew_list");
+  const std::shared_ptr<const Glom::Report> report = document.get_report("crew", "crew_list");
   g_assert(report);
   g_assert(report->get_title_original() == "Crew List"); //The original title should be unchanged:
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]