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
122b1498
Kaydet (Commit)
122b1498
authored
May 26, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SwPaM::Find: fix backwards-search in shape text
Change-Id: I79157853d16ead4cb4147763ef0590702b3d8be6
üst
1925a57d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
18 deletions
+62
-18
tiledrendering.cxx
sw/qa/extras/tiledrendering/tiledrendering.cxx
+16
-6
findtxt.cxx
sw/source/core/crsr/findtxt.cxx
+46
-12
No files found.
sw/qa/extras/tiledrendering/tiledrendering.cxx
Dosyayı görüntüle @
122b1498
...
@@ -226,12 +226,12 @@ void SwTiledRenderingTest::testResetSelection()
...
@@ -226,12 +226,12 @@ void SwTiledRenderingTest::testResetSelection()
}
}
#if !(defined WNT || defined MACOSX)
#if !(defined WNT || defined MACOSX)
void
lcl_search
()
void
lcl_search
(
bool
bBackward
)
{
{
uno
::
Sequence
<
beans
::
PropertyValue
>
aPropertyValues
(
comphelper
::
InitPropertySequence
(
uno
::
Sequence
<
beans
::
PropertyValue
>
aPropertyValues
(
comphelper
::
InitPropertySequence
(
{
{
{
"SearchItem.SearchString"
,
uno
::
makeAny
(
OUString
(
"shape"
))},
{
"SearchItem.SearchString"
,
uno
::
makeAny
(
OUString
(
"shape"
))},
{
"SearchItem.Backward"
,
uno
::
makeAny
(
false
)}
{
"SearchItem.Backward"
,
uno
::
makeAny
(
bBackward
)}
}));
}));
comphelper
::
dispatchCommand
(
".uno:ExecuteSearch"
,
aPropertyValues
);
comphelper
::
dispatchCommand
(
".uno:ExecuteSearch"
,
aPropertyValues
);
}
}
...
@@ -245,24 +245,34 @@ void SwTiledRenderingTest::testSearch()
...
@@ -245,24 +245,34 @@ void SwTiledRenderingTest::testSearch()
size_t
nNode
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
size_t
nNode
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
// First hit, in the second paragraph, before the shape.
// First hit, in the second paragraph, before the shape.
lcl_search
();
lcl_search
(
false
);
CPPUNIT_ASSERT
(
!
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
CPPUNIT_ASSERT
(
!
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
size_t
nActual
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
size_t
nActual
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
CPPUNIT_ASSERT_EQUAL
(
nNode
+
1
,
nActual
);
CPPUNIT_ASSERT_EQUAL
(
nNode
+
1
,
nActual
);
// Next hit, in the shape.
// Next hit, in the shape.
lcl_search
();
lcl_search
(
false
);
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
// Next hit, in the shape, still.
// Next hit, in the shape, still.
lcl_search
();
lcl_search
(
false
);
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
// Last hit, in the last paragraph, after the shape.
// Last hit, in the last paragraph, after the shape.
lcl_search
();
lcl_search
(
false
);
CPPUNIT_ASSERT
(
!
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
CPPUNIT_ASSERT
(
!
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
nActual
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
nActual
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
CPPUNIT_ASSERT_EQUAL
(
nNode
+
7
,
nActual
);
CPPUNIT_ASSERT_EQUAL
(
nNode
+
7
,
nActual
);
// Now change direction and make sure that the first 2 hits are in the shape, but not the 3rd one.
lcl_search
(
true
);
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
lcl_search
(
true
);
CPPUNIT_ASSERT
(
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
lcl_search
(
true
);
CPPUNIT_ASSERT
(
!
pWrtShell
->
GetDrawView
()
->
GetTextEditObject
());
nActual
=
pWrtShell
->
getShellCrsr
(
false
)
->
Start
()
->
nNode
.
GetNode
().
GetIndex
();
CPPUNIT_ASSERT_EQUAL
(
nNode
+
1
,
nActual
);
#endif
#endif
}
}
...
...
sw/source/core/crsr/findtxt.cxx
Dosyayı görüntüle @
122b1498
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include <IDocumentUndoRedo.hxx>
#include <IDocumentUndoRedo.hxx>
#include <IDocumentState.hxx>
#include <IDocumentState.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <dcontact.hxx>
#include <pamtyp.hxx>
#include <pamtyp.hxx>
#include <ndtxt.hxx>
#include <ndtxt.hxx>
#include <swundo.hxx>
#include <swundo.hxx>
...
@@ -302,9 +303,23 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
...
@@ -302,9 +303,23 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
aSearchItem
.
SetBackward
(
!
bSrchForward
);
aSearchItem
.
SetBackward
(
!
bSrchForward
);
// If there is an active text edit, then search there.
// If there is an active text edit, then search there.
if
(
SdrView
*
pSdrView
=
pWrtShell
->
GetDrawView
())
bool
bEndedTextEdit
=
false
;
SdrView
*
pSdrView
=
pWrtShell
->
GetDrawView
();
if
(
pSdrView
)
{
{
if
(
pSdrView
->
GetTextEditObject
())
// If the edited object is not anchored to this node, then ignore it.
SdrObject
*
pObject
=
pSdrView
->
GetTextEditObject
();
if
(
pObject
)
{
if
(
SwFrameFormat
*
pFrameFormat
=
FindFrameFormat
(
pObject
))
{
const
SwPosition
*
pPosition
=
pFrameFormat
->
GetAnchor
().
GetContentAnchor
();
if
(
!
pPosition
||
pPosition
->
nNode
.
GetIndex
()
!=
pNode
->
GetIndex
())
pObject
=
0
;
}
}
if
(
pObject
)
{
{
sal_uInt16
nResult
=
pSdrView
->
GetTextEditOutlinerView
()
->
StartSearchAndReplace
(
aSearchItem
);
sal_uInt16
nResult
=
pSdrView
->
GetTextEditOutlinerView
()
->
StartSearchAndReplace
(
aSearchItem
);
if
(
!
nResult
)
if
(
!
nResult
)
...
@@ -315,6 +330,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
...
@@ -315,6 +330,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
pSdrView
->
UnmarkAll
();
pSdrView
->
UnmarkAll
();
pWrtShell
->
SetCursor
(
&
aPoint
,
true
);
pWrtShell
->
SetCursor
(
&
aPoint
,
true
);
pWrtShell
->
Edit
();
pWrtShell
->
Edit
();
bEndedTextEdit
=
true
;
}
}
else
else
{
{
...
@@ -324,17 +340,35 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
...
@@ -324,17 +340,35 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
}
}
}
}
// If there are any shapes anchored to this node, search there.
// If we just finished search in shape text, don't attept to do that again.
SwPaM
aPaM
(
pNode
->
GetDoc
()
->
GetNodes
().
GetEndOfContent
());
if
(
!
bEndedTextEdit
)
aPaM
.
GetPoint
()
->
nNode
=
rTextNode
;
aPaM
.
GetPoint
()
->
nContent
.
Assign
(
aPaM
.
GetPoint
()
->
nNode
.
GetNode
().
GetTextNode
(),
nStart
);
aPaM
.
SetMark
();
aPaM
.
GetMark
()
->
nNode
=
rTextNode
.
GetIndex
()
+
1
;
aPaM
.
GetMark
()
->
nContent
.
Assign
(
aPaM
.
GetMark
()
->
nNode
.
GetNode
().
GetTextNode
(),
0
);
if
(
pNode
->
GetDoc
()
->
getIDocumentDrawModelAccess
().
Search
(
aPaM
,
aSearchItem
))
{
{
bFound
=
true
;
// If there are any shapes anchored to this node, search there.
break
;
SwPaM
aPaM
(
pNode
->
GetDoc
()
->
GetNodes
().
GetEndOfContent
());
aPaM
.
GetPoint
()
->
nNode
=
rTextNode
;
aPaM
.
GetPoint
()
->
nContent
.
Assign
(
aPaM
.
GetPoint
()
->
nNode
.
GetNode
().
GetTextNode
(),
nStart
);
aPaM
.
SetMark
();
aPaM
.
GetMark
()
->
nNode
=
rTextNode
.
GetIndex
()
+
1
;
aPaM
.
GetMark
()
->
nContent
.
Assign
(
aPaM
.
GetMark
()
->
nNode
.
GetNode
().
GetTextNode
(),
0
);
if
(
pNode
->
GetDoc
()
->
getIDocumentDrawModelAccess
().
Search
(
aPaM
,
aSearchItem
)
&&
pSdrView
)
{
if
(
SdrObject
*
pObject
=
pSdrView
->
GetTextEditObject
())
{
if
(
SwFrameFormat
*
pFrameFormat
=
FindFrameFormat
(
pObject
))
{
const
SwPosition
*
pPosition
=
pFrameFormat
->
GetAnchor
().
GetContentAnchor
();
if
(
pPosition
)
{
// Set search position to the shape's anchor point.
*
GetPoint
()
=
*
pPosition
;
GetPoint
()
->
nContent
.
Assign
(
pPosition
->
nNode
.
GetNode
().
GetContentNode
(),
0
);
SetMark
();
bFound
=
true
;
break
;
}
}
}
}
}
}
sal_Int32
aStart
=
0
;
sal_Int32
aStart
=
0
;
...
...
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