summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-03-07 07:56:35 -0900
committerJim Raykowski <raykowj@gmail.com>2021-04-29 07:27:12 +0200
commit4bc0af27204f099f14cb4c97611089643cbe271c (patch)
treee472e8002c9efee0739c6989b4654c29627bec20 /sw/source
parentb6ab5914d8b2fc7041430796890f086f8e3e6369 (diff)
tdf#137741 Add ability to navigate by fields from Navigate By control
Change-Id: I3cc464a3d5097b4e0438ea22ebf6daad5a2f2a86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112144 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/crstrvl.cxx3
-rw-r--r--sw/source/uibase/inc/workctrl.hxx4
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx20
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx26
4 files changed, 46 insertions, 7 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 3b2ad6514a51..58bf0b4f9626 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -729,10 +729,11 @@ bool SwCursorShell::MoveFieldType(
{
const SwFieldTypes& rFieldTypes = *mxDoc->getIDocumentFieldsAccess().GetFieldTypes();
const size_t nSize = rFieldTypes.size();
+ const bool bAllFieldTypes = nResType == SwFieldIds::Unknown;
for( size_t i=0; i < nSize; ++i )
{
pFieldType = rFieldTypes[ i ].get();
- if( nResType == pFieldType->Which() )
+ if (bAllFieldTypes || nResType == pFieldType->Which())
{
::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() );
}
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index de05fe608633..7f4d93a4afae 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -47,7 +47,9 @@ class SwView;
#define NID_TABLE_FORMULA 20016
#define NID_TABLE_FORMULA_ERROR 20017
#define NID_RECENCY 20018
-#define NID_COUNT 19
+#define NID_FIELD 20019
+#define NID_FIELD_BYTYPE 20020
+#define NID_COUNT 21
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 6a88d7c1a072..fe443c9aa99b 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -59,7 +59,7 @@
#include <sfx2/viewfrm.hxx>
// Size check
-#define NAVI_ENTRIES 19
+#define NAVI_ENTRIES 21
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -179,7 +179,9 @@ static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =
NID_INDEX_ENTRY,
NID_TABLE_FORMULA,
NID_TABLE_FORMULA_ERROR,
- NID_RECENCY
+ NID_RECENCY,
+ NID_FIELD,
+ NID_FIELD_BYTYPE
};
std::u16string_view const aNavigationImgIds[ NAVI_ENTRIES ] =
@@ -202,7 +204,9 @@ std::u16string_view const aNavigationImgIds[ NAVI_ENTRIES ] =
u"" RID_BMP_RIBBAR_ENTRY,
u"" RID_BMP_RIBBAR_FORMULA,
u"" RID_BMP_RIBBAR_ERROR,
- u"" RID_BMP_RIBBAR_RECENCY
+ u"" RID_BMP_RIBBAR_RECENCY,
+ u"" RID_BMP_RIBBAR_FIELD,
+ u"" RID_BMP_RIBBAR_FIELD_BYTYPE
};
static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
@@ -225,7 +229,9 @@ static const char* aNavigationStrIds[ NAVI_ENTRIES ] =
ST_INDEX_ENTRY,
ST_TABLE_FORMULA,
ST_TABLE_FORMULA_ERROR,
- ST_RECENCY
+ ST_RECENCY,
+ ST_FIELD,
+ ST_FIELD_BYTYPE
};
// these are global strings
@@ -250,6 +256,8 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_TBLFML_DOWN,
STR_IMGBTN_TBLFML_ERR_DOWN,
STR_IMGBTN_RECENCY_DOWN,
+ STR_IMGBTN_FIELD_DOWN,
+ STR_IMGBTN_FIELD_BYTYPE_DOWN,
STR_IMGBTN_TBL_UP,
STR_IMGBTN_FRM_UP,
STR_IMGBTN_PGE_UP,
@@ -268,7 +276,9 @@ static const char* STR_IMGBTN_ARY[] =
STR_IMGBTN_INDEX_ENTRY_UP,
STR_IMGBTN_TBLFML_UP,
STR_IMGBTN_TBLFML_ERR_UP,
- STR_IMGBTN_RECENCY_UP
+ STR_IMGBTN_RECENCY_UP,
+ STR_IMGBTN_FIELD_UP,
+ STR_IMGBTN_FIELD_BYTYPE_UP,
};
static OUString lcl_GetScrollToolTip(bool bNext)
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 69bd97623606..f2d3c5747d9e 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -422,6 +422,32 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
GetViewFrame()->GetDispatcher()->Execute(bNext ?
FN_NEXT_BOOKMARK :
FN_PREV_BOOKMARK);
+ break;
+ case NID_FIELD:
+ rSh.EnterStdMode();
+ rSh.MoveFieldType(nullptr, bNext, SwFieldIds::Unknown);
+ break;
+ case NID_FIELD_BYTYPE:
+ {
+ // see: SwFieldMgr::GoNextPrev
+ SwField* pCurField = rSh.GetCurField(true);
+ if (!pCurField)
+ break;
+ rSh.EnterStdMode();
+ SwFieldType* pTyp = nullptr;
+ const SwFieldTypesEnum nTypeId = pCurField->GetTypeId();
+ if (SwFieldTypesEnum::SetInput == nTypeId || SwFieldTypesEnum::UserInput == nTypeId)
+ pTyp = rSh.GetFieldType(0, SwFieldIds::Input);
+ else
+ pTyp = pCurField->GetTyp();
+ if (pTyp)
+ {
+ if (pTyp->Which() == SwFieldIds::Database)
+ rSh.MoveFieldType(nullptr, bNext, SwFieldIds::Database);
+ else
+ rSh.MoveFieldType(pTyp, bNext);
+ }
+ }
break;
case NID_OUTL:
rSh.EnterStdMode();