+bool wxDocument::DoSaveDocument(const wxString& file)
+{
+    wxString msgTitle;
+    if (!wxTheApp->GetAppDisplayName().empty())
+        msgTitle = wxTheApp->GetAppDisplayName();
+    else
+        msgTitle = wxString(_("File error"));
+
+#if wxUSE_STD_IOSTREAM
+    wxSTD ofstream store(file.mb_str(), wxSTD ios::binary);
+    if (store.fail() || store.bad())
+#else
+    wxFileOutputStream store(file);
+    if (store.GetLastError() != wxSTREAM_NO_ERROR)
+#endif
+    {
+        (void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION,
+                           GetDocumentWindow());
+        // Saving error
+        return false;
+    }
+    if (!SaveObject(store))
+    {
+        (void)wxMessageBox(_("Sorry, could not save this file."), msgTitle, wxOK | wxICON_EXCLAMATION,
+                           GetDocumentWindow());
+        // Saving error
+        return false;
+    }
+
+    return true;
+}
+
+bool wxDocument::DoOpenDocument(const wxString& file)
+{
+#if wxUSE_STD_IOSTREAM
+    wxSTD ifstream store(file.mb_str(), wxSTD ios::binary);
+    if (!store.fail() && !store.bad())
+#else
+    wxFileInputStream store(file);
+    if (store.GetLastError() == wxSTREAM_NO_ERROR)
+#endif
+    {
+#if wxUSE_STD_IOSTREAM
+        LoadObject(store);
+        if ( !!store || store.eof() )
+#else
+        int res = LoadObject(store).GetLastError();
+        if ( res == wxSTREAM_NO_ERROR || res == wxSTREAM_EOF )
+#endif
+            return true;
+    }
+
+    wxLogError(_("Sorry, could not open this file."));
+    return false;
+}
+
+