1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* 7 * The sole purpose of the Find service is to store globally the 8 * last used Find settings 9 * 10 */ 11 12 #include "nsFindService.h" 13 nsFindService()14nsFindService::nsFindService() 15 : mFindBackwards(false), 16 mWrapFind(true), 17 mEntireWord(false), 18 mMatchCase(false) {} 19 20 nsFindService::~nsFindService() = default; 21 NS_IMPL_ISUPPORTS(nsFindService,nsIFindService)22NS_IMPL_ISUPPORTS(nsFindService, nsIFindService) 23 24 NS_IMETHODIMP nsFindService::GetSearchString(nsAString& aSearchString) { 25 aSearchString = mSearchString; 26 return NS_OK; 27 } 28 SetSearchString(const nsAString & aSearchString)29NS_IMETHODIMP nsFindService::SetSearchString(const nsAString& aSearchString) { 30 mSearchString = aSearchString; 31 return NS_OK; 32 } 33 GetReplaceString(nsAString & aReplaceString)34NS_IMETHODIMP nsFindService::GetReplaceString(nsAString& aReplaceString) { 35 aReplaceString = mReplaceString; 36 return NS_OK; 37 } SetReplaceString(const nsAString & aReplaceString)38NS_IMETHODIMP nsFindService::SetReplaceString(const nsAString& aReplaceString) { 39 mReplaceString = aReplaceString; 40 return NS_OK; 41 } 42 GetFindBackwards(bool * aFindBackwards)43NS_IMETHODIMP nsFindService::GetFindBackwards(bool* aFindBackwards) { 44 NS_ENSURE_ARG_POINTER(aFindBackwards); 45 *aFindBackwards = mFindBackwards; 46 return NS_OK; 47 } SetFindBackwards(bool aFindBackwards)48NS_IMETHODIMP nsFindService::SetFindBackwards(bool aFindBackwards) { 49 mFindBackwards = aFindBackwards; 50 return NS_OK; 51 } 52 GetWrapFind(bool * aWrapFind)53NS_IMETHODIMP nsFindService::GetWrapFind(bool* aWrapFind) { 54 NS_ENSURE_ARG_POINTER(aWrapFind); 55 *aWrapFind = mWrapFind; 56 return NS_OK; 57 } SetWrapFind(bool aWrapFind)58NS_IMETHODIMP nsFindService::SetWrapFind(bool aWrapFind) { 59 mWrapFind = aWrapFind; 60 return NS_OK; 61 } 62 GetEntireWord(bool * aEntireWord)63NS_IMETHODIMP nsFindService::GetEntireWord(bool* aEntireWord) { 64 NS_ENSURE_ARG_POINTER(aEntireWord); 65 *aEntireWord = mEntireWord; 66 return NS_OK; 67 } SetEntireWord(bool aEntireWord)68NS_IMETHODIMP nsFindService::SetEntireWord(bool aEntireWord) { 69 mEntireWord = aEntireWord; 70 return NS_OK; 71 } 72 GetMatchCase(bool * aMatchCase)73NS_IMETHODIMP nsFindService::GetMatchCase(bool* aMatchCase) { 74 NS_ENSURE_ARG_POINTER(aMatchCase); 75 *aMatchCase = mMatchCase; 76 return NS_OK; 77 } SetMatchCase(bool aMatchCase)78NS_IMETHODIMP nsFindService::SetMatchCase(bool aMatchCase) { 79 mMatchCase = aMatchCase; 80 return NS_OK; 81 } 82 GetMatchDiacritics(bool * aMatchDiacritics)83NS_IMETHODIMP nsFindService::GetMatchDiacritics(bool* aMatchDiacritics) { 84 NS_ENSURE_ARG_POINTER(aMatchDiacritics); 85 *aMatchDiacritics = mMatchDiacritics; 86 return NS_OK; 87 } SetMatchDiacritics(bool aMatchDiacritics)88NS_IMETHODIMP nsFindService::SetMatchDiacritics(bool aMatchDiacritics) { 89 mMatchDiacritics = aMatchDiacritics; 90 return NS_OK; 91 } 92