From afe4760d2d2ee1e1fe5554b6727886de068372a2 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Tue, 16 Jul 2013 15:49:44 +0200 Subject: fdo#39904, n#825976: implement hyperlinks for Illustrations index (cherry picked from commit 8bb2c7f1556c10508c8ac451c579539ccf5dacfb) Conflicts: sw/inc/swtypes.hxx Change-Id: I6f682c382e7ab0e06259b335247fdcebd7412942 (cherry picked from commit 2c10d784deb86501b5488044a61d9fc2efc6321a) Reviewed-on: https://gerrit.libreoffice.org/4957 Reviewed-by: Fridrich Strba Tested-by: Fridrich Strba --- sw/inc/swtypes.hxx | 3 +++ sw/source/core/bastyp/init.cxx | 1 + sw/source/core/doc/doctxm.cxx | 6 +++++- sw/source/core/inc/txmsrt.hxx | 3 ++- sw/source/core/tox/txmsrt.cxx | 13 +++++++++++-- sw/source/ui/index/cnttab.cxx | 3 ++- sw/source/ui/uiview/view2.cxx | 14 +++++++++++++- 7 files changed, 37 insertions(+), 6 deletions(-) diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index d3c668818495..245c7cce6e31 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -170,6 +170,8 @@ SW_DLLPUBLIC Size GetGraphicSizeTwip( const Graphic&, OutputDevice* pOutDev ); // Separator for jumps to different content types in document. const sal_Unicode cMarkSeparator = '|'; +// Sequences names for jumps are ! +const sal_Unicode cSequenceMarkSeparator = '!'; extern const sal_Char* pMarkToTable; // Strings are extern const sal_Char* pMarkToFrame; // in Init.cxx. extern const sal_Char* pMarkToRegion; @@ -177,6 +179,7 @@ SW_DLLPUBLIC extern const sal_Char* pMarkToOutline; extern const sal_Char* pMarkToText; extern const sal_Char* pMarkToGraphic; extern const sal_Char* pMarkToOLE; +extern const sal_Char* pMarkToSequence; #ifndef DB_DELIM // This is defined in OFA! #define DB_DELIM ((sal_Unicode)0xff) // Database <-> table separator. diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index e6af8f9b1f4c..991cdd1caa2c 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -425,6 +425,7 @@ const sal_Char* pMarkToText = "text"; const sal_Char* pMarkToOutline = "outline"; const sal_Char* pMarkToGraphic = "graphic"; const sal_Char* pMarkToOLE = "ole"; +const sal_Char* pMarkToSequence = "sequence"; std::vector *pGlobalOLEExcludeList = 0; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 1bcd89285fd6..2029d9f30ee3 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1261,7 +1261,11 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode ) ( !IsFromChapter() || ::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) ) { - SwTOXPara * pNew = new SwTOXPara( rTxtNode, nsSwTOXElement::TOX_SEQUENCE, 1 ); + const SwSetExpField* pSeqField = dynamic_cast< const SwSetExpField* >( pFmtFld->GetFld() ); + OUString sName = GetSequenceName(); + sName += OUString( cSequenceMarkSeparator ); + sName += OUString::valueOf( sal_Int32( pSeqField->GetSeqNumber() ) ); + SwTOXPara * pNew = new SwTOXPara( rTxtNode, nsSwTOXElement::TOX_SEQUENCE, 1, sName ); // set indexes if the number or the reference text are to be displayed if( GetCaptionDisplay() == CAPTION_TEXT ) { diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index 05cdaf1b9d74..356f49d9fb1c 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -229,7 +229,7 @@ private: struct SwTOXPara : public SwTOXSortTabBase { - SwTOXPara( const SwCntntNode&, SwTOXElement, sal_uInt16 nLevel = FORM_ALPHA_DELIMITTER ); + SwTOXPara( const SwCntntNode&, SwTOXElement, sal_uInt16 nLevel = FORM_ALPHA_DELIMITTER, OUString sSeqName = OUString() ); virtual ~SwTOXPara() {} void SetStartIndex( xub_StrLen nSet) { nStartIndex = nSet;} @@ -246,6 +246,7 @@ private: sal_uInt16 m_nLevel; xub_StrLen nStartIndex; xub_StrLen nEndIndex; + OUString m_sSequenceName; }; struct SwTOXTable : public SwTOXSortTabBase diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 22e7091e00d4..6f12284dcd5c 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -571,12 +571,13 @@ sal_uInt16 SwTOXContent::GetLevel() const The position must not come from the document, but from the "anchor"! --------------------------------------------------------------------*/ -SwTOXPara::SwTOXPara( const SwCntntNode& rNd, SwTOXElement eT, sal_uInt16 nLevel ) +SwTOXPara::SwTOXPara( const SwCntntNode& rNd, SwTOXElement eT, sal_uInt16 nLevel, OUString sSeqName ) : SwTOXSortTabBase( TOX_SORT_PARA, &rNd, 0, 0 ), eType( eT ), m_nLevel(nLevel), nStartIndex(0), - nEndIndex(STRING_LEN) + nEndIndex(STRING_LEN), + m_sSequenceName( sSeqName ) { } @@ -699,6 +700,14 @@ String SwTOXPara::GetURL() const } } break; + case nsSwTOXElement::TOX_SEQUENCE: + { + aTxt = '#'; + aTxt += m_sSequenceName; + aTxt += cMarkSeparator; + aTxt.AppendAscii( pMarkToSequence ); + } + break; default: break; } return aTxt; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index bf7965e51da0..64e3661073da 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2090,6 +2090,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) sal_Bool bToxIsAuthorities = TOX_AUTHORITIES == aCurType.eType; sal_Bool bToxIsIndex = TOX_INDEX == aCurType.eType; sal_Bool bToxIsContent = TOX_CONTENT == aCurType.eType; + sal_Bool bToxIsSequence = TOX_ILLUSTRATIONS == aCurType.eType; aLevelLB.Clear(); for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++) @@ -2222,7 +2223,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) //show or hide controls aEntryNoPB.Show( bToxIsContent ); - aHyperLinkPB.Show( bToxIsContent ); + aHyperLinkPB.Show( bToxIsContent || bToxIsSequence ); aRelToStyleCB.Show( !bToxIsAuthorities ); aChapterInfoPB.Show( !bToxIsContent && !bToxIsAuthorities); aEntryPB.Show( !bToxIsAuthorities ); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 990d4853bf64..744428ca716a 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -115,6 +115,7 @@ #include #include #include +#include #include @@ -1881,7 +1882,7 @@ bool SwView::JumpToSwMark( const String& rMark ) if( sCmp.Len() ) { - String sName( sMark.Copy( 0, nPos ) ); + rtl::OUString sName( sMark.Copy( 0, nPos ) ); sCmp.ToLowerAscii(); FlyCntType eFlyType = FLYCNTTYPE_ALL; @@ -1906,6 +1907,17 @@ bool SwView::JumpToSwMark( const String& rMark ) m_pWrtShell->EnterStdMode(); bRet = m_pWrtShell->GotoTable( sName ); } + else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToSequence ) ) + { + m_pWrtShell->EnterStdMode(); + sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator ); + if ( nNoPos != -1 ) + { + sal_uInt16 nSeqNo = sName.copy( nNoPos + 1 ).toInt32(); + sName = sName.copy( 0, nNoPos ); + m_pWrtShell->GotoRefMark( sName, REF_SEQUENCEFLD, nSeqNo ); + } + } else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToText ) ) { // Normale Textsuche -- cgit v1.2.3