[Libreoffice-commits] core.git: include/writerperfect writerperfect/source

Stephan Bergmann sbergman at redhat.com
Tue May 19 01:36:04 PDT 2015


 include/writerperfect/WPFTEncodingDialog.hxx          |    4 ---
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx |    2 -
 writerperfect/source/common/WPFTEncodingDialog.cxx    |   20 ++++++------------
 writerperfect/source/writer/MSWorksImportFilter.cxx   |    5 +---
 4 files changed, 11 insertions(+), 20 deletions(-)

New commits:
commit de323517555bdb812c65112f6f091f4f6f6c0b93
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue May 19 10:35:35 2015 +0200

    Clean up WPFTEncodingDialog ctor params
    
    Change-Id: I28304671deb4e619e76f9ad5d8a2f9a9ec3a0d4f

diff --git a/include/writerperfect/WPFTEncodingDialog.hxx b/include/writerperfect/WPFTEncodingDialog.hxx
index ebc5355..ff35db1 100644
--- a/include/writerperfect/WPFTEncodingDialog.hxx
+++ b/include/writerperfect/WPFTEncodingDialog.hxx
@@ -25,9 +25,7 @@ namespace writerperfect {
 class WRITERPERFECT_DLLPUBLIC WPFTEncodingDialog : public ModalDialog
 {
 public:
-    WPFTEncodingDialog( vcl::Window*                 pParent,
-                  const OUString*         pStrTitle = 0,
-                  const OUString*         defEncoding = 0);
+    WPFTEncodingDialog( const OUString& title, const OUString& defEncoding);
 
     virtual ~WPFTEncodingDialog();
 
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
index 8d7dc75..f1363a5 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -58,7 +58,7 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream &rInp
         }
         try
         {
-            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(nullptr, &title, &encoding);
+            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(title, encoding);
             if (pDlg->Execute() == RET_OK)
             {
                 if (!pDlg->GetEncoding().isEmpty())
diff --git a/writerperfect/source/common/WPFTEncodingDialog.cxx b/writerperfect/source/common/WPFTEncodingDialog.cxx
index 4c69a77..1e35993 100644
--- a/writerperfect/source/common/WPFTEncodingDialog.cxx
+++ b/writerperfect/source/common/WPFTEncodingDialog.cxx
@@ -32,7 +32,7 @@ struct EncodingImplementation
 
     static int numEncodings();
     static void insertEncodings(ListBox *box);
-    static void selectEncoding(ListBox *box, const OUString *encoding);
+    static void selectEncoding(ListBox *box, const OUString &encoding);
     static OUString getEncoding(ListBox *box);
 };
 
@@ -99,14 +99,12 @@ void EncodingImplementation::insertEncodings(ListBox *box)
     }
 }
 
-void EncodingImplementation::selectEncoding(ListBox *box, const OUString *encoding)
+void EncodingImplementation::selectEncoding(ListBox *box, const OUString &encoding)
 {
-    if (!encoding)
-        return;
     sal_IntPtr num=sal_IntPtr(numEncodings());
     for (sal_IntPtr i=0; i<num; ++i)
     {
-        if (*encoding!=s_encodings[2*i]) continue;
+        if (encoding!=s_encodings[2*i]) continue;
         box->SelectEntryPos(i);
         return;
     }
@@ -123,10 +121,8 @@ OUString EncodingImplementation::getEncoding(ListBox *box)
 }
 
 WPFTEncodingDialog::WPFTEncodingDialog(
-    vcl::Window                 *pParent,
-    const OUString         *pStrTitle,
-    const OUString *encoding)
-    :   ModalDialog(pParent, "WPFTEncodingDialog", "writerperfect/ui/wpftencodingdialog.ui"),
+    const OUString &title, const OUString &encoding)
+    :   ModalDialog(nullptr, "WPFTEncodingDialog", "writerperfect/ui/wpftencodingdialog.ui"),
         m_pLbCharset(), m_pBtnOk(), m_pBtnCancel(), m_userHasCancelled(false)
 {
     get(m_pLbCharset, "comboboxtext");
@@ -139,12 +135,10 @@ WPFTEncodingDialog::WPFTEncodingDialog(
     m_pLbCharset->SetStyle(m_pLbCharset->GetStyle() | WB_SORT);
     // m_pLbCharset->set_height_request(6 * m_pLbCharset->GetTextHeight());
     m_pLbCharset->SetDoubleClickHdl(LINK(this, WPFTEncodingDialog, DoubleClickHdl));
-    if (encoding)
-        EncodingImplementation::selectEncoding(m_pLbCharset, encoding);
+    EncodingImplementation::selectEncoding(m_pLbCharset, encoding);
     m_pLbCharset->Show();
 
-    if (pStrTitle)
-        SetText(*pStrTitle);
+    SetText(title);
 }
 
 WPFTEncodingDialog::~WPFTEncodingDialog()
diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx
index d5e0947..ddfd785 100644
--- a/writerperfect/source/writer/MSWorksImportFilter.cxx
+++ b/writerperfect/source/writer/MSWorksImportFilter.cxx
@@ -45,9 +45,8 @@ bool MSWorksImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput,
     {
         if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT) && needEncoding)
         {
-            OUString title("Import MsWorks files(libwps)");
-            OUString encoding("CP850");
-            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(nullptr, &title, &encoding);
+            const ScopedVclPtrInstance<writerperfect::WPFTEncodingDialog> pDlg(
+                "Import MsWorks files(libwps)", "CP850");
             if (pDlg->Execute() == RET_OK)
             {
                 if (!pDlg->GetEncoding().isEmpty())


More information about the Libreoffice-commits mailing list