LibreOffice Module sw (master)
1
sw
source
core
inc
SearchResultLocator.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
*/
10
11
#pragma once
12
13
#include <
swdllapi.h
>
14
#include <
doc.hxx
>
15
#include <
basegfx/range/b2drange.hxx
>
16
#include <utility>
17
18
namespace
sw::search
19
{
20
enum class
NodeType
21
{
22
Undefined
= 0,
23
WriterNode
= 1,
24
CommonNode
= 2
// node in a SdrObject
25
};
26
27
struct
SearchIndexData
28
{
29
NodeType
meType
=
NodeType::Undefined
;
30
SwNodeOffset
mnNodeIndex
{ 0 };
31
OUString
maObjectName
;
32
33
SearchIndexData
() {}
34
35
SearchIndexData
(
NodeType
eType,
SwNodeOffset
nNodeIndex, OUString aObjectName = OUString())
36
:
meType
(
eType
)
37
,
mnNodeIndex
(nNodeIndex)
38
,
maObjectName
(
std
::move(aObjectName))
39
{
40
}
41
};
42
43
struct
LocationResult
44
{
45
bool
mbFound
=
false
;
46
std::vector<basegfx::B2DRange>
maRectangles
;
47
};
48
49
class
SW_DLLPUBLIC
SearchResultLocator
50
{
51
SwDoc
*
mpDocument
;
52
53
void
findOne(
LocationResult
& rResult,
SearchIndexData
const
& rSearchIndexData);
54
static
bool
tryParseJSON(
const
char
* pPayload,
55
std::vector<sw::search::SearchIndexData>& rDataVector);
56
static
bool
tryParseXML(
const
char
* pPayload,
57
std::vector<sw::search::SearchIndexData>& rDataVector);
58
59
public
:
60
SearchResultLocator
(
SwDoc
* pDoc)
61
: mpDocument(pDoc)
62
{
63
}
64
65
LocationResult
find
(std::vector<SearchIndexData>
const
& rSearchIndexDataVector);
66
LocationResult
findForPayload(
const
char
* pPayload);
67
};
68
69
}
// end sw namespace
70
71
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
b2drange.hxx
SwDoc
Definition:
doc.hxx:197
sw::search::SearchResultLocator
Definition:
SearchResultLocator.hxx:50
sw::search::SearchResultLocator::mpDocument
SwDoc * mpDocument
Definition:
SearchResultLocator.hxx:51
sw::search::SearchResultLocator::SearchResultLocator
SearchResultLocator(SwDoc *pDoc)
Definition:
SearchResultLocator.hxx:60
doc.hxx
eType
DocumentType eType
find
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
std
sw::search
Definition:
SearchResultLocator.hxx:19
sw::search::NodeType
NodeType
Definition:
SearchResultLocator.hxx:21
sw::search::NodeType::WriterNode
@ WriterNode
sw::search::NodeType::CommonNode
@ CommonNode
sw::search::NodeType::Undefined
@ Undefined
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset >
sw::search::LocationResult
Definition:
SearchResultLocator.hxx:44
sw::search::LocationResult::mbFound
bool mbFound
Definition:
SearchResultLocator.hxx:45
sw::search::LocationResult::maRectangles
std::vector< basegfx::B2DRange > maRectangles
Definition:
SearchResultLocator.hxx:46
sw::search::SearchIndexData
Definition:
SearchResultLocator.hxx:28
sw::search::SearchIndexData::SearchIndexData
SearchIndexData(NodeType eType, SwNodeOffset nNodeIndex, OUString aObjectName=OUString())
Definition:
SearchResultLocator.hxx:35
sw::search::SearchIndexData::mnNodeIndex
SwNodeOffset mnNodeIndex
Definition:
SearchResultLocator.hxx:30
sw::search::SearchIndexData::SearchIndexData
SearchIndexData()
Definition:
SearchResultLocator.hxx:33
sw::search::SearchIndexData::meType
NodeType meType
Definition:
SearchResultLocator.hxx:29
sw::search::SearchIndexData::maObjectName
OUString maObjectName
Definition:
SearchResultLocator.hxx:31
swdllapi.h
SW_DLLPUBLIC
#define SW_DLLPUBLIC
Definition:
swdllapi.h:28
ScDragSrc::Undefined
@ Undefined
Generated on Sun Jul 30 2023 04:28:37 for LibreOffice Module sw (master) by
1.9.3