diff options
Diffstat (limited to 'writerperfect/source/writer')
4 files changed, 32 insertions, 4 deletions
diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx index c0e316e1f32a..acc1f9a9182d 100644 --- a/writerperfect/source/writer/EPUBExportDialog.cxx +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -9,6 +9,8 @@ #include "EPUBExportDialog.hxx" +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <sfx2/opengrf.hxx> #include "EPUBExportFilter.hxx" @@ -63,8 +65,9 @@ sal_Int32 PositionToVersion(sal_Int32 nPosition) namespace writerperfect { -EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData) +EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, const uno::Reference<uno::XComponentContext> &xContext) : ModalDialog(pParent, "EpubDialog", "writerperfect/ui/exportepub.ui"), + mxContext(xContext), mrFilterData(rFilterData) { get(m_pVersion, "versionlb"); @@ -98,6 +101,11 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH get(m_pCoverButton, "coverbutton"); m_pCoverButton->SetClickHdl(LINK(this, EPUBExportDialog, CoverClickHdl)); + get(m_pMediaDir, "mediadir"); + + get(m_pMediaButton, "mediabutton"); + m_pMediaButton->SetClickHdl(LINK(this, EPUBExportDialog, MediaClickHdl)); + get(m_pIdentifier, "identifier"); get(m_pTitle, "title"); get(m_pInitialCreator, "author"); @@ -128,11 +136,22 @@ IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, Button *, void) m_pCoverPath->SetText(aDlg.GetPath()); } +IMPL_LINK_NOARG(EPUBExportDialog, MediaClickHdl, Button *, void) +{ + uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(mxContext); + if (xFolderPicker->execute() != ui::dialogs::ExecutableDialogResults::OK) + return; + + m_pMediaDir->SetText(xFolderPicker->getDirectory()); +} + IMPL_LINK_NOARG(EPUBExportDialog, OKClickHdl, Button *, void) { // General if (!m_pCoverPath->GetText().isEmpty()) mrFilterData["RVNGCoverImage"] <<= m_pCoverPath->GetText(); + if (!m_pMediaDir->GetText().isEmpty()) + mrFilterData["RVNGMediaDir"] <<= m_pMediaDir->GetText(); // Metadata if (!m_pIdentifier->GetText().isEmpty()) @@ -166,6 +185,8 @@ void EPUBExportDialog::dispose() m_pInitialCreator.clear(); m_pLanguage.clear(); m_pDate.clear(); + m_pMediaDir.clear(); + m_pMediaButton.clear(); ModalDialog::dispose(); } diff --git a/writerperfect/source/writer/EPUBExportDialog.hxx b/writerperfect/source/writer/EPUBExportDialog.hxx index 4ff67ee6f5e5..1181d096bd03 100644 --- a/writerperfect/source/writer/EPUBExportDialog.hxx +++ b/writerperfect/source/writer/EPUBExportDialog.hxx @@ -23,7 +23,7 @@ namespace writerperfect class EPUBExportDialog : public ModalDialog { public: - EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData); + EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsHashMap &rFilterData, const css::uno::Reference<css::uno::XComponentContext> &xContext); ~EPUBExportDialog() override; void dispose() override; @@ -31,13 +31,17 @@ private: DECL_LINK(VersionSelectHdl, ListBox &, void); DECL_LINK(SplitSelectHdl, ListBox &, void); DECL_LINK(CoverClickHdl, Button *, void); + DECL_LINK(MediaClickHdl, Button *, void); DECL_LINK(OKClickHdl, Button *, void); + css::uno::Reference<css::uno::XComponentContext> mxContext; comphelper::SequenceAsHashMap &mrFilterData; VclPtr<ListBox> m_pVersion; VclPtr<ListBox> m_pSplit; VclPtr<Edit> m_pCoverPath; VclPtr<PushButton> m_pCoverButton; + VclPtr<Edit> m_pMediaDir; + VclPtr<PushButton> m_pMediaButton; VclPtr<PushButton> m_pOKButton; VclPtr<Edit> m_pIdentifier; VclPtr<Edit> m_pTitle; diff --git a/writerperfect/source/writer/EPUBExportUIComponent.cxx b/writerperfect/source/writer/EPUBExportUIComponent.cxx index b38ebf799859..b6fe80ff3604 100644 --- a/writerperfect/source/writer/EPUBExportUIComponent.cxx +++ b/writerperfect/source/writer/EPUBExportUIComponent.cxx @@ -23,7 +23,8 @@ using namespace com::sun::star; namespace writerperfect { -EPUBExportUIComponent::EPUBExportUIComponent(const uno::Reference<uno::XComponentContext> &/*xContext*/) +EPUBExportUIComponent::EPUBExportUIComponent(const uno::Reference<uno::XComponentContext> &xContext) + : mxContext(xContext) { } @@ -76,7 +77,7 @@ sal_Int16 EPUBExportUIComponent::execute() { SolarMutexGuard aGuard; - ScopedVclPtrInstance<EPUBExportDialog> pDialog(Application::GetDefDialogParent(), maFilterData); + ScopedVclPtrInstance<EPUBExportDialog> pDialog(Application::GetDefDialogParent(), maFilterData, mxContext); if (pDialog->Execute() == RET_OK) return ui::dialogs::ExecutableDialogResults::OK; return ui::dialogs::ExecutableDialogResults::CANCEL; diff --git a/writerperfect/source/writer/EPUBExportUIComponent.hxx b/writerperfect/source/writer/EPUBExportUIComponent.hxx index f20adfd2d997..243e1f8a61fb 100644 --- a/writerperfect/source/writer/EPUBExportUIComponent.hxx +++ b/writerperfect/source/writer/EPUBExportUIComponent.hxx @@ -52,6 +52,8 @@ private: comphelper::SequenceAsHashMap maMediaDescriptor; /// The filter data key. comphelper::SequenceAsHashMap maFilterData; + /// UNO context. + css::uno::Reference<css::uno::XComponentContext> mxContext; }; } // namespace writerperfect |