diff options
-rw-r--r-- | writerperfect/qa/uitest/epubexport/epubexport.py | 14 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportDialog.cxx | 29 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportDialog.hxx | 7 | ||||
-rw-r--r-- | writerperfect/uiconfig/ui/exportepub.ui | 73 |
4 files changed, 123 insertions, 0 deletions
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py index 4dfeed19e617..aaac6759adac 100644 --- a/writerperfect/qa/uitest/epubexport/epubexport.py +++ b/writerperfect/qa/uitest/epubexport/epubexport.py @@ -69,4 +69,18 @@ class EPUBExportTest(UITestCase): # Make sure that initializing with 2 different versions results in 2 different widget states. self.assertEqual(2, len(set(positions))) + def testCoverImage(self): + def handleDialog(dialog): + dialog.getChild("coverpath").executeAction("TYPE", mkPropertyValues({"TEXT": "cover.png"})) + dialog.getChild("ok").executeAction("CLICK", tuple()) + + uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext("com.sun.star.comp.Writer.EPUBExportUIComponent", self.ui_test._xContext) + + self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog) + propertyValues = uiComponent.getPropertyValues() + filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0] + # The EPUBCoverImage key was missing, EPUBExportDialog::OKClickHdl() did not set it. + coverImage = [i.Value for i in filterData if i.Name == "EPUBCoverImage"][0] + self.assertEqual("cover.png", coverImage) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx index 23faa939db31..5c0eb9d1e930 100644 --- a/writerperfect/source/writer/EPUBExportDialog.cxx +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -9,6 +9,8 @@ #include "EPUBExportDialog.hxx" +#include <sfx2/opengrf.hxx> + #include "EPUBExportFilter.hxx" using namespace com::sun::star; @@ -90,6 +92,14 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH else m_pSplit->SelectEntryPos(EPUBExportFilter::GetDefaultSplitMethod()); m_pSplit->SetSelectHdl(LINK(this, EPUBExportDialog, SplitSelectHdl)); + + get(m_pCoverPath, "coverpath"); + + get(m_pCoverButton, "coverbutton"); + m_pCoverButton->SetClickHdl(LINK(this, EPUBExportDialog, CoverClickHdl)); + + get(m_pOKButton, "ok"); + m_pOKButton->SetClickHdl(LINK(this, EPUBExportDialog, OKClickHdl)); } IMPL_LINK_NOARG(EPUBExportDialog, VersionSelectHdl, ListBox &, void) @@ -104,6 +114,22 @@ IMPL_LINK_NOARG(EPUBExportDialog, SplitSelectHdl, ListBox &, void) mrFilterData["EPUBSplitMethod"] <<= m_pSplit->GetSelectedEntryPos(); } +IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, Button *, void) +{ + SvxOpenGraphicDialog aDlg("Import", this); + aDlg.EnableLink(false); + if (aDlg.Execute() == ERRCODE_NONE) + m_pCoverPath->SetText(aDlg.GetPath()); +} + +IMPL_LINK_NOARG(EPUBExportDialog, OKClickHdl, Button *, void) +{ + if (!m_pCoverPath->GetText().isEmpty()) + mrFilterData["EPUBCoverImage"] <<= m_pCoverPath->GetText(); + + EndDialog(RET_OK); +} + EPUBExportDialog::~EPUBExportDialog() { disposeOnce(); @@ -113,6 +139,9 @@ void EPUBExportDialog::dispose() { m_pVersion.clear(); m_pSplit.clear(); + m_pCoverPath.clear(); + m_pCoverButton.clear(); + m_pOKButton.clear(); ModalDialog::dispose(); } diff --git a/writerperfect/source/writer/EPUBExportDialog.hxx b/writerperfect/source/writer/EPUBExportDialog.hxx index bc8e2ed878ce..e211ca3340c7 100644 --- a/writerperfect/source/writer/EPUBExportDialog.hxx +++ b/writerperfect/source/writer/EPUBExportDialog.hxx @@ -11,7 +11,9 @@ #define INCLUDED_WRITERPERFECT_SOURCE_WRITER_EPUBEXPORTDIALOG_HXX #include <comphelper/sequenceashashmap.hxx> +#include <vcl/button.hxx> #include <vcl/dialog.hxx> +#include <vcl/edit.hxx> #include <vcl/lstbox.hxx> namespace writerperfect @@ -28,10 +30,15 @@ public: private: DECL_LINK(VersionSelectHdl, ListBox &, void); DECL_LINK(SplitSelectHdl, ListBox &, void); + DECL_LINK(CoverClickHdl, Button *, void); + DECL_LINK(OKClickHdl, Button *, void); comphelper::SequenceAsHashMap &mrFilterData; VclPtr<ListBox> m_pVersion; VclPtr<ListBox> m_pSplit; + VclPtr<Edit> m_pCoverPath; + VclPtr<PushButton> m_pCoverButton; + VclPtr<PushButton> m_pOKButton; }; } // namespace writerperfect diff --git a/writerperfect/uiconfig/ui/exportepub.ui b/writerperfect/uiconfig/ui/exportepub.ui index 20be5d41a52b..e6476ba947c0 100644 --- a/writerperfect/uiconfig/ui/exportepub.ui +++ b/writerperfect/uiconfig/ui/exportepub.ui @@ -177,6 +177,79 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="coverimageft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">6</property> + <property name="label" translatable="yes" context="exportepub|coverimageft">Custom cover image:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">versionlb</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkEntry" id="coverpath"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="coverbutton"> + <property name="label" translatable="yes" context="exportepub|coverbutton">Browse...</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> </object> </child> <action-widgets> |