ITEM: Refactor ItemType
[LibreOffice.git] / sw / source / ui / vba / vbafind.hxx
blobca20642614aea8b49b479829dfbb6f9752ef7b24
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UI_VBA_VBAFIND_HXX
20 #define INCLUDED_SW_SOURCE_UI_VBA_VBAFIND_HXX
22 #include <ooo/vba/word/XFind.hpp>
23 #include <vbahelper/vbahelperinterface.hxx>
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>
29 #include <rtl/ref.hxx>
31 class SwXTextDocument;
33 typedef InheritedHelperInterfaceWeakImpl< ooo::vba::word::XFind > SwVbaFind_BASE;
35 class SwVbaFind : public SwVbaFind_BASE
37 private:
38 rtl::Reference< SwXTextDocument > mxModel;
39 css::uno::Reference< css::text::XTextRange > mxTextRange;
40 css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
41 css::uno::Reference< css::text::XTextViewCursor> mxTVC;
42 css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp;
43 bool mbReplace;
44 sal_Int32 mnReplaceType;
45 sal_Int32 mnWrap;
47 private:
48 /// @throws css::uno::RuntimeException
49 bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange );
50 /// @throws css::uno::RuntimeException
51 bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange );
52 void SetReplace( sal_Int32 type );
53 /// @throws css::uno::RuntimeException
54 void SetReplaceWith( const OUString& rText );
55 /// @throws css::uno::RuntimeException
56 OUString GetReplaceWith();
57 /// @throws css::uno::RuntimeException
58 css::uno::Reference< css::text::XTextRange > FindOneElement();
59 /// @throws css::uno::RuntimeException
60 bool SearchReplace();
62 /// @throws css::uno::RuntimeException
63 SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent,
64 const css::uno::Reference< css::uno::XComponentContext >& rContext,
65 rtl::Reference< SwXTextDocument > xModel );
66 public:
67 static css::uno::Reference< ooo::vba::word::XFind > GetOrCreateFind(
68 const css::uno::Reference< ooo::vba::XHelperInterface >& rParent,
69 const css::uno::Reference< css::uno::XComponentContext >& rContext,
70 const rtl::Reference< SwXTextDocument >& xModel,
71 const css::uno::Reference< css::text::XTextRange >& xTextRange);
72 virtual ~SwVbaFind() override;
74 // Attributes
75 virtual OUString SAL_CALL getText() override;
76 virtual void SAL_CALL setText( const OUString& _text ) override;
77 virtual css::uno::Any SAL_CALL getReplacement() override;
78 virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) override;
79 virtual sal_Bool SAL_CALL getForward() override;
80 virtual void SAL_CALL setForward( sal_Bool _forward ) override;
81 virtual ::sal_Int32 SAL_CALL getWrap() override;
82 virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) override;
83 virtual sal_Bool SAL_CALL getFormat() override;
84 virtual void SAL_CALL setFormat( sal_Bool _format ) override;
85 virtual sal_Bool SAL_CALL getMatchCase() override;
86 virtual void SAL_CALL setMatchCase( sal_Bool _matchcase ) override;
87 virtual sal_Bool SAL_CALL getMatchWholeWord() override;
88 virtual void SAL_CALL setMatchWholeWord( sal_Bool _matchwholeword ) override;
89 virtual sal_Bool SAL_CALL getMatchWildcards() override;
90 virtual void SAL_CALL setMatchWildcards( sal_Bool _matchwildcards ) override;
91 virtual sal_Bool SAL_CALL getMatchSoundsLike() override;
92 virtual void SAL_CALL setMatchSoundsLike( sal_Bool _matchsoundslike ) override;
93 virtual sal_Bool SAL_CALL getMatchAllWordForms() override;
94 virtual void SAL_CALL setMatchAllWordForms( sal_Bool _matchallwordforms ) override;
95 virtual css::uno::Any SAL_CALL getStyle() override;
96 virtual void SAL_CALL setStyle( const css::uno::Any& _style ) override;
98 // Methods
99 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;
100 virtual void SAL_CALL ClearFormatting( ) override;
102 // XHelperInterface
103 virtual OUString getServiceImplName() override;
104 virtual css::uno::Sequence<OUString> getServiceNames() override;
106 #endif // INCLUDED_SW_SOURCE_UI_VBA_VBAFIND_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */