1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 2001
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Simon Fraser <sfraser@netscape.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : /*
40 : * The sole purpose of the Find service is to store globally the
41 : * last used Find settings
42 : *
43 : */
44 :
45 :
46 : #include "nsFindService.h"
47 :
48 :
49 0 : nsFindService::nsFindService()
50 : : mFindBackwards(false)
51 : , mWrapFind(true)
52 : , mEntireWord(false)
53 0 : , mMatchCase(false)
54 : {
55 0 : }
56 :
57 :
58 0 : nsFindService::~nsFindService()
59 : {
60 0 : }
61 :
62 0 : NS_IMPL_ISUPPORTS1(nsFindService, nsIFindService)
63 :
64 : /* attribute AString searchString; */
65 0 : NS_IMETHODIMP nsFindService::GetSearchString(nsAString & aSearchString)
66 : {
67 0 : aSearchString = mSearchString;
68 0 : return NS_OK;
69 : }
70 :
71 0 : NS_IMETHODIMP nsFindService::SetSearchString(const nsAString & aSearchString)
72 : {
73 0 : mSearchString = aSearchString;
74 0 : return NS_OK;
75 : }
76 :
77 : /* attribute AString replaceString; */
78 0 : NS_IMETHODIMP nsFindService::GetReplaceString(nsAString & aReplaceString)
79 : {
80 0 : aReplaceString = mReplaceString;
81 0 : return NS_OK;
82 : }
83 0 : NS_IMETHODIMP nsFindService::SetReplaceString(const nsAString & aReplaceString)
84 : {
85 0 : mReplaceString = aReplaceString;
86 0 : return NS_OK;
87 : }
88 :
89 : /* attribute boolean findBackwards; */
90 0 : NS_IMETHODIMP nsFindService::GetFindBackwards(bool *aFindBackwards)
91 : {
92 0 : NS_ENSURE_ARG_POINTER(aFindBackwards);
93 0 : *aFindBackwards = mFindBackwards;
94 0 : return NS_OK;
95 : }
96 0 : NS_IMETHODIMP nsFindService::SetFindBackwards(bool aFindBackwards)
97 : {
98 0 : mFindBackwards = aFindBackwards;
99 0 : return NS_OK;
100 : }
101 :
102 : /* attribute boolean wrapFind; */
103 0 : NS_IMETHODIMP nsFindService::GetWrapFind(bool *aWrapFind)
104 : {
105 0 : NS_ENSURE_ARG_POINTER(aWrapFind);
106 0 : *aWrapFind = mWrapFind;
107 0 : return NS_OK;
108 : }
109 0 : NS_IMETHODIMP nsFindService::SetWrapFind(bool aWrapFind)
110 : {
111 0 : mWrapFind = aWrapFind;
112 0 : return NS_OK;
113 : }
114 :
115 : /* attribute boolean entireWord; */
116 0 : NS_IMETHODIMP nsFindService::GetEntireWord(bool *aEntireWord)
117 : {
118 0 : NS_ENSURE_ARG_POINTER(aEntireWord);
119 0 : *aEntireWord = mEntireWord;
120 0 : return NS_OK;
121 : }
122 0 : NS_IMETHODIMP nsFindService::SetEntireWord(bool aEntireWord)
123 : {
124 0 : mEntireWord = aEntireWord;
125 0 : return NS_OK;
126 : }
127 :
128 : /* attribute boolean matchCase; */
129 0 : NS_IMETHODIMP nsFindService::GetMatchCase(bool *aMatchCase)
130 : {
131 0 : NS_ENSURE_ARG_POINTER(aMatchCase);
132 0 : *aMatchCase = mMatchCase;
133 0 : return NS_OK;
134 : }
135 0 : NS_IMETHODIMP nsFindService::SetMatchCase(bool aMatchCase)
136 : {
137 0 : mMatchCase = aMatchCase;
138 0 : return NS_OK;
139 : }
140 :
|