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
9338bea6
Kaydet (Commit)
9338bea6
authored
Ara 11, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add undo operation for deleting a bookmark + unit test, related fdo#51741
Change-Id: I79d8d3c30b6b0b2cc253963fdd50019aec033e12
üst
08ece8d8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
18 deletions
+81
-18
uiwriter.cxx
sw/qa/extras/uiwriter/uiwriter.cxx
+37
-0
bookmrk.cxx
sw/source/core/crsr/bookmrk.cxx
+5
-1
docbm.cxx
sw/source/core/doc/docbm.cxx
+11
-3
UndoBookmark.hxx
sw/source/core/inc/UndoBookmark.hxx
+10
-1
unbkmk.cxx
sw/source/core/undo/unbkmk.cxx
+17
-2
unobkm.cxx
sw/source/core/unocore/unobkm.cxx
+1
-11
No files found.
sw/qa/extras/uiwriter/uiwriter.cxx
Dosyayı görüntüle @
9338bea6
...
@@ -64,6 +64,7 @@ public:
...
@@ -64,6 +64,7 @@ public:
void
testFdo87005
();
void
testFdo87005
();
void
testMergeDoc
();
void
testMergeDoc
();
void
testCreatePortions
();
void
testCreatePortions
();
void
testBookmarkUndo
();
CPPUNIT_TEST_SUITE
(
SwUiWriterTest
);
CPPUNIT_TEST_SUITE
(
SwUiWriterTest
);
CPPUNIT_TEST
(
testReplaceForward
);
CPPUNIT_TEST
(
testReplaceForward
);
...
@@ -91,6 +92,7 @@ public:
...
@@ -91,6 +92,7 @@ public:
CPPUNIT_TEST
(
testFdo87005
);
CPPUNIT_TEST
(
testFdo87005
);
CPPUNIT_TEST
(
testMergeDoc
);
CPPUNIT_TEST
(
testMergeDoc
);
CPPUNIT_TEST
(
testCreatePortions
);
CPPUNIT_TEST
(
testCreatePortions
);
CPPUNIT_TEST
(
testBookmarkUndo
);
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
...
@@ -679,6 +681,41 @@ void SwUiWriterTest::testCreatePortions()
...
@@ -679,6 +681,41 @@ void SwUiWriterTest::testCreatePortions()
xParagraph
->
createEnumeration
();
xParagraph
->
createEnumeration
();
}
}
void
SwUiWriterTest
::
testBookmarkUndo
()
{
SwDoc
*
pDoc
=
createDoc
();
sw
::
UndoManager
&
rUndoManager
=
pDoc
->
GetUndoManager
();
IDocumentMarkAccess
*
const
pMarkAccess
=
pDoc
->
getIDocumentMarkAccess
();
SwPaM
aPaM
(
SwNodeIndex
(
pDoc
->
GetNodes
().
GetEndOfContent
(),
-
1
)
);
pMarkAccess
->
makeMark
(
aPaM
,
OUString
(
"Mark"
),
IDocumentMarkAccess
::
BOOKMARK
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
1
),
pMarkAccess
->
getAllMarksCount
());
rUndoManager
.
Undo
();
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
pMarkAccess
->
getAllMarksCount
());
rUndoManager
.
Redo
();
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
1
),
pMarkAccess
->
getAllMarksCount
());
IDocumentMarkAccess
::
const_iterator_t
ppBkmk
=
pMarkAccess
->
findMark
(
"Mark"
);
CPPUNIT_ASSERT
(
ppBkmk
!=
pMarkAccess
->
getAllMarksEnd
());
pMarkAccess
->
renameMark
(
ppBkmk
->
get
(),
"Mark_"
);
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark"
)
==
pMarkAccess
->
getAllMarksEnd
());
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark_"
)
!=
pMarkAccess
->
getAllMarksEnd
());
rUndoManager
.
Undo
();
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark"
)
!=
pMarkAccess
->
getAllMarksEnd
());
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark_"
)
==
pMarkAccess
->
getAllMarksEnd
());
rUndoManager
.
Redo
();
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark"
)
==
pMarkAccess
->
getAllMarksEnd
());
CPPUNIT_ASSERT
(
pMarkAccess
->
findMark
(
"Mark_"
)
!=
pMarkAccess
->
getAllMarksEnd
());
pMarkAccess
->
deleteMark
(
pMarkAccess
->
findMark
(
"Mark_"
)
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
pMarkAccess
->
getAllMarksCount
());
rUndoManager
.
Undo
();
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
1
),
pMarkAccess
->
getAllMarksCount
());
rUndoManager
.
Redo
();
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
pMarkAccess
->
getAllMarksCount
());
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
SwUiWriterTest
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
SwUiWriterTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
sw/source/core/crsr/bookmrk.cxx
Dosyayı görüntüle @
9338bea6
...
@@ -276,7 +276,11 @@ namespace sw { namespace mark
...
@@ -276,7 +276,11 @@ namespace sw { namespace mark
{
{
DdeBookmark
::
DeregisterFromDoc
(
io_pDoc
);
DdeBookmark
::
DeregisterFromDoc
(
io_pDoc
);
// fdo#51741 Bookmark should mark document as modified when deleted
if
(
io_pDoc
->
GetIDocumentUndoRedo
().
DoesUndo
())
{
io_pDoc
->
GetIDocumentUndoRedo
().
AppendUndo
(
new
SwUndoDeleteBookmark
(
*
this
));
}
io_pDoc
->
getIDocumentState
().
SetModified
();
io_pDoc
->
getIDocumentState
().
SetModified
();
}
}
...
...
sw/source/core/doc/docbm.cxx
Dosyayı görüntüle @
9338bea6
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <doc.hxx>
#include <doc.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentState.hxx>
#include <IDocumentState.hxx>
#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <docary.hxx>
#include <xmloff/odffields.hxx>
#include <xmloff/odffields.hxx>
#include <editsh.hxx>
#include <editsh.hxx>
...
@@ -49,6 +50,7 @@
...
@@ -49,6 +50,7 @@
#include <sfx2/linkmgr.hxx>
#include <sfx2/linkmgr.hxx>
#include <swserv.hxx>
#include <swserv.hxx>
#include <swundo.hxx>
#include <swundo.hxx>
#include <UndoBookmark.hxx>
#include <unocrsr.hxx>
#include <unocrsr.hxx>
#include <viscrs.hxx>
#include <viscrs.hxx>
#include <edimp.hxx>
#include <edimp.hxx>
...
@@ -550,12 +552,18 @@ namespace sw { namespace mark
...
@@ -550,12 +552,18 @@ namespace sw { namespace mark
return
false
;
return
false
;
if
(
::
sw
::
mark
::
MarkBase
*
pMarkBase
=
dynamic_cast
<
::
sw
::
mark
::
MarkBase
*
>
(
io_pMark
))
if
(
::
sw
::
mark
::
MarkBase
*
pMarkBase
=
dynamic_cast
<
::
sw
::
mark
::
MarkBase
*
>
(
io_pMark
))
{
{
m_aMarkNamesSet
.
erase
(
pMarkBase
->
GetName
());
const
OUString
sOldName
(
pMarkBase
->
GetName
());
m_aMarkNamesSet
.
erase
(
sOldName
);
m_aMarkNamesSet
.
insert
(
rNewName
);
m_aMarkNamesSet
.
insert
(
rNewName
);
pMarkBase
->
SetName
(
rNewName
);
pMarkBase
->
SetName
(
rNewName
);
// fdo#51741 Bookmark should mark document as modified when renamed
if
(
dynamic_cast
<
::
sw
::
mark
::
Bookmark
*
>
(
io_pMark
))
if
(
dynamic_cast
<
::
sw
::
mark
::
Bookmark
*
>
(
io_pMark
))
{
{
if
(
m_pDoc
->
GetIDocumentUndoRedo
().
DoesUndo
())
{
m_pDoc
->
GetIDocumentUndoRedo
().
AppendUndo
(
new
SwUndoRenameBookmark
(
sOldName
,
rNewName
));
}
m_pDoc
->
getIDocumentState
().
SetModified
();
m_pDoc
->
getIDocumentState
().
SetModified
();
}
}
}
}
...
...
sw/source/core/inc/UndoBookmark.hxx
Dosyayı görüntüle @
9338bea6
...
@@ -67,13 +67,22 @@ public:
...
@@ -67,13 +67,22 @@ public:
virtual
void
RedoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
virtual
void
RedoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
};
};
class
SwUndoDeleteBookmark
:
public
SwUndoBookmark
{
public
:
SwUndoDeleteBookmark
(
const
::
sw
::
mark
::
IMark
&
);
virtual
void
UndoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
virtual
void
RedoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
};
class
SwUndoRenameBookmark
:
public
SwUndo
class
SwUndoRenameBookmark
:
public
SwUndo
{
{
const
OUString
m_sOldName
;
const
OUString
m_sOldName
;
const
OUString
m_sNewName
;
const
OUString
m_sNewName
;
public
:
public
:
SwUndoRenameBookmark
(
const
::
sw
::
mark
::
IMark
&
,
const
OUString
&
rNewName
);
SwUndoRenameBookmark
(
const
OUString
&
rOldName
,
const
OUString
&
rNewName
);
virtual
~
SwUndoRenameBookmark
();
virtual
~
SwUndoRenameBookmark
();
private
:
private
:
...
...
sw/source/core/undo/unbkmk.cxx
Dosyayı görüntüle @
9338bea6
...
@@ -86,10 +86,25 @@ void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
...
@@ -86,10 +86,25 @@ void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
SetInDoc
(
&
rContext
.
GetDoc
()
);
SetInDoc
(
&
rContext
.
GetDoc
()
);
}
}
SwUndoRenameBookmark
::
SwUndoRenameBookmark
(
const
::
sw
::
mark
::
IMark
&
rBkmk
,
const
OUString
&
rOldName
)
SwUndoDeleteBookmark
::
SwUndoDeleteBookmark
(
const
::
sw
::
mark
::
IMark
&
rBkmk
)
:
SwUndoBookmark
(
UNDO_DELBOOKMARK
,
rBkmk
)
{
}
void
SwUndoDeleteBookmark
::
UndoImpl
(
::
sw
::
UndoRedoContext
&
rContext
)
{
SetInDoc
(
&
rContext
.
GetDoc
()
);
}
void
SwUndoDeleteBookmark
::
RedoImpl
(
::
sw
::
UndoRedoContext
&
rContext
)
{
ResetInDoc
(
&
rContext
.
GetDoc
()
);
}
SwUndoRenameBookmark
::
SwUndoRenameBookmark
(
const
OUString
&
rOldName
,
const
OUString
&
rNewName
)
:
SwUndo
(
UNDO_BOOKMARK_RENAME
)
:
SwUndo
(
UNDO_BOOKMARK_RENAME
)
,
m_sOldName
(
rOldName
)
,
m_sOldName
(
rOldName
)
,
m_sNewName
(
r
Bkmk
.
GetName
()
)
,
m_sNewName
(
r
NewName
)
{
{
}
}
...
...
sw/source/core/unocore/unobkm.cxx
Dosyayı görüntüle @
9338bea6
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
#include <vcl/svapp.hxx>
#include <vcl/svapp.hxx>
#include <TextCursorHelper.hxx>
#include <TextCursorHelper.hxx>
#include <UndoBookmark.hxx>
#include <unotextrange.hxx>
#include <unotextrange.hxx>
#include <unomap.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
#include <unoprnms.hxx>
...
@@ -32,7 +31,6 @@
...
@@ -32,7 +31,6 @@
#include <crossrefbookmark.hxx>
#include <crossrefbookmark.hxx>
#include <doc.hxx>
#include <doc.hxx>
#include <IDocumentState.hxx>
#include <IDocumentState.hxx>
#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <docary.hxx>
#include <swundo.hxx>
#include <swundo.hxx>
#include <docsh.hxx>
#include <docsh.hxx>
...
@@ -349,15 +347,7 @@ throw (uno::RuntimeException, std::exception)
...
@@ -349,15 +347,7 @@ throw (uno::RuntimeException, std::exception)
*
aPam
.
GetMark
()
=
m_pImpl
->
m_pRegisteredBookmark
->
GetOtherMarkPos
();
*
aPam
.
GetMark
()
=
m_pImpl
->
m_pRegisteredBookmark
->
GetOtherMarkPos
();
}
}
const
OUString
sOldName
(
m_pImpl
->
m_pRegisteredBookmark
->
GetName
());
pMarkAccess
->
renameMark
(
m_pImpl
->
m_pRegisteredBookmark
,
rName
);
if
(
pMarkAccess
->
renameMark
(
m_pImpl
->
m_pRegisteredBookmark
,
rName
))
{
if
(
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
DoesUndo
())
{
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
AppendUndo
(
new
SwUndoRenameBookmark
(
*
m_pImpl
->
m_pRegisteredBookmark
,
sOldName
));
}
}
}
}
OUString
SAL_CALL
OUString
SAL_CALL
...
...
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