tdf#154732: Fix zoom bar in Draw

Oringally, the zoom bar in both Draw and Impress show
"Fit slide to current window."
Now, the zoom bar in Draw is modified into
"Fit page to current window.", while Impress still uses "slide".

Change-Id: Iba25215d437b128f581bc5a8e6767f6b1f382be4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150650
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Baole Fang 2023-04-19 14:14:10 -04:00 committed by Mike Kaganski
parent 6e8a89b762
commit 91148ed5d5
3 changed files with 23 additions and 0 deletions

View file

@ -1324,6 +1324,7 @@
#define RID_SVXSTR_DOC_MODIFIED_NO NC_("RID_SVXSTR_DOC_MODIFIED_NO", "The document has not been modified since the last save.")
#define RID_SVXSTR_DOC_LOAD NC_("RID_SVXSTR_DOC_LOAD", "Loading document...")
#define RID_SVXSTR_FIT_SLIDE NC_("RID_SVXSTR_FIT_SLIDE", "Fit slide to current window.")
#define RID_SVXSTR_FIT_PAGE NC_("RID_SVXSTR_FIT_PAGE", "Fit page to current window.")
#define RID_SVXSTR_WARN_MISSING_SMARTART NC_("RID_SVXSTR_WARN_MISSING_SMARTART", "Could not load all SmartArt objects. Saving in Microsoft Office 2010 or later would avoid this issue.")
#define RID_SVXSTR_TABLECELL_HINT NC_("RID_SVXSTR_TABLECELL_HINT", "Table cell address. Click to open Table Properties dialog.")
#define RID_SVXSTR_SECTION_HINT NC_("RID_SVXSTR_SECTION_HINT", "Section name. Click to open Edit Sections dialog.")

View file

@ -52,6 +52,7 @@ private:
public:
virtual void Paint(const UserDrawEvent& rEvt) override;
virtual bool MouseButtonDown(const MouseEvent& rEvt) override;
virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& aArguments) override;
SFX_DECL_STATUSBAR_CONTROL();

View file

@ -39,6 +39,7 @@
#include <bitmaps.hlst>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl,SvxZoomItem);
@ -203,6 +204,26 @@ SvxZoomPageStatusBarControl::SvxZoomPageStatusBarControl(sal_uInt16 _nSlotId,
GetStatusBar().SetQuickHelpText(GetId(), SvxResId(RID_SVXSTR_FIT_SLIDE));
}
void SAL_CALL SvxZoomPageStatusBarControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
{
// Call inherited initialize
StatusbarController::initialize(aArguments);
// Get document type
css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = css::frame::ModuleManager::create( m_xContext );
OUString aModuleIdentifier = xModuleManager->identify( css::uno::Reference<XInterface>( m_xFrame, css::uno::UnoReference_Query::UNO_QUERY ) );
// Decide what to show in zoom bar
if ( aModuleIdentifier == "com.sun.star.drawing.DrawingDocument" )
{
GetStatusBar().SetQuickHelpText(GetId(), SvxResId(RID_SVXSTR_FIT_PAGE));
}
else if ( aModuleIdentifier == "com.sun.star.presentation.PresentationDocument" )
{
GetStatusBar().SetQuickHelpText(GetId(), SvxResId(RID_SVXSTR_FIT_SLIDE));
}
}
void SvxZoomPageStatusBarControl::Paint(const UserDrawEvent& rUsrEvt)
{
vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();