Kaydet (Commit) fdb7fe63 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Compress graphics dialog converted to new widget layout.

Change-Id: Iff1ffba10c5aaf3d438acf0a69467a0ac9e0f7cf
üst 38364f5a
......@@ -226,18 +226,14 @@ void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& )
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
CompressGraphicsDialog dialog( GetViewData()->GetDialogParent(), aGraphicObject.GetGraphic(), pObj->GetLogicRect().GetSize(), GetViewData()->GetBindings() );
SdrGrafObj* pGraphicObj = (SdrGrafObj*) pObj;
CompressGraphicsDialog dialog( GetViewData()->GetDialogParent(), pGraphicObj, GetViewData()->GetBindings() );
if ( dialog.Execute() == RET_OK )
{
SdrGrafObj* pNewObject = (SdrGrafObj*) pObj->Clone();
const Graphic aNewGraphic = dialog.GetCompressedGraphic();
SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
SdrPageView* pPageView = pView->GetSdrPageView();
pNewObject->SetEmptyPresObj( sal_False );
pNewObject->SetGraphic( aNewGraphic );
String aUndoString( pView->GetDescriptionOfMarkedObjects() );
aUndoString += (sal_Unicode) ' ';
aUndoString += String( "Compress" );
aUndoString += String( " Compress" );
pView->BegUndo( aUndoString );
pView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
pView->EndUndo();
......
......@@ -1017,25 +1017,20 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
SdrGrafObj* pGraphicObj = (SdrGrafObj*) pObj;
CompressGraphicsDialog dialog( GetParentWindow(), pGraphicObj, GetViewFrame()->GetBindings() );
if ( dialog.Execute() == RET_OK )
{
CompressGraphicsDialog dialog( GetParentWindow(), aGraphicObject.GetGraphic(), pObj->GetLogicRect().GetSize(), GetViewFrame()->GetBindings() );
if ( dialog.Execute() == RET_OK )
{
SdrGrafObj* pNewObject = (SdrGrafObj*) pObj->Clone();
const Graphic aNewGraphic = dialog.GetCompressedGraphic();
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
pNewObject->SetEmptyPresObj( sal_False );
pNewObject->SetGraphic( aNewGraphic );
String aUndoString( mpDrawView->GetDescriptionOfMarkedObjects() );
aUndoString += (sal_Unicode) ( ' ' );
aUndoString += String( "Compress" );
mpDrawView->BegUndo( aUndoString );
mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
mpDrawView->EndUndo();
}
SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj();
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
String aUndoString( mpDrawView->GetDescriptionOfMarkedObjects() );
aUndoString += String( " Compress" );
mpDrawView->BegUndo( aUndoString );
mpDrawView->ReplaceObjectAtView( pObj, *pPageView, pNewObject );
mpDrawView->EndUndo();
}
}
}
......
......@@ -51,7 +51,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
svx/source/dialog/bmpmask.src \
svx/source/dialog/contdlg.src \
svx/source/dialog/ctredlin.src \
svx/source/dialog/compressgraphicdialog.src \
svx/source/dialog/dlgctrl.src \
svx/source/dialog/docrecovery.src \
svx/source/dialog/fontwork.src \
......
......@@ -30,6 +30,7 @@ $(eval $(call gb_Module_add_targets,svx,\
Package_globlmn_hrc \
Package_inc \
Package_sdi \
UI_svx \
))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_UI_UI,svx))
$(eval $(call gb_UI_add_uifiles,svx,\
svx/source/dialog/compressgraphicdialog \
))
# vim: set noet sw=4 ts=4:
......@@ -30,43 +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_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;
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;
PushButton m_aBtnCalculate;
FixedText* m_aFixedText2;
FixedText* m_aFixedText3;
FixedText* m_aFixedText5;
FixedText* m_aFixedText6;
CheckBox* m_aReduceResolutionCB;
NumericField* m_aMFNewWidth;
NumericField* m_aMFNewHeight;
ComboBox* m_aResolutionLB;
RadioButton* m_aLosslessRB;
RadioButton* m_aJpegCompRB;
NumericField* m_aCompressionMF;
NumericField* m_aQualityMF;
PushButton* m_aBtnCalculate;
ListBox* m_aInterpolationCombo;
SdrGrafObj* m_pGraphicObj;
Graphic m_aGraphic;
Size m_aViewSize100mm;
Rectangle m_aCropRectangle;
SfxBindings& m_rBindings;
double m_dResolution;
void Initialize();
DECL_LINK( NewWidthModifiedHdl, void* );
DECL_LINK( NewHeightModifiedHdl, void* );
DECL_LINK( ResolutionModifiedHdl, void* );
......@@ -82,15 +71,18 @@ private:
void Compress(SvStream& aStream);
double GetViewWidthInch();
double GetViewHeightInch();
sal_uLong GetSelectedInterpolationType();
public:
CompressGraphicsDialog( Window* pParent, const Graphic& rGraphic, const Size& rViewSize100mm, SfxBindings& rBindings );
CompressGraphicsDialog( Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings );
CompressGraphicsDialog( Window* pParent, const Graphic& rGraphic, Size& rViewSize100mm, Rectangle& rCropRectangle, SfxBindings& rBindings );
virtual ~CompressGraphicsDialog();
Graphic GetCompressedGraphic();
SdrGrafObj* GetCompressedSdrGrafObj();
Graphic& GetCompressedGraphic();
};
#endif
......
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* 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_HRC
#define _COMPRESS_GRAPHICS_DIALOG_HRC
#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
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svx/dialogs.hrc>
#include "helpid.hrc"
#include "compressgraphicdialog.hrc"
ModalDialog RID_SVXDLG_COMPRESSGRAPHICS
{
HelpID = "svx:ModalDialog:RID_SVXDLG_COMPRESSGRAPHICS";
OutputSize = TRUE ;
SVLook = TRUE ;
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 , 12 ) ;
Size = MAP_APPFONT ( 50 , 10 ) ;
Text [ en-US ] = "Original Size:" ;
};
FixedText FT_CG_2
{
Pos = MAP_APPFONT ( 56 , 12 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
};
FixedText FT_CG_3_X
{
Pos = MAP_APPFONT ( 6 , 24 ) ;
Size = MAP_APPFONT ( 50 , 10 ) ;
Text [ en-US ] = "View Size:" ;
};
FixedText FT_CG_3
{
Pos = MAP_APPFONT ( 56 , 24 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
};
FixedText FT_CG_5_X
{
Pos = MAP_APPFONT ( 6 , 36 ) ;
Size = MAP_APPFONT ( 50 , 10 ) ;
Text [ en-US ] = "Image Capacity:" ;
};
FixedText FT_CG_5
{
Pos = MAP_APPFONT ( 56 , 36 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
};
FixedText FT_CG_6_X
{
Pos = MAP_APPFONT ( 6 , 48 ) ;
Size = MAP_APPFONT ( 50 , 10 ) ;
Text [ en-US ] = "New Capacity:" ;
};
FixedText FT_CG_6
{
Pos = MAP_APPFONT ( 56 , 48 ) ;
Size = MAP_APPFONT ( 124 , 10 ) ;
};
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 ( 50, 96 ) ;
Size = MAP_APPFONT ( 30, 50 ) ;
DropDown = TRUE;
StringList [ en-US ] =
{
"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_QUALITY_FACTOR
{
Border = TRUE ;
Pos = MAP_APPFONT ( 56, 144 ) ;
Size = MAP_APPFONT ( 30 , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
Spin = TRUE ;
Maximum = 99 ;
Last = 99 ;
SpinSize = 1 ;
Unit = FUNIT_PERCENT ;
};
CheckBox CB_CROP
{
Pos = MAP_APPFONT ( 6 , 156 ) ;
Size = MAP_APPFONT ( 118 , 10 ) ;
Text [ en-US ] = "Crop";
};
OKButton BUTTON_CG_OK
{
Pos = MAP_APPFONT ( 186 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE ;
};
CancelButton BUTTON_CG_CANCEL
{
Pos = MAP_APPFONT ( 186 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton BUTTON_CG_HELP
{
Pos = MAP_APPFONT ( 186 , 43 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
PushButton BUTTON_CG_CALCULATE
{
Pos = MAP_APPFONT ( 186 , 63 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "Calculate";
};
};
This diff is collapsed.
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