bump product version to 4.1.6.2
[LibreOffice.git] / include / svl / srchitem.hxx
blob5d4413ea8cab13a8244962b268fc9cfcfad6befe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SFX_SRCHITEM_HXX
20 #define _SFX_SRCHITEM_HXX
22 #include "sal/config.h"
23 #include "svl/svldllapi.h"
24 #include <com/sun/star/util/XSearchDescriptor.hpp>
25 #include <com/sun/star/util/SearchOptions.hpp>
26 #include <com/sun/star/util/SearchFlags.hpp>
27 #include <com/sun/star/i18n/TransliterationModules.hpp>
28 #include <unotools/configitem.hxx>
29 #include <rsc/rscsfx.hxx>
30 #include <tools/string.hxx>
31 #include <svl/poolitem.hxx>
32 #include <svl/srchdefs.hxx>
34 // defines ---------------------------------------------------------------
36 // commands
37 #define SVX_SEARCHCMD_FIND ((sal_uInt16)0)
38 #define SVX_SEARCHCMD_FIND_ALL ((sal_uInt16)1)
39 #define SVX_SEARCHCMD_REPLACE ((sal_uInt16)2)
40 #define SVX_SEARCHCMD_REPLACE_ALL ((sal_uInt16)3)
42 // search flags
43 #define SVX_SEARCHIN_FORMULA ((sal_uInt16)0)
44 #define SVX_SEARCHIN_VALUE ((sal_uInt16)1)
45 #define SVX_SEARCHIN_NOTE ((sal_uInt16)2)
46 #define SVX_SEARCHAPP_WRITER ((sal_uInt16)0)
47 #define SVX_SEARCHAPP_CALC ((sal_uInt16)1)
48 #define SVX_SEARCHAPP_DRAW ((sal_uInt16)2)
49 #define SVX_SEARCHAPP_BASE ((sal_uInt16)3)
51 // class SvxSearchItem ---------------------------------------------------
53 class SVL_DLLPUBLIC SvxSearchItem :
54 public SfxPoolItem,
55 public utl::ConfigItem
57 com::sun::star::util::SearchOptions aSearchOpt;
59 SfxStyleFamily eFamily; // Vorlagen-Familie
61 sal_uInt16 nCommand; // Kommando (Suchen, Alle Suchen, Ersetzen, Alle Ersetzen)
63 // Calc-Spezifische Daten
64 sal_uInt16 nCellType; // Suche in Formeln/Werten/Notizen
65 sal_uInt16 nAppFlag; // Fuer welche Applikation ist der Dialog ueberhaupt
66 bool bRowDirection; // Suchrichtung Zeilenweise/Spaltenweise
67 bool bAllTables; // in alle Tabellen suchen
68 bool bSearchFiltered; // search filtered cells.
70 // Writer-spezifisch
71 bool bNotes;
73 bool bBackward; // Suche Rueckwaerts
74 bool bPattern; // Suche nach Vorlagen
75 bool bContent; // Suche im Inhalt
76 bool bAsianOptions; // use asian options?
78 public:
79 TYPEINFO();
81 explicit SvxSearchItem( const sal_uInt16 nId );
82 SvxSearchItem( const SvxSearchItem& rItem );
83 virtual ~SvxSearchItem();
85 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
86 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
87 virtual int operator == ( const SfxPoolItem& ) const;
88 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
89 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
90 SfxMapUnit eCoreMetric,
91 SfxMapUnit ePresMetric,
92 OUString &rText, const IntlWrapper * = 0 ) const;
94 // ConfigItem
95 virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames );
96 virtual void Commit();
98 sal_uInt16 GetCommand() const { return nCommand; }
99 void SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; }
101 inline const String GetSearchString() const;
102 inline void SetSearchString(const String& rNewString);
104 inline const String GetReplaceString() const;
105 inline void SetReplaceString(const String& rNewString);
107 inline bool GetWordOnly() const;
108 void SetWordOnly(bool bNewWordOnly);
110 inline bool GetExact() const;
111 void SetExact(bool bNewExact);
113 bool GetBackward() const { return bBackward; }
114 void SetBackward(bool bNewBackward) { bBackward = bNewBackward; }
116 inline bool GetSelection() const;
117 void SetSelection(bool bNewSelection);
119 inline bool GetRegExp() const;
120 void SetRegExp( bool bVal );
122 bool GetPattern() const { return bPattern; }
123 void SetPattern(bool bNewPattern) { bPattern = bNewPattern; }
125 bool IsContent() const { return bContent; }
126 void SetContent( bool bNew ) { bContent = bNew; }
128 SfxStyleFamily GetFamily() const { return eFamily; }
129 void SetFamily( SfxStyleFamily eNewFamily )
130 { eFamily = eNewFamily; }
132 bool GetRowDirection() const { return bRowDirection; }
133 void SetRowDirection(bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
135 bool IsAllTables() const { return bAllTables; }
136 void SetAllTables(bool bNew) { bAllTables = bNew; }
138 bool IsSearchFiltered() const { return bSearchFiltered; }
139 void SetSearchFiltered(bool b) { bSearchFiltered = b; }
141 sal_uInt16 GetCellType() const { return nCellType; }
142 void SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
144 bool GetNotes() const { return bNotes; }
145 void SetNotes(bool bNew) { bNotes = bNew; }
147 sal_uInt16 GetAppFlag() const { return nAppFlag; }
148 void SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; }
150 inline bool IsLevenshtein() const;
151 void SetLevenshtein( bool bVal );
153 inline bool IsLEVRelaxed() const;
154 void SetLEVRelaxed(bool bSet);
156 inline sal_uInt16 GetLEVOther() const;
157 inline void SetLEVOther(sal_uInt16 nSet);
159 inline sal_uInt16 GetLEVShorter() const;
160 inline void SetLEVShorter(sal_uInt16 nSet);
162 inline sal_uInt16 GetLEVLonger() const;
163 inline void SetLEVLonger(sal_uInt16 nSet);
165 inline const com::sun::star::util::SearchOptions &
166 GetSearchOptions() const;
167 inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt );
169 inline sal_Int32 GetTransliterationFlags() const;
170 void SetTransliterationFlags( sal_Int32 nFlags );
172 inline bool IsMatchFullHalfWidthForms() const;
173 void SetMatchFullHalfWidthForms( bool bVal );
175 inline bool IsUseAsianOptions() const { return bAsianOptions; }
176 inline void SetUseAsianOptions( bool bVal ) { bAsianOptions = bVal; }
179 const String SvxSearchItem::GetSearchString() const
181 return aSearchOpt.searchString;
184 void SvxSearchItem::SetSearchString(const String& rNewString)
186 aSearchOpt.searchString = rNewString;
189 const String SvxSearchItem::GetReplaceString() const
191 return aSearchOpt.replaceString;
194 void SvxSearchItem::SetReplaceString(const String& rNewString)
196 aSearchOpt.replaceString = rNewString;
199 bool SvxSearchItem::GetWordOnly() const
201 return 0 != (aSearchOpt.searchFlag &
202 com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
205 bool SvxSearchItem::GetExact() const
207 return 0 == (aSearchOpt.transliterateFlags &
208 com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
211 bool SvxSearchItem::GetSelection() const
213 return 0 != (aSearchOpt.searchFlag &
214 com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
217 bool SvxSearchItem::GetRegExp() const
219 return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
222 bool SvxSearchItem::IsLEVRelaxed() const
224 return 0 != (aSearchOpt.searchFlag &
225 com::sun::star::util::SearchFlags::LEV_RELAXED);
228 sal_uInt16 SvxSearchItem::GetLEVOther() const
230 return (sal_Int16) aSearchOpt.changedChars;
233 void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
235 aSearchOpt.changedChars = nVal;
238 sal_uInt16 SvxSearchItem::GetLEVShorter() const
240 return (sal_Int16) aSearchOpt.insertedChars;
243 void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
245 aSearchOpt.insertedChars = nVal;
248 sal_uInt16 SvxSearchItem::GetLEVLonger() const
250 return (sal_Int16) aSearchOpt.deletedChars;
253 void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
255 aSearchOpt.deletedChars = nVal;
258 bool SvxSearchItem::IsLevenshtein() const
260 return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
263 const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
265 return aSearchOpt;
268 void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt )
270 aSearchOpt = rOpt;
273 sal_Int32 SvxSearchItem::GetTransliterationFlags() const
275 return aSearchOpt.transliterateFlags;
278 bool SvxSearchItem::IsMatchFullHalfWidthForms() const
280 return 0 != (aSearchOpt.transliterateFlags &
281 com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH);
284 #endif
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */