1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _UNOSRCH_HXX 28 #define _UNOSRCH_HXX 29 30 #include <com/sun/star/util/XPropertyReplace.hpp> 31 #include <com/sun/star/lang/XServiceInfo.hpp> 32 #include <com/sun/star/lang/XUnoTunnel.hpp> 33 #include <cppuhelper/implbase3.hxx> // helper for implementations 34 #include <tools/string.hxx> 35 36 /****************************************************************************** 37 * 38 ******************************************************************************/ 39 class SfxItemPropertySet; 40 class SwXTextDocument; 41 class SwSearchProperties_Impl; 42 class SfxItemSet; 43 44 namespace com{namespace sun{namespace star{namespace util{ 45 struct SearchOptions; 46 }}}} 47 48 49 /*-----------------19.12.97 12:58------------------- 50 51 --------------------------------------------------*/ 52 class SwXTextSearch : public cppu::WeakImplHelper3 53 < 54 ::com::sun::star::util::XPropertyReplace, 55 ::com::sun::star::lang::XServiceInfo, 56 ::com::sun::star::lang::XUnoTunnel 57 > 58 { 59 friend class SwXTextDocument; 60 61 String sSearchText; 62 String sReplaceText; 63 64 SwSearchProperties_Impl* pSearchProperties; 65 SwSearchProperties_Impl* pReplaceProperties; 66 67 68 const SfxItemPropertySet* m_pPropSet; 69 sal_Bool bAll : 1; 70 sal_Bool bWord : 1; 71 sal_Bool bBack : 1; 72 sal_Bool bExpr : 1; 73 sal_Bool bCase : 1; 74 // sal_Bool bInSel: 1; // wie geht Suchen in Selektionen? 75 sal_Bool bStyles:1; 76 sal_Bool bSimilarity : 1; 77 sal_Bool bLevRelax :1; 78 sal_Int16 nLevExchange; 79 sal_Int16 nLevAdd; 80 sal_Int16 nLevRemove; 81 82 sal_Bool bIsValueSearch :1; 83 protected: 84 virtual ~SwXTextSearch(); 85 public: 86 SwXTextSearch(); 87 88 89 90 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); 91 92 //XUnoTunnel 93 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 94 95 //XSearchDescriptor 96 virtual ::rtl::OUString SAL_CALL getSearchString( ) throw(::com::sun::star::uno::RuntimeException); 97 virtual void SAL_CALL setSearchString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException); 98 99 //XReplaceDescriptor 100 virtual ::rtl::OUString SAL_CALL getReplaceString(void) throw( ::com::sun::star::uno::RuntimeException ); 101 virtual void SAL_CALL setReplaceString(const ::rtl::OUString& aReplaceString) throw( ::com::sun::star::uno::RuntimeException ); 102 103 //XPropertySet 104 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 105 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 106 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 107 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 108 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 109 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 110 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 111 112 //XPropertyReplace 113 virtual sal_Bool SAL_CALL getValueSearch(void) throw( ::com::sun::star::uno::RuntimeException ); 114 virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) throw( ::com::sun::star::uno::RuntimeException ); 115 virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getSearchAttributes(void) throw( ::com::sun::star::uno::RuntimeException ); 116 virtual void SAL_CALL setSearchAttributes(const ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aSearchAttribs) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 117 virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getReplaceAttributes(void) throw( ::com::sun::star::uno::RuntimeException ); 118 virtual void SAL_CALL setReplaceAttributes(const ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aSearchAttribs) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); 119 120 //XServiceInfo 121 virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); 122 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); 123 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); 124 125 void FillSearchItemSet(SfxItemSet& rSet) const; 126 void FillReplaceItemSet(SfxItemSet& rSet) const; 127 128 sal_Bool HasSearchAttributes() const; 129 sal_Bool HasReplaceAttributes() const; 130 131 void FillSearchOptions( ::com::sun::star::util::SearchOptions& 132 rSearchOpt ) const; 133 }; 134 135 #endif 136 137