Kaydet (Commit) 5f170e69 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld WPFTEncodingDialog

and pass in parent window for dialog

Change-Id: Ibe9f576a74dfbbee3e568c8d3454440700cb0405
Reviewed-on: https://gerrit.libreoffice.org/54328Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d15c2404
......@@ -29,10 +29,13 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_wpftimport,\
test \
unotest \
utl \
vcl \
wpftqahelper \
writerperfect \
))
$(eval $(call gb_CppunitTest_use_external,writerperfect_wpftimport,boost_headers))
$(eval $(call gb_CppunitTest_use_ure,writerperfect_wpftimport))
$(eval $(call gb_CppunitTest_use_vcl,writerperfect_wpftimport))
......
......@@ -31,6 +31,8 @@
#include <cppuhelper/implbase.hxx>
#include <unotools/mediadescriptor.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include "DocumentHandler.hxx"
#include "WPXSvInputStream.hxx"
......@@ -73,6 +75,9 @@ public:
return false;
}
css::uno::Reference<css::awt::XWindow> xDialogParent;
aDescriptor["ParentWindow"] >>= xDialogParent;
// An XML import service: what we push sax messages to..
css::uno::Reference<css::xml::sax::XDocumentHandler> xInternalHandler(
mxContext->getServiceManager()->createInstanceWithContext(
......@@ -95,7 +100,8 @@ public:
doRegisterHandlers(exporter);
return doImportDocument(input, exporter, aDescriptor);
return doImportDocument(Application::GetFrameWeld(xDialogParent), input, exporter,
aDescriptor);
}
virtual void SAL_CALL cancel() override {}
......@@ -168,8 +174,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) = 0;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, Generator& rGenerator,
utl::MediaDescriptor& rDescriptor)
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
Generator& rGenerator, utl::MediaDescriptor& rDescriptor)
= 0;
virtual void doRegisterHandlers(Generator&){};
......
......@@ -14,18 +14,16 @@
#include <sal/types.h>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/weld.hxx>
#include "writerperfectdllapi.h"
namespace writerperfect
{
class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public ModalDialog
class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public weld::GenericDialogController
{
public:
WPFTEncodingDialog(const OUString& title, const OUString& defEncoding);
WPFTEncodingDialog(weld::Window* pParent, const OUString& title, const OUString& defEncoding);
virtual ~WPFTEncodingDialog() override;
......@@ -33,17 +31,14 @@ public:
bool hasUserCalledCancel() const { return m_userHasCancelled; }
private:
VclPtr<ListBox> m_pLbCharset;
VclPtr<OKButton> m_pBtnOk;
VclPtr<CancelButton> m_pBtnCancel;
bool m_userHasCancelled;
private:
DECL_LINK(DoubleClickHdl, ListBox&, void);
DECL_LINK(CancelHdl, Button*, void);
std::unique_ptr<weld::ComboBoxText> m_xLbCharset;
std::unique_ptr<weld::Button> m_xBtnOk;
std::unique_ptr<weld::Button> m_xBtnCancel;
void dispose() override;
private:
DECL_LINK(CancelHdl, weld::Button&, void);
WPFTEncodingDialog(WPFTEncodingDialog const&) = delete;
WPFTEncodingDialog& operator=(WPFTEncodingDialog const&) = delete;
......
......@@ -45,14 +45,15 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
rtl::OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
static void generate(librevenge::RVNGDrawingInterface& rDocument);
};
bool DrawingImportFilter::doImportDocument(librevenge::RVNGInputStream&, OdgGenerator& rGenerator,
utl::MediaDescriptor&)
bool DrawingImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
DrawingImportFilter::generate(rGenerator);
return true;
......
......@@ -45,13 +45,14 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
rtl::OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
static void generate(librevenge::RVNGPresentationInterface& rDocument);
};
bool PresentationImportFilter::doImportDocument(librevenge::RVNGInputStream&,
bool PresentationImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
OdpGenerator& rGenerator, utl::MediaDescriptor&)
{
PresentationImportFilter::generate(rGenerator);
......
......@@ -44,13 +44,14 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
rtl::OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
static void generate(librevenge::RVNGSpreadsheetInterface& rDocument);
};
bool SpreadsheetImportFilter::doImportDocument(librevenge::RVNGInputStream&,
bool SpreadsheetImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
OdsGenerator& rGenerator, utl::MediaDescriptor&)
{
SpreadsheetImportFilter::generate(rGenerator);
......
......@@ -43,14 +43,15 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput,
rtl::OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pWindow, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
static void generate(librevenge::RVNGTextInterface& rDocument);
};
bool TextImportFilter::doImportDocument(librevenge::RVNGInputStream&, OdtGenerator& rGenerator,
utl::MediaDescriptor&)
bool TextImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream&,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
TextImportFilter::generate(rGenerator);
return true;
......
......@@ -179,7 +179,8 @@ private:
}
////////////////////////////////////////////////////////////
bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MSWorksCalcImportFilter::doImportDocument(weld::Window* pParent,
librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&)
{
libwps::WPSKind kind = libwps::WPS_TEXT;
......@@ -226,14 +227,14 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInp
try
{
const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
if (pDlg->Execute() == RET_OK)
writerperfect::WPFTEncodingDialog aDlg(pParent, title, encoding);
if (aDlg.run() == RET_OK)
{
if (!pDlg->GetEncoding().isEmpty())
fileEncoding = pDlg->GetEncoding().toUtf8().getStr();
if (!aDlg.GetEncoding().isEmpty())
fileEncoding = aDlg.GetEncoding().toUtf8().getStr();
}
// we can fail because we are in headless mode, the user has cancelled conversion, ...
else if (pDlg->hasUserCalledCancel())
else if (aDlg.hasUserCalledCancel())
return false;
}
catch (...)
......@@ -248,7 +249,7 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInp
// try to ask for a password
try
{
SfxPasswordDialog aPasswdDlg(nullptr);
SfxPasswordDialog aPasswdDlg(pParent);
aPasswdDlg.SetMinLen(1);
if (!aPasswdDlg.execute())
return false;
......@@ -275,6 +276,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
OUString sUrl;
css::uno::Reference<css::io::XInputStream> xInputStream;
css::uno::Reference<ucb::XContent> xContent;
css::uno::Reference<css::awt::XWindow> xDialogParent;
sal_Int32 nLength = rDescriptor.getLength();
const css::beans::PropertyValue* pValue = rDescriptor.getConstArray();
......@@ -286,6 +288,8 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
pValue[i].Value >>= xContent;
else if (pValue[i].Name == "FileName" || pValue[i].Name == "URL")
pValue[i].Value >>= sUrl;
else if (pValue[i].Name == "ParentWindow")
pValue[i].Value >>= xDialogParent;
}
if (!getXContext().is() || !xInputStream.is())
......@@ -373,7 +377,8 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
= libwps::WPSDocument::isFileFormatSupported(&structuredInput, kind,
creator, needEncoding);
if (confidence != libwps::WPS_CONFIDENCE_NONE)
return doImportDocument(structuredInput, exporter, aDescriptor);
return doImportDocument(Application::GetFrameWeld(xDialogParent),
structuredInput, exporter, aDescriptor);
}
}
}
......@@ -382,7 +387,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
{
}
return doImportDocument(input, exporter, aDescriptor);
return doImportDocument(Application::GetFrameWeld(xDialogParent), input, exporter, aDescriptor);
}
bool MSWorksCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput,
......
......@@ -40,8 +40,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
};
......
......@@ -39,7 +39,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
return MWAWDocument::decodeSpreadsheet(data, &exporter);
}
bool MWAWCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MWAWCalcImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&)
{
return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
};
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
using libetonyek::EtonyekDocument;
bool NumbersImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool NumbersImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&)
{
return EtonyekDocument::parse(&rInput, &rGenerator);
......
......@@ -34,8 +34,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
};
......
......@@ -37,7 +37,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
return STOFFDocument::decodeSpreadsheet(data, &exporter);
}
bool StarOfficeCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool StarOfficeCalcImportFilter::doImportDocument(weld::Window*,
librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&)
{
return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator);
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdsGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdsGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdsGenerator& rGenerator) override;
};
......
......@@ -78,82 +78,46 @@ std::pair<OUStringLiteral, OUStringLiteral> const s_encodings[]
std::size_t const numEncodings = SAL_N_ELEMENTS(s_encodings);
void insertEncodings(ListBox* box)
void insertEncodings(weld::ComboBoxText& box)
{
for (std::size_t i = 0; i < numEncodings; ++i)
{
sal_IntPtr nAt = box->InsertEntry(s_encodings[i].second);
box->SetEntryData(nAt, reinterpret_cast<void*>(static_cast<sal_uIntPtr>(i)));
}
box.append(s_encodings[i].first, s_encodings[i].second);
}
void selectEncoding(ListBox* box, const OUString& encoding)
void selectEncoding(weld::ComboBoxText& box, const OUString& encoding)
{
for (std::size_t i = 0; i < numEncodings; ++i)
{
if (encoding != s_encodings[i].first)
continue;
box->SelectEntryPos(i);
return;
}
box.set_active_id(encoding);
}
OUString getEncoding(ListBox const* box)
{
sal_uIntPtr pos = reinterpret_cast<sal_uIntPtr>(box->GetSelectedEntryData());
if (pos >= numEncodings)
return OUString();
return s_encodings[pos].first;
}
OUString getEncoding(const weld::ComboBoxText& box) { return box.get_active_id(); }
}
WPFTEncodingDialog::WPFTEncodingDialog(const OUString& title, const OUString& encoding)
: ModalDialog(nullptr, "WPFTEncodingDialog", "writerperfect/ui/wpftencodingdialog.ui")
, m_pLbCharset()
, m_pBtnOk()
, m_pBtnCancel()
WPFTEncodingDialog::WPFTEncodingDialog(weld::Window* pParent, const OUString& title,
const OUString& encoding)
: GenericDialogController(pParent, "writerperfect/ui/wpftencodingdialog.ui",
"WPFTEncodingDialog")
, m_userHasCancelled(false)
, m_xLbCharset(m_xBuilder->weld_combo_box_text("comboboxtext"))
, m_xBtnOk(m_xBuilder->weld_button("ok"))
, m_xBtnCancel(m_xBuilder->weld_button("cancel"))
{
get(m_pLbCharset, "comboboxtext");
get(m_pBtnOk, "ok");
get(m_pBtnCancel, "cancel");
m_xBtnCancel->connect_clicked(LINK(this, WPFTEncodingDialog, CancelHdl));
m_pBtnCancel->SetClickHdl(LINK(this, WPFTEncodingDialog, CancelHdl));
insertEncodings(*m_xLbCharset);
m_xLbCharset->make_sorted();
selectEncoding(*m_xLbCharset, encoding);
insertEncodings(m_pLbCharset);
m_pLbCharset->SetStyle(m_pLbCharset->GetStyle() | WB_SORT);
// m_pLbCharset->set_height_request(6 * m_pLbCharset->GetTextHeight());
m_pLbCharset->SetDoubleClickHdl(LINK(this, WPFTEncodingDialog, DoubleClickHdl));
selectEncoding(m_pLbCharset, encoding);
m_pLbCharset->Show();
SetText(title);
m_xDialog->set_title(title);
}
WPFTEncodingDialog::~WPFTEncodingDialog() { disposeOnce(); }
WPFTEncodingDialog::~WPFTEncodingDialog() {}
OUString WPFTEncodingDialog::GetEncoding() const { return getEncoding(m_pLbCharset); }
OUString WPFTEncodingDialog::GetEncoding() const { return getEncoding(*m_xLbCharset); }
IMPL_LINK_NOARG(WPFTEncodingDialog, CancelHdl, Button*, void)
IMPL_LINK_NOARG(WPFTEncodingDialog, CancelHdl, weld::Button&, void)
{
m_userHasCancelled = true;
Close();
}
IMPL_LINK(WPFTEncodingDialog, DoubleClickHdl, ListBox&, rLb, void)
{
if (&rLb == m_pLbCharset)
{
m_pBtnOk->Click();
}
}
void WPFTEncodingDialog::dispose()
{
m_pLbCharset.disposeAndClear();
m_pBtnOk.disposeAndClear();
m_pBtnCancel.disposeAndClear();
ModalDialog::dispose();
m_xDialog->response(RET_CANCEL);
}
}
......
......@@ -24,7 +24,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool CDRImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool CDRImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libcdr::CDRDocument::parse(&rInput, &rGenerator);
......
......@@ -33,8 +33,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -24,7 +24,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool CMXImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool CMXImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libcdr::CMXDocument::parse(&rInput, &rGenerator);
......
......@@ -33,8 +33,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool FreehandImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool FreehandImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libfreehand::FreeHandDocument::parse(&rInput, &rGenerator);
......
......@@ -30,8 +30,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool MSPUBImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MSPUBImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libmspub::MSPUBDocument::parse(&rInput, &rGenerator);
......
......@@ -30,8 +30,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -40,7 +40,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
return MWAWDocument::decodeSpreadsheet(data, &exporter);
}
bool MWAWDrawImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MWAWDrawImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
};
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool PageMakerImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool PageMakerImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libpagemaker::PMDocument::parse(&rInput, &rGenerator);
......
......@@ -31,8 +31,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool QXPImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool QXPImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libqxp::QXPDocument::parse(&rInput, &rGenerator) == libqxp::QXPDocument::RESULT_OK;
......
......@@ -30,8 +30,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -38,7 +38,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
return STOFFDocument::decodeSpreadsheet(data, &exporter);
}
bool StarOfficeDrawImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool StarOfficeDrawImportFilter::doImportDocument(weld::Window*,
librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator);
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
};
......
......@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool VisioImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool VisioImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libvisio::VisioDocument::parse(&rInput, &rGenerator);
......
......@@ -30,8 +30,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -27,7 +27,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool WPGImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool WPGImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libwpg::WPGraphics::parse(&rInput, &rGenerator);
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool ZMFImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool ZMFImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&)
{
return libzmf::ZMFDocument::parse(&rInput, &rGenerator);
......
......@@ -30,8 +30,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdgGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -48,7 +48,7 @@ using writerperfect::WPXSvInputStream;
namespace beans = com::sun::star::beans;
namespace ucb = com::sun::star::ucb;
bool KeynoteImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool KeynoteImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator, utl::MediaDescriptor&)
{
return libetonyek::EtonyekDocument::parse(&rInput, &rGenerator);
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -40,7 +40,8 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
return MWAWDocument::decodeSpreadsheet(data, &exporter);
}
bool MWAWPresentationImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MWAWPresentationImportFilter::doImportDocument(weld::Window*,
librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator, utl::MediaDescriptor&)
{
return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
};
......
......@@ -38,7 +38,8 @@ static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryDat
return STOFFDocument::decodeSpreadsheet(data, &exporter);
}
bool StarOfficePresentationImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool StarOfficePresentationImportFilter::doImportDocument(weld::Window*,
librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator,
utl::MediaDescriptor&)
{
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdpGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
};
......
......@@ -20,7 +20,7 @@ using com::sun::star::uno::Sequence;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
bool AbiWordImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool AbiWordImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
return libabw::AbiDocument::parse(&rInput, &rGenerator);
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
};
#endif
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
using libebook::EBOOKDocument;
bool EBookImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool EBookImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor)
{
......
......@@ -35,7 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
};
......
......@@ -32,7 +32,8 @@ static bool handleEmbeddedWKSObject(const librevenge::RVNGBinaryData& data,
return libwps::WPSDocument::parse(data.getDataStream(), &exporter) == libwps::WPS_OK;
}
bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MSWorksImportFilter::doImportDocument(weld::Window* pParent,
librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
libwps::WPSKind kind = libwps::WPS_TEXT;
......@@ -69,14 +70,14 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
break;
}
const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
if (pDlg->Execute() == RET_OK)
writerperfect::WPFTEncodingDialog aDlg(pParent, title, encoding);
if (aDlg.run() == RET_OK)
{
if (!pDlg->GetEncoding().isEmpty())
fileEncoding = pDlg->GetEncoding().toUtf8().getStr();
if (!aDlg.GetEncoding().isEmpty())
fileEncoding = aDlg.GetEncoding().toUtf8().getStr();
}
// we can fail because we are in headless mode, the user has cancelled conversion, ...
else if (pDlg->hasUserCalledCancel())
else if (aDlg.hasUserCalledCancel())
return false;
}
}
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
};
......
......@@ -39,7 +39,7 @@ static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData
return MWAWDocument::decodeSpreadsheet(data, &exporter);
}
bool MWAWImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool MWAWImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
......
......@@ -35,8 +35,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
};
......
......@@ -22,7 +22,7 @@ using com::sun::star::uno::XInterface;
using libetonyek::EtonyekDocument;
bool PagesImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool PagesImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
return EtonyekDocument::parse(&rInput, &rGenerator);
......
......@@ -34,7 +34,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator,
utl::MediaDescriptor& rDescriptor) override;
};
......
......@@ -40,7 +40,8 @@ static bool handleEmbeddedSTOFFWriterSpreadsheetObject(const librevenge::RVNGBin
return STOFFDocument::decodeSpreadsheet(data, &exporter);
}
bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream& rInput,
bool StarOfficeWriterImportFilter::doImportDocument(weld::Window* pParent,
librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&)
{
STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
......@@ -52,7 +53,7 @@ bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream&
// try to ask for a password
try
{
SfxPasswordDialog aPasswdDlg(nullptr);
SfxPasswordDialog aPasswdDlg(pParent);
aPasswdDlg.SetMinLen(0);
if (!aPasswdDlg.execute())
return false;
......
......@@ -36,8 +36,8 @@ public:
private:
virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override;
virtual bool doImportDocument(librevenge::RVNGInputStream& rInput, OdtGenerator& rGenerator,
utl::MediaDescriptor&) override;
virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
OdtGenerator& rGenerator, utl::MediaDescriptor&) override;
virtual void doRegisterHandlers(OdtGenerator& rGenerator) override;
};
......
......@@ -11,6 +11,7 @@
#include <osl/diagnose.h>
#include <rtl/tencinfo.h>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/io/XSeekable.hpp>
......@@ -42,6 +43,7 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::XInterface;
using com::sun::star::awt::XWindow;
using com::sun::star::document::XImporter;
using com::sun::star::io::XInputStream;
using com::sun::star::xml::sax::XDocumentHandler;
......@@ -92,10 +94,13 @@ bool WordPerfectImportFilter::importImpl(const Sequence<css::beans::PropertyValu
sal_Int32 nLength = aDescriptor.getLength();
const PropertyValue* pValue = aDescriptor.getConstArray();
Reference<XInputStream> xInputStream;
Reference<XWindow> xDialogParent;
for (sal_Int32 i = 0; i < nLength; i++)
{
if (pValue[i].Name == "InputStream")
pValue[i].Value >>= xInputStream;
else if (pValue[i].Name == "ParentWindow")
pValue[i].Value >>= xDialogParent;
}
if (!xInputStream.is())
{
......@@ -114,7 +119,7 @@ bool WordPerfectImportFilter::importImpl(const Sequence<css::beans::PropertyValu
int unsuccessfulAttempts = 0;
while (true)
{
SfxPasswordDialog aPasswdDlg(nullptr);
SfxPasswordDialog aPasswdDlg(Application::GetFrameWeld(xDialogParent));
aPasswdDlg.SetMinLen(0);
if (!aPasswdDlg.execute())
return false;
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="wpt">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="WPFTEncodingDialog">
......@@ -7,8 +7,12 @@
<property name="border_width">6</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_height">-1</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -72,6 +76,7 @@
</child>
<child>
<object class="GtkComboBoxText" id="comboboxtext">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment