diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-10 23:06:35 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-10 23:06:35 +0100 |
commit | 01a1d08f17800fb7118835a13230226f536d627f (patch) | |
tree | 1655855cb12613cf53d884ab380b0df952c1d685 /sfx2 | |
parent | 8747398283b8217bbfcb2ef32bed0e1075b50c39 (diff) |
#i107450#: move SvxSearchIten to svl
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/sfxsids.hrc | 19 | ||||
-rw-r--r-- | sfx2/inc/sfx2/srchdefs.hxx | 52 | ||||
-rw-r--r-- | sfx2/inc/sfx2/srchitem.hxx | 306 | ||||
-rw-r--r-- | sfx2/source/appl/appbas.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/makefile.mk | 1 | ||||
-rw-r--r-- | sfx2/source/control/srchitem.cxx | 665 |
6 files changed, 1 insertions, 1044 deletions
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 32e31e782675..a0f5cf9481b2 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -1290,25 +1290,6 @@ #define SID_ATTR_CHAR_FILLCOLOR (SID_SFX_START + 1551) -#define MID_SEARCH_STYLEFAMILY 1 -#define MID_SEARCH_CELLTYPE 2 -#define MID_SEARCH_ROWDIRECTION 3 -#define MID_SEARCH_ALLTABLES 4 -#define MID_SEARCH_BACKWARD 5 -#define MID_SEARCH_PATTERN 6 -#define MID_SEARCH_CONTENT 7 -#define MID_SEARCH_ASIANOPTIONS 8 -#define MID_SEARCH_ALGORITHMTYPE 9 -#define MID_SEARCH_FLAGS 10 -#define MID_SEARCH_SEARCHSTRING 11 -#define MID_SEARCH_REPLACESTRING 12 -#define MID_SEARCH_LOCALE 13 -#define MID_SEARCH_CHANGEDCHARS 14 -#define MID_SEARCH_DELETEDCHARS 15 -#define MID_SEARCH_INSERTEDCHARS 16 -#define MID_SEARCH_TRANSLITERATEFLAGS 17 -#define MID_SEARCH_COMMAND 18 - // SvxSizeItem #define MID_SIZE_SIZE 0 #define MID_SIZE_WIDTH 1 diff --git a/sfx2/inc/sfx2/srchdefs.hxx b/sfx2/inc/sfx2/srchdefs.hxx deleted file mode 100644 index 385ad1c87582..000000000000 --- a/sfx2/inc/sfx2/srchdefs.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: srchdefs.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFX_SRCHDEFS_HXX_ -#define _SFX_SRCHDEFS_HXX_ - - -#define SEARCH_OPTIONS_SEARCH ((sal_uInt16)0x0001) -#define SEARCH_OPTIONS_SEARCH_ALL ((sal_uInt16)0x0002) -#define SEARCH_OPTIONS_REPLACE ((sal_uInt16)0x0004) -#define SEARCH_OPTIONS_REPLACE_ALL ((sal_uInt16)0x0008) -#define SEARCH_OPTIONS_WHOLE_WORDS ((sal_uInt16)0x0010) -#define SEARCH_OPTIONS_BACKWARDS ((sal_uInt16)0x0020) -#define SEARCH_OPTIONS_REG_EXP ((sal_uInt16)0x0040) -#define SEARCH_OPTIONS_EXACT ((sal_uInt16)0x0080) -#define SEARCH_OPTIONS_SELECTION ((sal_uInt16)0x0100) -#define SEARCH_OPTIONS_FAMILIES ((sal_uInt16)0x0200) -#define SEARCH_OPTIONS_FORMAT ((sal_uInt16)0x0400) -#define SEARCH_OPTIONS_MORE ((sal_uInt16)0x0800) -#define SEARCH_OPTIONS_SIMILARITY ((sal_uInt16)0x1000) -#define SEARCH_OPTIONS_CONTENT ((sal_uInt16)0x2000) - - -#endif - diff --git a/sfx2/inc/sfx2/srchitem.hxx b/sfx2/inc/sfx2/srchitem.hxx deleted file mode 100644 index 594d12cf05b5..000000000000 --- a/sfx2/inc/sfx2/srchitem.hxx +++ /dev/null @@ -1,306 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: srchitem.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_SRCHITEM_HXX -#define _SFX_SRCHITEM_HXX - -#include "sal/config.h" -#include "sfx2/dllapi.h" -#include <com/sun/star/util/XSearchDescriptor.hpp> -#include <com/sun/star/util/SearchOptions.hpp> -#include <com/sun/star/util/SearchFlags.hpp> -#include <com/sun/star/i18n/TransliterationModules.hpp> -#include <unotools/configitem.hxx> -#include <rsc/rscsfx.hxx> -#include <tools/string.hxx> -#include <svl/poolitem.hxx> -#include <sfx2/msg.hxx> -#include <sfx2/srchdefs.hxx> - -// defines --------------------------------------------------------------- - -// Kommandos -#define SVX_SEARCHCMD_FIND ((sal_uInt16)0) -#define SVX_SEARCHCMD_FIND_ALL ((sal_uInt16)1) -#define SVX_SEARCHCMD_REPLACE ((sal_uInt16)2) -#define SVX_SEARCHCMD_REPLACE_ALL ((sal_uInt16)3) - -// Suche in (fuer Calc) -#define SVX_SEARCHIN_FORMULA ((sal_uInt16)0) -#define SVX_SEARCHIN_VALUE ((sal_uInt16)1) -#define SVX_SEARCHIN_NOTE ((sal_uInt16)2) - -// Applicationsflag -#define SVX_SEARCHAPP_WRITER ((sal_uInt16)0) -#define SVX_SEARCHAPP_CALC ((sal_uInt16)1) -#define SVX_SEARCHAPP_DRAW ((sal_uInt16)2) -#define SVX_SEARCHAPP_BASE ((sal_uInt16)3) - -// class SvxSearchItem --------------------------------------------------- - -//#ifdef ITEMID_SEARCH - -/* [Beschreibung] - - In diesem Item werden alle Such-Attribute gespeichert. -*/ -class SFX2_DLLPUBLIC SvxSearchItem : - public SfxPoolItem, - public utl::ConfigItem -{ - com::sun::star::util::SearchOptions aSearchOpt; - - SfxStyleFamily eFamily; // Vorlagen-Familie - - sal_uInt16 nCommand; // Kommando (Suchen, Alle Suchen, Ersetzen, Alle Ersetzen) - - // Calc-Spezifische Daten - sal_uInt16 nCellType; // Suche in Formeln/Werten/Notizen - sal_uInt16 nAppFlag; // Fuer welche Applikation ist der Dialog ueberhaupt - sal_Bool bRowDirection; // Suchrichtung Zeilenweise/Spaltenweise - sal_Bool bAllTables; // in alle Tabellen suchen - - // Writer-spezifisch - sal_Bool bNotes; - - sal_Bool bBackward; // Suche Rueckwaerts - sal_Bool bPattern; // Suche nach Vorlagen - sal_Bool bContent; // Suche im Inhalt - sal_Bool bAsianOptions; // use asian options? - -public: - TYPEINFO(); - - SvxSearchItem( const sal_uInt16 nId /*= ITEMID_SEARCH*/ ); - SvxSearchItem( const SvxSearchItem& rItem ); - virtual ~SvxSearchItem(); - - virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - virtual int operator == ( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - String &rText, const IntlWrapper * = 0 ) const; - - // ConfigItem - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); - virtual void Commit(); - - sal_uInt16 GetCommand() const { return nCommand; } - void SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; } - - inline const String GetSearchString() const; - inline void SetSearchString(const String& rNewString); - - inline const String GetReplaceString() const; - inline void SetReplaceString(const String& rNewString); - - inline sal_Bool GetWordOnly() const; - void SetWordOnly(sal_Bool bNewWordOnly); - - inline sal_Bool GetExact() const; - void SetExact(sal_Bool bNewExact); - - sal_Bool GetBackward() const { return bBackward; } - void SetBackward(sal_Bool bNewBackward) { bBackward = bNewBackward; } - - inline sal_Bool GetSelection() const; - void SetSelection(sal_Bool bNewSelection); - - inline sal_Bool GetRegExp() const; - void SetRegExp( sal_Bool bVal ); - - sal_Bool GetPattern() const { return bPattern; } - void SetPattern(sal_Bool bNewPattern) { bPattern = bNewPattern; } - - sal_Bool IsContent() const { return bContent; } - void SetContent( sal_Bool bNew ) { bContent = bNew; } - - SfxStyleFamily GetFamily() const { return eFamily; } - void SetFamily( SfxStyleFamily eNewFamily ) - { eFamily = eNewFamily; } - - sal_Bool GetRowDirection() const { return bRowDirection; } - void SetRowDirection(sal_Bool bNewRowDirection) { bRowDirection = bNewRowDirection; } - - sal_Bool IsAllTables() const { return bAllTables; } - void SetAllTables(sal_Bool bNew) { bAllTables = bNew; } - - sal_uInt16 GetCellType() const { return nCellType; } - void SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; } - - sal_Bool GetNotes() const { return bNotes; } - void SetNotes(sal_Bool bNew) { bNotes = bNew; } - - sal_uInt16 GetAppFlag() const { return nAppFlag; } - void SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; } - - inline sal_Bool IsLevenshtein() const; - void SetLevenshtein( sal_Bool bVal ); - - inline sal_Bool IsLEVRelaxed() const; - void SetLEVRelaxed(sal_Bool bSet); - - inline sal_uInt16 GetLEVOther() const; - inline void SetLEVOther(sal_uInt16 nSet); - - inline sal_uInt16 GetLEVShorter() const; - inline void SetLEVShorter(sal_uInt16 nSet); - - inline sal_uInt16 GetLEVLonger() const; - inline void SetLEVLonger(sal_uInt16 nSet); - - void GetFromDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & rDescr ); - void SetToDescriptor( ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & rDescr ); - - inline const com::sun::star::util::SearchOptions & - GetSearchOptions() const; - inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt ); - - inline sal_Int32 GetTransliterationFlags() const; - void SetTransliterationFlags( sal_Int32 nFlags ); - - inline sal_Bool IsMatchFullHalfWidthForms() const; - void SetMatchFullHalfWidthForms( sal_Bool bVal ); - - inline sal_Bool IsUseAsianOptions() const { return bAsianOptions; } - inline void SetUseAsianOptions( sal_Bool bVal ) { bAsianOptions = bVal; } -}; - -const String SvxSearchItem::GetSearchString() const -{ - return aSearchOpt.searchString; -} - -void SvxSearchItem::SetSearchString(const String& rNewString) -{ - aSearchOpt.searchString = rNewString; -} - -const String SvxSearchItem::GetReplaceString() const -{ - return aSearchOpt.replaceString; -} - -void SvxSearchItem::SetReplaceString(const String& rNewString) -{ - aSearchOpt.replaceString = rNewString; -} - -sal_Bool SvxSearchItem::GetWordOnly() const -{ - return 0 != (aSearchOpt.searchFlag & - com::sun::star::util::SearchFlags::NORM_WORD_ONLY); -} - -sal_Bool SvxSearchItem::GetExact() const -{ - return 0 == (aSearchOpt.transliterateFlags & - com::sun::star::i18n::TransliterationModules_IGNORE_CASE); -} - -sal_Bool SvxSearchItem::GetSelection() const -{ - return 0 != (aSearchOpt.searchFlag & - com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE); -} - -sal_Bool SvxSearchItem::GetRegExp() const -{ - return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ; -} - -sal_Bool SvxSearchItem::IsLEVRelaxed() const -{ - return 0 != (aSearchOpt.searchFlag & - com::sun::star::util::SearchFlags::LEV_RELAXED); -} - -sal_uInt16 SvxSearchItem::GetLEVOther() const -{ - return (INT16) aSearchOpt.changedChars; -} - -void SvxSearchItem::SetLEVOther( sal_uInt16 nVal ) -{ - aSearchOpt.changedChars = nVal; -} - -sal_uInt16 SvxSearchItem::GetLEVShorter() const -{ - return (INT16) aSearchOpt.insertedChars; -} - -void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal ) -{ - aSearchOpt.insertedChars = nVal; -} - -sal_uInt16 SvxSearchItem::GetLEVLonger() const -{ - return (INT16) aSearchOpt.deletedChars; -} - -void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal ) -{ - aSearchOpt.deletedChars = nVal; -} - -sal_Bool SvxSearchItem::IsLevenshtein() const -{ - return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE; -} - -const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const -{ - return aSearchOpt; -} - -void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt ) -{ - aSearchOpt = rOpt; -} - -sal_Int32 SvxSearchItem::GetTransliterationFlags() const -{ - return aSearchOpt.transliterateFlags; -} - -sal_Bool SvxSearchItem::IsMatchFullHalfWidthForms() const -{ - return 0 != (aSearchOpt.transliterateFlags & - com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH); -} - -#endif - -//#endif - diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 4fe352c3c4bc..f2687fcb34ec 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -89,7 +89,7 @@ #define ITEMID_SEARCH SID_SEARCH_ITEM -#include <sfx2/srchitem.hxx> +#include <svl/srchitem.hxx> #include <vos/socket.hxx> #define SFX_TYPEMAP diff --git a/sfx2/source/control/makefile.mk b/sfx2/source/control/makefile.mk index 481952409d6c..6de7b1e59ae6 100644 --- a/sfx2/source/control/makefile.mk +++ b/sfx2/source/control/makefile.mk @@ -64,7 +64,6 @@ SLOFILES = \ $(SLO)$/sfxstatuslistener.obj \ $(SLO)$/shell.obj \ $(SLO)$/sorgitm.obj \ - $(SLO)$/srchitem.obj \ $(SLO)$/statcach.obj \ $(SLO)$/unoctitm.obj diff --git a/sfx2/source/control/srchitem.cxx b/sfx2/source/control/srchitem.cxx deleted file mode 100644 index 5702103e3398..000000000000 --- a/sfx2/source/control/srchitem.cxx +++ /dev/null @@ -1,665 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: srchitem.cxx,v $ - * $Revision: 1.24 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -// include --------------------------------------------------------------- - -#ifndef __SBX_SBXVARIABLE_HXX -#include <basic/sbxvar.hxx> -#endif -#include <unotools/searchopt.hxx> -#include <com/sun/star/util/XReplaceable.hpp> -#include <com/sun/star/util/XSearchable.hpp> -#include <com/sun/star/util/XSearchDescriptor.hpp> -#include <com/sun/star/util/XPropertyReplace.hpp> -#include <com/sun/star/util/XReplaceDescriptor.hpp> -#include <com/sun/star/lang/Locale.hpp> - -#include <svl/memberid.hrc> -#include <i18npool/mslangid.hxx> - -#ifndef GCC -#endif - -#define _SVX_SRCHITEM_CXX - -#include <sfx2/sfxsids.hrc> -#define ITEMID_SEARCH SID_SEARCH_ITEM -#include <sfx2/srchitem.hxx> - -#include <sfx2/sfxuno.hxx> - -using namespace utl; -using namespace com::sun::star::beans; -using namespace com::sun::star::i18n; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; - -#define CFG_ROOT_NODE "Office.Common/SearchOptions" - -#define SRCH_PARAMS 11 -#define SRCH_PARA_OPTIONS "Options" -#define SRCH_PARA_FAMILY "Family" -#define SRCH_PARA_COMMAND "Command" -#define SRCH_PARA_CELLTYPE "CellType" -#define SRCH_PARA_APPFLAG "AppFlag" -#define SRCH_PARA_ROWDIR "RowDirection" -#define SRCH_PARA_ALLTABLES "AllTables" -#define SRCH_PARA_BACKWARD "Backward" -#define SRCH_PARA_PATTERN "Pattern" -#define SRCH_PARA_CONTENT "Content" -#define SRCH_PARA_ASIANOPT "AsianOptions" - -// STATIC DATA ----------------------------------------------------------- - -TYPEINIT1_FACTORY(SvxSearchItem, SfxPoolItem, new SvxSearchItem(0)); - -// ----------------------------------------------------------------------- - -static Sequence< ::rtl::OUString > lcl_GetNotifyNames() -{ - // names of transliteration relevant properties - static const char* aTranslitNames[] = - { - "IsMatchCase", // 0 - "Japanese/IsMatchFullHalfWidthForms", // 1 - "Japanese/IsMatchHiraganaKatakana", // 2 - "Japanese/IsMatchContractions", // 3 - "Japanese/IsMatchMinusDashCho-on", // 4 - "Japanese/IsMatchRepeatCharMarks", // 5 - "Japanese/IsMatchVariantFormKanji", // 6 - "Japanese/IsMatchOldKanaForms", // 7 - "Japanese/IsMatch_DiZi_DuZu", // 8 - "Japanese/IsMatch_BaVa_HaFa", // 9 - "Japanese/IsMatch_TsiThiChi_DhiZi", // 10 - "Japanese/IsMatch_HyuIyu_ByuVyu", // 11 - "Japanese/IsMatch_SeShe_ZeJe", // 12 - "Japanese/IsMatch_IaIya", // 13 - "Japanese/IsMatch_KiKu", // 14 - "Japanese/IsIgnorePunctuation", // 15 - "Japanese/IsIgnoreWhitespace", // 16 - "Japanese/IsIgnoreProlongedSoundMark", // 17 - "Japanese/IsIgnoreMiddleDot" // 18 - }; - - const int nCount = sizeof( aTranslitNames ) / sizeof( aTranslitNames[0] ); - Sequence< ::rtl::OUString > aNames( nCount ); - ::rtl::OUString* pNames = aNames.getArray(); - for (INT32 i = 0; i < nCount; ++i) - pNames[i] = ::rtl::OUString::createFromAscii( aTranslitNames[i] ); - - return aNames; -} - -// ----------------------------------------------------------------------- -SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - ConfigItem( ::rtl::OUString::createFromAscii( CFG_ROOT_NODE ) ), - - aSearchOpt ( SearchAlgorithms_ABSOLUTE, - SearchFlags::LEV_RELAXED, - ::rtl::OUString(), - ::rtl::OUString(), - Locale(), - 2, 2, 2, - TransliterationModules_IGNORE_CASE ), - eFamily ( SFX_STYLE_FAMILY_PARA ), - nCommand ( 0 ), - nCellType ( SVX_SEARCHIN_FORMULA ), - nAppFlag ( SVX_SEARCHAPP_WRITER ), - bRowDirection ( sal_True ), - bAllTables ( sal_False ), - bNotes ( sal_False), - bBackward ( sal_False ), - bPattern ( sal_False ), - bContent ( sal_False ), - bAsianOptions ( FALSE ) -{ - EnableNotification( lcl_GetNotifyNames() ); - - SvtSearchOptions aOpt; - - bBackward = aOpt.IsBackwards(); - bAsianOptions = aOpt.IsUseAsianOptions(); - bNotes = aOpt.IsNotes(); - - if (aOpt.IsUseRegularExpression()) - aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; - if (aOpt.IsSimilaritySearch()) - aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; - if (aOpt.IsWholeWordsOnly()) - aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; - - INT32 &rFlags = aSearchOpt.transliterateFlags; - - if (!aOpt.IsMatchCase()) - rFlags |= TransliterationModules_IGNORE_CASE; - if ( aOpt.IsMatchFullHalfWidthForms()) - rFlags |= TransliterationModules_IGNORE_WIDTH; - if ( aOpt.IsMatchHiraganaKatakana()) - rFlags |= TransliterationModules_IGNORE_KANA; - if ( aOpt.IsMatchContractions()) - rFlags |= TransliterationModules_ignoreSize_ja_JP; - if ( aOpt.IsMatchMinusDashChoon()) - rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; - if ( aOpt.IsMatchRepeatCharMarks()) - rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; - if ( aOpt.IsMatchVariantFormKanji()) - rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if ( aOpt.IsMatchOldKanaForms()) - rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if ( aOpt.IsMatchDiziDuzu()) - rFlags |= TransliterationModules_ignoreZiZu_ja_JP; - if ( aOpt.IsMatchBavaHafa()) - rFlags |= TransliterationModules_ignoreBaFa_ja_JP; - if ( aOpt.IsMatchTsithichiDhizi()) - rFlags |= TransliterationModules_ignoreTiJi_ja_JP; - if ( aOpt.IsMatchHyuiyuByuvyu()) - rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; - if ( aOpt.IsMatchSesheZeje()) - rFlags |= TransliterationModules_ignoreSeZe_ja_JP; - if ( aOpt.IsMatchIaiya()) - rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if ( aOpt.IsMatchKiku()) - rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if ( aOpt.IsIgnorePunctuation()) - rFlags |= TransliterationModules_ignoreSeparator_ja_JP; - if ( aOpt.IsIgnoreWhitespace()) - rFlags |= TransliterationModules_ignoreSpace_ja_JP; - if ( aOpt.IsIgnoreProlongedSoundMark()) - rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if ( aOpt.IsIgnoreMiddleDot()) - rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; -} - -// ----------------------------------------------------------------------- - -SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) : - - SfxPoolItem ( rItem ), - ConfigItem( ::rtl::OUString::createFromAscii( CFG_ROOT_NODE ) ), - - aSearchOpt ( rItem.aSearchOpt ), - eFamily ( rItem.eFamily ), - nCommand ( rItem.nCommand ), - nCellType ( rItem.nCellType ), - nAppFlag ( rItem.nAppFlag ), - bRowDirection ( rItem.bRowDirection ), - bAllTables ( rItem.bAllTables ), - bNotes ( rItem.bNotes), - bBackward ( rItem.bBackward ), - bPattern ( rItem.bPattern ), - bContent ( rItem.bContent ), - bAsianOptions ( rItem.bAsianOptions ) -{ - EnableNotification( lcl_GetNotifyNames() ); -} - -// ----------------------------------------------------------------------- - -SvxSearchItem::~SvxSearchItem() -{ -} - -// ----------------------------------------------------------------------- -SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const -{ - return new SvxSearchItem(*this); -} - -// ----------------------------------------------------------------------- - -//! used below -static BOOL operator == ( const SearchOptions& rItem1, const SearchOptions& rItem2 ) -{ - return rItem1.algorithmType == rItem2.algorithmType && - rItem1.searchFlag == rItem2.searchFlag && - rItem1.searchString == rItem2.searchString && - rItem1.replaceString == rItem2.replaceString && - //rItem1.Locale == rItem2.Locale && - rItem1.changedChars == rItem2.changedChars && - rItem1.deletedChars == rItem2.deletedChars && - rItem1.insertedChars == rItem2.insertedChars && - rItem1.transliterateFlags == rItem2.transliterateFlags; -} - - -int SvxSearchItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" ); - const SvxSearchItem &rSItem = (SvxSearchItem &) rItem; - return ( nCommand == rSItem.nCommand ) && - ( bBackward == rSItem.bBackward ) && - ( bPattern == rSItem.bPattern ) && - ( bContent == rSItem.bContent ) && - ( eFamily == rSItem.eFamily ) && - ( bRowDirection == rSItem.bRowDirection ) && - ( bAllTables == rSItem.bAllTables ) && - ( nCellType == rSItem.nCellType ) && - ( nAppFlag == rSItem.nAppFlag ) && - ( bAsianOptions == rSItem.bAsianOptions ) && - ( aSearchOpt == rSItem.aSearchOpt ) && - ( bNotes == rSItem.bNotes ); -} - - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxSearchItem::GetPresentation -( - SfxItemPresentation , - SfxMapUnit , - SfxMapUnit , - XubString& , - const IntlWrapper * -) const -{ - return SFX_ITEM_PRESENTATION_NONE; -} - -void SvxSearchItem::GetFromDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& rDescr ) -{ - SetSearchString( rDescr->getSearchString() ); - ::com::sun::star::uno::Any aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchWords") ); - sal_Bool bTemp = false; - aAny >>= bTemp ; - SetWordOnly( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchCaseSensitive") ); - aAny >>= bTemp ; - SetExact( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchBackwards") ); - aAny >>= bTemp ; - SetBackward( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchInSelection") ); - aAny >>= bTemp ; - SetSelection( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchRegularExpression") ); - aAny >>= bTemp ; - SetRegExp( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarity") ); - aAny >>= bTemp ; - SetLevenshtein( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRelax") ); - aAny >>= bTemp ; - SetLEVRelaxed( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityExchange") ); - sal_Int16 nTemp = 0; - aAny >>= nTemp ; - SetLEVOther( nTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRemove") ); - aAny >>= nTemp ; - SetLEVShorter( nTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityAdd") ); - aAny >>= nTemp ; - SetLEVLonger( nTemp ); -} - -void SvxSearchItem::SetToDescriptor( ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & rDescr ) -{ - rDescr->setSearchString( GetSearchString() ); - ::com::sun::star::uno::Any aAny; - aAny <<= GetWordOnly() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchWords"), aAny ); - aAny <<= GetExact() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchCaseSensitive"), aAny ); - aAny <<= GetBackward() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchBackwards"), aAny ); - aAny <<= GetSelection() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchInSelection"), aAny ); - aAny <<= GetRegExp() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchRegularExpression"), aAny ); - aAny <<= IsLevenshtein() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarity"), aAny ); - aAny <<= IsLEVRelaxed() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRelax"), aAny ); - aAny <<= GetLEVOther() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityExchange"), aAny ); - aAny <<= GetLEVShorter() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRemove"), aAny ); - aAny <<= GetLEVLonger() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityAdd"), aAny ); -} - - -void SvxSearchItem::Notify( const Sequence< ::rtl::OUString > & ) -{ - // applies transliteration changes in the configuration database - // to the current SvxSearchItem - SetTransliterationFlags( SvtSearchOptions().GetTransliterationFlags() ); -} - -void SvxSearchItem::Commit() -{ -} - -void SvxSearchItem::SetMatchFullHalfWidthForms( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_WIDTH; - else - aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_WIDTH; -} - - -void SvxSearchItem::SetWordOnly( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; - else - aSearchOpt.searchFlag &= ~SearchFlags::NORM_WORD_ONLY; -} - - -void SvxSearchItem::SetExact( sal_Bool bVal ) -{ - if (!bVal) - aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_CASE; - else - aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_CASE; -} - - -void SvxSearchItem::SetSelection( sal_Bool bVal ) -{ - if (bVal) - { - aSearchOpt.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE | - SearchFlags::REG_NOT_ENDOFLINE); - } - else - { - aSearchOpt.searchFlag &= ~(SearchFlags::REG_NOT_BEGINOFLINE | - SearchFlags::REG_NOT_ENDOFLINE); - } -} - - -void SvxSearchItem::SetRegExp( sal_Bool bVal ) -{ - if ( bVal ) - aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; - else if ( SearchAlgorithms_REGEXP == aSearchOpt.algorithmType ) - aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; -} - - -void SvxSearchItem::SetLEVRelaxed( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.searchFlag |= SearchFlags::LEV_RELAXED; - else - aSearchOpt.searchFlag &= ~SearchFlags::LEV_RELAXED; -} - - -void SvxSearchItem::SetLevenshtein( sal_Bool bVal ) -{ - if ( bVal ) - aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; - else if ( SearchAlgorithms_APPROXIMATE == aSearchOpt.algorithmType ) - aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; -} - - -void SvxSearchItem::SetTransliterationFlags( sal_Int32 nFlags ) -{ - aSearchOpt.transliterateFlags = nFlags; -} - -sal_Bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0 : - { - Sequence< PropertyValue > aSeq( SRCH_PARAMS ); - aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_OPTIONS ) ); - aSeq[0].Value <<= aSearchOpt; - aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_FAMILY )); - aSeq[1].Value <<= sal_Int16( eFamily ); - aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_COMMAND )); - aSeq[2].Value <<= nCommand; - aSeq[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_CELLTYPE )); - aSeq[3].Value <<= nCellType; - aSeq[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_APPFLAG )); - aSeq[4].Value <<= nAppFlag; - aSeq[5].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ROWDIR )); - aSeq[5].Value <<= bRowDirection; - aSeq[6].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ALLTABLES )); - aSeq[6].Value <<= bAllTables; - aSeq[7].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_BACKWARD )); - aSeq[7].Value <<= bBackward; - aSeq[8].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_PATTERN )); - aSeq[8].Value <<= bPattern; - aSeq[9].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_CONTENT )); - aSeq[9].Value <<= bContent; - aSeq[10].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ASIANOPT )); - aSeq[10].Value <<= bAsianOptions; - rVal <<= aSeq; - } - break; - case MID_SEARCH_COMMAND: - rVal <<= (sal_Int16) nCommand; break; - case MID_SEARCH_STYLEFAMILY: - rVal <<= (sal_Int16) eFamily; break; - case MID_SEARCH_CELLTYPE: - rVal <<= (sal_Int32) nCellType; break; - case MID_SEARCH_ROWDIRECTION: - rVal <<= (sal_Bool) bRowDirection; break; - case MID_SEARCH_ALLTABLES: - rVal <<= (sal_Bool) bAllTables; break; - case MID_SEARCH_BACKWARD: - rVal <<= (sal_Bool) bBackward; break; - case MID_SEARCH_PATTERN: - rVal <<= (sal_Bool) bPattern; break; - case MID_SEARCH_CONTENT: - rVal <<= (sal_Bool) bContent; break; - case MID_SEARCH_ASIANOPTIONS: - rVal <<= (sal_Bool) bAsianOptions; break; - case MID_SEARCH_ALGORITHMTYPE: - rVal <<= (sal_Int16) aSearchOpt.algorithmType; break; - case MID_SEARCH_FLAGS: - rVal <<= aSearchOpt.searchFlag; break; - case MID_SEARCH_SEARCHSTRING: - rVal <<= aSearchOpt.searchString; break; - case MID_SEARCH_REPLACESTRING: - rVal <<= aSearchOpt.replaceString; break; - case MID_SEARCH_CHANGEDCHARS: - rVal <<= aSearchOpt.changedChars; break; - case MID_SEARCH_DELETEDCHARS: - rVal <<= aSearchOpt.deletedChars; break; - case MID_SEARCH_INSERTEDCHARS: - rVal <<= aSearchOpt.insertedChars; break; - case MID_SEARCH_TRANSLITERATEFLAGS: - rVal <<= aSearchOpt.transliterateFlags; break; - case MID_SEARCH_LOCALE: - { - sal_Int16 nLocale; - if (aSearchOpt.Locale.Language.getLength() || aSearchOpt.Locale.Country.getLength() ) - nLocale = MsLangId::convertLocaleToLanguage( aSearchOpt.Locale ); - else - nLocale = LANGUAGE_NONE; - rVal <<= nLocale; - break; - } - - default: - DBG_ERRORFILE( "SvxSearchItem::QueryValue(): Unknown MemberId" ); - return sal_False; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) -{ - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_False; - sal_Int32 nInt = 0; - switch ( nMemberId ) - { - case 0 : - { - Sequence< PropertyValue > aSeq; - if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) ) - { - sal_Int16 nConvertedCount( 0 ); - for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i ) - { - if ( aSeq[i].Name.equalsAscii( SRCH_PARA_OPTIONS ) ) - { - if ( ( aSeq[i].Value >>= aSearchOpt ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_FAMILY ) ) - { - sal_uInt16 nTemp( 0 ); - if ( ( aSeq[i].Value >>= nTemp ) == sal_True ) - { - eFamily = SfxStyleFamily( nTemp ); - ++nConvertedCount; - } - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_COMMAND ) ) - { - if ( ( aSeq[i].Value >>= nCommand ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_CELLTYPE ) ) - { - if ( ( aSeq[i].Value >>= nCellType ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_APPFLAG ) ) - { - if ( ( aSeq[i].Value >>= nAppFlag ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ROWDIR ) ) - { - if ( ( aSeq[i].Value >>= bRowDirection ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ALLTABLES ) ) - { - if ( ( aSeq[i].Value >>= bAllTables ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_BACKWARD ) ) - { - if ( ( aSeq[i].Value >>= bBackward ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_PATTERN ) ) - { - if ( ( aSeq[i].Value >>= bPattern ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_CONTENT ) ) - { - if ( ( aSeq[i].Value >>= bContent ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ASIANOPT ) ) - { - if ( ( aSeq[i].Value >>= bAsianOptions ) == sal_True ) - ++nConvertedCount; - } - } - - bRet = ( nConvertedCount == SRCH_PARAMS ); - } - break; - } - case MID_SEARCH_COMMAND: - bRet = (rVal >>= nInt); nCommand = (sal_uInt16) nInt; break; - case MID_SEARCH_STYLEFAMILY: - bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break; - case MID_SEARCH_CELLTYPE: - bRet = (rVal >>= nInt); nCellType = (sal_uInt16) nInt; break; - case MID_SEARCH_ROWDIRECTION: - bRet = (rVal >>= bRowDirection); break; - case MID_SEARCH_ALLTABLES: - bRet = (rVal >>= bAllTables); break; - case MID_SEARCH_BACKWARD: - bRet = (rVal >>= bBackward); break; - case MID_SEARCH_PATTERN: - bRet = (rVal >>= bPattern); break; - case MID_SEARCH_CONTENT: - bRet = (rVal >>= bContent); break; - case MID_SEARCH_ASIANOPTIONS: - bRet = (rVal >>= bAsianOptions); break; - case MID_SEARCH_ALGORITHMTYPE: - bRet = (rVal >>= nInt); aSearchOpt.algorithmType = (SearchAlgorithms)(sal_Int16)nInt; break; - case MID_SEARCH_FLAGS: - bRet = (rVal >>= aSearchOpt.searchFlag); break; - case MID_SEARCH_SEARCHSTRING: - bRet = (rVal >>= aSearchOpt.searchString); break; - case MID_SEARCH_REPLACESTRING: - bRet = (rVal >>= aSearchOpt.replaceString); break; - case MID_SEARCH_CHANGEDCHARS: - bRet = (rVal >>= aSearchOpt.changedChars); break; - case MID_SEARCH_DELETEDCHARS: - bRet = (rVal >>= aSearchOpt.deletedChars); break; - case MID_SEARCH_INSERTEDCHARS: - bRet = (rVal >>= aSearchOpt.insertedChars); break; - case MID_SEARCH_TRANSLITERATEFLAGS: - bRet = (rVal >>= aSearchOpt.transliterateFlags); break; - case MID_SEARCH_LOCALE: - { - bRet = (rVal >>= nInt); - if ( bRet ) - { - if ( nInt == LANGUAGE_NONE ) - { - aSearchOpt.Locale = ::com::sun::star::lang::Locale(); - } - else - { - MsLangId::convertLanguageToLocale( (sal_Int16) nInt, aSearchOpt.Locale ); - } - } - break; - } - default: - DBG_ERROR( "Unknown MemberId" ); - } - - return bRet; -} - - |