42#include <rtl/ustring.hxx>
48#include <svx/strings.hrc>
49#include <bitmaps.hlst>
51#include <com/sun/star/frame/XFrame.hpp>
56#define NAVI_ENTRIES 21
89 for(
size_t i = 1;
i <= nGroupCount; ++
i)
95 sal_uInt16
nIndex = o3tl::narrowing<sal_uInt16>(100*
i);
97 pPopup->InsertItem(
i, sTitle);
99 pSub->SetSelectHdl(aLnk);
100 pPopup->SetPopupMenu(
i, pSub);
101 for(sal_uInt16 j = 0; j < nBlockCount; j++)
106 OUString sEntry = sShortName +
" - " + sLongName;
107 pSub->InsertItem(++
nIndex, sEntry);
117 (pToolBox->
GetAlign() == WindowAlign::Top || pToolBox->
GetAlign() == WindowAlign::Bottom) ?
118 PopupMenuFlags::ExecuteDown : PopupMenuFlags::ExecuteRight );
134 sal_uInt16
nId = pMenu->GetCurItemId();
136 sal_uInt16 nBlock =
nId / 100;
140 OUString sShortName =
149 (*fnSetActGroup)( sGroup );
199 RID_BMP_RIBBAR_POSTIT,
201 RID_BMP_RIBBAR_ENTRY,
202 RID_BMP_RIBBAR_FORMULA,
203 RID_BMP_RIBBAR_ERROR,
204 RID_BMP_RIBBAR_RECENCY,
205 RID_BMP_RIBBAR_FIELD,
206 RID_BMP_RIBBAR_FIELD_BYTYPE
211 STR_CONTENT_TYPE_TABLE,
212 STR_CONTENT_TYPE_FRAME,
213 STR_CONTENT_TYPE_GRAPHIC,
214 STR_CONTENT_TYPE_OLE,
216 STR_CONTENT_TYPE_OUTLINE,
218 STR_CONTENT_TYPE_DRAWOBJECT,
220 STR_CONTENT_TYPE_REGION,
221 STR_CONTENT_TYPE_BOOKMARK,
223 STR_CONTENT_TYPE_FOOTNOTE,
224 STR_CONTENT_TYPE_POSTIT,
226 STR_CONTENT_TYPE_INDEX,
228 ST_TABLE_FORMULA_ERROR,
230 STR_CONTENT_TYPE_TEXTFIELD,
241 STR_IMGBTN_CTRL_DOWN,
246 STR_IMGBTN_OUTL_DOWN,
249 STR_IMGBTN_MARK_DOWN,
250 STR_IMGBTN_POSTIT_DOWN,
251 STR_IMGBTN_SRCH_REP_DOWN,
252 STR_IMGBTN_INDEX_ENTRY_DOWN,
253 STR_IMGBTN_TBLFML_DOWN,
254 STR_IMGBTN_TBLFML_ERR_DOWN,
255 STR_IMGBTN_RECENCY_DOWN,
256 STR_IMGBTN_FIELD_DOWN,
257 STR_IMGBTN_FIELD_BYTYPE_DOWN,
271 STR_IMGBTN_POSTIT_UP,
272 STR_IMGBTN_SRCH_REP_UP,
273 STR_IMGBTN_INDEX_ENTRY_UP,
274 STR_IMGBTN_TBLFML_UP,
275 STR_IMGBTN_TBLFML_ERR_UP,
276 STR_IMGBTN_RECENCY_UP,
278 STR_IMGBTN_FIELD_BYTYPE_UP,
295 if (!sFieldType.isEmpty())
296 sToolTip = sToolTip.replaceFirst(
u"%FIELDTYPE", sFieldType);
298 sToolTip =
SwResId(SW_STR_NONE);
307 std::unique_ptr<weld::ComboBox>
m_xWidget;
308 sal_uInt16 m_nSlotId;
321 SwZoomBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot);
323 virtual void dispose()
override
334 void set_entry_text(
const OUString& rText)
339 virtual ~SwZoomBox_Impl()
override
347SwZoomBox_Impl::SwZoomBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot)
349 ,
m_xWidget(m_xBuilder->weld_combo_box(
"zoom"))
357 m_xWidget->connect_changed(
LINK(
this, SwZoomBox_Impl, SelectHdl));
358 m_xWidget->connect_key_press(
LINK(
this, SwZoomBox_Impl, KeyInputHdl));
359 m_xWidget->connect_entry_activate(
LINK(
this, SwZoomBox_Impl, ActivateHdl));
360 m_xWidget->connect_focus_out(
LINK(
this, SwZoomBox_Impl, FocusOutHdl));
363 { RID_SVXSTR_ZOOM_25 , RID_SVXSTR_ZOOM_50 ,
364 RID_SVXSTR_ZOOM_75 , RID_SVXSTR_ZOOM_100 ,
365 RID_SVXSTR_ZOOM_150 , RID_SVXSTR_ZOOM_200 ,
366 RID_SVXSTR_ZOOM_WHOLE_PAGE, RID_SVXSTR_ZOOM_PAGE_WIDTH ,
367 RID_SVXSTR_ZOOM_OPTIMAL_VIEW };
370 OUString sEntry =
SvxResId(pZoomValue);
375 m_xWidget->set_entry_width_chars(std::ceil(nWidth /
m_xWidget->get_approximate_digit_width()));
377 SetSizePixel(
m_xWidget->get_preferred_size());
382 if (rComboBox.changed_by_direct_pick())
392void SwZoomBox_Impl::Select()
396 bool bNonNumeric =
true;
398 OUString sEntry =
m_xWidget->get_active_text().replaceAll(
"%",
"");
400 if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_PAGE_WIDTH ) )
401 aZoom.SetType(SvxZoomType::PAGEWIDTH);
402 else if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_OPTIMAL_VIEW ) )
403 aZoom.SetType(SvxZoomType::OPTIMAL);
404 else if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_WHOLE_PAGE) )
405 aZoom.SetType(SvxZoomType::WHOLEPAGE);
410 sal_uInt16 nZoom = o3tl::narrowing<sal_uInt16>(sEntry.toInt32());
415 aZoom.SetValue(nZoom);
428 pCurrentShell->GetDispatcher()->ExecuteList(SID_ATTR_ZOOM,
429 SfxCallMode::ASYNCHRON, { &aZoom });
437 bool bHandled =
false;
439 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
455 return bHandled || ChildKeyInput(rKEvt);
464void SwZoomBox_Impl::ReleaseFocus()
503 if(SfxItemState::DEFAULT <= eState)
507 pBox->set_entry_text(sZoom);
524 sal_uInt16 m_nSlotId;
529 SwJumpToSpecificBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot);
530 virtual void dispose()
override
535 virtual ~SwJumpToSpecificBox_Impl()
override
545 return ChildKeyInput(rKEvt);
548SwJumpToSpecificBox_Impl::SwJumpToSpecificBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot)
550 ,
m_xWidget(m_xBuilder->weld_entry(
"jumppos"))
555 m_xWidget->connect_key_press(
LINK(
this, SwJumpToSpecificBox_Impl, KeyInputHdl));
556 m_xWidget->connect_activate(
LINK(
this, SwJumpToSpecificBox_Impl, SelectHdl));
558 SetSizePixel(
m_xWidget->get_preferred_size());
565 aPageNum.
SetValue(o3tl::narrowing<sal_uInt16>(sEntry.toInt32()));
568 pCurrentShell->GetDispatcher()->ExecuteList(m_nSlotId, SfxCallMode::ASYNCHRON,
593 uno::Reference<frame::XFrame> xFrame)
594 : m_xComboBox(
std::move(xComboBox))
611 const uno::Reference<frame::XFrame>& xFrame)
621 m_xFrame->getContainerWindow()->setFocus();
626 if (!rComboBox.changed_by_direct_pick())
654 return DoKeyInput(rKEvt);
688 return "lo.writer.NavElementToolBoxController";
693 return {
"com.sun.star.frame.ToolbarController" };
714 if ( rEvent.FeatureURL.Path !=
"NavElement" )
717 if ( rEvent.IsEnabled )
747 return uno::Reference< awt::XWindow >();
751 const uno::Reference< awt::XWindow >& xParent )
753 uno::Reference< awt::XWindow > xItemWindow;
781extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
783 css::uno::XComponentContext *rxContext,
784 css::uno::Sequence<css::uno::Any>
const &)
791typedef cppu::ImplInheritanceHelper< ::svt::ToolboxController, css::lang::XServiceInfo> PrevNextScrollToolboxController_Base;
792class PrevNextScrollToolboxController :
public PrevNextScrollToolboxController_Base
797 PrevNextScrollToolboxController(
const css::uno::Reference< css::uno::XComponentContext >& rxContext,
Type eType );
805 virtual void SAL_CALL
dispose()
override;
808 virtual void SAL_CALL statusChanged(
const css::frame::FeatureStateEvent& rEvent )
override;
816PrevNextScrollToolboxController::PrevNextScrollToolboxController(
const css::uno::Reference< css::uno::XComponentContext > & rxContext,
Type eType )
817 : PrevNextScrollToolboxController_Base( rxContext,
819 (
eType ==
PREVIOUS) ? OUString(
".uno:ScrollToPrevious" ): OUString(
".uno:ScrollToNext" ) ),
822 addStatusListener(
".uno:NavElement");
826OUString SAL_CALL PrevNextScrollToolboxController::getImplementationName()
828 return meType == PrevNextScrollToolboxController::PREVIOUS?
829 OUString(
"lo.writer.PreviousScrollToolboxController" ) :
830 OUString(
"lo.writer.NextScrollToolboxController" );
833sal_Bool SAL_CALL PrevNextScrollToolboxController::supportsService(
const OUString& ServiceName )
838css::uno::Sequence< OUString > SAL_CALL PrevNextScrollToolboxController::getSupportedServiceNames()
840 return {
"com.sun.star.frame.ToolbarController" };
852void SAL_CALL PrevNextScrollToolboxController::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
854 if (rEvent.FeatureURL.Path ==
"NavElement")
862 if (getToolboxId(nId, &pToolBox))
866 else if (rEvent.FeatureURL.Path ==
"ScrollToPrevious" || rEvent.FeatureURL.Path ==
"ScrollToNext")
869 m_pToolbar->set_item_sensitive(m_aCommandURL, rEvent.IsEnabled);
874 if (getToolboxId(nId, &pToolBox))
880extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
882 css::uno::XComponentContext *context,
883 css::uno::Sequence<css::uno::Any>
const &)
885 return cppu::acquire(
new PrevNextScrollToolboxController( context, PrevNextScrollToolboxController::PREVIOUS ) );
888extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
890 css::uno::XComponentContext *context,
891 css::uno::Sequence<css::uno::Any>
const &)
893 return cppu::acquire(
new PrevNextScrollToolboxController( context, PrevNextScrollToolboxController::NEXT ) );
css::uno::Reference< css::lang::XComponent > m_xFrame
static const AllSettings & GetSettings()
void SetValue(sal_uInt16 nTheValue)
bool ChildKeyInput(const KeyEvent &rKEvt)
virtual void dispose() override
std::unique_ptr< weld::Container > m_xContainer
const vcl::KeyCode & GetKeyCode() const
std::unique_ptr< weld::ComboBox > m_xComboBox
virtual bool DoKeyInput(const KeyEvent &)
NavElementBox_Base(std::unique_ptr< weld::ComboBox > xComboBox, uno::Reference< frame::XFrame > xFrame)
void set_sensitive(bool bSensitive)
uno::Reference< frame::XFrame > m_xFrame
NavElementBox_Impl(vcl::Window *pParent, const uno::Reference< frame::XFrame > &xFrame)
virtual bool DoKeyInput(const KeyEvent &rKEvt) override
SfxDispatcher * GetDispatcher() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxBindings & GetBindings()
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
vcl::Window * GetWindow() const
virtual GlossarySetActGroup SetGlossaryActGroupFunc()=0
static SwAbstractDialogFactory * Create()
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
bool HasReadonlySel(bool isReplace=false) const
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
Base class of all fields.
SwFieldTypesEnum GetTypeId() const
bool InsertGlossary(const OUString &rName)
void SetCurGroup(const OUString &aGrp, bool bApi=false, bool bAlwaysCreateNew=false)
OUString GetBlockShortName(size_t nGroup, sal_uInt16 nBlock)
OUString GetGroupName(size_t nPos)
OUString GetBlockLongName(size_t nGroup, sal_uInt16 nBlock)
OUString GetGroupTitle(size_t nPos)
sal_uInt16 GetBlockCount(size_t nGroup)
virtual ~SwJumpToSpecificPageControl() override
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
SwJumpToSpecificPageControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
SwPreviewZoomControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual ~SwPreviewZoomControl() override
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual void CreatePopupWindow() override
SwTbxAutoTextCtrl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
virtual ~SwTbxAutoTextCtrl() override
SwWrtShell & GetWrtShell() const
SwDocShell * GetDocShell()
static sal_uInt16 GetMoveType()
Used by the UI to modify the document model.
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
sal_uInt16 GetCode() const
virtual void SetSizePixel(const Size &rNewSize)
virtual std::unique_ptr< ComboBox > weld_combo_box(const OUString &id)=0
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
constexpr OUStringLiteral HID_PVIEW_ZOOM_LB
static SwGlossaryList * pGlossaryList
SwGlossaryList * GetGlossaryList()
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_TAB
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Reference< XFrame > xFrame
void(* GlossarySetActGroup)(const OUString &rNewGroup)
SwWrtShell * GetActiveWrtShell()
OUString SwResId(TranslateId aId)
IMPL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu *, pMenu, bool)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_NextScrollToolboxController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_PreviousScrollToolboxController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static sal_uInt16 aNavigationInsertIds[NAVI_ENTRIES]
SFX_IMPL_TOOLBOX_CONTROL(SwTbxAutoTextCtrl, SfxVoidItem)
IMPL_LINK(SwZoomBox_Impl, SelectHdl, weld::ComboBox &, rComboBox, void)
const TranslateId aNavigationStrIds[NAVI_ENTRIES]
IMPL_LINK_NOARG(SwZoomBox_Impl, ActivateHdl, weld::ComboBox &, bool)
const TranslateId STR_IMGBTN_ARY[]
rtl::OUStringConstExpr constexpr aNavigationImgIds[NAVI_ENTRIES]
static OUString lcl_GetScrollToolTip(bool bNext)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_NavElementToolBoxController_get_implementation(css::uno::XComponentContext *rxContext, css::uno::Sequence< css::uno::Any > const &)
#define NID_TABLE_FORMULA
cppu::ImplInheritanceHelper< ::svt::ToolboxController, lang::XServiceInfo > NavElementToolBoxControl_Base
#define NID_TABLE_FORMULA_ERROR