[Libreoffice-commits] core.git: sfx2/source sw/inc sw/sdi sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 9 09:30:39 UTC 2020


 sfx2/source/control/unoctitm.cxx    |    4 ++--
 sw/inc/mdiexp.hxx                   |    5 +----
 sw/inc/view.hxx                     |    2 +-
 sw/sdi/swriter.sdi                  |    2 +-
 sw/source/core/view/viewsh.cxx      |   26 +++++++++-----------------
 sw/source/uibase/docvw/edtwin3.cxx  |    5 ++---
 sw/source/uibase/inc/bookctrl.hxx   |    3 ---
 sw/source/uibase/uiview/pview.cxx   |   14 +++++++++-----
 sw/source/uibase/uiview/view2.cxx   |   34 ++++++++++++----------------------
 sw/source/uibase/utlui/bookctrl.cxx |   20 ++++++++------------
 10 files changed, 45 insertions(+), 70 deletions(-)

New commits:
commit c81fea2e78d66c1978cb2340868c938ba9d6c9f1
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Fri Sep 18 01:32:01 2020 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Wed Dec 9 10:29:58 2020 +0100

    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 at gmail.com>

diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 68d97a8edf5b..49b2486cd8cd 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1212,7 +1212,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" ||
@@ -1272,7 +1271,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 0e68e0f32a26..ef752054b982 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1042,25 +1042,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 a873e4695419..52c8cca1050a 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 9995cfa94219..799b8feaf98e 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>
 
@@ -1364,21 +1365,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()
@@ -1428,15 +1418,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&  )


More information about the Libreoffice-commits mailing list