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
0d3b54b6
Kaydet (Commit)
0d3b54b6
authored
Tem 13, 2012
tarafından
Noel Grandin
Kaydeden (comit)
Michael Stahl
Tem 17, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert SV_DECL_PTRARR_SORT_DEL(SwGlblDocContents) to o3tl::sorted_vector
Change-Id: Id0ee0ae93d69641cf65d12c8f170d3c6b34dbeb9
üst
7bef4fe2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
57 deletions
+46
-57
edglbldc.hxx
sw/inc/edglbldc.hxx
+5
-5
edglbldc.cxx
sw/source/core/edit/edglbldc.cxx
+18
-23
glbltree.cxx
sw/source/ui/utlui/glbltree.cxx
+23
-29
No files found.
sw/inc/edglbldc.hxx
Dosyayı görüntüle @
0d3b54b6
...
...
@@ -28,7 +28,7 @@
#ifndef _EDGLBLDC_HXX
#define _EDGLBLDC_HXX
#include <
svl/svarray
.hxx>
#include <
o3tl/sorted_vector
.hxx>
class
SwSection
;
class
SwTOXBase
;
...
...
@@ -70,10 +70,10 @@ public:
};
typedef
SwGlblDocContent
*
SwGlblDocContentPtr
;
SV_DECL_PTRARR_SORT_DEL
(
SwGlblDocContents
,
SwGlblDocContentPtr
,
10
)
class
SwGlblDocContents
:
public
o3tl
::
sorted_vector
<
SwGlblDocContent
*
,
o3tl
::
less_ptr_to
<
SwGlblDocContent
>
>
{
public
:
~
SwGlblDocContents
()
{
DeleteAndDestroyAll
();
}
};
#endif
...
...
sw/source/core/edit/edglbldc.cxx
Dosyayı görüntüle @
0d3b54b6
...
...
@@ -40,8 +40,6 @@
#include <edglbldc.hxx>
SV_IMPL_OP_PTRARR_SORT
(
SwGlblDocContents
,
SwGlblDocContentPtr
)
sal_Bool
SwEditShell
::
IsGlobalDoc
()
const
{
return
getIDocumentSettingAccess
()
->
get
(
IDocumentSettingAccess
::
GLOBAL_DOCUMENT
);
...
...
@@ -64,8 +62,7 @@ sal_Bool SwEditShell::IsGlblDocSaveLinks() const
sal_uInt16
SwEditShell
::
GetGlobalDocContent
(
SwGlblDocContents
&
rArr
)
const
{
if
(
rArr
.
Count
()
)
rArr
.
DeleteAndDestroy
(
0
,
rArr
.
Count
()
);
rArr
.
DeleteAndDestroyAll
();
if
(
!
getIDocumentSettingAccess
()
->
get
(
IDocumentSettingAccess
::
GLOBAL_DOCUMENT
)
)
return
0
;
...
...
@@ -80,7 +77,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
const
SwSection
*
pSect
=
rSectFmts
[
--
n
]
->
GetGlobalDocSection
();
if
(
pSect
)
{
SwGlblDocContent
Ptr
pNew
;
SwGlblDocContent
*
pNew
;
switch
(
pSect
->
GetType
()
)
{
case
TOX_HEADER_SECTION
:
break
;
// ignore
...
...
@@ -93,7 +90,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
pNew
=
new
SwGlblDocContent
(
pSect
);
break
;
}
if
(
!
rArr
.
Insert
(
pNew
)
)
if
(
!
rArr
.
insert
(
pNew
).
second
)
delete
pNew
;
}
}
...
...
@@ -101,7 +98,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
// und als letztes die Dummies (sonstiger Text) einfuegen
SwNode
*
pNd
;
sal_uLong
nSttIdx
=
pMyDoc
->
GetNodes
().
GetEndOfExtras
().
GetIndex
()
+
2
;
for
(
n
=
0
;
n
<
rArr
.
Count
();
++
n
)
for
(
n
=
0
;
n
<
rArr
.
size
();
++
n
)
{
const
SwGlblDocContent
&
rNew
=
*
rArr
[
n
];
// suche von StartPos bis rNew.DocPos nach einem Content Node.
...
...
@@ -110,8 +107,8 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
if
(
(
pNd
=
pMyDoc
->
GetNodes
()[
nSttIdx
])
->
IsCntntNode
()
||
pNd
->
IsSectionNode
()
||
pNd
->
IsTableNode
()
)
{
SwGlblDocContent
Ptr
pNew
=
new
SwGlblDocContent
(
nSttIdx
);
if
(
!
rArr
.
Insert
(
pNew
)
)
SwGlblDocContent
*
pNew
=
new
SwGlblDocContent
(
nSttIdx
);
if
(
!
rArr
.
insert
(
pNew
).
second
)
delete
pNew
;
else
++
n
;
// auf die naechste Position
...
...
@@ -124,26 +121,26 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
}
// sollte man das Ende auch noch setzen??
if
(
rArr
.
Count
()
)
if
(
!
rArr
.
empty
()
)
{
sal_uLong
nNdEnd
=
pMyDoc
->
GetNodes
().
GetEndOfContent
().
GetIndex
();
for
(
;
nSttIdx
<
nNdEnd
;
++
nSttIdx
)
if
(
(
pNd
=
pMyDoc
->
GetNodes
()[
nSttIdx
])
->
IsCntntNode
()
||
pNd
->
IsSectionNode
()
||
pNd
->
IsTableNode
()
)
{
SwGlblDocContent
Ptr
pNew
=
new
SwGlblDocContent
(
nSttIdx
);
if
(
!
rArr
.
Insert
(
pNew
)
)
SwGlblDocContent
*
pNew
=
new
SwGlblDocContent
(
nSttIdx
);
if
(
!
rArr
.
insert
(
pNew
).
second
)
delete
pNew
;
break
;
}
}
else
{
SwGlblDocContent
Ptr
pNew
=
new
SwGlblDocContent
(
SwGlblDocContent
*
pNew
=
new
SwGlblDocContent
(
pMyDoc
->
GetNodes
().
GetEndOfExtras
().
GetIndex
()
+
2
);
rArr
.
I
nsert
(
pNew
);
rArr
.
i
nsert
(
pNew
);
}
return
rArr
.
Count
();
return
rArr
.
size
();
}
sal_Bool
SwEditShell
::
InsertGlobalDocContent
(
const
SwGlblDocContent
&
rInsPos
,
...
...
@@ -269,7 +266,7 @@ sal_Bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr ,
SwDoc
*
pMyDoc
=
GetDoc
();
const
SwGlblDocContent
&
rDelPos
=
*
rArr
[
nDelPos
];
sal_uLong
nDelIdx
=
rDelPos
.
GetDocPos
();
if
(
1
==
rArr
.
Count
()
)
if
(
1
==
rArr
.
size
()
)
{
// ein Node muss aber da bleiben!
rPos
.
nNode
=
nDelIdx
-
1
;
...
...
@@ -285,7 +282,7 @@ sal_Bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr ,
{
rPos
.
nNode
=
nDelIdx
;
pCrsr
->
SetMark
();
if
(
++
nDelPos
<
rArr
.
Count
()
)
if
(
++
nDelPos
<
rArr
.
size
()
)
rPos
.
nNode
=
rArr
[
nDelPos
]
->
GetDocPos
();
else
rPos
.
nNode
=
pMyDoc
->
GetNodes
().
GetEndOfContent
();
...
...
@@ -320,8 +317,8 @@ sal_Bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr ,
sal_uInt16
nInsPos
)
{
if
(
!
getIDocumentSettingAccess
()
->
get
(
IDocumentSettingAccess
::
GLOBAL_DOCUMENT
)
||
nFromPos
>=
rArr
.
Count
()
||
nToPos
>
rArr
.
Count
()
||
nInsPos
>
rArr
.
Count
()
||
nFromPos
>=
nToPos
||
nFromPos
>=
rArr
.
size
()
||
nToPos
>
rArr
.
size
()
||
nInsPos
>
rArr
.
size
()
||
nFromPos
>=
nToPos
||
(
nFromPos
<=
nInsPos
&&
nInsPos
<=
nToPos
)
)
return
sal_False
;
...
...
@@ -334,13 +331,13 @@ sal_Bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr ,
SwDoc
*
pMyDoc
=
GetDoc
();
SwNodeRange
aRg
(
pMyDoc
->
GetNodes
(),
rArr
[
nFromPos
]
->
GetDocPos
()
);
if
(
nToPos
<
rArr
.
Count
()
)
if
(
nToPos
<
rArr
.
size
()
)
aRg
.
aEnd
=
rArr
[
nToPos
]
->
GetDocPos
();
else
aRg
.
aEnd
=
pMyDoc
->
GetNodes
().
GetEndOfContent
();
SwNodeIndex
aInsPos
(
pMyDoc
->
GetNodes
()
);
if
(
nInsPos
<
rArr
.
Count
()
)
if
(
nInsPos
<
rArr
.
size
()
)
aInsPos
=
rArr
[
nInsPos
]
->
GetDocPos
();
else
aInsPos
=
pMyDoc
->
GetNodes
().
GetEndOfContent
();
...
...
@@ -405,6 +402,4 @@ SwGlblDocContent::SwGlblDocContent( const SwSection* pSect )
nDocPos
=
pSectNd
?
pSectNd
->
GetIndex
()
:
0
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/ui/utlui/glbltree.cxx
Dosyayı görüntüle @
0d3b54b6
...
...
@@ -245,11 +245,11 @@ sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
pActiveShell
->
GetGlobalDocContent
(
*
pTempContents
);
// wenn das file erfolgreich eingefuegt wurde,
// dann muss auch der naechste Content geholt werden
if
(
nEntryCount
<
pTempContents
->
Count
())
if
(
nEntryCount
<
pTempContents
->
size
())
{
nEntryCount
++
;
nAbsContPos
++
;
pCnt
=
pTempContents
->
GetObject
(
static_cast
<
sal_uInt16
>
(
nAbsContPos
)
)
;
pCnt
=
(
*
pTempContents
)[
nAbsContPos
]
;
}
}
}
...
...
@@ -553,7 +553,7 @@ sal_Bool SwGlobalTree::NotifyMoving( SvLBoxEntry* pTarget,
{
SvTreeList
*
_pModel
=
GetModel
();
sal_uInt16
nSource
=
(
sal_uInt16
)
_pModel
->
GetAbsPos
(
pSource
);
sal_uInt16
nDest
=
pTarget
?
(
sal_uInt16
)
_pModel
->
GetAbsPos
(
pTarget
)
:
pSwGlblDocContents
->
Count
();
sal_uInt16
nDest
=
pTarget
?
(
sal_uInt16
)
_pModel
->
GetAbsPos
(
pTarget
)
:
pSwGlblDocContents
->
size
();
if
(
pActiveShell
->
MoveGlobalDocContent
(
*
pSwGlblDocContents
,
nSource
,
nSource
+
1
,
nDest
)
&&
...
...
@@ -639,13 +639,13 @@ void SwGlobalTree::Display(sal_Bool bOnlyUpdateUserData)
aEntryImages
=
ImageList
(
SW_RES
(
IMG_NAVI_ENTRYBMP
));
bIsImageListInitialized
=
sal_True
;
}
sal_uInt16
nCount
=
pSwGlblDocContents
->
Count
();
if
(
bOnlyUpdateUserData
&&
GetEntryCount
()
==
pSwGlblDocContents
->
Count
())
sal_uInt16
nCount
=
pSwGlblDocContents
->
size
();
if
(
bOnlyUpdateUserData
&&
GetEntryCount
()
==
pSwGlblDocContents
->
size
())
{
SvLBoxEntry
*
pEntry
=
First
();
for
(
sal_uInt16
i
=
0
;
i
<
nCount
;
i
++
)
{
SwGlblDocContent
Ptr
pCont
=
pSwGlblDocContents
->
GetObject
(
i
)
;
SwGlblDocContent
*
pCont
=
(
*
pSwGlblDocContents
)[
i
]
;
pEntry
->
SetUserData
(
pCont
);
pEntry
=
Next
(
pEntry
);
}
...
...
@@ -668,7 +668,7 @@ void SwGlobalTree::Display(sal_Bool bOnlyUpdateUserData)
SvLBoxEntry
*
pSelEntry
=
0
;
for
(
sal_uInt16
i
=
0
;
i
<
nCount
;
i
++
)
{
SwGlblDocContent
Ptr
pCont
=
pSwGlblDocContents
->
GetObject
(
i
)
;
SwGlblDocContent
*
pCont
=
(
*
pSwGlblDocContents
)[
i
]
;
String
sEntry
;
Image
aImage
;
switch
(
pCont
->
GetType
()
)
...
...
@@ -1117,18 +1117,18 @@ sal_Bool SwGlobalTree::Update(sal_Bool bHard)
sal_Bool
bCopy
=
sal_False
;
SwGlblDocContents
*
pTempContents
=
new
SwGlblDocContents
;
pActiveShell
->
GetGlobalDocContent
(
*
pTempContents
);
if
(
pTempContents
->
Count
()
!=
pSwGlblDocContents
->
Count
()
||
pTempContents
->
Count
()
!=
GetEntryCount
())
if
(
pTempContents
->
size
()
!=
pSwGlblDocContents
->
size
()
||
pTempContents
->
size
()
!=
GetEntryCount
())
{
bRet
=
sal_True
;
bCopy
=
sal_True
;
}
else
{
for
(
sal_uInt16
i
=
0
;
i
<
pTempContents
->
Count
()
&&
!
bCopy
;
i
++
)
for
(
sal_uInt16
i
=
0
;
i
<
pTempContents
->
size
()
&&
!
bCopy
;
i
++
)
{
SwGlblDocContent
*
pLeft
=
pTempContents
->
GetObject
(
i
)
;
SwGlblDocContent
*
pRight
=
pSwGlblDocContents
->
GetObject
(
i
)
;
SwGlblDocContent
*
pLeft
=
(
*
pTempContents
)[
i
]
;
SwGlblDocContent
*
pRight
=
(
*
pSwGlblDocContents
)[
i
]
;
GlobalDocContentType
eType
=
pLeft
->
GetType
();
SvLBoxEntry
*
pEntry
=
GetEntry
(
i
);
String
sTemp
=
GetEntryText
(
pEntry
);
...
...
@@ -1150,15 +1150,9 @@ sal_Bool SwGlobalTree::Update(sal_Bool bHard)
}
if
(
bCopy
||
bHard
)
{
sal_uInt16
i
;
pSwGlblDocContents
->
DeleteAndDestroy
(
0
,
pSwGlblDocContents
->
Count
());
for
(
i
=
0
;
i
<
pTempContents
->
Count
();
i
++
)
{
pSwGlblDocContents
->
Insert
(
pTempContents
->
GetObject
(
i
));
}
for
(
i
=
pTempContents
->
Count
();
i
;
i
--
)
pTempContents
->
Remove
(
i
-
1
);
pSwGlblDocContents
->
DeleteAndDestroyAll
();
pSwGlblDocContents
->
insert
(
*
pTempContents
);
pTempContents
->
clear
();
}
delete
pTempContents
;
...
...
@@ -1169,7 +1163,7 @@ sal_Bool SwGlobalTree::Update(sal_Bool bHard)
{
Clear
();
if
(
pSwGlblDocContents
)
pSwGlblDocContents
->
DeleteAndDestroy
(
0
,
pSwGlblDocContents
->
Count
()
);
pSwGlblDocContents
->
DeleteAndDestroy
All
(
);
}
// hier muss noch eine Veraenderungspruefung rein!
return
bRet
;
...
...
@@ -1290,12 +1284,12 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
rSh
.
StartAction
();
// after insertion of the first new content the 'pCont' parameter becomes invalid
// find the index of the 'anchor' content to always use a current anchor content
sal_uInt16
nAnchorContent
=
pSwGlblDocContents
->
Count
()
-
1
;
sal_uInt16
nAnchorContent
=
pSwGlblDocContents
->
size
()
-
1
;
if
(
!
bMove
)
{
for
(
sal_uInt16
nContent
=
0
;
nContent
<
pSwGlblDocContents
->
Count
();
++
nContent
)
for
(
sal_uInt16
nContent
=
0
;
nContent
<
pSwGlblDocContents
->
size
();
++
nContent
)
{
if
(
*
_pContent
==
*
pSwGlblDocContents
->
GetObject
(
nContent
)
)
if
(
*
_pContent
==
*
(
*
pSwGlblDocContents
)[
nContent
]
)
{
nAnchorContent
=
nContent
;
break
;
...
...
@@ -1308,11 +1302,11 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
//update the global document content after each inserted document
rSh
.
GetGlobalDocContent
(
aTempContents
);
SwGlblDocContent
*
pAnchorContent
=
0
;
OSL_ENSURE
(
aTempContents
.
Count
()
>
(
nAnchorContent
+
nFile
),
"invalid anchor content -> last insertion failed"
);
if
(
aTempContents
.
Count
()
>
(
nAnchorContent
+
nFile
)
)
pAnchorContent
=
aTempContents
.
GetObject
(
nAnchorContent
+
(
sal_uInt16
)
nFile
)
;
OSL_ENSURE
(
aTempContents
.
size
()
>
(
nAnchorContent
+
nFile
),
"invalid anchor content -> last insertion failed"
);
if
(
aTempContents
.
size
()
>
(
nAnchorContent
+
nFile
)
)
pAnchorContent
=
aTempContents
[
nAnchorContent
+
(
sal_uInt16
)
nFile
]
;
else
pAnchorContent
=
aTempContents
.
GetObject
(
aTempContents
.
Count
()
-
1
);
pAnchorContent
=
aTempContents
.
back
(
);
String
sFileName
(
pFileNames
[
nFile
]);
INetURLObject
aFileUrl
;
aFileUrl
.
SetSmartURL
(
sFileName
);
...
...
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