Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ca8016c3
Kaydet (Commit)
ca8016c3
authored
Eki 06, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: extract lcl_emitSearchResultCallbacks() from SwView::ExecSearch()
Change-Id: I9c6b7540bcae85d6529e5cc195a7e86f58ee5713
üst
85b1f917
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
42 deletions
+46
-42
viewsrch.cxx
sw/source/uibase/uiview/viewsrch.cxx
+46
-42
No files found.
sw/source/uibase/uiview/viewsrch.cxx
Dosyayı görüntüle @
ca8016c3
...
@@ -102,6 +102,51 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt
...
@@ -102,6 +102,51 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt
rTree
.
add_child
(
rKey
.
getStr
(),
aChildren
);
rTree
.
add_child
(
rKey
.
getStr
(),
aChildren
);
}
}
/// Emits LOK callbacks (count, selection) for search results.
static
void
lcl_emitSearchResultCallbacks
(
sal_uInt16
nFound
,
SvxSearchItem
*
pSearchItem
,
SwWrtShell
*
pWrtShell
)
{
OString
aPayload
=
OString
::
number
(
nFound
)
+
";"
+
pSearchItem
->
GetSearchString
().
toUtf8
();
pWrtShell
->
libreOfficeKitCallback
(
LOK_CALLBACK_SEARCH_RESULT_COUNT
,
aPayload
.
getStr
());
// Emit a callback also about the selection rectangles, grouped by matches.
if
(
SwPaM
*
pPaM
=
pWrtShell
->
GetCrsr
())
{
std
::
vector
<
OString
>
aMatches
;
for
(
SwPaM
&
rPaM
:
pPaM
->
GetRingContainer
())
{
if
(
SwShellCrsr
*
pShellCrsr
=
dynamic_cast
<
SwShellCrsr
*>
(
&
rPaM
))
{
std
::
vector
<
OString
>
aSelectionRectangles
;
pShellCrsr
->
SwSelPaintRects
::
Show
(
&
aSelectionRectangles
);
std
::
stringstream
ss
;
bool
bFirst
=
true
;
for
(
size_t
i
=
0
;
i
<
aSelectionRectangles
.
size
();
++
i
)
{
const
OString
&
rSelectionRectangle
=
aSelectionRectangles
[
i
];
if
(
rSelectionRectangle
.
isEmpty
())
continue
;
if
(
bFirst
)
bFirst
=
false
;
else
ss
<<
"; "
;
ss
<<
rSelectionRectangle
.
getStr
();
}
OString
sRect
=
ss
.
str
().
c_str
();
aMatches
.
push_back
(
sRect
);
}
}
boost
::
property_tree
::
ptree
aTree
;
aTree
.
put
(
"searchString"
,
pSearchItem
->
GetSearchString
().
toUtf8
().
getStr
());
lcl_addContainerToJson
(
aTree
,
"searchResultSelection"
,
aMatches
);
std
::
stringstream
aStream
;
boost
::
property_tree
::
write_json
(
aStream
,
aTree
);
aPayload
=
aStream
.
str
().
c_str
();
pWrtShell
->
libreOfficeKitCallback
(
LOK_CALLBACK_SEARCH_RESULT_SELECTION
,
aPayload
.
getStr
());
}
}
void
SwView
::
ExecSearch
(
SfxRequest
&
rReq
,
bool
bNoMessage
)
void
SwView
::
ExecSearch
(
SfxRequest
&
rReq
,
bool
bNoMessage
)
{
{
const
SfxItemSet
*
pArgs
=
rReq
.
GetArgs
();
const
SfxItemSet
*
pArgs
=
rReq
.
GetArgs
();
...
@@ -241,48 +286,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
...
@@ -241,48 +286,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
m_bFound
=
false
;
m_bFound
=
false
;
}
}
else
if
(
comphelper
::
LibreOfficeKit
::
isActive
())
else
if
(
comphelper
::
LibreOfficeKit
::
isActive
())
{
lcl_emitSearchResultCallbacks
(
nFound
,
m_pSrchItem
,
m_pWrtShell
);
OString
aPayload
=
OString
::
number
(
nFound
)
+
";"
+
m_pSrchItem
->
GetSearchString
().
toUtf8
();
m_pWrtShell
->
libreOfficeKitCallback
(
LOK_CALLBACK_SEARCH_RESULT_COUNT
,
aPayload
.
getStr
());
// Emit a callback also about the selection rectangles, grouped by matches.
if
(
SwPaM
*
pPaM
=
m_pWrtShell
->
GetCrsr
())
{
std
::
vector
<
OString
>
aMatches
;
for
(
SwPaM
&
rPaM
:
pPaM
->
GetRingContainer
())
{
if
(
SwShellCrsr
*
pShellCrsr
=
dynamic_cast
<
SwShellCrsr
*>
(
&
rPaM
))
{
std
::
vector
<
OString
>
aSelectionRectangles
;
pShellCrsr
->
SwSelPaintRects
::
Show
(
&
aSelectionRectangles
);
std
::
stringstream
ss
;
bool
bFirst
=
true
;
for
(
size_t
i
=
0
;
i
<
aSelectionRectangles
.
size
();
++
i
)
{
const
OString
&
rSelectionRectangle
=
aSelectionRectangles
[
i
];
if
(
rSelectionRectangle
.
isEmpty
())
continue
;
if
(
bFirst
)
bFirst
=
false
;
else
ss
<<
"; "
;
ss
<<
rSelectionRectangle
.
getStr
();
}
OString
sRect
=
ss
.
str
().
c_str
();
aMatches
.
push_back
(
sRect
);
}
}
boost
::
property_tree
::
ptree
aTree
;
aTree
.
put
(
"searchString"
,
m_pSrchItem
->
GetSearchString
().
toUtf8
().
getStr
());
lcl_addContainerToJson
(
aTree
,
"searchResultSelection"
,
aMatches
);
std
::
stringstream
aStream
;
boost
::
property_tree
::
write_json
(
aStream
,
aTree
);
aPayload
=
aStream
.
str
().
c_str
();
m_pWrtShell
->
libreOfficeKitCallback
(
LOK_CALLBACK_SEARCH_RESULT_SELECTION
,
aPayload
.
getStr
());
}
}
rReq
.
SetReturnValue
(
SfxBoolItem
(
nSlot
,
bRet
));
rReq
.
SetReturnValue
(
SfxBoolItem
(
nSlot
,
bRet
));
#if HAVE_FEATURE_DESKTOP
#if HAVE_FEATURE_DESKTOP
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment