32 #include <strings.hrc>
41 #include <rtl/ustring.hxx>
47 #include <svx/strings.hrc>
48 #include <bitmaps.hlst>
50 #include <com/sun/star/frame/XFrame.hpp>
55 #define NAVI_ENTRIES 21
88 for(
size_t i = 1;
i <= nGroupCount; ++
i)
94 sal_uInt16
nIndex = o3tl::narrowing<sal_uInt16>(100*
i);
100 for(sal_uInt16 j = 0; j < nBlockCount; j++)
105 OUString sEntry = sShortName +
" - " + sLongName;
116 (pToolBox->
GetAlign() == WindowAlign::Top || pToolBox->
GetAlign() == WindowAlign::Bottom) ?
117 PopupMenuFlags::ExecuteDown : PopupMenuFlags::ExecuteRight );
133 sal_uInt16
nId = pMenu->GetCurItemId();
135 sal_uInt16 nBlock = nId / 100;
138 OUString sGroup = pGlossaryList->
GetGroupName(nBlock - 1);
139 OUString sShortName =
146 (*fnSetActGroup)( sGroup );
195 RID_BMP_RIBBAR_POSTIT,
197 RID_BMP_RIBBAR_ENTRY,
198 RID_BMP_RIBBAR_FORMULA,
199 RID_BMP_RIBBAR_ERROR,
200 RID_BMP_RIBBAR_RECENCY,
201 RID_BMP_RIBBAR_FIELD,
202 RID_BMP_RIBBAR_FIELD_BYTYPE
207 STR_CONTENT_TYPE_TABLE,
208 STR_CONTENT_TYPE_FRAME,
209 STR_CONTENT_TYPE_GRAPHIC,
210 STR_CONTENT_TYPE_OLE,
212 STR_CONTENT_TYPE_OUTLINE,
214 STR_CONTENT_TYPE_DRAWOBJECT,
216 STR_CONTENT_TYPE_REGION,
217 STR_CONTENT_TYPE_BOOKMARK,
219 STR_CONTENT_TYPE_FOOTNOTE,
220 STR_CONTENT_TYPE_POSTIT,
222 STR_CONTENT_TYPE_INDEX,
224 ST_TABLE_FORMULA_ERROR,
226 STR_CONTENT_TYPE_TEXTFIELD,
237 STR_IMGBTN_CTRL_DOWN,
242 STR_IMGBTN_OUTL_DOWN,
245 STR_IMGBTN_MARK_DOWN,
246 STR_IMGBTN_POSTIT_DOWN,
247 STR_IMGBTN_SRCH_REP_DOWN,
248 STR_IMGBTN_INDEX_ENTRY_DOWN,
249 STR_IMGBTN_TBLFML_DOWN,
250 STR_IMGBTN_TBLFML_ERR_DOWN,
251 STR_IMGBTN_RECENCY_DOWN,
252 STR_IMGBTN_FIELD_DOWN,
253 STR_IMGBTN_FIELD_BYTYPE_DOWN,
267 STR_IMGBTN_POSTIT_UP,
268 STR_IMGBTN_SRCH_REP_UP,
269 STR_IMGBTN_INDEX_ENTRY_UP,
270 STR_IMGBTN_TBLFML_UP,
271 STR_IMGBTN_TBLFML_ERR_UP,
272 STR_IMGBTN_RECENCY_UP,
274 STR_IMGBTN_FIELD_BYTYPE_UP,
291 if (!sFieldType.isEmpty())
292 sToolTip = sToolTip.replaceFirst(
u"%FIELDTYPE", sFieldType);
294 sToolTip =
SwResId(SW_STR_NONE);
303 std::unique_ptr<weld::ComboBox>
m_xWidget;
304 sal_uInt16 m_nSlotId;
317 SwZoomBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot);
319 virtual void dispose()
override
327 m_xWidget->save_value();
330 void set_entry_text(
const OUString& rText)
332 m_xWidget->set_entry_text(rText);
335 virtual ~SwZoomBox_Impl()
override
343 SwZoomBox_Impl::SwZoomBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot)
345 , m_xWidget(m_xBuilder->weld_combo_box(
"zoom"))
349 InitControlBase(m_xWidget.get());
352 m_xWidget->set_entry_completion(
false);
353 m_xWidget->connect_changed(
LINK(
this, SwZoomBox_Impl, SelectHdl));
354 m_xWidget->connect_key_press(
LINK(
this, SwZoomBox_Impl, KeyInputHdl));
355 m_xWidget->connect_entry_activate(
LINK(
this, SwZoomBox_Impl, ActivateHdl));
356 m_xWidget->connect_focus_out(
LINK(
this, SwZoomBox_Impl, FocusOutHdl));
359 { RID_SVXSTR_ZOOM_25 , RID_SVXSTR_ZOOM_50 ,
360 RID_SVXSTR_ZOOM_75 , RID_SVXSTR_ZOOM_100 ,
361 RID_SVXSTR_ZOOM_150 , RID_SVXSTR_ZOOM_200 ,
362 RID_SVXSTR_ZOOM_WHOLE_PAGE, RID_SVXSTR_ZOOM_PAGE_WIDTH ,
363 RID_SVXSTR_ZOOM_OPTIMAL_VIEW };
366 OUString sEntry =
SvxResId(pZoomValue);
367 m_xWidget->append_text(sEntry);
370 int nWidth = m_xWidget->get_pixel_size(
SvxResId(RID_SVXSTR_ZOOM_200)).Width();
371 m_xWidget->set_entry_width_chars(std::ceil(nWidth / m_xWidget->get_approximate_digit_width()));
373 SetSizePixel(m_xWidget->get_preferred_size());
378 if (rComboBox.changed_by_direct_pick())
388 void SwZoomBox_Impl::Select()
392 bool bNonNumeric =
true;
394 OUString sEntry = m_xWidget->get_active_text().replaceAll(
"%",
"");
396 if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_PAGE_WIDTH ) )
397 aZoom.SetType(SvxZoomType::PAGEWIDTH);
398 else if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_OPTIMAL_VIEW ) )
399 aZoom.SetType(SvxZoomType::OPTIMAL);
400 else if(sEntry ==
SvxResId( RID_SVXSTR_ZOOM_WHOLE_PAGE) )
401 aZoom.SetType(SvxZoomType::WHOLEPAGE);
406 sal_uInt16 nZoom = o3tl::narrowing<sal_uInt16>(sEntry.toInt32());
411 aZoom.SetValue(nZoom);
419 m_xWidget->set_entry_text(m_xWidget->get_saved_value());
425 SfxCallMode::ASYNCHRON, { &aZoom });
432 bool bHandled =
false;
434 sal_uInt16
nCode = rKEvt.GetKeyCode().GetCode();
444 m_xWidget->set_entry_text(m_xWidget->get_saved_value());
450 return bHandled || ChildKeyInput(rKEvt);
455 if (!m_xWidget->has_focus())
456 m_xWidget->set_entry_text(m_xWidget->get_saved_value());
459 void SwZoomBox_Impl::ReleaseFocus()
498 if(SfxItemState::DEFAULT <= eState)
502 pBox->set_entry_text(sZoom);
517 std::unique_ptr<weld::Entry> m_xWidget;
519 sal_uInt16 m_nSlotId;
524 SwJumpToSpecificBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot);
525 virtual void dispose()
override
530 virtual ~SwJumpToSpecificBox_Impl()
override
540 return ChildKeyInput(rKEvt);
543 SwJumpToSpecificBox_Impl::SwJumpToSpecificBox_Impl(
vcl::Window* pParent, sal_uInt16 nSlot)
545 , m_xWidget(m_xBuilder->weld_entry(
"jumppos"))
548 InitControlBase(m_xWidget.get());
550 m_xWidget->connect_key_press(
LINK(
this, SwJumpToSpecificBox_Impl, KeyInputHdl));
551 m_xWidget->connect_activate(
LINK(
this, SwJumpToSpecificBox_Impl, SelectHdl));
553 SetSizePixel(m_xWidget->get_preferred_size());
558 OUString sEntry(m_xWidget->get_text());
560 aPageNum.SetValue(o3tl::narrowing<sal_uInt16>(sEntry.toInt32()));
586 const uno::Reference<frame::XFrame>& xFrame)
587 : m_xComboBox(
std::move(xComboBox))
605 const uno::Reference<frame::XFrame>& xFrame)
621 m_xFrame->getContainerWindow()->setFocus();
626 if (!rComboBox.changed_by_direct_pick())
651 return DoKeyInput(rKEvt);
670 :
svt::ToolboxController( rxContext,
680 uno::Any a = ToolboxController::queryInterface( aType );
684 return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >(
this ) );
689 ToolboxController::acquire();
694 ToolboxController::release();
705 return "lo.writer.NavElementToolBoxController";
710 return {
"com.sun.star.frame.ToolbarController" };
731 if ( rEvent.FeatureURL.Path !=
"NavElement" )
734 if ( rEvent.IsEnabled )
765 return uno::Reference< awt::XWindow >();
769 const uno::Reference< awt::XWindow >& xParent )
771 uno::Reference< awt::XWindow > xItemWindow;
799 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
801 css::uno::XComponentContext *rxContext,
802 css::uno::Sequence<css::uno::Any>
const &)
810 public css::lang::XServiceInfo
815 PrevNextScrollToolboxController(
const css::uno::Reference< css::uno::XComponentContext >& rxContext,
Type eType );
818 virtual css::uno::Any SAL_CALL
queryInterface(
const css::uno::Type& aType )
override;
819 virtual void SAL_CALL
acquire() noexcept override;
820 virtual
void SAL_CALL release() noexcept override;
823 virtual OUString SAL_CALL getImplementationName() override;
824 virtual
sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
825 virtual
css::
uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
828 virtual
void SAL_CALL
dispose() override;
831 virtual
void SAL_CALL statusChanged( const
css::frame::FeatureStateEvent& rEvent ) override;
839 PrevNextScrollToolboxController::PrevNextScrollToolboxController( const
css::
uno::Reference<
css::
uno::XComponentContext > & rxContext,
Type eType )
840 :
svt::ToolboxController( rxContext,
841 css::
uno::Reference<
css::frame::XFrame >(),
842 (eType == PREVIOUS) ? OUString( ".
uno:ScrollToPrevious" ): OUString( ".
uno:ScrollToNext" ) ),
849 css::uno::Any SAL_CALL PrevNextScrollToolboxController::queryInterface(
const css::uno::Type& aType )
855 return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >(
this ) );
858 void SAL_CALL PrevNextScrollToolboxController::acquire() noexcept
863 void SAL_CALL PrevNextScrollToolboxController::release() noexcept
869 OUString SAL_CALL PrevNextScrollToolboxController::getImplementationName()
871 return meType == PrevNextScrollToolboxController::PREVIOUS?
872 OUString(
"lo.writer.PreviousScrollToolboxController" ) :
873 OUString(
"lo.writer.NextScrollToolboxController" );
876 sal_Bool SAL_CALL PrevNextScrollToolboxController::supportsService(
const OUString& ServiceName )
881 css::uno::Sequence< OUString > SAL_CALL PrevNextScrollToolboxController::getSupportedServiceNames()
883 return {
"com.sun.star.frame.ToolbarController" };
895 void SAL_CALL PrevNextScrollToolboxController::statusChanged(
const css::frame::FeatureStateEvent& rEvent )
897 if (rEvent.FeatureURL.Path ==
"NavElement")
900 m_pToolbar->set_item_tooltip_text(m_aCommandURL.toUtf8(),
lcl_GetScrollToolTip(
meType != PrevNextScrollToolboxController::PREVIOUS));
909 else if (rEvent.FeatureURL.Path ==
"ScrollToPrevious" || rEvent.FeatureURL.Path ==
"ScrollToNext")
912 m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
923 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
925 css::uno::XComponentContext *context,
926 css::uno::Sequence<css::uno::Any>
const &)
928 return cppu::acquire(
new PrevNextScrollToolboxController( context, PrevNextScrollToolboxController::PREVIOUS ) );
931 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
933 css::uno::XComponentContext *context,
934 css::uno::Sequence<css::uno::Any>
const &)
936 return cppu::acquire(
new PrevNextScrollToolboxController( context, PrevNextScrollToolboxController::NEXT ) );
SfxViewFrame * GetViewFrame() const
#define LINK(Instance, Class, Member)
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
void set_sensitive(bool bSensitive)
sal_uInt16 GetBlockCount(size_t nGroup)
static sal_uInt16 GetMoveType()
virtual ~SwTbxAutoTextCtrl() override
void(* GlossarySetActGroup)(const OUString &rNewGroup)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_NextScrollToolboxController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
virtual bool DoKeyInput(const KeyEvent &)
virtual std::unique_ptr< ComboBox > weld_combo_box(const OString &id)=0
static const AllSettings & GetSettings()
Base class of all fields.
SwWrtShell * GetActiveWrtShell()
virtual bool DoKeyInput(const KeyEvent &rKEvt) override
css::uno::Reference< css::lang::XComponent > m_xFrame
virtual void SetSizePixel(const Size &rNewSize)
#define NID_TABLE_FORMULA
bool ChildKeyInput(const KeyEvent &rKEvt)
sal_uInt16 GetCode() const
uno::Reference< frame::XFrame > m_xFrame
static SfxObjectShell * Current()
void Invalidate(sal_uInt16 nId)
SwJumpToSpecificPageControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
static const OUString & GetTypeStr(SwFieldTypesEnum nTypeId)
IMPL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu *, pMenu, bool)
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
SwWrtShell & GetWrtShell() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_NavElementToolBoxController_get_implementation(css::uno::XComponentContext *rxContext, css::uno::Sequence< css::uno::Any > const &)
Used by the UI to modify the document model.
OUString SwResId(TranslateId aId)
virtual ~SwJumpToSpecificPageControl() override
virtual void CreatePopupWindow() override
exports com.sun.star. frame
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
OUString SvxResId(TranslateId aId)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
static SfxViewShell * Current()
void SetCurGroup(const OUString &aGrp, bool bApi=false, bool bAlwaysCreateNew=false)
OUString GetBlockLongName(size_t nGroup, sal_uInt16 nBlock)
OUString GetGroupName(size_t nPos)
OUString GetBlockShortName(size_t nGroup, sal_uInt16 nBlock)
#define SAL_N_ELEMENTS(arr)
static sal_uInt16 aNavigationInsertIds[NAVI_ENTRIES]
SfxDispatcher * GetDispatcher() const
OUString GetGroupTitle(size_t nPos)
static OUString lcl_GetScrollToolTip(bool bNext)
SwPreviewZoomControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
static SwGlossaryList * pGlossaryList
virtual ~SwPreviewZoomControl() override
SfxBindings & GetBindings()
NavElementBox_Impl(vcl::Window *pParent, const uno::Reference< frame::XFrame > &xFrame)
#define NID_TABLE_FORMULA_ERROR
static SwAbstractDialogFactory * Create()
NavElementBox_Base(std::unique_ptr< weld::ComboBox > xComboBox, const uno::Reference< frame::XFrame > &xFrame)
bool HasReadonlySel() const
SwTbxAutoTextCtrl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
SwDocShell * GetDocShell()
SFX_IMPL_TOOLBOX_CONTROL(SwTbxAutoTextCtrl, SfxVoidItem)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_PreviousScrollToolboxController_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SwFieldTypesEnum GetTypeId() const
bool InsertGlossary(const OUString &rName)
const vcl::KeyCode & GetKeyCode() const
static SfxViewFrame * Current()
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
IMPL_LINK_NOARG(SwZoomBox_Impl, ActivateHdl, weld::ComboBox &, bool)
std::unique_ptr< weld::Container > m_xContainer
const TranslateId STR_IMGBTN_ARY[]
constexpr sal_uInt16 KEY_ESCAPE
virtual void dispose() override
static VclPtr< reference_type > Create(Arg &&...arg)
vcl::Window * GetWindow() const
SwGlossaryHdl * GetGlosHdl()
SfxDispatcher * GetDispatcher() const
reference_type * get() const
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const TranslateId aNavigationStrIds[NAVI_ENTRIES]
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
constexpr OStringLiteral HID_PVIEW_ZOOM_LB
virtual GlossarySetActGroup SetGlossaryActGroupFunc()=0
rtl::OUStringConstExpr constexpr aNavigationImgIds[NAVI_ENTRIES]
std::unique_ptr< weld::ComboBox > m_xComboBox
constexpr sal_uInt16 KEY_TAB
IMPL_LINK(SwZoomBox_Impl, SelectHdl, weld::ComboBox &, rComboBox, void)
SwGlossaryList * GetGlossaryList()