office-gobmx/writerperfect/inc/WPFTEncodingDialog.hxx
Skyler Grey 60fef0bfeb fix(lok): Expose the character encoding dialog
The character encoding dialog appears when importing a dialog with an
ambiguous character encoding. At the point when it appears, the document
isn't loaded, so we have to handle it in a similar way to the text
import dialog or password prompt dialog, allowing it to function early.

It's also required to make the dialog into a jsdialog, as tunneled
dialogs do not work this early in the document loading process.

I have not asynced the dialog here because there's no point. I did write
code where I set up a dialog factory to do this similar to how other
modules (sw, sc, sd, etc.) handle dialogs and make them async.
Unfortunately, this dialog is not useful with multiple users, since as
it's used on opening a document. It may, in the future, be useful to
someone to make a patch that asyncs the other writerperfect dialog (epub
export) so I have uploaded and abandoned my dialog factory patch as
Id8ec474510f3c8637639ad59331156c6e75dafb4.

Documents that require this dialog, whether async or not, cause crashes
when someone opens the document before the first person has finished
responding to this dialog. I still consider this behavior better than
crashing whenever we attempt to show this dialog at all.

Change-Id: Ibd36e695e733e07053bb6e22a510ac988be3ded2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174044
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 283f771b92a14c06871c931b01174622b855abe5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174950
Tested-by: Jenkins
2024-10-21 10:34:18 +02:00

48 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* MSWorksImportFilter: Sets up the filter, and calls DocumentCollector
* to do the actual filtering
*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <config_options.h>
#include <vcl/weld.hxx>
#include "writerperfectdllapi.h"
namespace writerperfect
{
class UNLESS_MERGELIBS_MORE(WRITERPERFECT_DLLPUBLIC) WPFTEncodingDialog final
: public weld::GenericDialogController
{
public:
WPFTEncodingDialog(weld::Window* pParent, const OUString& title, const OUString& defEncoding);
virtual ~WPFTEncodingDialog() override;
OUString GetEncoding() const;
bool hasUserCalledCancel() const { return m_userHasCancelled; }
private:
bool m_userHasCancelled;
std::unique_ptr<weld::ComboBox> m_xLbCharset;
std::unique_ptr<weld::Button> m_xBtnCancel;
private:
DECL_DLLPRIVATE_LINK(CancelHdl, weld::Button&, void);
DECL_STATIC_LINK(WPFTEncodingDialog, InstallLOKNotifierHdl, void*,
vcl::ILibreOfficeKitNotifier*);
WPFTEncodingDialog(WPFTEncodingDialog const&) = delete;
WPFTEncodingDialog& operator=(WPFTEncodingDialog const&) = delete;
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */