xref: /AOO41X/main/sw/inc/unosrch.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNOSRCH_HXX
24 #define _UNOSRCH_HXX
25 
26 #include <com/sun/star/util/XPropertyReplace.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <cppuhelper/implbase3.hxx> // helper for implementations
30 #include <tools/string.hxx>
31 
32 /******************************************************************************
33  *
34  ******************************************************************************/
35 class SfxItemPropertySet;
36 class SwXTextDocument;
37 class SwSearchProperties_Impl;
38 class SfxItemSet;
39 
40 namespace com{namespace sun{namespace star{namespace util{
41     struct SearchOptions;
42 }}}}
43 
44 
45 /*-----------------19.12.97 12:58-------------------
46 
47 --------------------------------------------------*/
48 class SwXTextSearch : public cppu::WeakImplHelper3
49 <
50     ::com::sun::star::util::XPropertyReplace,
51     ::com::sun::star::lang::XServiceInfo,
52     ::com::sun::star::lang::XUnoTunnel
53 >
54 {
55     friend class SwXTextDocument;
56 
57     String                  sSearchText;
58     String                  sReplaceText;
59 
60     SwSearchProperties_Impl*    pSearchProperties;
61     SwSearchProperties_Impl*    pReplaceProperties;
62 
63 
64     const SfxItemPropertySet*   m_pPropSet;
65     sal_Bool                    bAll  : 1;
66     sal_Bool                    bWord : 1;
67     sal_Bool                    bBack : 1;
68     sal_Bool                    bExpr : 1;
69     sal_Bool                    bCase : 1;
70 //  sal_Bool                    bInSel: 1;  // wie geht Suchen in Selektionen?
71     sal_Bool                    bStyles:1;
72     sal_Bool                    bSimilarity : 1;
73     sal_Bool                    bLevRelax       :1;
74     sal_Int16                   nLevExchange;
75     sal_Int16                   nLevAdd;
76     sal_Int16                   nLevRemove;
77 
78     sal_Bool                    bIsValueSearch :1;
79 protected:
80     virtual ~SwXTextSearch();
81 public:
82     SwXTextSearch();
83 
84 
85 
86     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
87 
88     //XUnoTunnel
89     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
90 
91     //XSearchDescriptor
92     virtual ::rtl::OUString SAL_CALL getSearchString(  ) throw(::com::sun::star::uno::RuntimeException);
93     virtual void SAL_CALL setSearchString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
94 
95     //XReplaceDescriptor
96     virtual ::rtl::OUString SAL_CALL getReplaceString(void) throw( ::com::sun::star::uno::RuntimeException );
97     virtual void SAL_CALL setReplaceString(const ::rtl::OUString& aReplaceString) throw( ::com::sun::star::uno::RuntimeException );
98 
99     //XPropertySet
100     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
101     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);
102     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);
103     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);
104     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);
105     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);
106     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);
107 
108     //XPropertyReplace
109     virtual sal_Bool SAL_CALL getValueSearch(void) throw( ::com::sun::star::uno::RuntimeException );
110     virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) throw( ::com::sun::star::uno::RuntimeException );
111     virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getSearchAttributes(void) throw( ::com::sun::star::uno::RuntimeException );
112     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 );
113     virtual ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > SAL_CALL getReplaceAttributes(void) throw( ::com::sun::star::uno::RuntimeException );
114     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 );
115 
116     //XServiceInfo
117     virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
118     virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
119     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
120 
121     void    FillSearchItemSet(SfxItemSet& rSet) const;
122     void    FillReplaceItemSet(SfxItemSet& rSet) const;
123 
124     sal_Bool    HasSearchAttributes() const;
125     sal_Bool    HasReplaceAttributes() const;
126 
127     void    FillSearchOptions( ::com::sun::star::util::SearchOptions&
128                                         rSearchOpt ) const;
129 };
130 
131 #endif
132 
133