From 7ec3da8bb6c82d78f4bfaa69c7c91d6fc99dfad4 Mon Sep 17 00:00:00 2001 From: Luke Deller Date: Fri, 11 Jul 2014 22:39:34 +1000 Subject: Improve header/footer UI label (fdo#81227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Indicate whether the header/footer being edited is only for the first page, left pages, or right pages if applicable. Change-Id: Ia38289503d0bae6cc6cef5917a47d5d25ca0f712 Reviewed-on: https://gerrit.libreoffice.org/10235 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/uibase/docvw/HeaderFooterWin.cxx | 17 +++++++++++++++-- sw/source/uibase/docvw/docvw.hrc | 8 +++++++- sw/source/uibase/docvw/docvw.src | 30 ++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 17d95ffd7461..d16fb4ee5072 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -181,11 +181,24 @@ const SwPageFrm* SwHeaderFooterWin::GetPageFrame( ) void SwHeaderFooterWin::SetOffset( Point aOffset, long nXLineStart, long nXLineEnd ) { // Compute the text to show + const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc(); + bool bIsFirst = !pDesc->IsFirstShared() && GetPageFrame()->OnFirstPage(); + bool bIsLeft = !pDesc->IsHeaderShared() && !GetPageFrame()->OnRightPage(); + bool bIsRight = !pDesc->IsHeaderShared() && GetPageFrame()->OnRightPage(); m_sLabel = SW_RESSTR( STR_HEADER_TITLE ); if ( !m_bIsHeader ) - m_sLabel = SW_RESSTR( STR_FOOTER_TITLE ); + m_sLabel = bIsFirst ? SW_RESSTR( STR_FIRST_FOOTER_TITLE ) + : bIsLeft ? SW_RESSTR( STR_LEFT_FOOTER_TITLE ) + : bIsRight ? SW_RESSTR( STR_RIGHT_FOOTER_TITLE ) + : SW_RESSTR( STR_FOOTER_TITLE ); + else + m_sLabel = bIsFirst ? SW_RESSTR( STR_FIRST_HEADER_TITLE ) + : bIsLeft ? SW_RESSTR( STR_LEFT_HEADER_TITLE ) + : bIsRight ? SW_RESSTR( STR_RIGHT_HEADER_TITLE ) + : SW_RESSTR( STR_HEADER_TITLE ); + sal_Int32 nPos = m_sLabel.lastIndexOf( "%1" ); - m_sLabel = m_sLabel.replaceAt( nPos, 2, GetPageFrame()->GetPageDesc()->GetName() ); + m_sLabel = m_sLabel.replaceAt( nPos, 2, pDesc->GetName() ); // Compute the text size and get the box position & size from it Rectangle aTextRect; diff --git a/sw/source/uibase/docvw/docvw.hrc b/sw/source/uibase/docvw/docvw.hrc index 3347b1862639..35cd1cd8b6bb 100644 --- a/sw/source/uibase/docvw/docvw.hrc +++ b/sw/source/uibase/docvw/docvw.hrc @@ -77,8 +77,14 @@ #define STR_FORMAT_HEADER (RC_DOCVW_BEGIN + 25) #define STR_DELETE_FOOTER (RC_DOCVW_BEGIN + 26) #define STR_FORMAT_FOOTER (RC_DOCVW_BEGIN + 27) +#define STR_FIRST_HEADER_TITLE (RC_DOCVW_BEGIN + 28) +#define STR_LEFT_HEADER_TITLE (RC_DOCVW_BEGIN + 29) +#define STR_RIGHT_HEADER_TITLE (RC_DOCVW_BEGIN + 30) +#define STR_FIRST_FOOTER_TITLE (RC_DOCVW_BEGIN + 31) +#define STR_LEFT_FOOTER_TITLE (RC_DOCVW_BEGIN + 32) +#define STR_RIGHT_FOOTER_TITLE (RC_DOCVW_BEGIN + 33) -#define DOCVW_ACT_END STR_SMARTTAG_CLICK +#define DOCVW_ACT_END STR_RIGHT_FOOTER_TITLE #if DOCVW_ACT_END > RC_DOCVW_END #error Resource-Id Ueberlauf in #file, #line diff --git a/sw/source/uibase/docvw/docvw.src b/sw/source/uibase/docvw/docvw.src index ff10f368a012..71654f2035fd 100644 --- a/sw/source/uibase/docvw/docvw.src +++ b/sw/source/uibase/docvw/docvw.src @@ -279,11 +279,41 @@ String STR_HEADER_TITLE Text [ en-US ] = "Header (%1)" ; }; +String STR_FIRST_HEADER_TITLE +{ + Text [ en-US ] = "First Page Header (%1)" ; +}; + +String STR_LEFT_HEADER_TITLE +{ + Text [ en-US ] = "Left Page Header (%1)" ; +}; + +String STR_RIGHT_HEADER_TITLE +{ + Text [ en-US ] = "Right Page Header (%1)" ; +}; + String STR_FOOTER_TITLE { Text [ en-US ] = "Footer (%1)" ; }; +String STR_FIRST_FOOTER_TITLE +{ + Text [ en-US ] = "First Page Footer (%1)" ; +}; + +String STR_LEFT_FOOTER_TITLE +{ + Text [ en-US ] = "Left Page Footer (%1)" ; +}; + +String STR_RIGHT_FOOTER_TITLE +{ + Text [ en-US ] = "Right Page Footer (%1)" ; +}; + String STR_DELETE_HEADER { Text [ en-US ] = "Delete Header..." ; -- cgit v1.2.3