update emoji autocorrect entries from po-files
[LibreOffice.git] / include / svl / srchitem.hxx
blob9a298585e43a09f28ff555b55bfb17da0b0e4398
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 INCLUDED_SVL_SRCHITEM_HXX
20 #define INCLUDED_SVL_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 <svl/poolitem.hxx>
31 #include <svl/srchdefs.hxx>
33 // defines ---------------------------------------------------------------
35 // commands
36 enum class SvxSearchCmd
38 FIND = 0,
39 FIND_ALL = 1,
40 REPLACE = 2,
41 REPLACE_ALL = 3,
44 // search flags
45 enum class SvxSearchCellType
47 FORMULA = 0,
48 VALUE = 1,
49 NOTE = 2,
52 enum class SvxSearchApp
54 WRITER = 0,
55 CALC = 1,
56 DRAW = 2,
57 BASE = 3,
60 // class SvxSearchItem ---------------------------------------------------
62 class SVL_DLLPUBLIC SvxSearchItem :
63 public SfxPoolItem,
64 public utl::ConfigItem
66 com::sun::star::util::SearchOptions aSearchOpt;
68 SfxStyleFamily eFamily; // style family
70 SvxSearchCmd nCommand; // command (Search, Search all, Replace, Replace all)
72 // Calc-specific
73 SvxSearchCellType nCellType; // Search in Formulas/Values/Notes
74 SvxSearchApp nAppFlag; // application which the dialog is for
75 bool bRowDirection; // search direction: row-wise/column-wise
76 bool bAllTables; // search in all sheets
77 bool bSearchFiltered; // search filtered cells.
79 // Writer-specific
80 bool bNotes;
82 bool bBackward; // search backwards
83 bool bPattern; // search for styles
84 bool bContent; // search in content
85 bool bAsianOptions; // use asian options?
87 // Start search at this point (absolute twips).
88 sal_Int32 m_nStartPointX;
89 sal_Int32 m_nStartPointY;
91 virtual void ImplCommit() SAL_OVERRIDE;
93 public:
94 TYPEINFO_OVERRIDE();
96 explicit SvxSearchItem( const sal_uInt16 nId );
97 SvxSearchItem( const SvxSearchItem& rItem );
98 virtual ~SvxSearchItem();
100 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
101 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
102 virtual bool operator == ( const SfxPoolItem& ) const SAL_OVERRIDE;
103 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
104 virtual bool GetPresentation( SfxItemPresentation ePres,
105 SfxMapUnit eCoreMetric,
106 SfxMapUnit ePresMetric,
107 OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
109 // ConfigItem
110 virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE;
112 SvxSearchCmd GetCommand() const { return nCommand; }
113 void SetCommand(SvxSearchCmd nNewCommand) { nCommand = nNewCommand; }
115 inline const OUString GetSearchString() const;
116 inline void SetSearchString(const OUString& rNewString);
118 inline const OUString GetReplaceString() const;
119 inline void SetReplaceString(const OUString& rNewString);
121 inline bool GetWordOnly() const;
122 void SetWordOnly(bool bNewWordOnly);
124 inline bool GetExact() const;
125 void SetExact(bool bNewExact);
127 bool GetBackward() const { return bBackward; }
128 void SetBackward(bool bNewBackward) { bBackward = bNewBackward; }
130 inline bool GetSelection() const;
131 void SetSelection(bool bNewSelection);
133 inline bool GetRegExp() const;
134 void SetRegExp( bool bVal );
136 bool GetPattern() const { return bPattern; }
137 void SetPattern(bool bNewPattern) { bPattern = bNewPattern; }
139 bool IsContent() const { return bContent; }
140 void SetContent( bool bNew ) { bContent = bNew; }
142 SfxStyleFamily GetFamily() const { return eFamily; }
143 void SetFamily( SfxStyleFamily eNewFamily )
144 { eFamily = eNewFamily; }
146 bool GetRowDirection() const { return bRowDirection; }
147 void SetRowDirection(bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
149 bool IsAllTables() const { return bAllTables; }
150 void SetAllTables(bool bNew) { bAllTables = bNew; }
152 bool IsSearchFiltered() const { return bSearchFiltered; }
153 void SetSearchFiltered(bool b) { bSearchFiltered = b; }
155 SvxSearchCellType GetCellType() const { return nCellType; }
156 void SetCellType(SvxSearchCellType nNewCellType) { nCellType = nNewCellType; }
158 bool GetNotes() const { return bNotes; }
159 void SetNotes(bool bNew) { bNotes = bNew; }
161 SvxSearchApp GetAppFlag() const { return nAppFlag; }
162 void SetAppFlag(SvxSearchApp nNewAppFlag) { nAppFlag = nNewAppFlag; }
164 inline bool IsLevenshtein() const;
165 void SetLevenshtein( bool bVal );
167 inline bool IsLEVRelaxed() const;
168 void SetLEVRelaxed(bool bSet);
170 inline sal_uInt16 GetLEVOther() const;
171 inline void SetLEVOther(sal_uInt16 nSet);
173 inline sal_uInt16 GetLEVShorter() const;
174 inline void SetLEVShorter(sal_uInt16 nSet);
176 inline sal_uInt16 GetLEVLonger() const;
177 inline void SetLEVLonger(sal_uInt16 nSet);
179 inline const com::sun::star::util::SearchOptions &
180 GetSearchOptions() const;
181 inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt );
183 inline sal_Int32 GetTransliterationFlags() const;
184 void SetTransliterationFlags( sal_Int32 nFlags );
186 inline bool IsMatchFullHalfWidthForms() const;
187 void SetMatchFullHalfWidthForms( bool bVal );
189 inline bool IsUseAsianOptions() const { return bAsianOptions; }
190 inline void SetUseAsianOptions( bool bVal ) { bAsianOptions = bVal; }
192 sal_Int32 GetStartPointX() const;
193 sal_Int32 GetStartPointY() const;
194 /// Either x or y start point is set.
195 bool HasStartPoint() const;
198 const OUString SvxSearchItem::GetSearchString() const
200 return aSearchOpt.searchString;
203 void SvxSearchItem::SetSearchString(const OUString& rNewString)
205 aSearchOpt.searchString = rNewString;
208 const OUString SvxSearchItem::GetReplaceString() const
210 return aSearchOpt.replaceString;
213 void SvxSearchItem::SetReplaceString(const OUString& rNewString)
215 aSearchOpt.replaceString = rNewString;
218 bool SvxSearchItem::GetWordOnly() const
220 return 0 != (aSearchOpt.searchFlag &
221 com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
224 bool SvxSearchItem::GetExact() const
226 return 0 == (aSearchOpt.transliterateFlags &
227 com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
230 bool SvxSearchItem::GetSelection() const
232 return 0 != (aSearchOpt.searchFlag &
233 com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
236 bool SvxSearchItem::GetRegExp() const
238 return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
241 bool SvxSearchItem::IsLEVRelaxed() const
243 return 0 != (aSearchOpt.searchFlag &
244 com::sun::star::util::SearchFlags::LEV_RELAXED);
247 sal_uInt16 SvxSearchItem::GetLEVOther() const
249 return (sal_Int16) aSearchOpt.changedChars;
252 void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
254 aSearchOpt.changedChars = nVal;
257 sal_uInt16 SvxSearchItem::GetLEVShorter() const
259 return (sal_Int16) aSearchOpt.insertedChars;
262 void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
264 aSearchOpt.insertedChars = nVal;
267 sal_uInt16 SvxSearchItem::GetLEVLonger() const
269 return (sal_Int16) aSearchOpt.deletedChars;
272 void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
274 aSearchOpt.deletedChars = nVal;
277 bool SvxSearchItem::IsLevenshtein() const
279 return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
282 const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
284 return aSearchOpt;
287 void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt )
289 aSearchOpt = rOpt;
292 sal_Int32 SvxSearchItem::GetTransliterationFlags() const
294 return aSearchOpt.transliterateFlags;
297 bool SvxSearchItem::IsMatchFullHalfWidthForms() const
299 return 0 != (aSearchOpt.transliterateFlags &
300 com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH);
303 #endif
306 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */