33#include <svx/strings.hrc>
39#include <bitmaps.hlst>
41#include <com/sun/star/beans/PropertyValue.hpp>
42#include <com/sun/star/frame/ModuleManager.hpp>
53 sal_uInt16 GetZoom(std::u16string_view ident)
const;
57 return m_xMenu->popup_at_rect(m_pPopupParent, rRect);
62 std::unique_ptr<weld::Builder> m_xBuilder;
63 std::unique_ptr<weld::Menu> m_xMenu;
70 : m_pPopupParent(pPopupParent)
71 , m_xBuilder(
Application::CreateBuilder(m_pPopupParent,
"svx/ui/zoommenu.ui"))
72 , m_xMenu(m_xBuilder->weld_menu(
"menu"))
75 if ( !(SvxZoomEnableFlags::N50 & nValueSet) )
76 m_xMenu->set_sensitive(
"50",
false);
77 if ( !(SvxZoomEnableFlags::N100 & nValueSet) )
78 m_xMenu->set_sensitive(
"100",
false);
79 if ( !(SvxZoomEnableFlags::N150 & nValueSet) )
80 m_xMenu->set_sensitive(
"150",
false);
81 if ( !(SvxZoomEnableFlags::N200 & nValueSet) )
82 m_xMenu->set_sensitive(
"200",
false);
83 if ( !(SvxZoomEnableFlags::OPTIMAL & nValueSet) )
84 m_xMenu->set_sensitive(
"optimal",
false);
85 if ( !(SvxZoomEnableFlags::WHOLEPAGE & nValueSet) )
86 m_xMenu->set_sensitive(
"page",
false);
87 if ( !(SvxZoomEnableFlags::PAGEWIDTH & nValueSet) )
88 m_xMenu->set_sensitive(
"width",
false);
91sal_uInt16 ZoomPopup_Impl::GetZoom(std::u16string_view ident)
const
93 sal_uInt16 nRet = nZoom;
97 else if (ident == u
"150")
99 else if (ident == u
"100")
101 else if (ident == u
"75")
103 else if (ident == u
"50")
105 else if (ident == u
"optimal" || ident == u
"width" || ident == u
"page")
126 if( SfxItemState::DEFAULT != eState )
131 else if (
auto pItem =
dynamic_cast< const SfxUInt16Item*
>(pState) )
133 nZoom = pItem->GetValue();
136 if (
auto pZoomItem =
dynamic_cast<const SvxZoomItem*
>(pState) )
142 SAL_INFO(
"svx",
"use SfxZoomItem for SID_ATTR_ZOOM" );
170 OUString sIdent = aPop.popup_at_rect(aRect);
171 if (!sIdent.isEmpty() && (
nZoom != aPop.GetZoom(sIdent) || !
nZoom))
173 nZoom = aPop.GetZoom(sIdent);
177 if (sIdent ==
"optimal")
178 aZoom.
SetType(SvxZoomType::OPTIMAL);
179 else if (sIdent ==
"width")
180 aZoom.
SetType(SvxZoomType::PAGEWIDTH);
181 else if (sIdent ==
"page")
182 aZoom.
SetType(SvxZoomType::WHOLEPAGE);
213 css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = css::frame::ModuleManager::create(
m_xContext );
214 OUString aModuleIdentifier = xModuleManager->identify( css::uno::Reference<XInterface>(
m_xFrame, css::uno::UnoReference_Query::UNO_QUERY ) );
217 if ( aModuleIdentifier ==
"com.sun.star.drawing.DrawingDocument" )
221 else if ( aModuleIdentifier ==
"com.sun.star.presentation.PresentationDocument" )
Reference< XComponentContext > m_xContext
css::uno::Reference< css::lang::XComponent > m_xFrame
static const AllSettings & GetSettings()
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
StatusBar & GetStatusBar() const
virtual void Command(const CommandEvent &rCEvt)
void SetItemText(sal_uInt16 nItemId, const OUString &rText, int nCharsWidth=-1)
void SetQuickHelpText(sal_uInt16 nItemId, const OUString &rText)
void SetType(SvxZoomType eNewType)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
SvxZoomPageStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb)
virtual bool MouseButtonDown(const MouseEvent &rEvt) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual void Paint(const UserDrawEvent &rEvt) override
void ImplUpdateItemText()
virtual void Command(const CommandEvent &rCEvt) override
SvxZoomEnableFlags nValueSet
virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual void Paint(const UserDrawEvent &rEvt) override
SvxZoomStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb)
vcl::RenderContext * GetRenderContext() const
const tools::Rectangle & GetRect() const
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
OUString SvxResId(TranslateId aId)
Sequence< PropertyValue > aArguments
#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...
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl, SvxZoomItem)