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 
13 #include "nsFindService.h"
14 
15 
nsFindService()16 nsFindService::nsFindService()
17 : mFindBackwards(false)
18 , mWrapFind(true)
19 , mEntireWord(false)
20 , mMatchCase(false)
21 {
22 }
23 
24 
~nsFindService()25 nsFindService::~nsFindService()
26 {
27 }
28 
NS_IMPL_ISUPPORTS(nsFindService,nsIFindService)29 NS_IMPL_ISUPPORTS(nsFindService, nsIFindService)
30 
31 NS_IMETHODIMP nsFindService::GetSearchString(nsAString & aSearchString)
32 {
33     aSearchString = mSearchString;
34     return NS_OK;
35 }
36 
SetSearchString(const nsAString & aSearchString)37 NS_IMETHODIMP nsFindService::SetSearchString(const nsAString & aSearchString)
38 {
39     mSearchString = aSearchString;
40     return NS_OK;
41 }
42 
GetReplaceString(nsAString & aReplaceString)43 NS_IMETHODIMP nsFindService::GetReplaceString(nsAString & aReplaceString)
44 {
45     aReplaceString = mReplaceString;
46     return NS_OK;
47 }
SetReplaceString(const nsAString & aReplaceString)48 NS_IMETHODIMP nsFindService::SetReplaceString(const nsAString & aReplaceString)
49 {
50     mReplaceString = aReplaceString;
51     return NS_OK;
52 }
53 
GetFindBackwards(bool * aFindBackwards)54 NS_IMETHODIMP nsFindService::GetFindBackwards(bool *aFindBackwards)
55 {
56     NS_ENSURE_ARG_POINTER(aFindBackwards);
57     *aFindBackwards = mFindBackwards;
58     return NS_OK;
59 }
SetFindBackwards(bool aFindBackwards)60 NS_IMETHODIMP nsFindService::SetFindBackwards(bool aFindBackwards)
61 {
62     mFindBackwards = aFindBackwards;
63     return NS_OK;
64 }
65 
GetWrapFind(bool * aWrapFind)66 NS_IMETHODIMP nsFindService::GetWrapFind(bool *aWrapFind)
67 {
68     NS_ENSURE_ARG_POINTER(aWrapFind);
69     *aWrapFind = mWrapFind;
70     return NS_OK;
71 }
SetWrapFind(bool aWrapFind)72 NS_IMETHODIMP nsFindService::SetWrapFind(bool aWrapFind)
73 {
74     mWrapFind = aWrapFind;
75     return NS_OK;
76 }
77 
GetEntireWord(bool * aEntireWord)78 NS_IMETHODIMP nsFindService::GetEntireWord(bool *aEntireWord)
79 {
80     NS_ENSURE_ARG_POINTER(aEntireWord);
81     *aEntireWord = mEntireWord;
82     return NS_OK;
83 }
SetEntireWord(bool aEntireWord)84 NS_IMETHODIMP nsFindService::SetEntireWord(bool aEntireWord)
85 {
86     mEntireWord = aEntireWord;
87     return NS_OK;
88 }
89 
GetMatchCase(bool * aMatchCase)90 NS_IMETHODIMP nsFindService::GetMatchCase(bool *aMatchCase)
91 {
92     NS_ENSURE_ARG_POINTER(aMatchCase);
93     *aMatchCase = mMatchCase;
94     return NS_OK;
95 }
SetMatchCase(bool aMatchCase)96 NS_IMETHODIMP nsFindService::SetMatchCase(bool aMatchCase)
97 {
98     mMatchCase = aMatchCase;
99     return NS_OK;
100 }
101 
102