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
b4982fff
Kaydet (Commit)
b4982fff
authored
Şub 21, 2011
tarafından
Nigel Hawkins
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove use of SvBools in wrtww8.cxx
üst
28201dd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
68 deletions
+67
-68
wrtww8.cxx
sw/source/filter/ww8/wrtww8.cxx
+67
-68
No files found.
sw/source/filter/ww8/wrtww8.cxx
Dosyayı görüntüle @
b4982fff
...
...
@@ -191,12 +191,21 @@ public:
class
WW8_WrtBookmarks
{
private
:
SvULongs
aSttCps
,
aEndCps
;
// Array of Start- and End CPs
SvBools
aFieldMarks
;
// If the bookmark is in a field result
std
::
vector
<
String
>
maSwBkmkNms
;
// Array of Sw - Bookmarknames
typedef
std
::
vector
<
String
>::
iterator
myIter
;
//! Holds information about a single bookmark.
struct
BookmarkInfo
{
ULONG
startPos
;
//!< Starting character position.
ULONG
endPos
;
//!< Ending character position.
bool
isField
;
//!< True if the bookmark is in a field result.
String
name
;
//!< Name of this bookmark.
inline
BookmarkInfo
(
ULONG
start
,
ULONG
end
,
bool
isFld
,
const
String
&
bkName
)
:
startPos
(
start
),
endPos
(
end
),
isField
(
isFld
),
name
(
bkName
)
{};
//! Operator < is defined purely for sorting.
inline
bool
operator
<
(
const
BookmarkInfo
&
other
)
const
{
return
startPos
<
other
.
startPos
;
}
};
std
::
vector
<
BookmarkInfo
>
aBookmarks
;
typedef
std
::
vector
<
BookmarkInfo
>::
iterator
BkmIter
;
USHORT
GetPos
(
const
String
&
rNm
);
//! Return the position in aBookmarks where the string rNm can be found.
BkmIter
GetPos
(
const
String
&
rNm
);
//No copying
WW8_WrtBookmarks
(
const
WW8_WrtBookmarks
&
);
...
...
@@ -205,8 +214,11 @@ public:
WW8_WrtBookmarks
();
~
WW8_WrtBookmarks
();
//! Add a new bookmark to the list OR add an end position to an existing bookmark.
void
Append
(
WW8_CP
nStartCp
,
const
String
&
rNm
,
const
::
sw
::
mark
::
IMark
*
pBkmk
=
NULL
);
//! Write out bookmarks to file.
void
Write
(
WW8Export
&
rWrt
);
//! Move existing field marks from one position to another.
void
MoveFieldMarks
(
ULONG
nFrom
,
ULONG
nTo
);
};
...
...
@@ -1257,7 +1269,6 @@ WW8_CP WW8_WrPct::Fc2Cp( ULONG nFc ) const
/* */
WW8_WrtBookmarks
::
WW8_WrtBookmarks
()
:
aSttCps
(
0
,
16
),
aEndCps
(
0
,
16
)
{
}
...
...
@@ -1267,71 +1278,63 @@ WW8_WrtBookmarks::~WW8_WrtBookmarks()
void
WW8_WrtBookmarks
::
Append
(
WW8_CP
nStartCp
,
const
String
&
rNm
,
const
::
sw
::
mark
::
IMark
*
)
{
USHORT
nPos
=
GetPos
(
rNm
);
if
(
USHRT_MAX
==
nPos
)
BkmIter
bkIter
=
GetPos
(
rNm
);
if
(
bkIter
==
aBookmarks
.
end
()
)
{
// new -> insert as start position
nPos
=
aSttCps
.
Count
();
myIter
aIter
=
maSwBkmkNms
.
end
();
// sort by startposition
// theory: write continuous -> then the new position is at end
while
(
nPos
&&
aSttCps
[
nPos
-
1
]
>
ULONG
(
nStartCp
))
{
--
nPos
;
--
aIter
;
}
aSttCps
.
Insert
(
nStartCp
,
nPos
);
aEndCps
.
Insert
(
nStartCp
,
nPos
);
aFieldMarks
.
Insert
(
BOOL
(
false
),
nPos
);
maSwBkmkNms
.
insert
(
aIter
,
rNm
);
// new bookmark -> insert with start==end
aBookmarks
.
push_back
(
BookmarkInfo
(
nStartCp
,
nStartCp
,
false
,
rNm
)
);
}
else
{
// old
-> its
the end position
OSL_ENSURE
(
aEndCps
[
nPos
]
==
aSttCps
[
nPos
]
,
"end position is valid"
);
// old
bookmark -> this should be
the end position
OSL_ENSURE
(
bkIter
->
endPos
==
bkIter
->
startPos
,
"end position is valid"
);
//If this bookmark was around a field in writer, then we want to move
//it to the field result in word. The end is therefore one cp
//backwards from the 0x15 end mark that was inserted.
if
(
aFieldMarks
[
nPos
]
)
if
(
bkIter
->
isField
)
--
nStartCp
;
aEndCps
.
Replace
(
nStartCp
,
nPos
);
bkIter
->
endPos
=
nStartCp
;
}
}
void
WW8_WrtBookmarks
::
Write
(
WW8Export
&
rWrt
)
{
USHORT
nCount
=
aSttCps
.
Count
(),
i
;
if
(
nCount
)
if
(
!
aBookmarks
.
empty
())
{
SvULongs
aEndSortTab
(
255
<
nCount
?
255
:
nCount
,
4
);
// sort then endpositions
for
(
i
=
0
;
i
<
nCount
;
++
i
)
{
ULONG
nCP
=
aEndCps
[
i
];
USHORT
nPos
=
i
;
while
(
nPos
&&
aEndSortTab
[
nPos
-
1
]
>
nCP
)
--
nPos
;
aEndSortTab
.
Insert
(
nCP
,
nPos
);
}
//Make sure the bookmarks are sorted in order of start position.
std
::
sort
(
aBookmarks
.
begin
(),
aBookmarks
.
end
());
// we have some bookmarks found in the document -> write them
// first the Bookmark Name Stringtable
rWrt
.
WriteAsStringTable
(
maSwBkmkNms
,
rWrt
.
pFib
->
fcSttbfbkmk
,
rWrt
.
pFib
->
lcbSttbfbkmk
);
// First write the Bookmark Name Stringtable
std
::
vector
<
String
>
aNames
;
aNames
.
reserve
(
aBookmarks
.
size
());
for
(
BkmIter
bIt
=
aBookmarks
.
begin
();
bIt
<
aBookmarks
.
end
();
++
bIt
)
aNames
.
push_back
(
bIt
->
name
);
rWrt
.
WriteAsStringTable
(
aNames
,
rWrt
.
pFib
->
fcSttbfbkmk
,
rWrt
.
pFib
->
lcbSttbfbkmk
);
//
second
the Bookmark start positions as pcf of longs
//
Second write
the Bookmark start positions as pcf of longs
SvStream
&
rStrm
=
rWrt
.
bWrtWW8
?
*
rWrt
.
pTableStrm
:
rWrt
.
Strm
();
rWrt
.
pFib
->
fcPlcfbkf
=
rStrm
.
Tell
();
for
(
i
=
0
;
i
<
nCount
;
++
i
)
SwWW8Writer
::
WriteLong
(
rStrm
,
aSttCps
[
i
]
);
for
(
BkmIter
bIt
=
aBookmarks
.
begin
();
bIt
<
aBookmarks
.
end
();
++
bIt
)
SwWW8Writer
::
WriteLong
(
rStrm
,
bIt
->
startPos
);
SwWW8Writer
::
WriteLong
(
rStrm
,
rWrt
.
pFib
->
ccpText
+
rWrt
.
pFib
->
ccpTxbx
);
for
(
i
=
0
;
i
<
nCount
;
++
i
)
{
ULONG
nEndCP
=
aEndCps
[
i
];
//Lastly, need to write out the end positions (sorted by end position). But
//before that we need a lookup table (sorted by start position) to link
//start and end positions.
// Start by sorting the end positions.
std
::
vector
<
ULONG
>
aEndSortTab
;
aEndSortTab
.
reserve
(
aBookmarks
.
size
());
for
(
BkmIter
bIt
=
aBookmarks
.
begin
();
bIt
<
aBookmarks
.
end
();
++
bIt
)
aEndSortTab
.
push_back
(
bIt
->
endPos
);
std
::
sort
(
aEndSortTab
.
begin
(),
aEndSortTab
.
end
());
//Now write out the lookups.
//Note that in most cases, the positions in both vectors will be very close.
for
(
ULONG
i
=
0
;
i
<
aBookmarks
.
size
();
++
i
)
{
ULONG
nEndCP
=
aBookmarks
[
i
].
endPos
;
USHORT
nPos
=
i
;
if
(
aEndSortTab
[
nPos
]
>
nEndCP
)
{
...
...
@@ -1341,43 +1344,39 @@ void WW8_WrtBookmarks::Write( WW8Export& rWrt )
else
if
(
aEndSortTab
[
nPos
]
<
nEndCP
)
while
(
aEndSortTab
[
++
nPos
]
!=
nEndCP
)
;
SwWW8Writer
::
WriteLong
(
rStrm
,
nPos
);
}
rWrt
.
pFib
->
lcbPlcfbkf
=
rStrm
.
Tell
()
-
rWrt
.
pFib
->
fcPlcfbkf
;
//
third the Bookmark end positions
//
Finally, the actual Bookmark end positions.
rWrt
.
pFib
->
fcPlcfbkl
=
rStrm
.
Tell
();
for
(
i
=
0
;
i
<
nCount
;
++
i
)
for
(
ULONG
i
=
0
;
i
<
aEndSortTab
.
size
()
;
++
i
)
SwWW8Writer
::
WriteLong
(
rStrm
,
aEndSortTab
[
i
]
);
SwWW8Writer
::
WriteLong
(
rStrm
,
rWrt
.
pFib
->
ccpText
+
rWrt
.
pFib
->
ccpTxbx
);
rWrt
.
pFib
->
lcbPlcfbkl
=
rStrm
.
Tell
()
-
rWrt
.
pFib
->
fcPlcfbkl
;
}
}
USHORT
WW8_WrtBookmarks
::
GetPos
(
const
String
&
rNm
)
WW8_WrtBookmarks
::
BkmIter
WW8_WrtBookmarks
::
GetPos
(
const
String
&
rNm
)
{
USHORT
nRet
=
USHRT_MAX
,
n
;
for
(
n
=
0
;
n
<
aSttCps
.
Count
();
++
n
)
if
(
rNm
==
maSwBkmkNms
[
n
])
{
nRet
=
n
;
break
;
}
return
nRet
;
for
(
BkmIter
bIt
=
aBookmarks
.
begin
();
bIt
<
aBookmarks
.
end
();
++
bIt
)
{
if
(
rNm
==
bIt
->
name
)
return
bIt
;
}
return
aBookmarks
.
end
();
}
void
WW8_WrtBookmarks
::
MoveFieldMarks
(
ULONG
nFrom
,
ULONG
nTo
)
{
for
(
USHORT
nI
=
0
;
nI
<
aSttCps
.
Count
();
++
nI
)
for
(
BkmIter
i
=
aBookmarks
.
begin
();
i
<
aBookmarks
.
end
();
++
i
)
{
if
(
aSttCps
[
nI
]
==
nFrom
)
if
(
i
->
startPos
==
nFrom
)
{
aSttCps
[
nI
]
=
nTo
;
if
(
aEndCps
[
nI
]
==
nFrom
)
i
->
startPos
=
nTo
;
if
(
i
->
endPos
==
nFrom
)
{
aFieldMarks
[
nI
]
=
true
;
aEndCps
[
nI
]
=
nTo
;
i
->
isField
=
true
;
i
->
endPos
=
nTo
;
}
}
}
...
...
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