diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2012-07-08 23:36:30 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2012-07-09 00:07:22 +0200 |
commit | 4d7581b9075d826feebfb095310c74627314a484 (patch) | |
tree | 7966b832c69de8c422880afc9e46a334125527d2 /sd/source | |
parent | 9a7e4eac50523df3f24008430340635d7b870328 (diff) |
Compress Graphic functionallity added (currently only for Draw)
This is a initial commit of "Compress Graphics" functionallity.
Compress Graphics is accesible via pop-up menu option to graphics
objects. Currently this funtionallity is only available in Draw.
When the menu option is triggered, a Compress Graphics modal dialog
opens to define DPI, compression level and type of compression.
When OK is clicked, the graphics in Draw is compressed and exchanged.
The current implementation is not final as it needs handling in case
when the graphics is croped. Additionally cropped areas could be
removed when compressing, depending on a checkbox in the dialog.
Special cases of graphics need to be checked too, and some tests
would not hurt.
Change-Id: I9ec1a71f6ff4364a49b2521e42d88c3ba224dd87
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/app/popup2_tmpl.src | 1 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 34 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsj.cxx | 6 |
3 files changed, 39 insertions, 2 deletions
diff --git a/sd/source/ui/app/popup2_tmpl.src b/sd/source/ui/app/popup2_tmpl.src index abf411542ee3..67628796964c 100644 --- a/sd/source/ui/app/popup2_tmpl.src +++ b/sd/source/ui/app/popup2_tmpl.src @@ -659,6 +659,7 @@ MN_STYLEDT SEPARATOR MenuItem { ITEM_SAVE_GRAPHIC }; + MenuItem { ITEM_COMPRESS_GRAPHIC }; }; }; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index c4630c2831f2..75ff0f135d49 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -48,6 +48,7 @@ #include <editeng/flditem.hxx> #include <svx/xlineit0.hxx> #include <svx/graphichelper.hxx> +#include <svx/compressgraphicdialog.hxx> #include <svx/svdoutl.hxx> #include <svx/xlnwtit.hxx> #include <svx/svdoattr.hxx> @@ -949,6 +950,39 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_COMPRESS_GRAPHIC: + { + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + 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() ); + { + 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(); + } + } + } + } + Cancel(); + rReq.Ignore(); + } + break; + default: { // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index d6f2055e4ac5..0706bcdd4e58 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -71,9 +71,9 @@ namespace sd { void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { - // Status der Menueintraege, bzw. Buttons - // Einfachselektion + // Status of menu entries (Buttons,...) + // Single selection const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); sal_uLong nMarkCount = rMarkList.GetMarkCount(); @@ -119,6 +119,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REVERSE_ORDER ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ORIGINAL_SIZE ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVE_GRAPHIC ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COMPRESS_GRAPHIC ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) ) { const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -140,6 +141,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) if ( !( pObj->ISA( SdrGrafObj ) ) ) { rSet.DisableItem(SID_SAVE_GRAPHIC); + rSet.DisableItem(SID_COMPRESS_GRAPHIC); } // Wenn es sich um kein Gruppenobjekt oder 3D-Objekt handelt |