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
7adef94b
Kaydet (Commit)
7adef94b
authored
Eki 09, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Share undo doc creation code.
Change-Id: I55f27b61637ba0284479c63c2fa48b0bd8938c0f
üst
ed0e3fdc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
80 deletions
+82
-80
docfunc.cxx
sc/source/ui/docshell/docfunc.cxx
+2
-36
docfuncutil.cxx
sc/source/ui/docshell/docfuncutil.cxx
+61
-0
docfuncutil.hxx
sc/source/ui/inc/docfuncutil.hxx
+17
-0
viewfunc.cxx
sc/source/ui/view/viewfunc.cxx
+2
-44
No files found.
sc/source/ui/docshell/docfunc.cxx
Dosyayı görüntüle @
7adef94b
...
@@ -628,42 +628,8 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, InsertDeleteFlags nFlag
...
@@ -628,42 +628,8 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, InsertDeleteFlags nFlag
if
(
bRecord
)
if
(
bRecord
)
{
{
pUndoDoc
=
new
ScDocument
(
SCDOCMODE_UNDO
);
pUndoDoc
=
sc
::
DocFuncUtil
::
createDeleteContentsUndoDoc
(
rDoc
,
aMultiMark
,
aMarkRange
,
nFlags
,
bMulti
);
pUndoDoc
->
InitUndo
(
&
rDoc
,
aMarkRange
.
aStart
.
Tab
(),
aMarkRange
.
aEnd
.
Tab
()
);
pDataSpans
.
reset
(
sc
::
DocFuncUtil
::
getNonEmptyCellSpans
(
rDoc
,
aMultiMark
,
aMarkRange
));
// bei "Format/Standard" alle Attribute kopieren, weil CopyToDocument
// nur mit IDF_HARDATTR zu langsam ist:
InsertDeleteFlags
nUndoDocFlags
=
nFlags
;
if
(
nFlags
&
IDF_ATTRIB
)
nUndoDocFlags
|=
IDF_ATTRIB
;
if
(
nFlags
&
IDF_EDITATTR
)
// Edit-Engine-Attribute
nUndoDocFlags
|=
IDF_STRING
;
// -> Zellen werden geaendert
if
(
nFlags
&
IDF_NOTE
)
nUndoDocFlags
|=
IDF_CONTENTS
;
// copy all cells with their notes
// note captions are handled in drawing undo
nUndoDocFlags
|=
IDF_NOCAPTIONS
;
rDoc
.
CopyToDocument
(
aExtendedRange
,
nUndoDocFlags
,
bMulti
,
pUndoDoc
,
&
aMultiMark
);
pDataSpans
.
reset
(
new
ScSimpleUndo
::
DataSpansType
);
ScMarkData
::
iterator
it
=
aMultiMark
.
begin
(),
itEnd
=
aMultiMark
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
SCTAB
nTab
=
*
it
;
SCCOL
nCol1
=
aMarkRange
.
aStart
.
Col
(),
nCol2
=
aMarkRange
.
aEnd
.
Col
();
SCROW
nRow1
=
aMarkRange
.
aStart
.
Row
(),
nRow2
=
aMarkRange
.
aEnd
.
Row
();
std
::
pair
<
ScSimpleUndo
::
DataSpansType
::
iterator
,
bool
>
r
=
pDataSpans
->
insert
(
nTab
,
new
sc
::
ColumnSpanSet
(
false
));
if
(
r
.
second
)
{
ScSimpleUndo
::
DataSpansType
::
iterator
it2
=
r
.
first
;
sc
::
ColumnSpanSet
*
pSet
=
it2
->
second
;
pSet
->
scan
(
rDoc
,
nTab
,
nCol1
,
nRow1
,
nCol2
,
nRow2
,
true
);
}
}
}
}
rDoc
.
DeleteSelection
(
nFlags
,
aMultiMark
);
rDoc
.
DeleteSelection
(
nFlags
,
aMultiMark
);
...
...
sc/source/ui/docshell/docfuncutil.cxx
Dosyayı görüntüle @
7adef94b
...
@@ -20,6 +20,10 @@
...
@@ -20,6 +20,10 @@
#include <docfuncutil.hxx>
#include <docfuncutil.hxx>
#include <document.hxx>
#include <document.hxx>
#include <markdata.hxx>
#include <markdata.hxx>
#include <undobase.hxx>
#include <global.hxx>
#include <memory>
namespace
sc
{
namespace
sc
{
...
@@ -34,6 +38,63 @@ bool DocFuncUtil::hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMa
...
@@ -34,6 +38,63 @@ bool DocFuncUtil::hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMa
return
false
;
return
false
;
}
}
ScDocument
*
DocFuncUtil
::
createDeleteContentsUndoDoc
(
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
,
const
ScRange
&
rRange
,
InsertDeleteFlags
nFlags
,
bool
bOnlyMarked
)
{
std
::
unique_ptr
<
ScDocument
>
pUndoDoc
(
new
ScDocument
(
SCDOCMODE_UNDO
));
SCTAB
nTab
=
rRange
.
aStart
.
Tab
();
pUndoDoc
->
InitUndo
(
&
rDoc
,
nTab
,
nTab
);
SCTAB
nTabCount
=
rDoc
.
GetTableCount
();
ScMarkData
::
const_iterator
itr
=
rMark
.
begin
(),
itrEnd
=
rMark
.
end
();
for
(;
itr
!=
itrEnd
;
++
itr
)
if
(
*
itr
!=
nTab
)
pUndoDoc
->
AddUndoTab
(
*
itr
,
*
itr
);
ScRange
aCopyRange
=
rRange
;
aCopyRange
.
aStart
.
SetTab
(
0
);
aCopyRange
.
aEnd
.
SetTab
(
nTabCount
-
1
);
// in case of "Format/Standard" copy all attributes, because CopyToDocument
// with IDF_HARDATTR only is too time-consuming:
InsertDeleteFlags
nUndoDocFlags
=
nFlags
;
if
(
nFlags
&
IDF_ATTRIB
)
nUndoDocFlags
|=
IDF_ATTRIB
;
if
(
nFlags
&
IDF_EDITATTR
)
// Edit-Engine-Attribute
nUndoDocFlags
|=
IDF_STRING
;
// -> cells will be changed
if
(
nFlags
&
IDF_NOTE
)
nUndoDocFlags
|=
IDF_CONTENTS
;
// copy all cells with their notes
// do not copy note captions to undo document
nUndoDocFlags
|=
IDF_NOCAPTIONS
;
rDoc
.
CopyToDocument
(
aCopyRange
,
nUndoDocFlags
,
bOnlyMarked
,
pUndoDoc
.
get
(),
&
rMark
);
return
pUndoDoc
.
release
();
}
ScSimpleUndo
::
DataSpansType
*
DocFuncUtil
::
getNonEmptyCellSpans
(
const
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
,
const
ScRange
&
rRange
)
{
std
::
unique_ptr
<
ScSimpleUndo
::
DataSpansType
>
pDataSpans
(
new
ScSimpleUndo
::
DataSpansType
);
ScMarkData
::
const_iterator
it
=
rMark
.
begin
(),
itEnd
=
rMark
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
SCTAB
nTab
=
*
it
;
SCCOL
nCol1
=
rRange
.
aStart
.
Col
(),
nCol2
=
rRange
.
aEnd
.
Col
();
SCROW
nRow1
=
rRange
.
aStart
.
Row
(),
nRow2
=
rRange
.
aEnd
.
Row
();
std
::
pair
<
ScSimpleUndo
::
DataSpansType
::
iterator
,
bool
>
r
=
pDataSpans
->
insert
(
nTab
,
new
sc
::
ColumnSpanSet
(
false
));
if
(
r
.
second
)
{
sc
::
ColumnSpanSet
*
pSet
=
r
.
first
->
second
;
pSet
->
scan
(
rDoc
,
nTab
,
nCol1
,
nRow1
,
nCol2
,
nRow2
,
true
);
}
}
return
pDataSpans
.
release
();
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/ui/inc/docfuncutil.hxx
Dosyayı görüntüle @
7adef94b
...
@@ -5,17 +5,34 @@
...
@@ -5,17 +5,34 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
#ifndef INCLUDED_SC_DOCFUNCUTIL_HXX
#define INCLUDED_SC_DOCFUNCUTIL_HXX
#include <undobase.hxx>
class
ScDocument
;
class
ScDocument
;
class
ScMarkData
;
class
ScMarkData
;
class
ScRange
;
struct
InsertDeleteFlags
;
namespace
sc
{
namespace
sc
{
class
DocFuncUtil
class
DocFuncUtil
{
{
public
:
public
:
static
bool
hasProtectedTab
(
const
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
);
static
bool
hasProtectedTab
(
const
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
);
static
ScDocument
*
createDeleteContentsUndoDoc
(
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
,
const
ScRange
&
rRange
,
InsertDeleteFlags
nFlags
,
bool
bOnlyMarked
);
static
ScSimpleUndo
::
DataSpansType
*
getNonEmptyCellSpans
(
const
ScDocument
&
rDoc
,
const
ScMarkData
&
rMark
,
const
ScRange
&
rRange
);
};
};
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/ui/view/viewfunc.cxx
Dosyayı görüntüle @
7adef94b
...
@@ -1834,50 +1834,8 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags, bool bRecord )
...
@@ -1834,50 +1834,8 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags, bool bRecord )
if
(
bRecord
)
if
(
bRecord
)
{
{
pUndoDoc
=
new
ScDocument
(
SCDOCMODE_UNDO
);
pUndoDoc
=
sc
::
DocFuncUtil
::
createDeleteContentsUndoDoc
(
*
pDoc
,
aFuncMark
,
aExtendedRange
,
nFlags
,
bMulti
);
SCTAB
nTab
=
aMarkRange
.
aStart
.
Tab
();
pDataSpans
.
reset
(
sc
::
DocFuncUtil
::
getNonEmptyCellSpans
(
*
pDoc
,
aFuncMark
,
aExtendedRange
));
pUndoDoc
->
InitUndo
(
pDoc
,
nTab
,
nTab
);
SCTAB
nTabCount
=
pDoc
->
GetTableCount
();
ScMarkData
::
iterator
itr
=
aFuncMark
.
begin
(),
itrEnd
=
aFuncMark
.
end
();
for
(;
itr
!=
itrEnd
;
++
itr
)
if
(
*
itr
!=
nTab
)
pUndoDoc
->
AddUndoTab
(
*
itr
,
*
itr
);
ScRange
aCopyRange
=
aExtendedRange
;
aCopyRange
.
aStart
.
SetTab
(
0
);
aCopyRange
.
aEnd
.
SetTab
(
nTabCount
-
1
);
// in case of "Format/Standard" copy all attributes, because CopyToDocument
// with IDF_HARDATTR only is too time-consuming:
InsertDeleteFlags
nUndoDocFlags
=
nFlags
;
if
(
nFlags
&
IDF_ATTRIB
)
nUndoDocFlags
|=
IDF_ATTRIB
;
if
(
nFlags
&
IDF_EDITATTR
)
// Edit-Engine-Attribute
nUndoDocFlags
|=
IDF_STRING
;
// -> cells will be changed
if
(
nFlags
&
IDF_NOTE
)
nUndoDocFlags
|=
IDF_CONTENTS
;
// copy all cells with their notes
// do not copy note captions to undo document
nUndoDocFlags
|=
IDF_NOCAPTIONS
;
pDoc
->
CopyToDocument
(
aCopyRange
,
nUndoDocFlags
,
bMulti
,
pUndoDoc
,
&
aFuncMark
);
pDataSpans
.
reset
(
new
ScSimpleUndo
::
DataSpansType
);
for
(
itr
=
aFuncMark
.
begin
();
itr
!=
itrEnd
;
++
itr
)
{
nTab
=
*
itr
;
SCCOL
nCol1
=
aCopyRange
.
aStart
.
Col
(),
nCol2
=
aCopyRange
.
aEnd
.
Col
();
SCROW
nRow1
=
aCopyRange
.
aStart
.
Row
(),
nRow2
=
aCopyRange
.
aEnd
.
Row
();
std
::
pair
<
ScSimpleUndo
::
DataSpansType
::
iterator
,
bool
>
r
=
pDataSpans
->
insert
(
nTab
,
new
sc
::
ColumnSpanSet
(
false
));
if
(
r
.
second
)
{
ScSimpleUndo
::
DataSpansType
::
iterator
it
=
r
.
first
;
sc
::
ColumnSpanSet
*
pSet
=
it
->
second
;
pSet
->
scan
(
*
pDoc
,
nTab
,
nCol1
,
nRow1
,
nCol2
,
nRow2
,
true
);
}
}
}
}
HideAllCursors
();
// for if summary is cancelled
HideAllCursors
();
// for if summary is cancelled
...
...
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