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
c7fa6687
Kaydet (Commit)
c7fa6687
authored
Kas 26, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Writer: Set document as modified and add undo when renaming bookmarks
Change-Id: Id0d4695b6a7c5eae0493e679345bd41d4687d6d7
üst
97da1b3c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
22 deletions
+87
-22
UndoBookmark.hxx
sw/source/core/inc/UndoBookmark.hxx
+18
-0
unbkmk.cxx
sw/source/core/undo/unbkmk.cxx
+57
-0
unobkm.cxx
sw/source/core/unocore/unobkm.cxx
+12
-22
No files found.
sw/source/core/inc/UndoBookmark.hxx
Dosyayı görüntüle @
c7fa6687
...
...
@@ -67,6 +67,24 @@ public:
virtual
void
RedoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
};
class
SwUndoRenameBookmark
:
public
SwUndo
{
const
OUString
m_sOldName
;
const
OUString
m_sNewName
;
const
sal_uLong
m_nNode
;
const
sal_Int32
m_nCntnt
;
public
:
SwUndoRenameBookmark
(
const
::
sw
::
mark
::
IMark
&
,
const
OUString
&
rNewName
);
virtual
~
SwUndoRenameBookmark
();
private
:
virtual
SwRewriter
GetRewriter
()
const
SAL_OVERRIDE
;
void
Rename
(
::
sw
::
UndoRedoContext
&
,
const
OUString
&
sFrom
,
const
OUString
&
sTo
);
virtual
void
UndoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
virtual
void
RedoImpl
(
::
sw
::
UndoRedoContext
&
)
SAL_OVERRIDE
;
};
#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOBOOKMARK_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/core/undo/unbkmk.cxx
Dosyayı görüntüle @
c7fa6687
...
...
@@ -19,6 +19,7 @@
#include <UndoBookmark.hxx>
#include <comcore.hrc>
#include "doc.hxx"
#include "docary.hxx"
#include "swundo.hxx"
...
...
@@ -85,4 +86,60 @@ void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
SetInDoc
(
&
rContext
.
GetDoc
()
);
}
SwUndoRenameBookmark
::
SwUndoRenameBookmark
(
const
::
sw
::
mark
::
IMark
&
rBkmk
,
const
OUString
&
rOldName
)
:
SwUndo
(
UNDO_BOOKMARK_RENAME
)
,
m_sOldName
(
rOldName
)
,
m_sNewName
(
rBkmk
.
GetName
()
)
,
m_nNode
(
rBkmk
.
GetMarkPos
().
nNode
.
GetIndex
()
)
,
m_nCntnt
(
rBkmk
.
GetMarkPos
().
nContent
.
GetIndex
()
)
{
}
SwUndoRenameBookmark
::~
SwUndoRenameBookmark
()
{
}
static
OUString
lcl_QuoteName
(
const
OUString
&
rName
)
{
static
const
OUString
sStart
=
SW_RES
(
STR_START_QUOTE
);
static
const
OUString
sEnd
=
SW_RES
(
STR_END_QUOTE
);
return
sStart
+
rName
+
sEnd
;
}
SwRewriter
SwUndoRenameBookmark
::
GetRewriter
()
const
{
SwRewriter
aRewriter
;
aRewriter
.
AddRule
(
UndoArg1
,
lcl_QuoteName
(
m_sOldName
));
aRewriter
.
AddRule
(
UndoArg2
,
SW_RES
(
STR_YIELDS
));
aRewriter
.
AddRule
(
UndoArg3
,
lcl_QuoteName
(
m_sNewName
));
return
aRewriter
;
}
void
SwUndoRenameBookmark
::
Rename
(
::
sw
::
UndoRedoContext
&
rContext
,
const
OUString
&
sFrom
,
const
OUString
&
sTo
)
{
IDocumentMarkAccess
*
const
pMarkAccess
=
rContext
.
GetDoc
().
getIDocumentMarkAccess
();
for
(
IDocumentMarkAccess
::
const_iterator_t
ppBkmk
=
pMarkAccess
->
getAllMarksBegin
();
ppBkmk
!=
pMarkAccess
->
getAllMarksEnd
();
++
ppBkmk
)
{
if
(
m_nNode
==
ppBkmk
->
get
()
->
GetMarkPos
().
nNode
.
GetIndex
()
&&
m_nCntnt
==
ppBkmk
->
get
()
->
GetMarkPos
().
nContent
.
GetIndex
()
&&
sFrom
==
ppBkmk
->
get
()
->
GetName
()
)
{
pMarkAccess
->
renameMark
(
ppBkmk
->
get
(),
sTo
);
break
;
}
}
}
void
SwUndoRenameBookmark
::
UndoImpl
(
::
sw
::
UndoRedoContext
&
rContext
)
{
Rename
(
rContext
,
m_sNewName
,
m_sOldName
);
}
void
SwUndoRenameBookmark
::
RedoImpl
(
::
sw
::
UndoRedoContext
&
rContext
)
{
Rename
(
rContext
,
m_sOldName
,
m_sNewName
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/core/unocore/unobkm.cxx
Dosyayı görüntüle @
c7fa6687
...
...
@@ -24,17 +24,17 @@
#include <vcl/svapp.hxx>
#include <TextCursorHelper.hxx>
#include <UndoBookmark.hxx>
#include <unotextrange.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
#include <IMark.hxx>
#include <crossrefbookmark.hxx>
#include <doc.hxx>
#include <IDocumentState.hxx>
#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <swundo.hxx>
#include <comcore.hrc>
#include <SwRewriter.hxx>
#include <docsh.hxx>
#include <xmloff/odffields.hxx>
#include <comphelper/servicehelper.hxx>
...
...
@@ -42,16 +42,6 @@
using
namespace
::
sw
::
mark
;
using
namespace
::
com
::
sun
::
star
;
namespace
{
static
OUString
lcl_QuoteName
(
const
OUString
&
rName
)
{
static
const
OUString
sStart
=
SW_RES
(
STR_START_QUOTE
);
static
const
OUString
sEnd
=
SW_RES
(
STR_END_QUOTE
);
return
sStart
+
rName
+
sEnd
;
}
}
class
SwXBookmark
::
Impl
:
public
SwClient
{
...
...
@@ -359,16 +349,16 @@ throw (uno::RuntimeException, std::exception)
*
aPam
.
GetMark
()
=
m_pImpl
->
m_pRegisteredBookmark
->
GetOtherMarkPos
();
}
SwRewriter
aRewriter
;
aRewriter
.
AddRule
(
UndoArg1
,
lcl_QuoteName
(
getName
()));
aRewriter
.
AddRule
(
UndoArg2
,
SW_RES
(
STR_YIELDS
));
aRewriter
.
AddRule
(
UndoArg3
,
lcl_QuoteName
(
rName
));
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
Start
Undo
(
UNDO_BOOKMARK_RENAME
,
&
aRewriter
);
pMarkAccess
->
renameMark
(
m_pImpl
->
m_pRegisteredBookmark
,
rName
);
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
EndUndo
(
UNDO_BOOKMARK_RENAME
,
&
aRewriter
);
const
OUString
sOldName
(
m_pImpl
->
m_pRegisteredBookmark
->
GetName
())
;
if
(
pMarkAccess
->
renameMark
(
m_pImpl
->
m_pRegisteredBookmark
,
rName
))
{
if
(
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
DoesUndo
())
{
m_pImpl
->
m_pDoc
->
GetIDocumentUndoRedo
().
Append
Undo
(
new
SwUndoRenameBookmark
(
*
m_pImpl
->
m_pRegisteredBookmark
,
sOldName
)
);
}
m_pImpl
->
m_pDoc
->
getIDocumentState
().
SetModified
();
}
}
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