LibreOffice Module sw (master)  1
unosrch.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SW_INC_UNOSRCH_HXX
20 #define INCLUDED_SW_INC_UNOSRCH_HXX
21 
22 #include <com/sun/star/util/XPropertyReplace.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/lang/XUnoTunnel.hpp>
25 #include <cppuhelper/implbase.hxx>
26 #include <rtl/ustring.hxx>
27 #include <memory>
28 
29 class SfxItemPropertySet;
31 class SfxItemSet;
32 
33 namespace i18nutil {
34  struct SearchOptions2;
35 }
36 
37 class SwXTextSearch : public cppu::WeakImplHelper
38 <
39  css::util::XPropertyReplace,
40  css::lang::XServiceInfo,
41  css::lang::XUnoTunnel
42 >
43 {
44  friend class SwXTextDocument;
45 
46  OUString m_sSearchText;
47  OUString m_sReplaceText;
48 
49  std::unique_ptr<SwSearchProperties_Impl> m_pSearchProperties;
50  std::unique_ptr<SwSearchProperties_Impl> m_pReplaceProperties;
51 
53  bool m_bAll : 1;
54  bool m_bWord : 1;
55  bool m_bBack : 1;
56  bool m_bExpr : 1;
57  bool m_bCase : 1;
58  bool m_bStyles:1;
59  bool m_bSimilarity : 1;
60  bool m_bLevRelax :1;
61  sal_Int16 m_nLevExchange;
62  sal_Int16 m_nLevAdd;
63  sal_Int16 m_nLevRemove;
64 
66 protected:
67  virtual ~SwXTextSearch() override;
68 public:
69  SwXTextSearch();
70 
71  static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
72 
73  //XUnoTunnel
74  virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
75 
76  //XSearchDescriptor
77  virtual OUString SAL_CALL getSearchString( ) override;
78  virtual void SAL_CALL setSearchString( const OUString& aString ) override;
79 
80  //XReplaceDescriptor
81  virtual OUString SAL_CALL getReplaceString() override;
82  virtual void SAL_CALL setReplaceString(const OUString& aReplaceString) override;
83 
84  //XPropertySet
85  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
86  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
87  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
88  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
89  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
90  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
91  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
92 
93  //XPropertyReplace
94  virtual sal_Bool SAL_CALL getValueSearch() override;
95  virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) override;
96  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getSearchAttributes() override;
97  virtual void SAL_CALL setSearchAttributes(const css::uno::Sequence< css::beans::PropertyValue >& aSearchAttribs) override;
98  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getReplaceAttributes() override;
99  virtual void SAL_CALL setReplaceAttributes(const css::uno::Sequence< css::beans::PropertyValue >& aSearchAttribs) override;
100 
101  //XServiceInfo
102  virtual OUString SAL_CALL getImplementationName() override;
103  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
104  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
105 
106  void FillSearchItemSet(SfxItemSet& rSet) const;
107  void FillReplaceItemSet(SfxItemSet& rSet) const;
108 
109  bool HasSearchAttributes() const;
110  bool HasReplaceAttributes() const;
111 
112  void FillSearchOptions( i18nutil::SearchOptions2& rSearchOpt ) const;
113 };
114 
115 #endif
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unosrch.cxx:464
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unosrch.cxx:653
bool HasReplaceAttributes() const
Definition: unosrch.cxx:638
bool HasSearchAttributes() const
Definition: unosrch.cxx:633
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unosrch.cxx:576
sal_Int16 m_nLevRemove
Definition: unosrch.hxx:63
virtual void SAL_CALL setSearchString(const OUString &aString) override
Definition: unosrch.cxx:481
void FillSearchOptions(i18nutil::SearchOptions2 &rSearchOpt) const
Definition: unosrch.cxx:658
OUString m_sSearchText
Definition: unosrch.hxx:46
virtual ~SwXTextSearch() override
Definition: unosrch.cxx:448
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getReplaceAttributes() override
Definition: unosrch.cxx:613
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unosrch.cxx:581
std::unique_ptr< SwSearchProperties_Impl > m_pSearchProperties
Definition: unosrch.hxx:49
bool m_bWord
Definition: unosrch.hxx:54
bool m_bExpr
Definition: unosrch.hxx:56
OUString m_sReplaceText
Definition: unosrch.hxx:47
virtual void SAL_CALL setValueSearch(sal_Bool ValueSearch_) override
Definition: unosrch.cxx:597
const SfxItemPropertySet * m_pPropSet
Definition: unosrch.hxx:52
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unosrch.cxx:505
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unosrch.cxx:499
bool m_bCase
Definition: unosrch.hxx:57
std::unique_ptr< SwSearchProperties_Impl > m_pReplaceProperties
Definition: unosrch.hxx:50
virtual OUString SAL_CALL getReplaceString() override
Definition: unosrch.cxx:487
unsigned char sal_Bool
bool m_bBack
Definition: unosrch.hxx:55
virtual OUString SAL_CALL getImplementationName() override
Definition: unosrch.cxx:643
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unosrch.cxx:648
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getSearchAttributes() override
Definition: unosrch.cxx:603
sal_Int16 m_nLevAdd
Definition: unosrch.hxx:62
void FillReplaceItemSet(SfxItemSet &rSet) const
Definition: unosrch.cxx:628
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unosrch.cxx:571
sal_Int16 m_nLevExchange
Definition: unosrch.hxx:61
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unosrch.cxx:535
virtual OUString SAL_CALL getSearchString() override
Definition: unosrch.cxx:475
virtual sal_Bool SAL_CALL getValueSearch() override
Definition: unosrch.cxx:591
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unosrch.cxx:586
virtual void SAL_CALL setReplaceString(const OUString &aReplaceString) override
Definition: unosrch.cxx:493
virtual void SAL_CALL setReplaceAttributes(const css::uno::Sequence< css::beans::PropertyValue > &aSearchAttribs) override
Definition: unosrch.cxx:618
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unosrch.cxx:459
void FillSearchItemSet(SfxItemSet &rSet) const
Definition: unosrch.cxx:623
bool m_bStyles
Definition: unosrch.hxx:58
bool m_bIsValueSearch
Definition: unosrch.hxx:65
bool m_bSimilarity
Definition: unosrch.hxx:59
virtual void SAL_CALL setSearchAttributes(const css::uno::Sequence< css::beans::PropertyValue > &aSearchAttribs) override
Definition: unosrch.cxx:608
bool m_bLevRelax
Definition: unosrch.hxx:60