[Libreoffice-commits] core.git: include/svx svx/source sw/source

Rishabh Kumar kris.kr296 at gmail.com
Thu Mar 26 07:58:55 PDT 2015


 include/svx/dialogs.hrc              |   11 ++++++-
 svx/source/stbctrls/stbctrls.src     |   45 +++++++++++++++++++++++++++++
 sw/source/uibase/ribbar/workctrl.cxx |   54 ++++++++++++++++++++---------------
 3 files changed, 87 insertions(+), 23 deletions(-)

New commits:
commit 97f08e0632b2a947848223f862dd89a36386cb71
Author: Rishabh Kumar <kris.kr296 at gmail.com>
Date:   Fri Mar 13 19:38:31 2015 +0530

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 63963d0..e6abab7 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 ac26b26..a31e6d4 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 7cbb8b9..b04dd47 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();
     }
 }


More information about the Libreoffice-commits mailing list