Kaydet (Commit) c2a76550 authored tarafından Gulsah Kose's avatar Gulsah Kose Kaydeden (comit) Oliver Specht

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: 's avatarGulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/19335Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst 707f4161
...@@ -1660,6 +1660,14 @@ ...@@ -1660,6 +1660,14 @@
<value>1</value> <value>1</value>
</prop> </prop>
</node> </node>
<node oor:name=".uno:JumpToSpecificPage" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Jump To Specific Page</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:PageDown" oor:op="replace"> <node oor:name=".uno:PageDown" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string"> <prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Next Page</value> <value xml:lang="en-US">Next Page</value>
......
...@@ -700,6 +700,7 @@ ...@@ -700,6 +700,7 @@
#define FN_READONLY_SELECTION_MODE (FN_SELECTION + 89) /* switches text selection mode in readonly documents*/ #define FN_READONLY_SELECTION_MODE (FN_SELECTION + 89) /* switches text selection mode in readonly documents*/
#define FN_SELECTION_MODE_DEFAULT (FN_SELECTION + 90) /* use default selection mode - not block mode */ #define FN_SELECTION_MODE_DEFAULT (FN_SELECTION + 90) /* use default selection mode - not block mode */
#define FN_SELECTION_MODE_BLOCK (FN_SELECTION + 91) /* switch on block selection */ #define FN_SELECTION_MODE_BLOCK (FN_SELECTION + 91) /* switch on block selection */
#define SID_JUMP_TO_SPECIFIC_PAGE (FN_SELECTION + 92)
// QUERY-Block // QUERY-Block
#define FN_TXTATR_INET (FN_QUERY +29) /* INet-Attribut */ #define FN_TXTATR_INET (FN_QUERY +29) /* INet-Attribut */
......
...@@ -240,6 +240,7 @@ ...@@ -240,6 +240,7 @@
#define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE" #define HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE "SW_HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE"
#define HID_PVIEW_ZOOM_LB "SW_HID_PVIEW_ZOOM_LB" #define HID_PVIEW_ZOOM_LB "SW_HID_PVIEW_ZOOM_LB"
#define HID_JUMP_TO_SPEC_PAGE "SW_HID_JUMP_TO_SPEC_PAGE"
#define HID_NID_TBL "SW_HID_NID_TBL" #define HID_NID_TBL "SW_HID_NID_TBL"
......
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
#define CMD_FN_HEADERFOOTER_BORDERBACK ".uno:HeaderFooterBorderBackground" #define CMD_FN_HEADERFOOTER_BORDERBACK ".uno:HeaderFooterBorderBackground"
#define CMD_FN_PAGEBREAK_EDIT ".uno:PageBreakEdit" #define CMD_FN_PAGEBREAK_EDIT ".uno:PageBreakEdit"
#define CMD_FN_PAGEBREAK_DELETE ".uno:PageBreakDelete" #define CMD_FN_PAGEBREAK_DELETE ".uno:PageBreakDelete"
#define CMD_SID_JUMP_TO_SPECIFIC_PAGE ".uno:JumpToSpecificPage"
#endif #endif
......
...@@ -10300,3 +10300,29 @@ SfxVoidItem UnicodeNotationToggle SID_UNICODE_NOTATION_TOGGLE ...@@ -10300,3 +10300,29 @@ SfxVoidItem UnicodeNotationToggle SID_UNICODE_NOTATION_TOGGLE
GroupId = GID_OPTIONS; GroupId = GID_OPTIONS;
] ]
SfxVoidItem JumpToSpecificPage SID_JUMP_TO_SPECIFIC_PAGE
( SfxUInt16Item JumpToSpecificPage SID_JUMP_TO_SPECIFIC_PAGE )
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = TRUE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
/* status: */
SlotType = SfxUInt16Item
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_NAVIGATOR;
]
...@@ -312,6 +312,11 @@ interface TextPrintPreview ...@@ -312,6 +312,11 @@ interface TextPrintPreview
ExecMethod = Execute ; ExecMethod = Execute ;
StateMethod = GetState ; StateMethod = GetState ;
] ]
SID_JUMP_TO_SPECIFIC_PAGE // status()
[
ExecMethod = Execute ;
StateMethod = GetState ;
]
// End StatusBar // End StatusBar
} }
......
...@@ -383,6 +383,7 @@ void SwDLL::RegisterControls() ...@@ -383,6 +383,7 @@ void SwDLL::RegisterControls()
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
::sfx2::TaskPaneWrapper::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) // Load Module (only dummy for linking of the DLL)
......
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
// Add <MV_SELPAGE>, <MV_SCROLL> // Add <MV_SELPAGE>, <MV_SCROLL>
enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END, 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 ); bool MovePage( int eMoveMode );
// Create the status bar's string // Create the status bar's string
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#define RID_PVIEW_ZOOM_LB (RC_RIBBAR_BEGIN + 32) #define RID_PVIEW_ZOOM_LB (RC_RIBBAR_BEGIN + 32)
#define STR_IMGBTN_START (RC_RIBBAR_BEGIN + 33) #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_NEXT_DOWN (STR_IMGBTN_START + 0)
#define STR_IMGBTN_PREV_DOWN (STR_IMGBTN_START + 1) #define STR_IMGBTN_PREV_DOWN (STR_IMGBTN_START + 1)
......
...@@ -157,6 +157,17 @@ public: ...@@ -157,6 +157,17 @@ public:
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override; 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 #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -612,4 +612,67 @@ VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent ...@@ -612,4 +612,67 @@ VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent
return pRet.get(); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -359,5 +359,12 @@ ComboBox RID_PVIEW_ZOOM_LB ...@@ -359,5 +359,12 @@ ComboBox RID_PVIEW_ZOOM_LB
Border = TRUE ; Border = TRUE ;
Hide = 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -334,6 +334,7 @@ bool SwPagePreviewWin::MovePage( int eMoveMode ) ...@@ -334,6 +334,7 @@ bool SwPagePreviewWin::MovePage( int eMoveMode )
nNewSttPage = nPageCount; nNewSttPage = nPageCount;
SetSelectedPage( nPageCount ); SetSelectedPage( nPageCount );
break; break;
case MV_SELPAGE: case MV_SELPAGE:
// <nNewSttPage> and <SelectedPage()> are already set. // <nNewSttPage> and <SelectedPage()> are already set.
// not start at first column, only if the // not start at first column, only if the
...@@ -880,6 +881,24 @@ void SwPagePreview::Execute( SfxRequest &rReq ) ...@@ -880,6 +881,24 @@ void SwPagePreview::Execute( SfxRequest &rReq )
_ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq ); _ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq );
break; 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_LINE:
case FN_START_OF_DOCUMENT: case FN_START_OF_DOCUMENT:
pViewWin->SetSelectedPage( 1 ); pViewWin->SetSelectedPage( 1 );
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:GoToStartOfDoc" toolbar:helpid="20907"/> <toolbar:toolbaritem xlink:href=".uno:GoToStartOfDoc" toolbar:helpid="20907"/>
<toolbar:toolbaritem xlink:href=".uno:PageUp" toolbar:helpid="20937"/> <toolbar:toolbaritem xlink:href=".uno:PageUp" toolbar:helpid="20937"/>
<toolbar:toolbaritem xlink:href=".uno:JumpToSpecificPage" />
<toolbar:toolbaritem xlink:href=".uno:PageDown" toolbar:helpid="20938"/> <toolbar:toolbaritem xlink:href=".uno:PageDown" toolbar:helpid="20938"/>
<toolbar:toolbaritem xlink:href=".uno:GoToEndOfDoc" toolbar:helpid="20908"/> <toolbar:toolbaritem xlink:href=".uno:GoToEndOfDoc" toolbar:helpid="20908"/>
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment