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
7dde4269
Kaydet (Commit)
7dde4269
authored
Tem 17, 2012
tarafından
Uray M. János
Kaydeden (comit)
Andras Timar
Tem 17, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#50801 fix cross-reference text when Caption order is Numbering first
Change-Id: I7306f99c18d0f9cfb3b0ce147ecc200662d23b3d
üst
80de3c0f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
61 deletions
+101
-61
expfld.hxx
sw/inc/expfld.hxx
+1
-1
reffld.hxx
sw/inc/reffld.hxx
+12
-12
expfld.cxx
sw/source/core/fields/expfld.cxx
+12
-7
reffld.cxx
sw/source/core/fields/reffld.cxx
+76
-41
No files found.
sw/inc/expfld.hxx
Dosyayı görüntüle @
7dde4269
...
@@ -123,7 +123,7 @@ public:
...
@@ -123,7 +123,7 @@ public:
virtual
bool
QueryValue
(
com
::
sun
::
star
::
uno
::
Any
&
rVal
,
sal_uInt16
nWhich
)
const
;
virtual
bool
QueryValue
(
com
::
sun
::
star
::
uno
::
Any
&
rVal
,
sal_uInt16
nWhich
)
const
;
virtual
bool
PutValue
(
const
com
::
sun
::
star
::
uno
::
Any
&
rVal
,
sal_uInt16
nWhich
);
virtual
bool
PutValue
(
const
com
::
sun
::
star
::
uno
::
Any
&
rVal
,
sal_uInt16
nWhich
);
static
sal_uInt16
GetReferenceTextPos
(
const
SwFmtFld
&
rFmt
,
SwDoc
&
rDoc
);
static
sal_uInt16
GetReferenceTextPos
(
const
SwFmtFld
&
rFmt
,
SwDoc
&
rDoc
,
unsigned
nHint
=
0
);
// #i82544#
// #i82544#
void
SetLateInitialization
()
{
bLateInitialization
=
true
;}
void
SetLateInitialization
()
{
bLateInitialization
=
true
;}
};
};
...
...
sw/inc/reffld.hxx
Dosyayı görüntüle @
7dde4269
...
@@ -48,19 +48,19 @@ enum REFERENCESUBTYPE
...
@@ -48,19 +48,19 @@ enum REFERENCESUBTYPE
enum
REFERENCEMARK
enum
REFERENCEMARK
{
{
REF_BEGIN
,
REF_BEGIN
,
REF_PAGE
=
REF_BEGIN
,
REF_PAGE
=
REF_BEGIN
,
// "Page"
REF_CHAPTER
,
REF_CHAPTER
,
// "Chapter"
REF_CONTENT
,
REF_CONTENT
,
// "Reference"
REF_UPDOWN
,
REF_UPDOWN
,
// "Above/Below"
REF_PAGE_PGDESC
,
REF_PAGE_PGDESC
,
// "As Page Style"
REF_ONLYNUMBER
,
REF_ONLYNUMBER
,
// "Category and Number"
REF_ONLYCAPTION
,
REF_ONLYCAPTION
,
// "Caption Text"
REF_ONLYSEQNO
,
REF_ONLYSEQNO
,
// "Numbering"
// --> #i81002#
// --> #i81002#
// new reference format types for referencing bookmarks and set references
// new reference format types for referencing bookmarks and set references
REF_NUMBER
,
REF_NUMBER
,
// "Number"
REF_NUMBER_NO_CONTEXT
,
REF_NUMBER_NO_CONTEXT
,
// "Number (no context)"
REF_NUMBER_FULL_CONTEXT
,
REF_NUMBER_FULL_CONTEXT
,
// "Number (full context)"
REF_END
REF_END
};
};
...
@@ -72,7 +72,7 @@ class SwGetRefFieldType : public SwFieldType
...
@@ -72,7 +72,7 @@ class SwGetRefFieldType : public SwFieldType
SwDoc
*
pDoc
;
SwDoc
*
pDoc
;
protected
:
protected
:
// Overlay in order to update all ref-fields.
// Overlay in order to update all ref-fields.
virtual
void
Modify
(
const
SfxPoolItem
*
,
const
SfxPoolItem
*
);
virtual
void
Modify
(
const
SfxPoolItem
*
,
const
SfxPoolItem
*
);
public
:
public
:
SwGetRefFieldType
(
SwDoc
*
pDoc
);
SwGetRefFieldType
(
SwDoc
*
pDoc
);
virtual
SwFieldType
*
Copy
()
const
;
virtual
SwFieldType
*
Copy
()
const
;
...
...
sw/source/core/fields/expfld.cxx
Dosyayı görüntüle @
7dde4269
...
@@ -895,19 +895,21 @@ void SwGetExpField::SetValue( const double& rAny )
...
@@ -895,19 +895,21 @@ void SwGetExpField::SetValue( const double& rAny )
/* --------------------------------------------------
/* --------------------------------------------------
Description: Find the index of the reference text
Description: Find the index of the reference text
following the current field
following the current field
nHint: search starting position after the current
field (or 0 if default)
--------------------------------------------------*/
--------------------------------------------------*/
xub_StrLen
SwGetExpField
::
GetReferenceTextPos
(
const
SwFmtFld
&
rFmt
,
SwDoc
&
rDoc
)
xub_StrLen
SwGetExpField
::
GetReferenceTextPos
(
const
SwFmtFld
&
rFmt
,
SwDoc
&
rDoc
,
unsigned
nHint
)
{
{
//
//
const
SwTxtFld
*
pTxtFld
=
rFmt
.
GetTxtFld
();
const
SwTxtFld
*
pTxtFld
=
rFmt
.
GetTxtFld
();
const
SwTxtNode
&
rTxtNode
=
pTxtFld
->
GetTxtNode
();
const
SwTxtNode
&
rTxtNode
=
pTxtFld
->
GetTxtNode
();
//
//
xub_StrLen
nRet
=
*
pTxtFld
->
GetStart
()
+
1
;
xub_StrLen
nRet
=
nHint
?
nHint
:
*
pTxtFld
->
GetStart
()
+
1
;
String
sNodeText
=
rTxtNode
.
GetTxt
();
String
sNodeText
=
rTxtNode
.
GetTxt
();
sNodeText
.
Erase
(
0
,
nRet
);
sNodeText
.
Erase
(
0
,
nRet
);
if
(
sNodeText
.
Len
())
if
(
sNodeText
.
Len
())
{
{
//
now check if sNodeText starts with a non-alphanumeric character plus a blank
//
now check if sNodeText starts with a non-alphanumeric character plus blanks
sal_uInt16
nSrcpt
=
pBreakIt
->
GetRealScriptOfText
(
sNodeText
,
0
);
sal_uInt16
nSrcpt
=
pBreakIt
->
GetRealScriptOfText
(
sNodeText
,
0
);
static
sal_uInt16
nIds
[]
=
static
sal_uInt16
nIds
[]
=
...
@@ -934,11 +936,14 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc
...
@@ -934,11 +936,14 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc
if
(
!
bIsAlphaNum
||
if
(
!
bIsAlphaNum
||
(
c0
==
' '
||
c0
==
'\t'
))
(
c0
==
' '
||
c0
==
'\t'
))
{
{
// ignoring blanks
nRet
++
;
nRet
++
;
if
(
sNodeText
.
Len
()
>
1
&&
unsigned
i
=
1
;
(
sNodeText
.
GetChar
(
1
)
==
' '
||
while
(
i
<
sNodeText
.
Len
()
&&
sNodeText
.
GetChar
(
1
)
==
'\t'
))
(
sNodeText
.
GetChar
(
i
)
==
' '
||
nRet
++
;
sNodeText
.
GetChar
(
i
)
==
'\t'
)
)
nRet
++
,
i
++
;
}
}
}
}
}
}
...
...
sw/source/core/fields/reffld.cxx
Dosyayı görüntüle @
7dde4269
...
@@ -67,6 +67,7 @@
...
@@ -67,6 +67,7 @@
#include <set>
#include <set>
#include <map>
#include <map>
#include <algorithm> // min, max
#include <sfx2/childwin.hxx>
#include <sfx2/childwin.hxx>
...
@@ -290,16 +291,28 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
...
@@ -290,16 +291,28 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
sTxt
.
Erase
();
sTxt
.
Erase
();
SwDoc
*
pDoc
=
((
SwGetRefFieldType
*
)
GetTyp
())
->
GetDoc
();
SwDoc
*
pDoc
=
((
SwGetRefFieldType
*
)
GetTyp
())
->
GetDoc
();
sal_uInt16
nStt
=
USHRT_MAX
;
// finding the reference target (the number)
sal_uInt16
nEnd
=
USHRT_MAX
;
sal_uInt16
nNumStart
,
nNumEnd
;
SwTxtNode
*
pTxtNd
=
SwGetRefFieldType
::
FindAnchor
(
pDoc
,
sSetRefName
,
SwTxtNode
*
pTxtNd
=
SwGetRefFieldType
::
FindAnchor
(
nSubType
,
nSeqNo
,
&
nStt
,
&
nEnd
);
pDoc
,
sSetRefName
,
nSubType
,
nSeqNo
,
&
nNumStart
,
&
nNumEnd
);
// not found?
if
(
!
pTxtNd
)
if
(
!
pTxtNd
)
{
{
sTxt
=
ViewShell
::
GetShellRes
()
->
aGetRefFld_RefItemNotFound
;
sTxt
=
ViewShell
::
GetShellRes
()
->
aGetRefFld_RefItemNotFound
;
return
;
return
;
}
}
// where is the category name (e.g. "Illustration")?
rtl
::
OUString
const
Text
=
pTxtNd
->
GetTxt
();
unsigned
const
nCatStart
=
Text
.
indexOf
(
sSetRefName
);
unsigned
const
nCatEnd
=
nCatStart
==
unsigned
(
-
1
)
?
unsigned
(
-
1
)
:
nCatStart
+
sSetRefName
.
getLength
();
bool
const
bHasCat
=
nCatStart
!=
unsigned
(
-
1
);
// length of the referenced text
unsigned
const
nLen
=
Text
.
getLength
();
// which format?
switch
(
GetFormat
()
)
switch
(
GetFormat
()
)
{
{
case
REF_CONTENT
:
case
REF_CONTENT
:
...
@@ -307,73 +320,95 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
...
@@ -307,73 +320,95 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
case
REF_ONLYCAPTION
:
case
REF_ONLYCAPTION
:
case
REF_ONLYSEQNO
:
case
REF_ONLYSEQNO
:
{
{
// needed part of Text
unsigned
nStart
,
nEnd
;
switch
(
nSubType
)
switch
(
nSubType
)
{
{
case
REF_SEQUENCEFLD
:
case
REF_SEQUENCEFLD
:
nEnd
=
pTxtNd
->
GetTxt
().
Len
();
switch
(
GetFormat
()
)
switch
(
GetFormat
()
)
{
{
// "Category and Number"
case
REF_ONLYNUMBER
:
case
REF_ONLYNUMBER
:
if
(
nStt
+
1
<
nEnd
)
if
(
bHasCat
)
{
nEnd
=
nStt
+
1
;
nStart
=
std
::
min
<
unsigned
>
(
nNumStart
,
nCatStart
);
nStt
=
0
;
nEnd
=
std
::
max
<
unsigned
>
(
nNumEnd
,
nCatEnd
);
}
else
{
nStart
=
nNumStart
;
nEnd
=
nNumEnd
;
}
break
;
break
;
case
REF_ONLYCAPTION
:
// "Caption Text"
{
case
REF_ONLYCAPTION
:
{
const
SwTxtAttr
*
const
pTxtAttr
=
// next alphanumeric character after category+number
pTxtNd
->
GetTxtAttrForCharAt
(
nStt
,
RES_TXTATR_FIELD
);
if
(
const
SwTxtAttr
*
const
pTxtAttr
=
if
(
pTxtAttr
)
pTxtNd
->
GetTxtAttrForCharAt
(
nNumStart
,
RES_TXTATR_FIELD
)
nStt
=
SwGetExpField
::
GetReferenceTextPos
(
)
{
pTxtAttr
->
GetFld
(),
*
pDoc
);
// start searching from nFrom
else
if
(
nStt
+
1
<
nEnd
)
unsigned
const
nFrom
=
bHasCat
?
++
nStt
;
std
::
max
<
unsigned
>
(
nNumStart
+
1
,
nCatEnd
)
:
nNumStart
+
1
;
nStart
=
SwGetExpField
::
GetReferenceTextPos
(
pTxtAttr
->
GetFld
(),
*
pDoc
,
nFrom
);
}
else
{
nStart
=
bHasCat
?
std
::
max
<
unsigned
>
(
nNumEnd
,
nCatEnd
)
:
nNumEnd
;
}
}
nEnd
=
nLen
;
break
;
break
;
}
// "Numbering"
case
REF_ONLYSEQNO
:
case
REF_ONLYSEQNO
:
if
(
nStt
+
1
<
nEnd
)
nStart
=
nNumStart
;
nEnd
=
nStt
+
1
;
nEnd
=
std
::
min
<
unsigned
>
(
nStart
+
1
,
nLen
)
;
break
;
break
;
// "Reference" (whole Text)
default
:
default
:
nStt
=
0
;
nStart
=
0
;
nEnd
=
nLen
;
break
;
break
;
}
}
break
;
break
;
case
REF_BOOKMARK
:
case
REF_BOOKMARK
:
if
(
USHRT_MAX
==
nEnd
)
nStart
=
nNumStart
;
{
// Text steht ueber verschiedene Nodes verteilt.
// Text steht ueber verschiedene Nodes verteilt.
// Gesamten Text oder nur bis zum Ende vom Node?
// Gesamten Text oder nur bis zum Ende vom Node?
nEnd
=
nNumEnd
==
USHRT_MAX
?
nLen
:
nNumEnd
;
nEnd
=
pTxtNd
->
GetTxt
().
Len
();
}
break
;
break
;
case
REF_OUTLINE
:
case
REF_OUTLINE
:
nStart
=
nNumStart
;
nEnd
=
nNumEnd
;
break
;
break
;
case
REF_FOOTNOTE
:
case
REF_FOOTNOTE
:
case
REF_ENDNOTE
:
case
REF_ENDNOTE
:
// die Nummer oder den NumString besorgen
for
(
unsigned
i
=
0
;
i
<
pDoc
->
GetFtnIdxs
().
Count
();
++
i
)
{
{
// die Nummer oder den NumString besorgen
SwTxtFtn
*
const
pFtnIdx
=
pDoc
->
GetFtnIdxs
()[
i
];
sal_uInt16
n
,
nFtnCnt
=
pDoc
->
GetFtnIdxs
().
Count
();
if
(
nSeqNo
==
pFtnIdx
->
GetSeqRefNo
()
)
SwTxtFtn
*
pFtnIdx
;
{
for
(
n
=
0
;
n
<
nFtnCnt
;
++
n
)
sTxt
=
pFtnIdx
->
GetFtn
().
GetViewNumStr
(
*
pDoc
);
if
(
nSeqNo
==
(
pFtnIdx
=
pDoc
->
GetFtnIdxs
()[
n
])
->
GetSeqRefNo
()
)
break
;
{
}
sTxt
=
pFtnIdx
->
GetFtn
().
GetViewNumStr
(
*
pDoc
);
break
;
}
nStt
=
nEnd
;
// kein Bereich, der String ist fertig
}
}
return
;
default
:
nStart
=
nNumStart
;
nEnd
=
nNumEnd
;
break
;
break
;
}
}
if
(
nSt
t
!=
nEnd
)
// ein Bereich?
if
(
nSt
art
!=
nEnd
)
// ein Bereich?
{
{
sTxt
=
pTxtNd
->
GetExpandTxt
(
nSt
t
,
nEnd
-
nSt
t
);
sTxt
=
pTxtNd
->
GetExpandTxt
(
nSt
art
,
nEnd
-
nStar
t
);
// alle Sonderzeichen entfernen (durch Blanks ersetzen):
// alle Sonderzeichen entfernen (durch Blanks ersetzen):
if
(
sTxt
.
Len
()
)
if
(
sTxt
.
Len
()
)
...
@@ -396,7 +431,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
...
@@ -396,7 +431,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
{
{
const
SwTxtFrm
*
pFrm
=
(
SwTxtFrm
*
)
pTxtNd
->
getLayoutFrm
(
pDoc
->
GetCurrentLayout
(),
0
,
0
,
sal_False
),
const
SwTxtFrm
*
pFrm
=
(
SwTxtFrm
*
)
pTxtNd
->
getLayoutFrm
(
pDoc
->
GetCurrentLayout
(),
0
,
0
,
sal_False
),
*
pSave
=
pFrm
;
*
pSave
=
pFrm
;
while
(
pFrm
&&
!
pFrm
->
IsInside
(
n
St
t
)
)
while
(
pFrm
&&
!
pFrm
->
IsInside
(
n
NumStar
t
)
)
pFrm
=
(
SwTxtFrm
*
)
pFrm
->
GetFollow
();
pFrm
=
(
SwTxtFrm
*
)
pFrm
->
GetFollow
();
if
(
pFrm
||
0
!=
(
pFrm
=
pSave
))
if
(
pFrm
||
0
!=
(
pFrm
=
pSave
))
...
@@ -443,14 +478,14 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
...
@@ -443,14 +478,14 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
// Node stehen!
// Node stehen!
if
(
pFldTxtAttr
->
GetpTxtNode
()
==
pTxtNd
)
if
(
pFldTxtAttr
->
GetpTxtNode
()
==
pTxtNd
)
{
{
sTxt
=
n
St
t
<
*
pFldTxtAttr
->
GetStart
()
sTxt
=
n
NumStar
t
<
*
pFldTxtAttr
->
GetStart
()
?
aLocaleData
.
getAboveWord
()
?
aLocaleData
.
getAboveWord
()
:
aLocaleData
.
getBelowWord
();
:
aLocaleData
.
getBelowWord
();
break
;
break
;
}
}
sTxt
=
::
IsFrameBehind
(
*
pFldTxtAttr
->
GetpTxtNode
(),
*
pFldTxtAttr
->
GetStart
(),
sTxt
=
::
IsFrameBehind
(
*
pFldTxtAttr
->
GetpTxtNode
(),
*
pFldTxtAttr
->
GetStart
(),
*
pTxtNd
,
n
St
t
)
*
pTxtNd
,
n
NumStar
t
)
?
aLocaleData
.
getAboveWord
()
?
aLocaleData
.
getAboveWord
()
:
aLocaleData
.
getBelowWord
();
:
aLocaleData
.
getBelowWord
();
}
}
...
...
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