diff options
author | Muhammet Kara <muhammet.kara@collabora.com> | 2019-06-15 12:08:35 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2019-06-16 01:26:32 +0200 |
commit | b61a1ca837223ba9d7da1aa8936f228d89bde60a (patch) | |
tree | 42761ab146613e8b35365f2d1502e7b2b9b39056 /sfx2/inc | |
parent | b674d3c12a5819fbcb551e83bf6862afc85ef7f3 (diff) |
Add predefined targets to auto redaction
Change-Id: Ib8cf8b50944667d6a87a5cafb6995ad195699358
Reviewed-on: https://gerrit.libreoffice.org/74092
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'sfx2/inc')
-rw-r--r-- | sfx2/inc/SfxRedactionHelper.hxx | 14 | ||||
-rw-r--r-- | sfx2/inc/autoredactdialog.hxx | 7 |
2 files changed, 20 insertions, 1 deletions
diff --git a/sfx2/inc/SfxRedactionHelper.hxx b/sfx2/inc/SfxRedactionHelper.hxx index 2f470386d2dc..ae72c39f4886 100644 --- a/sfx2/inc/SfxRedactionHelper.hxx +++ b/sfx2/inc/SfxRedactionHelper.hxx @@ -120,6 +120,20 @@ public: /// Fill the search options based on the given redaction target static void fillSearchOptions(i18nutil::SearchOptions2& rSearchOpt, const RedactionTarget* pTarget); + +private: + static constexpr OUStringLiteral m_aPredefinedTargets[6] = { + "\\b(?:\\d[ -]*?){13,16}\\b", //Credit card numbers + "\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b", //Email addresses + "\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + "\\b", //IP addresses + "([12]\\d{3}[./-](0[1-9]|1[0-2])[./" + "-](0[1-9]|[12]\\d|3[01]))|((0[1-9]|[12]\\d|3[01])[./-](0[1-9]|1[0-2])[./" + "-][12]\\d{3})", //Dates (numerical) + "\\s*[a-zA-Z]{2}(?:\\s*\\d\\s*){6}[a-zA-Z]?\\s*", //National Insurance Number (UK) + "([1-9])(?!\\1{2}-\\1{2}-\\1{4})[1-9]{2}-[1-9]{2}-[1-9]{4}" //Social Security Number (US) + }; }; #endif // INCLUDED_CUI_SOURCE_INC_SFXREDACTIONHELPER_HXX diff --git a/sfx2/inc/autoredactdialog.hxx b/sfx2/inc/autoredactdialog.hxx index 3b6b45c99032..bb633b9a9bb1 100644 --- a/sfx2/inc/autoredactdialog.hxx +++ b/sfx2/inc/autoredactdialog.hxx @@ -155,10 +155,15 @@ class SfxAddTargetDialog : public weld::GenericDialogController private: std::unique_ptr<weld::Entry> m_xName; std::unique_ptr<weld::ComboBox> m_xType; + std::unique_ptr<weld::Label> m_xLabelContent; std::unique_ptr<weld::Entry> m_xContent; + std::unique_ptr<weld::Label> m_xLabelPredefContent; + std::unique_ptr<weld::ComboBox> m_xPredefContent; std::unique_ptr<weld::CheckButton> m_xCaseSensitive; std::unique_ptr<weld::CheckButton> m_xWholeWords; + DECL_LINK(SelectTypeHdl, weld::ComboBox&, void); + public: SfxAddTargetDialog(weld::Window* pWindow, const OUString& rName); SfxAddTargetDialog(weld::Window* pWindow, const OUString& sName, @@ -167,7 +172,7 @@ public: OUString getName() const { return m_xName->get_text(); } RedactionTargetType getType() const; - OUString getContent() const { return m_xContent->get_text(); } + OUString getContent() const; bool isCaseSensitive() const { return m_xCaseSensitive->get_state() == TriState::TRISTATE_TRUE; |