33 #include <svx/strings.hrc>
39 #include <bitmaps.hlst>
41 #include <com/sun/star/beans/PropertyValue.hpp>
52 sal_uInt16 GetZoom(std::string_view ident)
const;
56 return m_xMenu->popup_at_rect(m_pPopupParent, rRect);
61 std::unique_ptr<weld::Builder> m_xBuilder;
62 std::unique_ptr<weld::Menu> m_xMenu;
69 : m_pPopupParent(pPopupParent)
70 , m_xBuilder(
Application::CreateBuilder(m_pPopupParent,
"svx/ui/zoommenu.ui"))
71 , m_xMenu(m_xBuilder->weld_menu(
"menu"))
74 if ( !(SvxZoomEnableFlags::N50 & nValueSet) )
75 m_xMenu->set_sensitive(
"50",
false);
76 if ( !(SvxZoomEnableFlags::N100 & nValueSet) )
77 m_xMenu->set_sensitive(
"100",
false);
78 if ( !(SvxZoomEnableFlags::N150 & nValueSet) )
79 m_xMenu->set_sensitive(
"150",
false);
80 if ( !(SvxZoomEnableFlags::N200 & nValueSet) )
81 m_xMenu->set_sensitive(
"200",
false);
82 if ( !(SvxZoomEnableFlags::OPTIMAL & nValueSet) )
83 m_xMenu->set_sensitive(
"optimal",
false);
84 if ( !(SvxZoomEnableFlags::WHOLEPAGE & nValueSet) )
85 m_xMenu->set_sensitive(
"page",
false);
86 if ( !(SvxZoomEnableFlags::PAGEWIDTH & nValueSet) )
87 m_xMenu->set_sensitive(
"width",
false);
90 sal_uInt16 ZoomPopup_Impl::GetZoom(std::string_view ident)
const
92 sal_uInt16 nRet = nZoom;
96 else if (ident ==
"150")
98 else if (ident ==
"100")
100 else if (ident ==
"75")
102 else if (ident ==
"50")
104 else if (ident ==
"optimal" || ident ==
"width" || ident ==
"page")
125 if( SfxItemState::DEFAULT != eState )
128 nValueSet = SvxZoomEnableFlags::NONE;
130 else if (
auto pItem = dynamic_cast< const SfxUInt16Item* >(pState) )
132 nZoom = pItem->GetValue();
135 if (
auto pZoomItem = dynamic_cast<const SvxZoomItem*>(pState) )
137 nValueSet = pZoomItem->GetValueSet();
141 SAL_INFO(
"svx",
"use SfxZoomItem for SID_ATTR_ZOOM" );
142 nValueSet = SvxZoomEnableFlags::ALL;
163 if ( CommandEventId::ContextMenu == rCEvt.
GetCommand() && bool(nValueSet) )
167 ZoomPopup_Impl aPop(pPopupParent,
nZoom, nValueSet);
169 OString sIdent = aPop.popup_at_rect(aRect);
170 if (!sIdent.isEmpty() && (
nZoom != aPop.GetZoom(sIdent) || !
nZoom))
172 nZoom = aPop.GetZoom(sIdent);
176 if (sIdent ==
"optimal")
177 aZoom.
SetType(SvxZoomType::OPTIMAL);
178 else if (sIdent ==
"width")
179 aZoom.
SetType(SvxZoomType::PAGEWIDTH);
180 else if (sIdent ==
"page")
181 aZoom.
SetType(SvxZoomType::WHOLEPAGE);
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
virtual void Paint(const UserDrawEvent &rEvt) override
const tools::Rectangle & GetRect() const
void SetType(SvxZoomType eNewType)
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual bool MouseButtonDown(const MouseEvent &rEvt) override
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
static const AllSettings & GetSettings()
void SetItemText(sal_uInt16 nItemId, const OUString &rText, int nCharsWidth=-1)
SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl, SvxZoomItem)
OUString SvxResId(TranslateId aId)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual void Command(const CommandEvent &rCEvt) override
virtual void Paint(const UserDrawEvent &rEvt) override
vcl::RenderContext * GetRenderContext() const
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
CommandEventId GetCommand() const
void ImplUpdateItemText()
const Point & GetMousePosPixel() const
SvxZoomStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb)
void SetQuickHelpText(sal_uInt16 nItemId, const OUString &rText)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
virtual void Command(const CommandEvent &rCEvt)
StatusBar & GetStatusBar() const
#define SAL_INFO(area, stream)
Point centerImage(const tools::Rectangle &rBoundingRect, const Image &rImg)
Given a bounding rectangle and an image, determine the top-left position of the image so that the ima...
virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
SvxZoomPageStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb)