summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-09-18 01:32:01 -0800
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-12-23 08:51:50 +0100
commit2bd03b6de32a8bd6ff7d075752eda051a43e4add (patch)
tree488dc6dcf1a488aea2e960553838eee9380d8b5d
parent9e0e40d65d92490b2946f4e2ac7ce763209a8339 (diff)
tdf#89709 Make statusbar page number/bookmarks control tooltip show
Change-Id: I3a84ae29d4758799e1ee7e2ab1349ca3b30fb5f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102883 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com> (cherry picked from commit c81fea2e78d66c1978cb2340868c938ba9d6c9f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107701 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--sfx2/source/control/unoctitm.cxx4
-rw-r--r--sw/inc/mdiexp.hxx5
-rw-r--r--sw/inc/view.hxx2
-rw-r--r--sw/sdi/swriter.sdi2
-rw-r--r--sw/source/core/view/viewsh.cxx26
-rw-r--r--sw/source/uibase/docvw/edtwin3.cxx5
-rw-r--r--sw/source/uibase/inc/bookctrl.hxx3
-rw-r--r--sw/source/uibase/uiview/pview.cxx14
-rw-r--r--sw/source/uibase/uiview/view2.cxx34
-rw-r--r--sw/source/uibase/utlui/bookctrl.cxx20
10 files changed, 45 insertions, 70 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index d51e5f3b443f..b32235b4ca48 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1211,7 +1211,6 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
aEvent.FeatureURL.Path == "RowColSelCount" ||
aEvent.FeatureURL.Path == "StatusPageStyle" ||
aEvent.FeatureURL.Path == "StateTableCell" ||
- aEvent.FeatureURL.Path == "StatePageNumber" ||
aEvent.FeatureURL.Path == "StateWordCount" ||
aEvent.FeatureURL.Path == "PageStyleName" ||
aEvent.FeatureURL.Path == "PageStatus" ||
@@ -1271,7 +1270,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra
aBuffer.append(OUString::number(aSize.Width)).append(" x ").append(OUString::number(aSize.Height));
}
}
- else if (aEvent.FeatureURL.Path == "LanguageStatus")
+ else if (aEvent.FeatureURL.Path == "LanguageStatus" ||
+ aEvent.FeatureURL.Path == "StatePageNumber")
{
css::uno::Sequence< OUString > aSeq;
diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx
index eee934b66ddf..3901fce1c12f 100644
--- a/sw/inc/mdiexp.hxx
+++ b/sw/inc/mdiexp.hxx
@@ -34,10 +34,7 @@ extern bool IsScrollMDI(SwViewShell const * pVwSh, const SwRect &);
extern void SizeNotify(SwViewShell const * pVwSh, const Size &);
// Update of status bar during an action.
-extern void PageNumNotify( SwViewShell const * pVwSh,
- sal_uInt16 nPhyNum,
- sal_uInt16 nVirtNum,
- const OUString& rPg );
+extern void PageNumNotify(SwViewShell const * pVwSh);
enum FlyMode { FLY_DRAG_START, FLY_DRAG, FLY_DRAG_END };
extern void FrameNotify( SwViewShell* pVwSh, FlyMode eMode = FLY_DRAG );
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 280388e1ac25..abdba739c3b7 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -547,7 +547,7 @@ public:
void InsertCaption(const InsCaptionOpt *pOpt);
// Async call by Core
- void UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
+ void UpdatePageNums();
OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index ccfc2821c4dc..9a03663dc19d 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5785,7 +5785,7 @@ SfxVoidItem StateBookmark FN_STAT_BOOKMARK
GroupId = SfxGroupId::Intern;
]
-SfxStringItem StatePageNumber FN_STAT_PAGE
+SfxStringListItem StatePageNumber FN_STAT_PAGE
[
AutoUpdate = FALSE,
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 1cc7288a6200..acf81134ba6b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1043,25 +1043,17 @@ void SwViewShell::SizeChgNotify()
if ( !Imp()->IsCalcLayoutProgress() && dynamic_cast<const SwCursorShell*>( this ) != nullptr )
{
- const SwFrame *pCnt = static_cast<SwCursorShell*>(this)->GetCurrFrame( false );
- const SwPageFrame *pPage;
- if ( pCnt && nullptr != (pPage = pCnt->FindPageFrame()) )
- {
- const sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
- const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
- OUString sDisplay = rNum.GetNumStr( nVirtNum );
- PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
+ PageNumNotify(this);
- if (comphelper::LibreOfficeKit::isActive())
- {
- Size aDocSize = GetDocSize();
- std::stringstream ss;
- ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << aDocSize.Height() + 2 * DOCUMENTBORDER;
- OString sSize = ss.str().c_str();
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ Size aDocSize = GetDocSize();
+ std::stringstream ss;
+ ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << aDocSize.Height() + 2 * DOCUMENTBORDER;
+ OString sSize = ss.str().c_str();
- SwXTextDocument* pModel = comphelper::getUnoTunnelImplementation<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), sSize, pModel);
- }
+ SwXTextDocument* pModel = comphelper::getUnoTunnelImplementation<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
+ SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), sSize, pModel);
}
}
}
diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx
index 583f485f34a5..d90df78919d5 100644
--- a/sw/source/uibase/docvw/edtwin3.cxx
+++ b/sw/source/uibase/docvw/edtwin3.cxx
@@ -64,15 +64,14 @@ void SizeNotify(SwViewShell const * pVwSh, const Size &rSize)
}
// Notify for page number update
-void PageNumNotify( SwViewShell const * pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
- const OUString& rPgStr)
+void PageNumNotify(SwViewShell const * pVwSh)
{
SfxViewShell *pSfxViewShell = pVwSh->GetSfxViewShell();
if (SwView* pSwView = dynamic_cast<SwView *>(pSfxViewShell))
{
if (pSwView->GetCurShell())
- pSwView->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
+ pSwView->UpdatePageNums();
}
}
diff --git a/sw/source/uibase/inc/bookctrl.hxx b/sw/source/uibase/inc/bookctrl.hxx
index 002cdea92c3b..f87395e516a3 100644
--- a/sw/source/uibase/inc/bookctrl.hxx
+++ b/sw/source/uibase/inc/bookctrl.hxx
@@ -35,9 +35,6 @@ public:
SwBookmarkControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
virtual ~SwBookmarkControl() override;
-
-private:
- OUString sPageNumber;
};
#endif
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 038428d9290e..87d04bebed90 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -27,7 +27,7 @@
#include <rtl/ustrbuf.hxx>
#include <svl/whiter.hxx>
-#include <svl/stritem.hxx>
+#include <svl/slstitm.hxx>
#include <svl/eitem.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/bindings.hxx>
@@ -966,8 +966,10 @@ void SwPagePreview::GetState( SfxItemSet& rSet )
case FN_STAT_PAGE:
{
- OUString aStr = m_sPageStr + m_pViewWin->GetStatusStr( mnPageCount );
- rSet.Put( SfxStringItem( nWhich, aStr) );
+ std::vector<OUString> aStringList;
+ aStringList.push_back(m_sPageStr + m_pViewWin->GetStatusStr(mnPageCount));
+ aStringList.push_back(OUString());
+ rSet.Put(SfxStringListItem(FN_STAT_PAGE, &aStringList));
}
break;
@@ -1263,7 +1265,6 @@ bool SwPagePreview::ChgPage( int eMvMode, bool bUpdateScrollbar )
if( bChg )
{
// Update statusbar
- OUString aStr = m_sPageStr + m_pViewWin->GetStatusStr( mnPageCount );
SfxBindings& rBindings = GetViewFrame()->GetBindings();
if( bUpdateScrollbar )
@@ -1277,7 +1278,10 @@ bool SwPagePreview::ChgPage( int eMvMode, bool bUpdateScrollbar )
};
rBindings.Invalidate( aInval );
}
- rBindings.SetState( SfxStringItem( FN_STAT_PAGE, aStr ) );
+ std::vector<OUString> aStringList;
+ aStringList.push_back(m_sPageStr + m_pViewWin->GetStatusStr(mnPageCount));
+ aStringList.push_back(OUString());
+ rBindings.SetState(SfxStringListItem(FN_STAT_PAGE, &aStringList));
}
return bChg;
}
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index e44925380ff2..da05a1cd6794 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -140,6 +140,7 @@
#include <memory>
#include <string_view>
+#include <svl/slstitm.hxx>
#include <basegfx/utils/zoomtools.hxx>
@@ -1366,21 +1367,10 @@ bool SwView::IsConditionalFastCall( const SfxRequest &rReq )
}
/// invalidate page numbering field
-void SwView::UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
+void SwView::UpdatePageNums()
{
- OUString sTemp(GetPageStr( nPhyNum, nVirtNum, rPgStr ));
- const SfxStringItem aTmp( FN_STAT_PAGE, sTemp );
- // Used to distinguish which tooltip to show
- const SfxBoolItem bExtendedTooltip( FN_STAT_PAGE,
- !rPgStr.isEmpty()
- && std::u16string_view(OUString::number(nPhyNum)) != rPgStr
- && nPhyNum != nVirtNum );
-
SfxBindings &rBnd = GetViewFrame()->GetBindings();
- rBnd.SetState( aTmp );
- rBnd.Update( FN_STAT_PAGE );
- rBnd.SetState( bExtendedTooltip );
- rBnd.Update( FN_STAT_PAGE );
+ rBnd.Invalidate(FN_STAT_PAGE);
}
void SwView::UpdateDocStats()
@@ -1430,15 +1420,15 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
sal_uInt16 nPage, nLogPage;
OUString sDisplay;
rShell.GetPageNumber( -1, rShell.IsCursorVisible(), nPage, nLogPage, sDisplay );
- OUString sTemp( GetPageStr( nPage, nLogPage, sDisplay ) );
- const SfxStringItem aTmp( FN_STAT_PAGE, sTemp );
- GetViewFrame()->GetBindings().SetState( aTmp );
- // Used to distinguish which tooltip to show
- const SfxBoolItem bExtendedTooltip( FN_STAT_PAGE, !sDisplay.isEmpty() &&
- std::u16string_view(OUString::number( nPage ))
- != sDisplay &&
- nPage != nLogPage );
- GetViewFrame()->GetBindings().SetState( bExtendedTooltip );
+ std::vector<OUString> aStringList;
+ aStringList.push_back(GetPageStr(nPage, nLogPage, sDisplay));
+ bool bExtendedTooltip(!sDisplay.isEmpty() &&
+ std::u16string_view(OUString::number(nPage)) != sDisplay &&
+ nPage != nLogPage);
+ OUString aTooltip = bExtendedTooltip ? SwResId(STR_BOOKCTRL_HINT_EXTENDED)
+ : SwResId(STR_BOOKCTRL_HINT);
+ aStringList.push_back(aTooltip);
+ rSet.Put(SfxStringListItem(FN_STAT_PAGE, &aStringList));
//if existing page number is not equal to old page number, send out this event.
if (m_nOldPageNum != nLogPage )
{
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index aa1f84506d0e..d07744290151 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -21,7 +21,7 @@
#include <strings.hrc>
#include <svl/intitem.hxx>
-#include <svl/stritem.hxx>
+#include <svl/slstitm.hxx>
#include <svl/eitem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
@@ -36,7 +36,7 @@
#include <bookctrl.hxx>
#include <map>
-SFX_IMPL_STATUSBAR_CONTROL( SwBookmarkControl, SfxStringItem );
+SFX_IMPL_STATUSBAR_CONTROL(SwBookmarkControl, SfxStringListItem);
namespace {
@@ -81,20 +81,16 @@ void SwBookmarkControl::StateChanged(
sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
{
if( eState != SfxItemState::DEFAULT || pState->IsVoidItem() )
- GetStatusBar().SetItemText( GetId(), OUString() );
- else if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pState))
{
- sPageNumber = pStringItem->GetValue();
- GetStatusBar().SetItemText(GetId(), sPageNumber);
+ GetStatusBar().SetItemText(GetId(), OUString());
+ GetStatusBar().SetQuickHelpText(GetId(), OUString());
}
- else if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pState))
+ else if (auto pStringListItem = dynamic_cast<const SfxStringListItem*>(pState))
{
- if (pBoolItem->GetValue()) // Indicates whether to show extended tooltip
- GetStatusBar().SetQuickHelpText(GetId(), SwResId(STR_BOOKCTRL_HINT_EXTENDED));
- else
- GetStatusBar().SetQuickHelpText(GetId(), SwResId(STR_BOOKCTRL_HINT));
+ const std::vector<OUString>& rStringList(pStringListItem->GetList());
+ GetStatusBar().SetItemText(GetId(), rStringList[0]);
+ GetStatusBar().SetQuickHelpText(GetId(), rStringList[1]);
}
-
}
void SwBookmarkControl::Paint( const UserDrawEvent& )