diff options
-rw-r--r-- | writerperfect/qa/uitest/epubexport/epubexport.py | 16 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportDialog.cxx | 24 | ||||
-rw-r--r-- | writerperfect/source/writer/EPUBExportDialog.hxx | 2 | ||||
-rw-r--r-- | writerperfect/uiconfig/ui/exportepub.ui | 57 |
4 files changed, 96 insertions, 3 deletions
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py index 301f090e3362..b8e7d3f52fd9 100644 --- a/writerperfect/qa/uitest/epubexport/epubexport.py +++ b/writerperfect/qa/uitest/epubexport/epubexport.py @@ -97,6 +97,22 @@ class EPUBExportTest(UITestCase): mediaDir = [i.Value for i in filterData if i.Name == "RVNGMediaDir"][0] self.assertEqual("file:///foo/bar", mediaDir) + def testFixedLayout(self): + def handleDialog(dialog): + # Select the second entry to request fixed, not reflowable layout. + dialog.getChild("layoutlb").executeAction("SELECT", mkPropertyValues({"POS": "1"})) + 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 EPUBLayoutMethod key was missing, EPUBExportDialog::OKClickHdl() did not set it. + layout = [i.Value for i in filterData if i.Name == "EPUBLayoutMethod"][0] + # 1 stands for libepubgen::EPUB_LAYOUT_METHOD_FIXED. + self.assertEqual(1, layout) + def testMeta(self): def handleDialog(dialog): dialog.getChild("identifier").executeAction("TYPE", mkPropertyValues({"TEXT": "baddcafe-e394-4cd6-9b83-7172794612e5"})) diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx index acc1f9a9182d..232ca4128fec 100644 --- a/writerperfect/source/writer/EPUBExportDialog.cxx +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -90,12 +90,26 @@ EPUBExportDialog::EPUBExportDialog(vcl::Window *pParent, comphelper::SequenceAsH if (it->second >>= nSplitMethod) // No conversion, 1:1 mapping between libepubgen::EPUBSplitMethod // and entry positions. - m_pVersion->SelectEntryPos(nSplitMethod); + m_pSplit->SelectEntryPos(nSplitMethod); } else m_pSplit->SelectEntryPos(EPUBExportFilter::GetDefaultSplitMethod()); m_pSplit->SetSelectHdl(LINK(this, EPUBExportDialog, SplitSelectHdl)); + get(m_pLayout, "layoutlb"); + it = rFilterData.find("EPUBLayoutMethod"); + if (it != rFilterData.end()) + { + sal_Int32 nLayoutMethod = 0; + if (it->second >>= nLayoutMethod) + // No conversion, 1:1 mapping between libepubgen::EPUBLayoutMethod + // and entry positions. + m_pLayout->SelectEntryPos(nLayoutMethod); + } + else + m_pLayout->SelectEntryPos(EPUBExportFilter::GetDefaultLayoutMethod()); + m_pLayout->SetSelectHdl(LINK(this, EPUBExportDialog, LayoutSelectHdl)); + get(m_pCoverPath, "coverpath"); get(m_pCoverButton, "coverbutton"); @@ -128,6 +142,13 @@ IMPL_LINK_NOARG(EPUBExportDialog, SplitSelectHdl, ListBox &, void) mrFilterData["EPUBSplitMethod"] <<= m_pSplit->GetSelectedEntryPos(); } +IMPL_LINK_NOARG(EPUBExportDialog, LayoutSelectHdl, ListBox &, void) +{ + // No conversion, 1:1 mapping between entry positions and + // libepubgen::EPUBLayoutMethod. + mrFilterData["EPUBLayoutMethod"] <<= m_pLayout->GetSelectedEntryPos(); +} + IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, Button *, void) { SvxOpenGraphicDialog aDlg("Import", this); @@ -187,6 +208,7 @@ void EPUBExportDialog::dispose() m_pDate.clear(); m_pMediaDir.clear(); m_pMediaButton.clear(); + m_pLayout.clear(); ModalDialog::dispose(); } diff --git a/writerperfect/source/writer/EPUBExportDialog.hxx b/writerperfect/source/writer/EPUBExportDialog.hxx index 1181d096bd03..aafdbbb35105 100644 --- a/writerperfect/source/writer/EPUBExportDialog.hxx +++ b/writerperfect/source/writer/EPUBExportDialog.hxx @@ -30,6 +30,7 @@ public: private: DECL_LINK(VersionSelectHdl, ListBox &, void); DECL_LINK(SplitSelectHdl, ListBox &, void); + DECL_LINK(LayoutSelectHdl, ListBox &, void); DECL_LINK(CoverClickHdl, Button *, void); DECL_LINK(MediaClickHdl, Button *, void); DECL_LINK(OKClickHdl, Button *, void); @@ -38,6 +39,7 @@ private: comphelper::SequenceAsHashMap &mrFilterData; VclPtr<ListBox> m_pVersion; VclPtr<ListBox> m_pSplit; + VclPtr<ListBox> m_pLayout; VclPtr<Edit> m_pCoverPath; VclPtr<PushButton> m_pCoverButton; VclPtr<Edit> m_pMediaDir; diff --git a/writerperfect/uiconfig/ui/exportepub.ui b/writerperfect/uiconfig/ui/exportepub.ui index 3d7c28af73be..da0124161652 100644 --- a/writerperfect/uiconfig/ui/exportepub.ui +++ b/writerperfect/uiconfig/ui/exportepub.ui @@ -207,6 +207,59 @@ </packing> </child> <child> + <object class="GtkAlignment" id="alignment6"> + <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="box10"> + <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="layoutft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">6</property> + <property name="label" translatable="yes" context="exportepub|layoutft">Layout method:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">layoutlb</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="layoutlb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="active">0</property> + <items> + <item translatable="yes" context="exportepub|layoutreflowable">Reflowable</item> + <item translatable="yes" context="exportepub|layoutfixed">Fixed</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -276,7 +329,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -349,7 +402,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> </object> |