[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - sfx2/inc sfx2/source

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 17 14:42:20 UTC 2019


 sfx2/inc/autoredactdialog.hxx          |   15 ++++++---------
 sfx2/source/doc/SfxRedactionHelper.cxx |    2 ++
 sfx2/source/doc/autoredactdialog.cxx   |   25 ++++++++-----------------
 sfx2/source/doc/objserv.cxx            |    2 +-
 4 files changed, 17 insertions(+), 27 deletions(-)

New commits:
commit 372676e1bb5cc951240b8801b7e9791899b8202a
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Fri Jun 28 20:18:50 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Aug 17 16:41:50 2019 +0200

    Fix undefined reference to static constexpr for pre-C++17
    
    Change-Id: I451dba37688441f26aa48e62b1baa3aa24678073
    Reviewed-on: https://gerrit.libreoffice.org/77168
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Tested-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/sfx2/source/doc/SfxRedactionHelper.cxx b/sfx2/source/doc/SfxRedactionHelper.cxx
index 6fff84c6b5da..fb3181db898b 100644
--- a/sfx2/source/doc/SfxRedactionHelper.cxx
+++ b/sfx2/source/doc/SfxRedactionHelper.cxx
@@ -60,6 +60,8 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 
+constexpr OUStringLiteral SfxRedactionHelper::m_aPredefinedTargets[6];
+
 bool SfxRedactionHelper::isRedactMode(const SfxRequest& rReq)
 {
     const SfxItemSet* pArgs = rReq.GetArgs();
commit 35913ab8151eb084c00d099aefc3112eb2c146e5
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Tue Jun 18 21:04:26 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Aug 17 16:41:30 2019 +0200

    Copy targets instead of moving during redaction
    
    To allow properly remembering the last state.
    
    * And some clean-up.
    
    Change-Id: Id0b0f4251e3578b8baced1e6e6b1161f46e324dc
    Reviewed-on: https://gerrit.libreoffice.org/74302
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/77167
    Tested-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/sfx2/inc/autoredactdialog.hxx b/sfx2/inc/autoredactdialog.hxx
index 2cec20cc64c8..92010071b185 100644
--- a/sfx2/inc/autoredactdialog.hxx
+++ b/sfx2/inc/autoredactdialog.hxx
@@ -106,6 +106,7 @@ class SFX2_DLLPUBLIC SfxAutoRedactDialog : public SfxDialogController
     std::vector<std::pair<RedactionTarget*, OUString>> m_aTableTargets;
     std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
     bool m_bIsValidState;
+    bool m_bTargetsCopied;
 
     std::unique_ptr<weld::Label> m_xRedactionTargetsLabel;
     std::unique_ptr<TargetsTable> m_xTargetsBox;
@@ -138,16 +139,12 @@ public:
     bool hasTargets() const;
     /// Check if the dialog is in a valid state.
     bool isValidState() const { return m_bIsValidState; }
-    /** Literally moves targets into the given vector.
-     *  At the end of the operation, m_aTableTargets vector becomes empty.
-     *  The contents of the given vector will be erased before being filled in.
-     *  Returns true if successfull.
-     */
-    bool moveTargets(std::vector<std::pair<RedactionTarget*, OUString>>& r_aTargets);
 
-    // TODO: Some method(s) to check emptiness/validity
-    // TODO: Some method(s) to get the search params/objects
-    // TODO: Some method(s) to load/save redaction target sets
+    /** Copies targets vector
+     *  Does a shallow copy.
+     *  Returns true if successful.
+     */
+    bool getTargets(std::vector<std::pair<RedactionTarget*, OUString>>& r_aTargets);
 };
 
 class SfxAddTargetDialog : public weld::GenericDialogController
diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx
index 90ceb3941962..692bce0080b9 100644
--- a/sfx2/source/doc/autoredactdialog.cxx
+++ b/sfx2/source/doc/autoredactdialog.cxx
@@ -545,6 +545,7 @@ void SfxAutoRedactDialog::clearTargets()
 SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* pParent)
     : SfxDialogController(pParent, "sfx/ui/autoredactdialog.ui", "AutoRedactDialog")
     , m_bIsValidState(true)
+    , m_bTargetsCopied(false)
     , m_xRedactionTargetsLabel(m_xBuilder->weld_label("labelRedactionTargets"))
     , m_xTargetsBox(new TargetsTable(m_xBuilder->weld_tree_view("targets")))
     , m_xLoadBtn(m_xBuilder->weld_button("btnLoadTargets"))
@@ -636,7 +637,8 @@ SfxAutoRedactDialog::~SfxAutoRedactDialog()
                                OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
         aDlgOpt.SetUserItem("UserItem", css::uno::makeAny(sUserDataStr));
 
-        clearTargets();
+        if (!m_bTargetsCopied)
+            clearTargets();
     }
     catch (css::uno::Exception& e)
     {
@@ -656,24 +658,13 @@ bool SfxAutoRedactDialog::hasTargets() const
     return true;
 }
 
-bool SfxAutoRedactDialog::moveTargets(
-    std::vector<std::pair<RedactionTarget*, OUString>>& r_aTargets)
+bool SfxAutoRedactDialog::getTargets(std::vector<std::pair<RedactionTarget*, OUString>>& r_aTargets)
 {
-    try
-    {
-        r_aTargets.clear();
-        r_aTargets.insert(r_aTargets.end(), std::make_move_iterator(m_aTableTargets.begin()),
-                          std::make_move_iterator(m_aTableTargets.end()));
-        m_aTableTargets.clear();
-        m_bIsValidState = false;
-    }
-    catch (const css::uno::Exception& e)
-    {
-        SAL_WARN("sfx.doc", "Exception caught while moving redaction targets: " << e.Message);
-        m_bIsValidState = false;
-        return false;
-    }
+    if (m_aTableTargets.empty())
+        return true;
 
+    r_aTargets = m_aTableTargets;
+    m_bTargetsCopied = true;
     return true;
 }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 691d01f62a46..3c8fd76ce3b5 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -548,7 +548,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
             // else continue with normal redaction
             bIsAutoRedact = true;
-            aDlg.moveTargets(aRedactionTargets);
+            aDlg.getTargets(aRedactionTargets);
 
             [[fallthrough]];
         }


More information about the Libreoffice-commits mailing list