[Libreoffice-commits] .: svx/inc svx/source

Tomaž Vajngerl tvajngerl at kemper.freedesktop.org
Sun Jul 15 13:35:09 PDT 2012


 svx/inc/svx/compressgraphicdialog.hxx       |   37 +++-
 svx/source/dialog/compressgraphicdialog.cxx |  234 ++++++++++++++++++----------
 svx/source/dialog/compressgraphicdialog.hrc |   56 +++---
 svx/source/dialog/compressgraphicdialog.src |  189 +++++++++++++++++-----
 4 files changed, 365 insertions(+), 151 deletions(-)

New commits:
commit 660e3c1b204ac709e2acdace2a67f359505a1555
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Sun Jul 15 22:22:45 2012 +0200

    GUI improvements for CompressGraphicDialog.
    
    In CompressGraphicDialog it is possible to set the target image width
    and height besides resolution. Better lossless / JPEG compression
    selection. Added Compression / Quality settings.
    
    Change-Id: Ic8a6bfbe9dfbcd4acdfda4c0a856c3ea813a2702

diff --git a/svx/inc/svx/compressgraphicdialog.hxx b/svx/inc/svx/compressgraphicdialog.hxx
index a33bb76..bf93e62 100644
--- a/svx/inc/svx/compressgraphicdialog.hxx
+++ b/svx/inc/svx/compressgraphicdialog.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef _COMPRESS_GRAPHICS_DIALOG_HXX
-#define _COMPRESS_GRAPHICS_DIALOG_HXX
+#ifndef _COMPRESS_GRAPHIC_DIALOG_HXX
+#define _COMPRESS_GRAPHIC_DIALOG_HXX
 
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
@@ -30,19 +30,32 @@
 class SVX_DLLPUBLIC CompressGraphicsDialog : public ModalDialog
 {
 private:
+    FixedLine       m_aImageDetailsFL;
     FixedText       m_aFixedText2X;
     FixedText       m_aFixedText2;
     FixedText       m_aFixedText3X;
     FixedText       m_aFixedText3;
-    FixedText       m_aFixedText4X;
-    FixedText       m_aFixedText4;
     FixedText       m_aFixedText5X;
     FixedText       m_aFixedText5;
     FixedText       m_aFixedText6X;
     FixedText       m_aFixedText6;
+
+    FixedLine       m_aSettingsFL;
+    CheckBox        m_aReduceResolutionCB;
+    FixedText       m_aNewWidthFT;
+    MetricField     m_aMFNewWidth;
+    FixedText       m_aNewHeightFT;
+    MetricField     m_aMFNewHeight;
+    FixedText       m_aResolutionFT;
     ComboBox        m_aResolutionLB;
-    MetricField     m_aMFQuality;
-    CheckBox        m_aLossless;
+    FixedText       m_aFixedTextDPI;
+    RadioButton     m_aLosslessRB;
+    RadioButton     m_aJpegCompRB;
+    FixedText       m_aCompressionFT;
+    MetricField     m_aCompressionMF;
+    FixedText       m_aQualityFT;
+    MetricField     m_aQualityMF;
+    CheckBox        m_aCropCB;
     OKButton        m_aBtnOK;
     CancelButton    m_aBtnCancel;
     HelpButton      m_aBtnHelp;
@@ -52,10 +65,20 @@ private:
     Size            m_aViewSize100mm;
     SfxBindings&    m_rBindings;
 
+    double          m_dResolution;
+
+    DECL_LINK( NewWidthModifiedHdl, void* );
+    DECL_LINK( NewHeightModifiedHdl, void* );
     DECL_LINK( ResolutionModifiedHdl, void* );
-    DECL_LINK( ClickHdl, void* );
+    DECL_LINK( ToggleCompressionRB, void* );
+    DECL_LINK( ToggleReduceResolutionRB, void* );
+
+    DECL_LINK( CalculateClickHdl, void* );
 
     void Update();
+    void UpdateNewWidthMF();
+    void UpdateNewHeightMF();
+    void UpdateResolutionLB();
 
 public:
     CompressGraphicsDialog( Window* pParent, const Graphic& rGraphic, const Size& rViewSize100mm, SfxBindings& rBindings );
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index b1bdb6a..637af17 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -35,35 +35,67 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::beans;
 
 CompressGraphicsDialog::CompressGraphicsDialog( Window* pParent, const Graphic& rGraphic, const Size& rViewSize100mm, SfxBindings& rBindings ) :
-    ModalDialog       ( pParent, SVX_RES( RID_SVXDLG_COMPRESSGRAPHICS ) ),
-    m_aFixedText2X    ( this,    SVX_RES( FT_CG_2_X ) ),
-    m_aFixedText2     ( this,    SVX_RES( FT_CG_2 ) ),
-    m_aFixedText3X    ( this,    SVX_RES( FT_CG_3_X ) ),
-    m_aFixedText3     ( this,    SVX_RES( FT_CG_3 ) ),
-    m_aFixedText4X    ( this,    SVX_RES( FT_CG_4_X ) ),
-    m_aFixedText4     ( this,    SVX_RES( FT_CG_4 ) ),
-    m_aFixedText5X    ( this,    SVX_RES( FT_CG_5_X ) ),
-    m_aFixedText5     ( this,    SVX_RES( FT_CG_5 ) ),
-    m_aFixedText6X    ( this,    SVX_RES( FT_CG_6_X ) ),
-    m_aFixedText6     ( this,    SVX_RES( FT_CG_6 ) ),
-    m_aResolutionLB   ( this,    SVX_RES( LB_CG_RESOLUTION ) ),
-    m_aMFQuality      ( this,    SVX_RES( MF_CG_QUALITY ) ),
-    m_aLossless       ( this,    SVX_RES( CB_CG_LOSSLESS ) ),
-    m_aBtnOK          ( this,    SVX_RES( BUTTON_CG_OK ) ),
-    m_aBtnCancel      ( this,    SVX_RES( BUTTON_CG_CANCEL ) ),
-    m_aBtnHelp        ( this,    SVX_RES( BUTTON_CG_HELP ) ),
-    m_aBtnCalculate   ( this,    SVX_RES( BUTTON_CG_CALCULATE ) ),
-    m_aGraphic        ( rGraphic ),
-    m_aViewSize100mm  ( rViewSize100mm ),
-    m_rBindings       ( rBindings )
+    ModalDialog             ( pParent, SVX_RES( RID_SVXDLG_COMPRESSGRAPHICS ) ),
+    m_aImageDetailsFL       ( this,    SVX_RES( FL_IMAGE_DETAILS ) ),
+    m_aFixedText2X          ( this,    SVX_RES( FT_CG_2_X ) ),
+    m_aFixedText2           ( this,    SVX_RES( FT_CG_2 ) ),
+    m_aFixedText3X          ( this,    SVX_RES( FT_CG_3_X ) ),
+    m_aFixedText3           ( this,    SVX_RES( FT_CG_3 ) ),
+    m_aFixedText5X          ( this,    SVX_RES( FT_CG_5_X ) ),
+    m_aFixedText5           ( this,    SVX_RES( FT_CG_5 ) ),
+    m_aFixedText6X          ( this,    SVX_RES( FT_CG_6_X ) ),
+    m_aFixedText6           ( this,    SVX_RES( FT_CG_6 ) ),
+    m_aSettingsFL           ( this,    SVX_RES( FL_SETTINGS ) ),
+    m_aReduceResolutionCB   ( this,    SVX_RES( CB_REDUCE_IMAGE_RESOLUTION ) ),
+    m_aNewWidthFT           ( this,    SVX_RES( FT_NEW_WIDTH ) ),
+    m_aMFNewWidth           ( this,    SVX_RES( MF_NEW_WIDTH ) ),
+    m_aNewHeightFT          ( this,    SVX_RES( FT_NEW_HEIGHT ) ),
+    m_aMFNewHeight          ( this,    SVX_RES( MF_NEW_HEIGHT ) ),
+    m_aResolutionFT         ( this,    SVX_RES( FT_RESOLUTION ) ),
+    m_aResolutionLB         ( this,    SVX_RES( LB_RESOLUTION ) ),
+    m_aFixedTextDPI         ( this,    SVX_RES( FT_DPI ) ),
+    m_aLosslessRB           ( this,    SVX_RES( RB_LOSSLESS_COMPRESSION ) ),
+    m_aJpegCompRB           ( this,    SVX_RES( RB_JPEG_COMPRESSION ) ),
+    m_aCompressionMF        ( this,    SVX_RES( MF_COMPRESSION_FACTOR ) ),
+    m_aCompressionFT        ( this,    SVX_RES( FT_COMPRESSION ) ),
+    m_aQualityMF            ( this,    SVX_RES( MF_QUALITY_FACTOR ) ),
+    m_aQualityFT            ( this,    SVX_RES( FT_QUALITY ) ),
+    m_aCropCB               ( this,    SVX_RES( CB_CROP ) ),
+    m_aBtnOK                ( this,    SVX_RES( BUTTON_CG_OK ) ),
+    m_aBtnCancel            ( this,    SVX_RES( BUTTON_CG_CANCEL ) ),
+    m_aBtnHelp              ( this,    SVX_RES( BUTTON_CG_HELP ) ),
+    m_aBtnCalculate         ( this,    SVX_RES( BUTTON_CG_CALCULATE ) ),
+    m_aGraphic              ( rGraphic ),
+    m_aViewSize100mm        ( rViewSize100mm ),
+    m_rBindings             ( rBindings )
 {
     FreeResource();
 
     SetStyle(GetStyle() | WB_CENTER | WB_VCENTER);
-    m_aMFQuality.SetValue( 90L );
-    m_aResolutionLB.SetText(String("96 DPI"));
+
+    m_aQualityMF.SetValue( 90L );
+    m_aCompressionMF.SetValue( 9L );
+
+    m_aMFNewWidth.SetModifyHdl( LINK( this, CompressGraphicsDialog, NewWidthModifiedHdl ));
+    m_aMFNewHeight.SetModifyHdl( LINK( this, CompressGraphicsDialog, NewHeightModifiedHdl ));
+
+    m_dResolution = 96.0;
+
     m_aResolutionLB.SetModifyHdl( LINK( this, CompressGraphicsDialog, ResolutionModifiedHdl ));
-    m_aBtnCalculate.SetClickHdl(  LINK( this, CompressGraphicsDialog, ClickHdl ) );
+    m_aBtnCalculate.SetClickHdl(  LINK( this, CompressGraphicsDialog, CalculateClickHdl ) );
+
+    m_aLosslessRB.SetToggleHdl( LINK( this, CompressGraphicsDialog, ToggleCompressionRB ) );
+    m_aJpegCompRB.SetToggleHdl( LINK( this, CompressGraphicsDialog, ToggleCompressionRB ) );
+
+    m_aReduceResolutionCB.SetToggleHdl( LINK( this, CompressGraphicsDialog, ToggleReduceResolutionRB ) );
+
+
+    m_aLosslessRB.Check();
+    m_aReduceResolutionCB.Check();
+
+    UpdateNewWidthMF();
+    UpdateNewHeightMF();
+    UpdateResolutionLB();
     Update();
 }
 
@@ -108,9 +140,8 @@ void CompressGraphicsDialog::Update()
     aViewSizeString += ( " DPI" ) ;
     m_aFixedText3.SetText(aViewSizeString);
 
-    int aResolution = m_aResolutionLB.GetText().ToInt32();
-    int nPixelX = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100 * aResolution );
-    int nPixelY = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100 * aResolution );
+    int nPixelX = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100 * m_dResolution );
+    int nPixelY = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100 * m_dResolution );
 
     SvMemoryStream aMemStream;
     aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
@@ -118,15 +149,6 @@ void CompressGraphicsDialog::Update()
     aMemStream.Seek( STREAM_SEEK_TO_END );
     sal_Int32 aNativeSize = aMemStream.Tell();
 
-    String aCompressedSizeString;
-    aCompressedSizeString += UniString::CreateFromInt32(nPixelX);
-    aCompressedSizeString += String( " x " ) ;
-    aCompressedSizeString += UniString::CreateFromInt32(nPixelY);
-    aCompressedSizeString += ( " at " ) ;
-    aCompressedSizeString += UniString::CreateFromInt32(aResolution);
-    aCompressedSizeString += ( " DPI" ) ;
-    m_aFixedText4.SetText(aCompressedSizeString);
-
     String aNativeSizeString;
     aNativeSizeString += UniString::CreateFromInt32(aNativeSize / 1024);
     aNativeSizeString += String( " kiB" ) ;
@@ -135,52 +157,113 @@ void CompressGraphicsDialog::Update()
     m_aFixedText6.SetText(String("??"));
 }
 
+void CompressGraphicsDialog::UpdateNewWidthMF()
+{
+    int nPixelX = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100 * m_dResolution );
+    m_aMFNewWidth.SetText( UniString::CreateFromInt32( nPixelX ) );
+}
+
+void CompressGraphicsDialog::UpdateNewHeightMF()
+{
+    int nPixelY = (sal_Int32)((double)MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100 * m_dResolution );
+    m_aMFNewHeight.SetText( UniString::CreateFromInt32( nPixelY ) );
+}
+
+void CompressGraphicsDialog::UpdateResolutionLB()
+{
+    m_aResolutionLB.SetText( UniString::CreateFromInt32( (sal_Int32) m_dResolution ) );
+}
+
+IMPL_LINK_NOARG( CompressGraphicsDialog, NewWidthModifiedHdl )
+{
+    int aNewPixelWidth = m_aMFNewWidth.GetValue();
+    double aViewWidthInch = (double) MetricField::ConvertValue(m_aViewSize100mm.Width(),  2, MAP_100TH_MM, FUNIT_INCH) / 100;
+    m_dResolution =  aNewPixelWidth / aViewWidthInch;
+
+    UpdateNewHeightMF();
+    UpdateResolutionLB();
+    Update();
+
+    return 0L;
+}
+
+IMPL_LINK_NOARG( CompressGraphicsDialog, NewHeightModifiedHdl )
+{
+    int aNewPixelHeight = m_aMFNewHeight.GetValue();
+    double aViewHeightInch = (double) MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100;
+    m_dResolution =  aNewPixelHeight / aViewHeightInch;
+
+    UpdateNewWidthMF();
+    UpdateResolutionLB();
+    Update();
+
+    return 0L;
+}
+
 IMPL_LINK_NOARG( CompressGraphicsDialog, ResolutionModifiedHdl )
 {
+    m_dResolution = (double) m_aResolutionLB.GetText().ToInt32();
+
+    UpdateNewWidthMF();
+    UpdateNewHeightMF();
     Update();
+
     return 0L;
 }
 
-IMPL_LINK_NOARG( CompressGraphicsDialog, ClickHdl )
+IMPL_LINK_NOARG( CompressGraphicsDialog, ToggleCompressionRB )
+{
+    bool choice = m_aLosslessRB.IsChecked();
+    m_aCompressionMF.Enable(choice);
+    m_aQualityMF.Enable(!choice);
+
+    return 0L;
+}
+
+IMPL_LINK_NOARG( CompressGraphicsDialog, ToggleReduceResolutionRB )
+{
+    bool choice = m_aReduceResolutionCB.IsChecked();
+    m_aMFNewWidth.Enable(choice);
+    m_aMFNewHeight.Enable(choice);
+    m_aResolutionLB.Enable(choice);
+
+    return 0L;
+}
+
+IMPL_LINK_NOARG( CompressGraphicsDialog, CalculateClickHdl )
 {
-    int aResolution = m_aResolutionLB.GetText().ToInt32();
     sal_Int32 aSize = 0;
 
-    if ( aResolution > 0  )
+    if ( m_dResolution > 0  )
     {
-        long nPixelX = (long)((double) MetricField::ConvertValue(m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * (double) aResolution );
-        long nPixelY = (long)((double) MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * (double) aResolution );
+        long nPixelX = (long)((double) MetricField::ConvertValue(m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * m_dResolution );
+        long nPixelY = (long)((double) MetricField::ConvertValue(m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * m_dResolution );
 
         BitmapEx bitmap = m_aGraphic.GetBitmapEx();
-        bitmap.Scale(Size(nPixelX, nPixelY), BMP_SCALE_BEST);
-        Graphic aScaledGraphic = Graphic (bitmap);
+        if ( m_aReduceResolutionCB.IsChecked() )
+        {
+            bitmap.Scale( Size( nPixelX, nPixelY ), BMP_SCALE_BEST );
+        }
+        Graphic aScaledGraphic = Graphic( bitmap );
         GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
         Sequence< PropertyValue > aFilterData( 3 );
         aFilterData[ 0 ].Name = "Interlaced";
         aFilterData[ 0 ].Value <<= (sal_Int32) 0;
         aFilterData[ 1 ].Name = "Compression";
-        aFilterData[ 1 ].Value <<= (sal_Int32) 9;
+        aFilterData[ 1 ].Value <<= (sal_Int32) m_aCompressionMF.GetValue();
         aFilterData[ 2 ].Name = "Quality";
-        aFilterData[ 2 ].Value <<= (sal_Int32) m_aMFQuality.GetValue();
+        aFilterData[ 2 ].Value <<= (sal_Int32) m_aQualityMF.GetValue();
 
         SvMemoryStream aMemStream;
         aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
 
-        if ( m_aLossless.IsChecked() )
-        {
-            sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( String( "png" ) );
-            rFilter.ExportGraphic( aScaledGraphic, String("test.png"), aMemStream, nFilterFormat, &aFilterData );
-            aMemStream.Seek( STREAM_SEEK_TO_END );
-            aSize = aMemStream.Tell();
-        }
-        else
-        {
-            sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( String( "jpg" ) );
-            rFilter.ExportGraphic( aScaledGraphic, String("test.jpg"), aMemStream, nFilterFormat, &aFilterData );
-            aMemStream.Seek( STREAM_SEEK_TO_END );
-            aSize = aMemStream.Tell();
-        }
+        String aGraphicFormatName = m_aLosslessRB.IsChecked() ? String( "png" ) : String( "jpg" );
+
+        sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( aGraphicFormatName );
+        rFilter.ExportGraphic( aScaledGraphic, String( "test" ), aMemStream, nFilterFormat, &aFilterData );
+        aMemStream.Seek( STREAM_SEEK_TO_END );
+        aSize = aMemStream.Tell();
     }
 
     if ( aSize > 0 )
@@ -195,12 +278,10 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, ClickHdl )
 
 Graphic CompressGraphicsDialog::GetCompressedGraphic()
 {
-    int aResolution = m_aResolutionLB.GetText().ToInt32();
-
-    if ( aResolution > 0  )
+    if ( m_dResolution > 0  )
     {
-        long nPixelX = (long)((double) MetricField::ConvertValue( m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * (double) aResolution );
-        long nPixelY = (long)((double) MetricField::ConvertValue( m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * (double) aResolution );
+        long nPixelX = (long)((double) MetricField::ConvertValue( m_aViewSize100mm.Width(),   2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * m_dResolution );
+        long nPixelY = (long)((double) MetricField::ConvertValue( m_aViewSize100mm.Height(),  2, MAP_100TH_MM, FUNIT_INCH) / 100.0 * m_dResolution );
 
         BitmapEx bitmap = m_aGraphic.GetBitmapEx();
         bitmap.Scale(Size(nPixelX, nPixelY), BMP_SCALE_BEST);
@@ -211,28 +292,21 @@ Graphic CompressGraphicsDialog::GetCompressedGraphic()
         aFilterData[ 0 ].Name = "Interlaced";
         aFilterData[ 0 ].Value <<= (sal_Int32) 0;
         aFilterData[ 1 ].Name = "Compression";
-        aFilterData[ 1 ].Value <<= (sal_Int32) 9;
+        aFilterData[ 1 ].Value <<= (sal_Int32) m_aCompressionMF.GetValue();
         aFilterData[ 2 ].Name = "Quality";
-        aFilterData[ 2 ].Value <<= (sal_Int32) m_aMFQuality.GetValue();
+        aFilterData[ 2 ].Value <<= (sal_Int32) m_aQualityMF.GetValue();
 
         SvMemoryStream aMemStream;
         aMemStream.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
         Graphic aResultGraphic = Graphic ();
 
-        if ( m_aLossless.IsChecked() )
-        {
-            sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( String( "png" ) );
-            rFilter.ExportGraphic( aScaledGraphic, String("test.png"), aMemStream, nFilterFormat, &aFilterData );
-            aMemStream.Seek( STREAM_SEEK_TO_BEGIN );
-            rFilter.ImportGraphic( aResultGraphic, String("test.png"), aMemStream );
-        }
-        else
-        {
-            sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( String( "jpg" ) );
-            rFilter.ExportGraphic( aScaledGraphic, String("test.jpg"), aMemStream, nFilterFormat, &aFilterData );
-            aMemStream.Seek( STREAM_SEEK_TO_BEGIN );
-            rFilter.ImportGraphic( aResultGraphic, String("test.jpg"), aMemStream );
-        }
+        String aGraphicFormatName = m_aLosslessRB.IsChecked() ? String( "png" ) : String( "jpg" );
+
+        sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(aGraphicFormatName );
+        rFilter.ExportGraphic( aScaledGraphic, String("test"), aMemStream, nFilterFormat, &aFilterData );
+        aMemStream.Seek( STREAM_SEEK_TO_BEGIN );
+        rFilter.ImportGraphic( aResultGraphic, String("test"), aMemStream );
+
         return aResultGraphic;
     }
     return m_aGraphic;
diff --git a/svx/source/dialog/compressgraphicdialog.hrc b/svx/source/dialog/compressgraphicdialog.hrc
index 1b94aa4..a0925f1 100644
--- a/svx/source/dialog/compressgraphicdialog.hrc
+++ b/svx/source/dialog/compressgraphicdialog.hrc
@@ -18,28 +18,38 @@
 #ifndef _COMPRESS_GRAPHICS_DIALOG_HRC
 #define _COMPRESS_GRAPHICS_DIALOG_HRC
 
-#define FT_CG_2 2
-#define FT_CG_2_X 3
-
-#define FT_CG_3 4
-#define FT_CG_3_X 5
-
-#define FT_CG_4 6
-#define FT_CG_4_X 7
-
-#define FT_CG_5 8
-#define FT_CG_5_X 9
-
-#define FT_CG_6 10
-#define FT_CG_6_X 11
-
-#define LB_CG_RESOLUTION 20
-#define MF_CG_QUALITY 21
-#define CB_CG_LOSSLESS 22
-
-#define BUTTON_CG_OK           30
-#define BUTTON_CG_CANCEL       31
-#define BUTTON_CG_HELP         32
-#define BUTTON_CG_CALCULATE    33
+#define FL_IMAGE_DETAILS    1
+#define FT_CG_2             2
+#define FT_CG_2_X           3
+#define FT_CG_3             4
+#define FT_CG_3_X           5
+#define FT_CG_5             8
+#define FT_CG_5_X           9
+#define FT_CG_6             10
+#define FT_CG_6_X           11
+
+#define FL_SETTINGS                 20
+
+#define CB_REDUCE_IMAGE_RESOLUTION  21
+#define FT_NEW_WIDTH                22
+#define MF_NEW_WIDTH                23
+#define FT_NEW_HEIGHT               24
+#define MF_NEW_HEIGHT               25
+#define FT_RESOLUTION               26
+#define LB_RESOLUTION               27
+#define FT_DPI                      28
+
+#define RB_LOSSLESS_COMPRESSION     29
+#define RB_JPEG_COMPRESSION         30
+#define FT_COMPRESSION              31
+#define MF_COMPRESSION_FACTOR       32
+#define FT_QUALITY                  33
+#define MF_QUALITY_FACTOR           34
+#define CB_CROP                     35
+
+#define BUTTON_CG_OK           40
+#define BUTTON_CG_CANCEL       41
+#define BUTTON_CG_HELP         42
+#define BUTTON_CG_CALCULATE    43
 
 #endif
diff --git a/svx/source/dialog/compressgraphicdialog.src b/svx/source/dialog/compressgraphicdialog.src
index a336fd1..3ec2e64 100644
--- a/svx/source/dialog/compressgraphicdialog.src
+++ b/svx/source/dialog/compressgraphicdialog.src
@@ -25,102 +25,209 @@ ModalDialog RID_SVXDLG_COMPRESSGRAPHICS
     HelpID = "svx:ModalDialog:RID_SVXDLG_COMPRESSGRAPHICS";
     OutputSize = TRUE ;
     SVLook = TRUE ;
-    Size = MAP_APPFONT ( 226 , 200 ) ;
+    Size = MAP_APPFONT ( 242 , 200 ) ;
     Moveable = TRUE ;
     Sizeable = TRUE ;
     Closeable = TRUE ;
     Hide = TRUE ;
     Text [ en-US ] = "Compress Graphics" ;
 
+    FixedLine FL_IMAGE_DETAILS
+    {
+        Pos = MAP_APPFONT ( 6 , 0 ) ;
+        Size = MAP_APPFONT ( 164 , 12 ) ;
+        Text[ en-US ] = "Image Details";
+    };
+
     FixedText FT_CG_2_X
     {
-        Pos = MAP_APPFONT ( 6 , 8 ) ;
+        Pos = MAP_APPFONT ( 6 , 12 ) ;
         Size = MAP_APPFONT ( 50 , 10 ) ;
         Text [ en-US ] = "Original Size:" ;
     };
 
     FixedText FT_CG_2
     {
-        Pos = MAP_APPFONT ( 56 , 8 ) ;
+        Pos = MAP_APPFONT ( 56 , 12 ) ;
         Size = MAP_APPFONT ( 124 , 10 ) ;
     };
 
     FixedText FT_CG_3_X
     {
-        Pos = MAP_APPFONT ( 6 , 20 ) ;
+        Pos = MAP_APPFONT ( 6 , 24 ) ;
         Size = MAP_APPFONT ( 50 , 10 ) ;
         Text [ en-US ] = "View Size:" ;
     };
 
     FixedText FT_CG_3
     {
-        Pos = MAP_APPFONT ( 56 , 20 ) ;
-        Size = MAP_APPFONT ( 124 , 10 ) ;
-    };
-
-    FixedText FT_CG_4_X
-    {
-        Pos = MAP_APPFONT ( 6 , 32 ) ;
-        Size = MAP_APPFONT ( 50 , 10 ) ;
-        Text [ en-US ] = "Compressed Size:" ;
-    };
-
-    FixedText FT_CG_4
-    {
-        Pos = MAP_APPFONT ( 56 , 32 ) ;
+        Pos = MAP_APPFONT ( 56 , 24 ) ;
         Size = MAP_APPFONT ( 124 , 10 ) ;
     };
 
     FixedText FT_CG_5_X
     {
-        Pos = MAP_APPFONT ( 6 , 44 ) ;
+        Pos = MAP_APPFONT ( 6 , 36 ) ;
         Size = MAP_APPFONT ( 50 , 10 ) ;
         Text [ en-US ] = "Image Capacity:" ;
     };
 
     FixedText FT_CG_5
     {
-        Pos = MAP_APPFONT ( 56 , 44 ) ;
+        Pos = MAP_APPFONT ( 56 , 36 ) ;
         Size = MAP_APPFONT ( 124 , 10 ) ;
     };
 
     FixedText FT_CG_6_X
     {
-        Pos = MAP_APPFONT ( 6 , 56 ) ;
+        Pos = MAP_APPFONT ( 6 , 48 ) ;
         Size = MAP_APPFONT ( 50 , 10 ) ;
         Text [ en-US ] = "New Capacity:" ;
     };
 
     FixedText FT_CG_6
     {
-        Pos = MAP_APPFONT ( 56 , 56 ) ;
+        Pos = MAP_APPFONT ( 56 , 48 ) ;
         Size = MAP_APPFONT ( 124 , 10 ) ;
     };
 
-    ComboBox LB_CG_RESOLUTION
+     FixedLine FL_SETTINGS
+    {
+        Pos = MAP_APPFONT ( 6 , 60 ) ;
+        Size = MAP_APPFONT ( 164 , 12 ) ;
+        Text[ en-US ] = "Settings";
+    };
+
+    CheckBox CB_REDUCE_IMAGE_RESOLUTION
+    {
+        Pos = MAP_APPFONT ( 6 , 72 ) ;
+        Size = MAP_APPFONT ( 118 , 10 ) ;
+        Text [ en-US ] = "Reduce Image Resolution";
+    };
+
+    FixedText FT_NEW_WIDTH
+    {
+        Pos = MAP_APPFONT ( 16 , 85 ) ;
+        Size = MAP_APPFONT ( 20 , 12 ) ;
+        Text [ en-US ] = "Width:" ;
+    };
+
+    MetricField MF_NEW_WIDTH
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 36, 84 ) ;
+        Size = MAP_APPFONT ( 30 , 12 ) ;
+        TabStop = TRUE ;
+        Repeat = TRUE ;
+        Spin = TRUE ;
+        Maximum = 9999 ;
+        Last = 9999 ;
+        SpinSize = 1 ;
+        Unit = FUNIT_CUSTOM ;
+    };
+
+    FixedText FT_NEW_HEIGHT
+    {
+        Pos = MAP_APPFONT ( 72 , 85 ) ;
+        Size = MAP_APPFONT ( 20 , 12 ) ;
+        Text [ en-US ] = "Height:" ;
+    };
+
+    MetricField MF_NEW_HEIGHT
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 98, 84 ) ;
+        Size = MAP_APPFONT ( 30 , 12 ) ;
+        TabStop = TRUE ;
+        Repeat = TRUE ;
+        Spin = TRUE ;
+        Maximum = 9999 ;
+        Last = 9999 ;
+        SpinSize = 1 ;
+        Unit = FUNIT_CUSTOM ;
+    };
+
+    FixedText FT_RESOLUTION
+    {
+        Pos = MAP_APPFONT ( 16 , 97 ) ;
+        Size = MAP_APPFONT ( 34 , 12 ) ;
+        Text [ en-US ] = "Resolution:" ;
+    };
+
+    ComboBox LB_RESOLUTION
     {
         HelpID = "sfx2:ListBox:TP_COMMONPRINTOPTIONS:LB_REDUCEBITMAPS_RESOLUTION";
         TabStop = TRUE;
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 6, 68 ) ;
-        Size = MAP_APPFONT ( 60, 100 ) ;
+        Pos = MAP_APPFONT ( 50, 96 ) ;
+        Size = MAP_APPFONT ( 30, 50 ) ;
         DropDown = TRUE;
         StringList [ en-US ] =
         {
-            "75 DPI";
-            "96 DPI";
-            "150 DPI";
-            "200 DPI";
-            "300 DPI";
-            "600 DPI";
+            "75";
+            "96";
+            "150";
+            "200";
+            "300";
+            "600";
         };
     };
+    FixedText FT_DPI
+    {
+        Pos = MAP_APPFONT ( 81 , 97 ) ;
+        Size = MAP_APPFONT ( 20 , 12 ) ;
+        Text [ en-US ] = "DPI" ;
+    };
+
+    RadioButton RB_LOSSLESS_COMPRESSION
+    {
+        HelpID = "filter:RadioButton:RID_SVXDLG_COMPRESSGRAPHICS:RB_LOSSLESS_COMPRESSION";
+        Pos = MAP_APPFONT ( 6, 108 ) ;
+        Size = MAP_APPFONT ( 158 , 10 ) ;
+        Text[ en-US ] = "~Lossless compression";
+    };
+
+    FixedText FT_COMPRESSION
+    {
+        Pos = MAP_APPFONT ( 16 , 120 ) ;
+        Size = MAP_APPFONT ( 40 , 12 ) ;
+        Text [ en-US ] = "Compression:" ;
+    };
+
+    MetricField MF_COMPRESSION_FACTOR
+    {
+        Border = TRUE ;
+        Pos = MAP_APPFONT ( 56, 120 ) ;
+        Size = MAP_APPFONT ( 30 , 12 ) ;
+        TabStop = TRUE ;
+        Repeat = TRUE ;
+        Spin = TRUE ;
+        Maximum = 9 ;
+        Last = 9 ;
+        SpinSize = 1 ;
+        Unit = FUNIT_CUSTOM ;
+    };
+
+    RadioButton RB_JPEG_COMPRESSION
+    {
+        HelpID = "filter:RadioButton:RID_SVXDLG_COMPRESSGRAPHICS:RB_JPEG_COMPRESSION";
+        Pos = MAP_APPFONT ( 6, 132 ) ;
+        Size = MAP_APPFONT ( 158 , 10 ) ;
+        Text[ en-US ] = "~JPEG compression";
+    };
+
+    FixedText FT_QUALITY
+    {
+        Pos = MAP_APPFONT ( 16 , 144 ) ;
+        Size = MAP_APPFONT ( 40 , 12 ) ;
+        Text [ en-US ] = "Quality:" ;
+    };
 
-    MetricField MF_CG_QUALITY
+    MetricField MF_QUALITY_FACTOR
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT ( 70, 68 ) ;
-        Size = MAP_APPFONT ( 29 , 12 ) ;
+        Pos = MAP_APPFONT ( 56, 144 ) ;
+        Size = MAP_APPFONT ( 30 , 12 ) ;
         TabStop = TRUE ;
         Repeat = TRUE ;
         Spin = TRUE ;
@@ -130,35 +237,35 @@ ModalDialog RID_SVXDLG_COMPRESSGRAPHICS
         Unit = FUNIT_PERCENT ;
     };
 
-    CheckBox CB_CG_LOSSLESS
+    CheckBox CB_CROP
     {
-        Pos = MAP_APPFONT ( 6 , 80 ) ;
+        Pos = MAP_APPFONT ( 6 , 156 ) ;
         Size = MAP_APPFONT ( 118 , 10 ) ;
-        Text [ en-US ] = "Lossless";
+        Text [ en-US ] = "Crop";
     };
 
     OKButton BUTTON_CG_OK
     {
-        Pos = MAP_APPFONT ( 170 , 6 ) ;
+        Pos = MAP_APPFONT ( 186 , 6 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
         DefButton = TRUE ;
     };
 
     CancelButton BUTTON_CG_CANCEL
     {
-        Pos = MAP_APPFONT ( 170 , 23 ) ;
+        Pos = MAP_APPFONT ( 186 , 23 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
     };
 
     HelpButton BUTTON_CG_HELP
     {
-        Pos = MAP_APPFONT ( 170 , 43 ) ;
+        Pos = MAP_APPFONT ( 186 , 43 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
     };
 
     PushButton BUTTON_CG_CALCULATE
     {
-        Pos = MAP_APPFONT ( 170 , 63 ) ;
+        Pos = MAP_APPFONT ( 186 , 63 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
         Text [ en-US ] = "Calculate";
     };


More information about the Libreoffice-commits mailing list