summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/crstrvl.cxx4
-rw-r--r--sw/source/core/fields/reffld.cxx99
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx1
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx8
-rw-r--r--sw/source/ui/fldui/fldref.cxx37
-rw-r--r--sw/source/ui/fldui/fldref.hxx4
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx21
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx2
-rw-r--r--sw/source/uibase/shells/textsh1.cxx3
-rw-r--r--sw/source/uibase/wrtsh/move.cxx4
-rw-r--r--sw/source/uibase/wrtsh/wrtsh2.cxx3
12 files changed, 131 insertions, 57 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 93d22362745c..05ea83bfad70 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1402,7 +1402,7 @@ void SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN
/// jump to reference marker
bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
- sal_uInt16 nSeqNo )
+ sal_uInt16 nSeqNo, sal_uInt16 nFlags )
{
CurrShell aCurr( this );
SwCallLink aLk( *this ); // watch Cursor-Moves
@@ -1416,7 +1416,7 @@ bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
SwContentFrame* pRefFrame = GetCurrFrame();
SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor(GetDoc(), rRefMark,
- nSubType, nSeqNo, &nPos, nullptr, GetLayout(), pRefTextNd, pRefFrame);
+ nSubType, nSeqNo, nFlags, &nPos, nullptr, GetLayout(), pRefTextNd, pRefFrame);
if( !pTextNd || !pTextNd->GetNodes().IsDocNodes() )
return false;
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 442e1644a753..96b9716f7eac 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -350,12 +350,13 @@ static void lcl_formatReferenceLanguage( OUString& rRefText,
/// get references
SwGetRefField::SwGetRefField( SwGetRefFieldType* pFieldType,
OUString aSetRef, OUString aSetReferenceLanguage, sal_uInt16 nSubTyp,
- sal_uInt16 nSequenceNo, sal_uLong nFormat )
+ sal_uInt16 nSequenceNo, sal_uInt16 nFlags, sal_uLong nFormat )
: SwField(pFieldType, nFormat),
m_sSetRefName(std::move(aSetRef)),
m_sSetReferenceLanguage(std::move(aSetReferenceLanguage)),
m_nSubType(nSubTyp),
- m_nSeqNo(nSequenceNo)
+ m_nSeqNo(nSequenceNo),
+ m_nFlags(nFlags)
{
}
@@ -409,7 +410,7 @@ const SwTextNode* SwGetRefField::GetReferencedTextNode(SwTextNode* pTextNode, Sw
if (!pTyp)
return nullptr;
sal_Int32 nDummy = -1;
- return SwGetRefFieldType::FindAnchor( &pTyp->GetDoc(), m_sSetRefName, m_nSubType, m_nSeqNo, &nDummy,
+ return SwGetRefFieldType::FindAnchor( &pTyp->GetDoc(), m_sSetRefName, m_nSubType, m_nSeqNo, m_nFlags, &nDummy,
nullptr, nullptr, pTextNode, pFrame );
}
@@ -424,6 +425,30 @@ static OUString lcl_formatStringByCombiningCharacter(std::u16string_view sText,
return sRet.makeStringAndClear();
}
+void SwGetRefField::StylerefStripNonnumerical(OUString& rText) const
+{
+ // for STYLEREF, hide text that is neither a delimiter nor a number if that flag is set
+ if ( m_nSubType != REF_STYLE || (GetFlags() & REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL) != REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL )
+ return;
+
+ std::vector<sal_Unicode> charactersToKeep;
+
+ for (int i = 0; i < rText.getLength(); i++) {
+ auto character = rText[i];
+
+ if (
+ (character >= '(' && character <= '@') || // includes 0-9 and most of the punctuation we want
+ (character >= '[' && character <= '_') // includes the rest of the punctuation we want
+ )
+ charactersToKeep.push_back(character);
+ }
+
+ if (charactersToKeep.size())
+ rText = OUString(charactersToKeep.data(), charactersToKeep.size());
+ else
+ rText = OUString();
+}
+
// #i85090#
OUString SwGetRefField::GetExpandedTextOfReferencedTextNode(
SwRootFrame const& rLayout, SwTextNode* pTextNode, SwFrame* pFrame) const
@@ -442,6 +467,9 @@ OUString SwGetRefField::GetExpandedTextOfReferencedTextNode(
sRet = sw::GetExpandTextMerged(&rLayout, *pReferencedTextNode, true, false, ExpandMode(0));
sRet = lcl_formatStringByCombiningCharacter( sRet, cStrikethrough );
}
+
+ StylerefStripNonnumerical(sRet);
+
return sRet;
}
@@ -524,7 +552,7 @@ void SwGetRefField::UpdateField(const SwTextField* pFieldTextAttr, SwFrame* pFra
sal_Int32 nNumStart = -1;
sal_Int32 nNumEnd = -1;
SwTextNode* pTextNd = SwGetRefFieldType::FindAnchor(
- &rDoc, m_sSetRefName, m_nSubType, m_nSeqNo, &nNumStart, &nNumEnd,
+ &rDoc, m_sSetRefName, m_nSubType, m_nSeqNo, m_nFlags, &nNumStart, &nNumEnd,
pLayout, pFieldTextAttr ? pFieldTextAttr->GetpTextNode() : nullptr, pFrameContainingField
);
// not found?
@@ -785,6 +813,8 @@ void SwGetRefField::UpdateField(const SwTextField* pFieldTextAttr, SwFrame* pFra
default:
OSL_FAIL("<SwGetRefField::UpdateField(..)> - unknown format type");
}
+
+ StylerefStripNonnumerical(rText);
}
// #i81002#
@@ -880,7 +910,7 @@ std::unique_ptr<SwField> SwGetRefField::Copy() const
{
std::unique_ptr<SwGetRefField> pField( new SwGetRefField( static_cast<SwGetRefFieldType*>(GetTyp()),
m_sSetRefName, m_sSetReferenceLanguage, m_nSubType,
- m_nSeqNo, GetFormat() ) );
+ m_nSeqNo, m_nFlags, GetFormat() ) );
pField->m_sText = m_sText;
pField->m_sTextRLHidden = m_sTextRLHidden;
return std::unique_ptr<SwField>(pField.release());
@@ -1217,8 +1247,8 @@ namespace
}
SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
- sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_Int32* pStt,
- sal_Int32* pEnd, SwRootFrame const* const pLayout,
+ sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags,
+ sal_Int32* pStt, sal_Int32* pEnd, SwRootFrame const* const pLayout,
SwTextNode* pSelf, SwFrame* pContentFrame)
{
OSL_ENSURE( pStt, "Why did no one check the StartPos?" );
@@ -1337,6 +1367,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
case REF_STYLE:
if (!pSelf) break;
+ bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM;
+
const SwNodes& nodes = pDoc->GetNodes();
StyleRefElementType elementType = StyleRefElementType::Default;
@@ -1434,9 +1466,9 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
pPageEnd = pReference;
}
- std::deque<SwNode*> pAbovePage;
- std::deque<SwNode*> pInPage;
- std::deque<SwNode*> pBelowPage;
+ std::deque<SwNode*> pSearchSecond;
+ std::deque<SwNode*> pInPage; /* or pSearchFirst */
+ std::deque<SwNode*> pSearchThird;
bool beforeStart = true;
bool beforeEnd = true;
@@ -1450,21 +1482,27 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
if (beforeStart)
{
- pAbovePage.push_front(nodes[n]);
+ if (bFlagFromBottom)
+ pSearchThird.push_front(nodes[n]);
+ else
+ pSearchSecond.push_front(nodes[n]);
}
else if (beforeEnd)
{
- pInPage.push_back(nodes[n]);
+ if (bFlagFromBottom)
+ pInPage.push_front(nodes[n]);
+ else
+ pInPage.push_back(nodes[n]);
if (*pPageEnd == *nodes[n])
{
beforeEnd = false;
}
}
+ else if (bFlagFromBottom)
+ pSearchSecond.push_back(nodes[n]);
else
- {
- pBelowPage.push_back(nodes[n]);
- }
+ pSearchThird.push_back(nodes[n]);
}
pTextNd = SearchForStyleAnchor(pSelf, pInPage, rRefMark);
@@ -1474,14 +1512,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
}
// 2. Search up from the top of the page
- pTextNd = SearchForStyleAnchor(pSelf, pAbovePage, rRefMark);
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark);
if (pTextNd)
{
break;
}
// 3. Search down from the bottom of the page
- pTextNd = SearchForStyleAnchor(pSelf, pBelowPage, rRefMark);
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark);
if (pTextNd)
{
break;
@@ -1497,14 +1535,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
break;
}
- pTextNd = SearchForStyleAnchor(pSelf, pAbovePage, rRefMark,
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark,
false /* bCaseSensitive */);
if (pTextNd)
{
break;
}
- pTextNd = SearchForStyleAnchor(pSelf, pBelowPage, rRefMark,
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark,
false /* bCaseSensitive */);
break;
}
@@ -1515,8 +1553,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
// For references, styleref acts from the position of the reference not the field
// Happily, the previous code saves either one into pReference, so the following is generic for both
- std::deque<SwNode*> pNotBelowElement;
- std::deque<SwNode*> pBelowElement;
+ std::deque<SwNode*> pSearchFirst;
+ std::deque<SwNode*> pSearchSecond;
bool beforeElement = true;
@@ -1524,22 +1562,25 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
{
if (beforeElement)
{
- pNotBelowElement.push_front(nodes[n]);
+ if (bFlagFromBottom)
+ pSearchSecond.push_front(nodes[n]);
+ else
+ pSearchFirst.push_front(nodes[n]);
if (*pReference == *nodes[n])
{
beforeElement = false;
}
}
+ else if (bFlagFromBottom)
+ pSearchFirst.push_back(nodes[n]);
else
- {
- pBelowElement.push_back(nodes[n]);
- }
+ pSearchSecond.push_back(nodes[n]);
}
// 1. Search up until we hit the top of the document
- pTextNd = SearchForStyleAnchor(pSelf, pNotBelowElement, rRefMark);
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark);
if (pTextNd)
{
break;
@@ -1547,7 +1588,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
// 2. Search down until we hit the bottom of the document
- pTextNd = SearchForStyleAnchor(pSelf, pBelowElement, rRefMark);
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark);
if (pTextNd)
{
break;
@@ -1555,14 +1596,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark,
// Again, we need to remember that Word styles are not case sensitive
- pTextNd = SearchForStyleAnchor(pSelf, pNotBelowElement, rRefMark,
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark,
false /* bCaseSensitive */);
if (pTextNd)
{
break;
}
- pTextNd = SearchForStyleAnchor(pSelf, pBelowElement, rRefMark,
+ pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark,
false /* bCaseSensitive */);
break;
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index f9702e28b19a..decdd4215f0b 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2405,7 +2405,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
// Destination Rectangle
const SwGetRefField* pField = static_cast<SwGetRefField*>(pFormatField->GetField());
const OUString& rRefName = pField->GetSetRefName();
- mrSh.GotoRefMark( rRefName, pField->GetSubType(), pField->GetSeqNo() );
+ mrSh.GotoRefMark( rRefName, pField->GetSubType(), pField->GetSeqNo(), pField->GetFlags() );
const SwRect& rDestRect = mrSh.GetCharRect();
const SwPageFrame* pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 749678ec6b32..b5d423e8fd42 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1498,6 +1498,7 @@ void SAL_CALL SwXTextField::attach(
m_pImpl->m_pProps->sPar4,
0,
0,
+ 0,
0));
if (!m_pImpl->m_pProps->sPar3.isEmpty())
static_cast<SwGetRefField*>(xField.get())->SetExpand(m_pImpl->m_pProps->sPar3);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index c51f8a1256ab..f041e7ac1fad 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2183,7 +2183,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr )
SwGetRefField aField(
static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),
- sBkmName,"",REF_BOOKMARK,0,eFormat);
+ sBkmName,"",REF_BOOKMARK,0,0,eFormat);
if (eFormat == REF_CONTENT)
{
@@ -2238,14 +2238,14 @@ eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr )
// set Sequence No of corresponding Foot-/Endnote to Zero
// (will be corrected in
SwGetRefField aField( static_cast<SwGetRefFieldType*>(
- m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), aBkmName, "", REF_FOOTNOTE, 0,
+ m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), aBkmName, "", REF_FOOTNOTE, 0, 0,
REF_ONLYNUMBER );
m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField));
m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD);
if (bAboveBelow)
{
SwGetRefField aField2( static_cast<SwGetRefFieldType*>(
- m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),aBkmName, "", REF_FOOTNOTE, 0,
+ m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),aBkmName, "", REF_FOOTNOTE, 0, 0,
REF_UPDOWN );
m_xReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField2));
m_xReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD);
@@ -2318,7 +2318,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr )
sPageRefBookmarkName = sName;
}
SwGetRefField aField( static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),
- sPageRefBookmarkName, "", REF_BOOKMARK, 0, REF_PAGE );
+ sPageRefBookmarkName, "", REF_BOOKMARK, 0, 0, REF_PAGE );
m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
return eF_ResT::OK;
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 61083223eb3f..feab4e976385 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -40,16 +40,6 @@
#include <o3tl/string_view.hxx>
#include <vcl/settings.hxx>
-#define REFFLDFLAG 0x4000
-#define REFFLDFLAG_BOOKMARK 0x4800
-#define REFFLDFLAG_FOOTNOTE 0x5000
-#define REFFLDFLAG_ENDNOTE 0x6000
-// #i83479#
-#define REFFLDFLAG_HEADING 0x7100
-#define REFFLDFLAG_NUMITEM 0x7200
-#define REFFLDFLAG_STYLE 0xc000
-/* we skip past 0x8000, 0x9000, 0xa000 and 0xb000 as when we bitwise 'and'
- with REFFLDFLAG they are false */
static sal_uInt16 nFieldDlgFormatSel = 0;
@@ -70,6 +60,9 @@ SwFieldRefPage::SwFieldRefPage(weld::Container* pPage, weld::DialogController* p
, m_xNameED(m_xBuilder->weld_entry("name"))
, m_xValueED(m_xBuilder->weld_entry("value"))
, m_xFilterED(m_xBuilder->weld_entry("filter"))
+ , m_xStylerefFlags(m_xBuilder->weld_widget("stylerefflagsframe"))
+ , m_xStylerefFromBottomCB(m_xBuilder->weld_check_button("stylereffrombottomcheckbox"))
+ , m_xStylerefHideNonNumericalCB(m_xBuilder->weld_check_button("stylerefhidenonnumericalcheckbox"))
{
m_xSelectionLB->make_sorted();
// #i83479#
@@ -293,6 +286,8 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
m_xNameED->save_value();
m_xValueED->save_value();
m_xFilterED->set_text(OUString());
+ m_xStylerefFromBottomCB->save_state();
+ m_xStylerefHideNonNumericalCB->save_state();
}
}
@@ -464,6 +459,8 @@ void SwFieldRefPage::SubTypeHdl()
{
sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ m_xStylerefFlags->set_visible(nTypeId == REFFLDFLAG_STYLE);
+
switch(nTypeId)
{
case static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef):
@@ -701,8 +698,11 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
pStyle = stylesheetIterator->Next();
}
- if (IsFieldEdit() && pRefField)
+ if (IsFieldEdit() && pRefField) {
sOldSel = pRefField->GetPar1();
+ m_xStylerefFromBottomCB->set_active((pRefField->GetFlags() & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM);
+ m_xStylerefHideNonNumericalCB->set_active((pRefField->GetFlags() & REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL) == REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL);
+ }
}
else
{
@@ -1135,6 +1135,17 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
aName = m_xSelectionLB->get_text(nEntry);
nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_STYLE;
+ sal_uInt16 nVal = REFFLDFLAG_STYLE;
+
+ if (m_xStylerefFromBottomCB->get_active()) {
+ nVal |= REFFLDFLAG_STYLE_FROM_BOTTOM;
+ }
+
+ if (m_xStylerefHideNonNumericalCB->get_active()) {
+ nVal |= REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL;
+ }
+
+ aVal = OUString::number(nVal);
} else {
SAL_WARN("sw.ui", "<SwFieldRefPage::FillItemSet(..)> no entry selected in selection listbox!");
}
@@ -1179,7 +1190,9 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
m_xValueED->get_value_changed_from_saved() ||
m_xTypeLB->get_value_changed_from_saved() ||
m_xSelectionLB->get_value_changed_from_saved() ||
- m_xFormatLB->get_value_changed_from_saved())
+ m_xFormatLB->get_value_changed_from_saved() ||
+ (nSubType == REF_STYLE
+ && (m_xStylerefFromBottomCB->get_state_changed_from_saved() || m_xStylerefHideNonNumericalCB->get_state_changed_from_saved())))
{
InsertField( static_cast<SwFieldTypesEnum>(nTypeId), nSubType, aName, aVal, nFormat );
}
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
index 872e6f526bb6..24727e26169a 100644
--- a/sw/source/ui/fldui/fldref.hxx
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -57,6 +57,10 @@ class SwFieldRefPage : public SwFieldPage
std::unique_ptr<weld::Entry> m_xValueED;
std::unique_ptr<weld::Entry> m_xFilterED;
+ std::unique_ptr<weld::Widget> m_xStylerefFlags;
+ std::unique_ptr<weld::CheckButton> m_xStylerefFromBottomCB;
+ std::unique_ptr<weld::CheckButton> m_xStylerefHideNonNumericalCB;
+
DECL_LINK(TypeHdl, weld::TreeView&, void);
DECL_LINK(SubTypeListBoxHdl, weld::TreeView&, void);
DECL_LINK(SubTypeTreeListBoxHdl, weld::TreeView&, void);
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 3b69fb63739d..9187afa08832 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1119,7 +1119,13 @@ bool SwFieldMgr::InsertField(
{
SwGetRefFieldType* pTyp =
static_cast<SwGetRefFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::GetRef) );
- sal_uInt16 nSeqNo = o3tl::narrowing<sal_uInt16>(rData.m_sPar2.toInt32());
+
+ sal_uInt16 nSeqNo = 0;
+ sal_uInt16 nFlags = 0;
+
+ if (nSubType == REF_STYLE) nFlags = o3tl::narrowing<sal_uInt16>(rData.m_sPar2.toInt32());
+ else nSeqNo = o3tl::narrowing<sal_uInt16>(rData.m_sPar2.toInt32());
+
OUString sReferenceLanguage;
// handle language-variant formats
if (nFormatId >= SAL_N_ELEMENTS(FMT_REF_ARY))
@@ -1135,7 +1141,7 @@ bool SwFieldMgr::InsertField(
nFormatId %= SAL_N_ELEMENTS(FMT_REF_ARY);
}
- pField.reset(new SwGetRefField(pTyp, rData.m_sPar1, sReferenceLanguage, nSubType, nSeqNo, nFormatId));
+ pField.reset(new SwGetRefField(pTyp, rData.m_sPar1, sReferenceLanguage, nSubType, nSeqNo, nFlags, nFormatId));
bExp = true;
break;
}
@@ -1668,10 +1674,17 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat,
case SwFieldTypesEnum::GetRef:
{
bSetPar2 = false;
- static_cast<SwGetRefField*>(pTmpField.get())->SetSubType( o3tl::narrowing<sal_uInt16>(rPar2.toInt32()) );
+ sal_Int16 nSubType = o3tl::narrowing<sal_uInt16>(rPar2.toInt32());
+ static_cast<SwGetRefField*>(pTmpField.get())->SetSubType( nSubType );
const sal_Int32 nPos = rPar2.indexOf( '|' );
if( nPos>=0 )
- static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rPar2.subView( nPos + 1 ))));
+ switch (nSubType) {
+ case REF_STYLE:
+ static_cast<SwGetRefField*>(pTmpField.get())->SetFlags( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rPar2.subView( nPos + 1 ))));
+ break;
+ default:
+ static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(rPar2.subView( nPos + 1 ))));
+ }
}
break;
case SwFieldTypesEnum::Dropdown:
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index da8214329486..741c28c8a648 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -494,7 +494,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)();
bool GotoOutline( const OUString& rName );
bool GotoRegion( std::u16string_view rName );
bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType = 0,
- sal_uInt16 nSeqNo = 0 );
+ sal_uInt16 nSeqNo = 0, sal_uInt16 nFlags = 0 );
bool GotoNextTOXBase( const OUString* pName = nullptr);
bool GotoTable( const OUString& rName );
void GotoFormatField( const SwFormatField& rField );
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 6bcabdd4292d..d7fbf8c2674a 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1314,7 +1314,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
rWrtSh.StartAllAction();
rWrtSh.SwCursorShell::GotoRefMark( static_cast<SwGetRefField*>(pField)->GetSetRefName(),
static_cast<SwGetRefField*>(pField)->GetSubType(),
- static_cast<SwGetRefField*>(pField)->GetSeqNo() );
+ static_cast<SwGetRefField*>(pField)->GetSeqNo(),
+ static_cast<SwGetRefField*>(pField)->GetFlags() );
rWrtSh.EndAllAction();
rReq.Done();
}
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index c50740354928..cda2b32112ce 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -708,10 +708,10 @@ bool SwWrtShell::GotoRegion( std::u16string_view rName )
}
bool SwWrtShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType,
- sal_uInt16 nSeqNo )
+ sal_uInt16 nSeqNo, sal_uInt16 nFlags )
{
SwPosition aPos = *GetCursor()->GetPoint();
- bool bRet = SwCursorShell::GotoRefMark(rRefMark, nSubType, nSeqNo);
+ bool bRet = SwCursorShell::GotoRefMark(rRefMark, nSubType, nSeqNo, nFlags);
if (bRet)
m_aNavigationMgr.addEntry(aPos);
return bRet;
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index f4881304f95c..3bf614370b97 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -475,7 +475,8 @@ void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks)
StartAllAction();
SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(),
static_cast<const SwGetRefField&>(rField).GetSubType(),
- static_cast<const SwGetRefField&>(rField).GetSeqNo() );
+ static_cast<const SwGetRefField&>(rField).GetSeqNo(),
+ static_cast<const SwGetRefField&>(rField).GetFlags() );
EndAllAction();
break;