summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2015-10-13 00:53:25 +0300
committerOliver Specht <oliver.specht@cib.de>2015-11-01 17:41:55 +0000
commitc2a76550a287adf8bdbe93c02395fb80cb11c950 (patch)
tree49f82b1d8b8e622966cf71f2436f72ecce42eff9 /sw/source/uibase
parent707f416192d5a0ca5fa96f7e141c988060b0f292 (diff)
tdf#80657 Adding new field to jump to specific page.
This patch is not completed. It adds a dropdown field to toolbar. When you click it, the page preview focuses third page (hard coded). This patch's purpose is getting information from developers how to add numbers to dropdown field. -- v2: Removed unnecessary MV_SPECIFIC_PAGE case. v3: Added dropdown field and defined new controller for new field. v4: Implemented page focus who user want. v5: Used NumericField instead of Combobox and added page count control v6: Used nSlotId instead of SID_JUMP_TO_SPECIFIC_PAGE in order to fix macOs build error. Change-Id: I722fbffcc72a1bcee70065e2e9369b73ab27f100 Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/19335 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/app/swmodule.cxx1
-rw-r--r--sw/source/uibase/inc/pview.hxx2
-rw-r--r--sw/source/uibase/inc/ribbar.hrc1
-rw-r--r--sw/source/uibase/inc/workctrl.hxx11
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx63
-rw-r--r--sw/source/uibase/ribbar/workctrl.src7
-rw-r--r--sw/source/uibase/uiview/pview.cxx19
7 files changed, 103 insertions, 1 deletions
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index c213443bfa98..9be3159c792f 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -383,6 +383,7 @@ void SwDLL::RegisterControls()
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pMod);
+ SwJumpToSpecificPageControl::RegisterControl(SID_JUMP_TO_SPECIFIC_PAGE, pMod);
}
// Load Module (only dummy for linking of the DLL)
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index e07f066d45ab..a59f37f87f23 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -120,7 +120,7 @@ public:
// Add <MV_SELPAGE>, <MV_SCROLL>
enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END,
- MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE };
+ MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE, MV_SPECIFIC_PAGE };
bool MovePage( int eMoveMode );
// Create the status bar's string
diff --git a/sw/source/uibase/inc/ribbar.hrc b/sw/source/uibase/inc/ribbar.hrc
index ac38d3155a9e..4973d8126f34 100644
--- a/sw/source/uibase/inc/ribbar.hrc
+++ b/sw/source/uibase/inc/ribbar.hrc
@@ -54,6 +54,7 @@
#define RID_PVIEW_ZOOM_LB (RC_RIBBAR_BEGIN + 32)
#define STR_IMGBTN_START (RC_RIBBAR_BEGIN + 33)
+#define RID_JUMP_TO_SPEC_PAGE (RC_RIBBAR_BEGIN + 34)
#define STR_IMGBTN_NEXT_DOWN (STR_IMGBTN_START + 0)
#define STR_IMGBTN_PREV_DOWN (STR_IMGBTN_START + 1)
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 6f65bb7c14a1..9a13873c0e7d 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -157,6 +157,17 @@ public:
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override;
};
+
+class SwJumpToSpecificPageControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwJumpToSpecificPageControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ virtual ~SwJumpToSpecificPageControl();
+
+ virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
+};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 8c26419167d8..9b8276d6bd2c 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -612,4 +612,67 @@ VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent
return pRet.get();
}
+class SwJumpToSpecificBox_Impl : public NumericField
+{
+ sal_uInt16 nSlotId;
+ uno::Reference< frame::XDispatchProvider > m_xDispatchProvider;
+
+public:
+ SwJumpToSpecificBox_Impl(
+ vcl::Window* pParent,
+ sal_uInt16 nSlot,
+ const Reference< XDispatchProvider >& rDispatchProvider );
+ virtual ~SwJumpToSpecificBox_Impl();
+
+protected:
+ virtual void Select();
+ virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
+};
+
+SwJumpToSpecificBox_Impl::SwJumpToSpecificBox_Impl(
+ vcl::Window* pParent,
+ sal_uInt16 nSlot,
+ const Reference< XDispatchProvider >& rDispatchProvider ):
+ NumericField( pParent, SW_RES(RID_JUMP_TO_SPEC_PAGE)),
+ nSlotId(nSlot),
+ m_xDispatchProvider( rDispatchProvider )
+{}
+
+SwJumpToSpecificBox_Impl::~SwJumpToSpecificBox_Impl()
+{}
+
+void SwJumpToSpecificBox_Impl::Select()
+{
+ OUString sEntry(GetText());
+ SfxUInt16Item aPageNum(nSlotId);
+ aPageNum.SetValue((sal_uInt16)sEntry.toInt32());
+ SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
+ pCurrentShell->GetDispatcher()->Execute(nSlotId, SfxCallMode::ASYNCHRON, &aPageNum, 0L);
+}
+
+bool SwJumpToSpecificBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+ Select();
+ return NumericField::Notify( rNEvt );
+}
+
+SFX_IMPL_TOOLBOX_CONTROL( SwJumpToSpecificPageControl, SfxUInt16Item);
+
+SwJumpToSpecificPageControl::SwJumpToSpecificPageControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{}
+
+SwJumpToSpecificPageControl::~SwJumpToSpecificPageControl()
+{}
+
+VclPtr<vcl::Window> SwJumpToSpecificPageControl::CreateItemWindow( vcl::Window *pParent )
+{
+ VclPtrInstance<SwJumpToSpecificBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
+ return pRet.get();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/ribbar/workctrl.src b/sw/source/uibase/ribbar/workctrl.src
index ed871055336e..0ea858d157d2 100644
--- a/sw/source/uibase/ribbar/workctrl.src
+++ b/sw/source/uibase/ribbar/workctrl.src
@@ -359,5 +359,12 @@ ComboBox RID_PVIEW_ZOOM_LB
Border = TRUE ;
Hide = TRUE ;
};
+NumericField RID_JUMP_TO_SPEC_PAGE
+{
+ HelpId = HID_JUMP_TO_SPEC_PAGE;
+ Size = MAP_APPFONT ( 16 , 12) ;
+ Border = TRUE ;
+ Hide = TRUE ;
+};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index ee4f6a767188..2a9018834aeb 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -334,6 +334,7 @@ bool SwPagePreviewWin::MovePage( int eMoveMode )
nNewSttPage = nPageCount;
SetSelectedPage( nPageCount );
break;
+
case MV_SELPAGE:
// <nNewSttPage> and <SelectedPage()> are already set.
// not start at first column, only if the
@@ -880,6 +881,24 @@ void SwPagePreview::Execute( SfxRequest &rReq )
_ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq );
break;
}
+ case SID_JUMP_TO_SPECIFIC_PAGE:
+ {
+ sal_uInt16 nPageNum = 1;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if( pArgs && pArgs->Count())
+ {
+ nPageNum = static_cast<const SfxUInt16Item &>(pArgs->Get(SID_JUMP_TO_SPECIFIC_PAGE)).GetValue();
+
+ if( nPageNum > 0 && nPageNum <= mnPageCount )
+ {
+ pViewWin->SetSttPage( nPageNum);
+ pViewWin->SetSelectedPage( nPageNum );
+ ChgPage( SwPagePreviewWin::MV_SPECIFIC_PAGE, false );
+ ScrollViewSzChg();
+ }
+ }
+ }
+ break;
case FN_START_OF_LINE:
case FN_START_OF_DOCUMENT:
pViewWin->SetSelectedPage( 1 );