LibreOffice Module sw (master)  1
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
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 .
18  */
22 #include <ooo/vba/word/XFind.hpp>
24 #include <com/sun/star/text/XTextRange.hpp>
25 #include <com/sun/star/util/XReplaceable.hpp>
26 #include <com/sun/star/util/XPropertyReplace.hpp>
27 #include <com/sun/star/text/XTextViewCursor.hpp>
28 #include <com/sun/star/view/XSelectionSupplier.hpp>
32 class SwVbaFind : public SwVbaFind_BASE
33 {
34 private:
35  css::uno::Reference< css::frame::XModel > mxModel;
36  css::uno::Reference< css::text::XTextRange > mxTextRange;
37  css::uno::Reference< css::util::XReplaceable > mxReplaceable;
38  css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
39  css::uno::Reference< css::text::XTextViewCursor> mxTVC;
40  css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp;
41  bool mbReplace;
42  sal_Int32 mnReplaceType;
43  sal_Int32 mnWrap;
45 private:
47  bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange );
49  bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange );
50  void SetReplace( sal_Int32 type );
52  void SetReplaceWith( const OUString& rText );
54  OUString GetReplaceWith();
56  css::uno::Reference< css::text::XTextRange > FindOneElement();
58  bool SearchReplace();
60 public:
62  SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
63  virtual ~SwVbaFind() override;
65  // Attributes
66  virtual OUString SAL_CALL getText() override;
67  virtual void SAL_CALL setText( const OUString& _text ) override;
68  virtual css::uno::Any SAL_CALL getReplacement() override;
69  virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) override;
70  virtual sal_Bool SAL_CALL getForward() override;
71  virtual void SAL_CALL setForward( sal_Bool _forward ) override;
72  virtual ::sal_Int32 SAL_CALL getWrap() override;
73  virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) override;
74  virtual sal_Bool SAL_CALL getFormat() override;
75  virtual void SAL_CALL setFormat( sal_Bool _format ) override;
76  virtual sal_Bool SAL_CALL getMatchCase() override;
77  virtual void SAL_CALL setMatchCase( sal_Bool _matchcase ) override;
78  virtual sal_Bool SAL_CALL getMatchWholeWord() override;
79  virtual void SAL_CALL setMatchWholeWord( sal_Bool _matchwholeword ) override;
80  virtual sal_Bool SAL_CALL getMatchWildcards() override;
81  virtual void SAL_CALL setMatchWildcards( sal_Bool _matchwildcards ) override;
82  virtual sal_Bool SAL_CALL getMatchSoundsLike() override;
83  virtual void SAL_CALL setMatchSoundsLike( sal_Bool _matchsoundslike ) override;
84  virtual sal_Bool SAL_CALL getMatchAllWordForms() override;
85  virtual void SAL_CALL setMatchAllWordForms( sal_Bool _matchallwordforms ) override;
86  virtual css::uno::Any SAL_CALL getStyle() override;
87  virtual void SAL_CALL setStyle( const css::uno::Any& _style ) override;
89  // Methods
90  virtual sal_Bool SAL_CALL Execute( const css::uno::Any& FindText, const css::uno::Any& MatchCase, const css::uno::Any& MatchWholeWord, const css::uno::Any& MatchWildcards, const css::uno::Any& MatchSoundsLike, const css::uno::Any& MatchAllWordForms, const css::uno::Any& Forward, const css::uno::Any& Wrap, const css::uno::Any& Format, const css::uno::Any& ReplaceWith, const css::uno::Any& Replace, const css::uno::Any& MatchKashida, const css::uno::Any& MatchDiacritics, const css::uno::Any& MatchAlefHamza, const css::uno::Any& MatchControl, const css::uno::Any& MatchPrefix, const css::uno::Any& MatchSuffix, const css::uno::Any& MatchPhrase, const css::uno::Any& IgnoreSpace, const css::uno::Any& IgnorePunct ) override;
91  virtual void SAL_CALL ClearFormatting( ) override;
93  // XHelperInterface
94  virtual OUString getServiceImplName() override;
95  virtual css::uno::Sequence<OUString> getServiceNames() override;
96 };
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool SearchReplace()
Definition: vbafind.cxx:115
virtual sal_Bool SAL_CALL Execute(const css::uno::Any &FindText, const css::uno::Any &MatchCase, const css::uno::Any &MatchWholeWord, const css::uno::Any &MatchWildcards, const css::uno::Any &MatchSoundsLike, const css::uno::Any &MatchAllWordForms, const css::uno::Any &Forward, const css::uno::Any &Wrap, const css::uno::Any &Format, const css::uno::Any &ReplaceWith, const css::uno::Any &Replace, const css::uno::Any &MatchKashida, const css::uno::Any &MatchDiacritics, const css::uno::Any &MatchAlefHamza, const css::uno::Any &MatchControl, const css::uno::Any &MatchPrefix, const css::uno::Any &MatchSuffix, const css::uno::Any &MatchPhrase, const css::uno::Any &IgnoreSpace, const css::uno::Any &IgnorePunct) override
Definition: vbafind.cxx:304
virtual sal_Bool SAL_CALL getMatchWholeWord() override
Definition: vbafind.cxx:240
css::uno::Reference< css::text::XTextViewCursor > mxTVC
Definition: vbafind.hxx:39
virtual sal_Bool SAL_CALL getMatchWildcards() override
Definition: vbafind.cxx:252
virtual OUString getServiceImplName() override
Definition: vbafind.cxx:391
bool InEqualRange(const css::uno::Reference< css::text::XTextRange > &xCurrentRange)
Definition: vbafind.cxx:49
virtual sal_Bool SAL_CALL getForward() override
Definition: vbafind.cxx:193
virtual void SAL_CALL setReplacement(const css::uno::Any &_replacement) override
Definition: vbafind.cxx:188
css::uno::Reference< css::frame::XModel > mxModel
Definition: vbafind.hxx:35
virtual void SAL_CALL ClearFormatting() override
Definition: vbafind.cxx:384
virtual ::sal_Int32 SAL_CALL getWrap() override
Definition: vbafind.cxx:206
css::uno::Reference< css::util::XReplaceable > mxReplaceable
Definition: vbafind.hxx:37
OUString GetReplaceWith()
Definition: vbafind.cxx:61
virtual void SAL_CALL setMatchWholeWord(sal_Bool _matchwholeword) override
Definition: vbafind.cxx:247
virtual sal_Bool SAL_CALL getMatchCase() override
Definition: vbafind.cxx:228
virtual void SAL_CALL setWrap(::sal_Int32 _wrap) override
Definition: vbafind.cxx:212
sal_Int32 mnReplaceType
Definition: vbafind.hxx:42
css::uno::Reference< css::text::XTextRange > mxTextRange
Definition: vbafind.hxx:36
css::uno::Reference< css::util::XPropertyReplace > mxPropertyReplace
Definition: vbafind.hxx:38
virtual void SAL_CALL setMatchAllWordForms(sal_Bool _matchallwordforms) override
Definition: vbafind.cxx:286
virtual void SAL_CALL setMatchWildcards(sal_Bool _matchwildcards) override
Definition: vbafind.cxx:259
unsigned char sal_Bool
css::uno::Reference< css::text::XTextRange > FindOneElement()
Definition: vbafind.cxx:70
virtual ~SwVbaFind() override
Definition: vbafind.cxx:39
virtual css::uno::Any SAL_CALL getStyle() override
Definition: vbafind.cxx:293
virtual sal_Bool SAL_CALL getMatchSoundsLike() override
Definition: vbafind.cxx:264
css::uno::Reference< css::view::XSelectionSupplier > mxSelSupp
Definition: vbafind.hxx:40
virtual void SAL_CALL setFormat(sal_Bool _format) override
Definition: vbafind.cxx:223
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbafind.cxx:397
SwVbaFind(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::text::XTextRange > &xTextRange)
Definition: vbafind.cxx:30
virtual void SAL_CALL setStyle(const css::uno::Any &_style) override
Definition: vbafind.cxx:298
virtual OUString SAL_CALL getText() override
Definition: vbafind.cxx:173
bool mbReplace
Definition: vbafind.hxx:41
virtual sal_Bool SAL_CALL getFormat() override
Definition: vbafind.cxx:218
InheritedHelperInterfaceWeakImpl< ooo::vba::word::XFind > SwVbaFind_BASE
Definition: vbafind.hxx:30
virtual void SAL_CALL setForward(sal_Bool _forward) override
Definition: vbafind.cxx:200
virtual void SAL_CALL setText(const OUString &_text) override
Definition: vbafind.cxx:178
virtual css::uno::Any SAL_CALL getReplacement() override
Definition: vbafind.cxx:183
virtual sal_Bool SAL_CALL getMatchAllWordForms() override
Definition: vbafind.cxx:277
void SetReplaceWith(const OUString &rText)
Definition: vbafind.cxx:55
void SetReplace(sal_Int32 type)
Definition: vbafind.cxx:65
bool InRange(const css::uno::Reference< css::text::XTextRange > &xCurrentRange)
Definition: vbafind.cxx:43
virtual void SAL_CALL setMatchSoundsLike(sal_Bool _matchsoundslike) override
Definition: vbafind.cxx:271
virtual void SAL_CALL setMatchCase(sal_Bool _matchcase) override
Definition: vbafind.cxx:235
sal_Int32 mnWrap
Definition: vbafind.hxx:43