summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRishabh Kumar <kris.kr296@gmail.com>2015-03-13 19:38:31 +0530
committerCaolán McNamara <caolanm@redhat.com>2015-03-26 14:58:29 +0000
commit97f08e0632b2a947848223f862dd89a36386cb71 (patch)
tree189fa820387aa64b5dd99519e2157d21ae7c17d7
parent873141fb5be5fa49b56ea413bc912af33f758a0b (diff)
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/14488 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/svx/dialogs.hrc11
-rw-r--r--svx/source/stbctrls/stbctrls.src45
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx54
3 files changed, 87 insertions, 23 deletions
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 63963d024580..e6abab7a62ae 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -1087,9 +1087,18 @@
#define RID_SVXIMG_SHADOW_SIZE (RID_SVX_START + 1379)
#define RID_SVXIMG_SHADOW_XDIST (RID_SVX_START + 1380)
#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 !!!
-#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
// of grouping them by semantics. The reason is that resource ids have to be
diff --git a/svx/source/stbctrls/stbctrls.src b/svx/source/stbctrls/stbctrls.src
index ac26b2626fa1..a31e6d41fdae 100644
--- a/svx/source/stbctrls/stbctrls.src
+++ b/svx/source/stbctrls/stbctrls.src
@@ -141,6 +141,51 @@ String RID_SVXSTR_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 -------------------------------------------------------------
Menu RID_SVXMNU_ZOOM
{
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 7cbb8b9fdbbb..b04dd47f240e 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -46,8 +46,10 @@
#include <rtl/ustring.hxx>
#include "swabstdlg.hxx"
#include <misc.hrc>
-
+#include <sfx2/zoomitem.hxx>
#include <vcl/svapp.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
// Size check
#define NAVI_ENTRIES 20
@@ -55,6 +57,8 @@
#error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added?
#endif
+#define ZOOM_ENTRIES 9
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -563,13 +567,17 @@ SwZoomBox_Impl::SwZoomBox_Impl(
{
EnableAutocomplete( false );
sal_uInt16 aZoomValues[] =
- { 25, 50, 75, 100, 150, 200 };
- for(sal_uInt16 i = 0; i < sizeof(aZoomValues)/sizeof(sal_uInt16); i++)
+ { RID_SVXSTR_ZOOM_25 , RID_SVXSTR_ZOOM_50 ,
+ 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],
- Application::GetSettings().GetUILanguageTag());
+ OUString sEntry = SVX_RESSTR( aZoomValues[i] );
InsertEntry(sEntry);
}
+
}
SwZoomBox_Impl::~SwZoomBox_Impl()
@@ -580,26 +588,28 @@ void SwZoomBox_Impl::Select()
if ( !IsTravelSelect() )
{
OUString sEntry(comphelper::string::remove(GetText(), '%'));
- sal_uInt16 nZoom = (sal_uInt16)sEntry.toInt32();
- if(nZoom < MINZOOM)
- nZoom = MINZOOM;
- if(nZoom > MAXZOOM)
- nZoom = MAXZOOM;
-
- SfxUInt16Item aItem( nSlotId, nZoom );
- if ( FN_PREVIEW_ZOOM == nSlotId )
+ SvxZoomItem aZoom(SvxZoomType::PERCENT,100);
+ if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_PAGE_WIDTH ) )
+ aZoom.SetType(SvxZoomType::PAGEWIDTH);
+ else if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_OPTIMAL_VIEW ) )
+ aZoom.SetType(SvxZoomType::OPTIMAL);
+ else if(sEntry == SVX_RESSTR( RID_SVXSTR_ZOOM_WHOLE_PAGE) )
+ aZoom.SetType(SvxZoomType::WHOLEPAGE);
+ else
{
- Any a;
- Sequence< PropertyValue > aArgs( 1 );
- aArgs[0].Name = "PreviewZoom";
- aItem.QueryValue( a );
- aArgs[0].Value = a;
- SfxToolBoxControl::Dispatch(
- m_xDispatchProvider,
- OUString( ".uno:PreviewZoom" ),
- aArgs );
+ sal_uInt16 nZoom = (sal_uInt16)sEntry.toInt32();
+ if(nZoom < MINZOOM)
+ nZoom = MINZOOM;
+ if(nZoom > MAXZOOM)
+ nZoom = MAXZOOM;
+ aZoom.SetValue(nZoom);
}
+ if( FN_PREVIEW_ZOOM == nSlotId )
+ {
+ SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
+ pCurrentShell->GetDispatcher()->Execute(SID_ATTR_ZOOM, SfxCallMode::ASYNCHRON, &aZoom, 0L);
+ }
ReleaseFocus();
}
}