Kaydet (Commit) 97f08e06 authored tarafından Rishabh Kumar's avatar Rishabh Kumar Kaydeden (comit) Caolán McNamara

tdf#81073 :Addition of text zoom levels to print preview zoom

SvxZoomItem includes text zoom level Ids unlike SfxUInt16Iem which only
includes zoom percent id.SfxUInt16Item is the base class for SvxZoomItem.

Change-Id: I8ad2a8cf48632853538aa2d99993f8dfccf49f4c
Reviewed-on: https://gerrit.libreoffice.org/14488Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 873141fb
...@@ -1087,9 +1087,18 @@ ...@@ -1087,9 +1087,18 @@
#define RID_SVXIMG_SHADOW_SIZE (RID_SVX_START + 1379) #define RID_SVXIMG_SHADOW_SIZE (RID_SVX_START + 1379)
#define RID_SVXIMG_SHADOW_XDIST (RID_SVX_START + 1380) #define RID_SVXIMG_SHADOW_XDIST (RID_SVX_START + 1380)
#define RID_SVXIMG_SHADOW_YDIST (RID_SVX_START + 1381) #define RID_SVXIMG_SHADOW_YDIST (RID_SVX_START + 1381)
#define RID_SVXSTR_ZOOM_25 (RID_SVX_START + 1382)
#define RID_SVXSTR_ZOOM_50 (RID_SVX_START + 1383)
#define RID_SVXSTR_ZOOM_75 (RID_SVX_START + 1384)
#define RID_SVXSTR_ZOOM_100 (RID_SVX_START + 1385)
#define RID_SVXSTR_ZOOM_150 (RID_SVX_START + 1386)
#define RID_SVXSTR_ZOOM_200 (RID_SVX_START + 1387)
#define RID_SVXSTR_ZOOM_WHOLE_PAGE (RID_SVX_START + 1388)
#define RID_SVXSTR_ZOOM_PAGE_WIDTH (RID_SVX_START + 1389)
#define RID_SVXSTR_ZOOM_OPTIMAL_VIEW (RID_SVX_START + 1390)
// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!! // !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!!
#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1382) #define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1391)
// if we have _a_lot_ time, we should group the resource ids by type, instead // if we have _a_lot_ time, we should group the resource ids by type, instead
// of grouping them by semantics. The reason is that resource ids have to be // of grouping them by semantics. The reason is that resource ids have to be
......
...@@ -141,6 +141,51 @@ String RID_SVXSTR_ZOOM_OUT ...@@ -141,6 +141,51 @@ String RID_SVXSTR_ZOOM_OUT
Text [ en-US ] = "Zoom Out"; Text [ en-US ] = "Zoom Out";
}; };
String RID_SVXSTR_ZOOM_25
{
Text [ en-US ] = "25%" ;
};
String RID_SVXSTR_ZOOM_50
{
Text [ en-US ] = "50%" ;
};
String RID_SVXSTR_ZOOM_75
{
Text [ en-US ] = "75%" ;
};
String RID_SVXSTR_ZOOM_100
{
Text [ en-US ] = "100%" ;
};
String RID_SVXSTR_ZOOM_150
{
Text [ en-US ] = "150%" ;
};
String RID_SVXSTR_ZOOM_200
{
Text [ en-US ] = "200%" ;
};
String RID_SVXSTR_ZOOM_WHOLE_PAGE
{
Text [ en-US ] = "Entire Page" ;
};
String RID_SVXSTR_ZOOM_PAGE_WIDTH
{
Text [ en-US ] = "Page Width" ;
};
String RID_SVXSTR_ZOOM_OPTIMAL_VIEW
{
Text [ en-US ] = "Optimal View" ;
};
// PopupMenu ------------------------------------------------------------- // PopupMenu -------------------------------------------------------------
Menu RID_SVXMNU_ZOOM Menu RID_SVXMNU_ZOOM
{ {
......
...@@ -46,8 +46,10 @@ ...@@ -46,8 +46,10 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include "swabstdlg.hxx" #include "swabstdlg.hxx"
#include <misc.hrc> #include <misc.hrc>
#include <sfx2/zoomitem.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
// Size check // Size check
#define NAVI_ENTRIES 20 #define NAVI_ENTRIES 20
...@@ -55,6 +57,8 @@ ...@@ -55,6 +57,8 @@
#error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added? #error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added?
#endif #endif
#define ZOOM_ENTRIES 9
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
...@@ -563,13 +567,17 @@ SwZoomBox_Impl::SwZoomBox_Impl( ...@@ -563,13 +567,17 @@ SwZoomBox_Impl::SwZoomBox_Impl(
{ {
EnableAutocomplete( false ); EnableAutocomplete( false );
sal_uInt16 aZoomValues[] = sal_uInt16 aZoomValues[] =
{ 25, 50, 75, 100, 150, 200 }; { RID_SVXSTR_ZOOM_25 , RID_SVXSTR_ZOOM_50 ,
for(sal_uInt16 i = 0; i < sizeof(aZoomValues)/sizeof(sal_uInt16); i++) RID_SVXSTR_ZOOM_75 , RID_SVXSTR_ZOOM_100 ,
RID_SVXSTR_ZOOM_150 , RID_SVXSTR_ZOOM_200 ,
RID_SVXSTR_ZOOM_WHOLE_PAGE, RID_SVXSTR_ZOOM_PAGE_WIDTH ,
RID_SVXSTR_ZOOM_OPTIMAL_VIEW };
for(sal_uInt16 i = 0; i < ZOOM_ENTRIES ; i++)
{ {
OUString sEntry = unicode::formatPercent(aZoomValues[i], OUString sEntry = SVX_RESSTR( aZoomValues[i] );
Application::GetSettings().GetUILanguageTag());
InsertEntry(sEntry); InsertEntry(sEntry);
} }
} }
SwZoomBox_Impl::~SwZoomBox_Impl() SwZoomBox_Impl::~SwZoomBox_Impl()
...@@ -580,26 +588,28 @@ void SwZoomBox_Impl::Select() ...@@ -580,26 +588,28 @@ void SwZoomBox_Impl::Select()
if ( !IsTravelSelect() ) if ( !IsTravelSelect() )
{ {
OUString sEntry(comphelper::string::remove(GetText(), '%')); OUString sEntry(comphelper::string::remove(GetText(), '%'));
sal_uInt16 nZoom = (sal_uInt16)sEntry.toInt32(); SvxZoomItem aZoom(SvxZoomType::PERCENT,100);
if(nZoom < MINZOOM) if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_PAGE_WIDTH ) )
nZoom = MINZOOM; aZoom.SetType(SvxZoomType::PAGEWIDTH);
if(nZoom > MAXZOOM) else if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_OPTIMAL_VIEW ) )
nZoom = MAXZOOM; aZoom.SetType(SvxZoomType::OPTIMAL);
else if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_WHOLE_PAGE) )
SfxUInt16Item aItem( nSlotId, nZoom ); aZoom.SetType(SvxZoomType::WHOLEPAGE);
if ( FN_PREVIEW_ZOOM == nSlotId ) else
{ {
Any a; sal_uInt16 nZoom = (sal_uInt16)sEntry.toInt32();
Sequence< PropertyValue > aArgs( 1 ); if(nZoom < MINZOOM)
aArgs[0].Name = "PreviewZoom"; nZoom = MINZOOM;
aItem.QueryValue( a ); if(nZoom > MAXZOOM)
aArgs[0].Value = a; nZoom = MAXZOOM;
SfxToolBoxControl::Dispatch( aZoom.SetValue(nZoom);
m_xDispatchProvider,
OUString( ".uno:PreviewZoom" ),
aArgs );
} }
if( FN_PREVIEW_ZOOM == nSlotId )
{
SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
pCurrentShell->GetDispatcher()->Execute(SID_ATTR_ZOOM, SfxCallMode::ASYNCHRON, &aZoom, 0L);
}
ReleaseFocus(); ReleaseFocus();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment