sc/source/ui/drawfunc/graphsh.cxx    |    1 
 sd/inc/app.hrc                       |    1 
 sd/inc/sdcommands.h                  |    1 
 sd/inc/sdgrffilter.hxx               |    7 -
 sd/sdi/_drvwsh.sdi                   |    2 
 sd/sdi/sdraw.sdi                     |   27 -----
 sd/source/filter/grf/sdgrffilter.cxx |  176 ----------------------------------
 sd/source/ui/app/menuids_tmpl.src    |    9 -
 sd/source/ui/app/popup2_tmpl.src     |    2 
 sd/source/ui/app/strings.src         |    4 
 sd/source/ui/inc/strings.hrc         |   16 +--
 sd/source/ui/view/drviews2.cxx       |   14 +-
 sd/source/ui/view/drviewsj.cxx       |    4 
 svx/AllLangResTarget_svx.mk          |    3 
 svx/Library_svxcore.mk               |    3 
 svx/Package_inc.mk                   |    1 
 svx/inc/globlmn_tmpl.hrc             |    5 
 svx/inc/svx/dialogs.hrc              |    6 -
 svx/inc/svx/extedit.hxx              |    2 
 svx/inc/svx/graphichelper.hxx        |   45 ++++++++
 svx/inc/svx/svxids.hrc               |    3 
 svx/sdi/svx.sdi                      |   24 ++++
 svx/source/core/extedit.cxx          |   34 ------
 svx/source/core/graphichelper.cxx    |  178 +++++++++++++++++++++++++++++++++++
 svx/source/core/graphichelper.src    |   24 ++++
 sw/inc/cmdid.h                       |    3 
 sw/inc/swcommands.h                  |    1 
 sw/sdi/_grfsh.sdi                    |    2 
 sw/sdi/swriter.sdi                   |   24 ----
 sw/source/ui/app/mn.src              |   12 --
 sw/source/ui/docvw/docvw.hrc         |    3 
 sw/source/ui/docvw/docvw.src         |    4 
 sw/source/ui/docvw/romenu.cxx        |  131 -------------------------
 sw/source/ui/shells/grfsh.cxx        |   10 -
 34 files changed, 323 insertions(+), 459 deletions(-)

New commits:
commit d82a77197cab00258e1e2b370c931d69f1e24fa2
Author: Tomaž Vajngerl <qui...@gmail.com>
Date:   Sun Jul 1 17:43:57 2012 +0200

    Combine popup menu entries and IDs (SID_SAVE_GRAPHIC)
    
    Change-Id: I9d0e4f31d073ad416934358c6507dc6564754758

diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 67636c9..71aabc1 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -372,7 +372,6 @@
 #define SID_NOTES_MASTERPAGE                (SID_SD_START+350)
 #define SID_TITLE_MASTERPAGE                (SID_SD_START+351)
 #define SID_INSERTPAGE_QUICK                (SID_SD_START+352)
-#define SID_SAVEGRAPHIC                     (SID_SD_START+353)
 // free
 #define SID_INSERT_FLD_DATE_VAR             (SID_SD_START+357)
 #define SID_INSERT_FLD_DATE_FIX             (SID_SD_START+358)
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
index cee596e..02839d1 100644
--- a/sd/inc/sdcommands.h
+++ b/sd/inc/sdcommands.h
@@ -89,7 +89,6 @@
 #define CMD_SID_NOTESMODE                           ".uno:NotesMode"
 #define CMD_SID_POSITION                            ".uno:ObjectPosition"
 #define CMD_SID_ORIGINAL_SIZE                       ".uno:OriginalSize"
-#define CMD_SID_SAVEGRAPHIC                         ".uno:SaveGraphic"
 #define CMD_SID_OUTLINEMODE                         ".uno:OutlineMode"
 #define CMD_SID_OUTLINE_TEXT_AUTOFIT                ".uno.OutlineTextAutofit"
 #define CMD_SID_PAGESETUP                           ".uno:PageSetup"
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 018e7d0..7cb4c10 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -70,7 +70,7 @@ interface DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
-    SID_SAVEGRAPHIC
+    SID_SAVE_GRAPHIC
     [
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 4b6ddae..03208aa 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -4729,31 +4729,6 @@ SfxVoidItem OriginalSize SID_ORIGINAL_SIZE
 ]
 
 //--------------------------------------------------------------------------
-SfxVoidItem SaveGraphic SID_SAVEGRAPHIC
-()
-[
-    /* flags: */
-    AutoUpdate = FALSE,
-    Cachable = Cachable,
-    FastCall = FALSE,
-    HasCoreId = FALSE,
-    HasDialog = FALSE,
-    ReadOnlyDoc = TRUE,
-    Toggle = FALSE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-    Synchron;
-
-    /* config: */
-    AccelConfig = FALSE,
-    MenuConfig = FALSE,
-    StatusBarConfig = FALSE,
-    ToolBoxConfig = FALSE,
-    GroupId = GID_MODIFY;
-]
-
-//--------------------------------------------------------------------------
 SfxBoolItem OutlineMode SID_OUTLINEMODE
 
 [
@@ -7210,5 +7185,3 @@ SfxVoidItem TaskPaneShowPanel SID_SHOW_TOOL_PANEL (
     ToolBoxConfig = FALSE,
     GroupId = GID_VIEW;
 ]
-
-
diff --git a/sd/source/ui/app/menuids_tmpl.src 
b/sd/source/ui/app/menuids_tmpl.src
index 604e952..5bd1663 100644
--- a/sd/source/ui/app/menuids_tmpl.src
+++ b/sd/source/ui/app/menuids_tmpl.src
@@ -846,14 +846,6 @@
         Text [ en-US ] = "~Original Size" ; \
     };
 
-#define MN_SAVEGRAPHIC\
-    MenuItem\
-    {\
-        Identifier = SID_SAVEGRAPHIC ; \
-        HelpId = CMD_SID_SAVEGRAPHIC ; \
-        Text [ en-US ] = "Save as Picture..." ; \
-    };
-
 #define MN_CROP\
     MenuItem\
     {\
@@ -1197,4 +1189,3 @@
         HelpId = CMD_SID_STYLE_EDIT ; \
         Text [ en-US ] = "Edit Style..." ; \
     };
-
diff --git a/sd/source/ui/app/popup2_tmpl.src b/sd/source/ui/app/popup2_tmpl.src
index a1ded7c..abf4115 100644
--- a/sd/source/ui/app/popup2_tmpl.src
+++ b/sd/source/ui/app/popup2_tmpl.src
@@ -658,7 +658,7 @@
         SEPARATOR
         MN_STYLEDT
         SEPARATOR
-        MN_SAVEGRAPHIC
+        MenuItem { ITEM_SAVE_GRAPHIC };
     };
 };
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c9f49e6..a33b12b 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -931,7 +931,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         }
         break;
 
-        case SID_SAVEGRAPHIC:
+        case SID_SAVE_GRAPHIC:
         {
             const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
             if( rMarkList.GetMarkCount() == 1 )
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index 10be9e1..d6f2055 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -118,7 +118,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
             SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_BEHIND_OBJ ) ||
             SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REVERSE_ORDER ) ||
             SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ORIGINAL_SIZE ) ||
-             SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVEGRAPHIC ) ||
+            SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SAVE_GRAPHIC ) ||
             SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
         {
             const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
@@ -139,7 +139,7 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
 
             if ( !( pObj->ISA( SdrGrafObj ) ) )
             {
-                rSet.DisableItem(SID_SAVEGRAPHIC);
+                rSet.DisableItem(SID_SAVE_GRAPHIC);
             }
 
             // Wenn es sich um kein Gruppenobjekt oder 3D-Objekt handelt
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc
index e85bd91..8ab7e4b 100644
--- a/svx/inc/globlmn_tmpl.hrc
+++ b/svx/inc/globlmn_tmpl.hrc
@@ -262,6 +262,11 @@
     Command = ".uno:ExternalEdit" ; \
     Text [ en-US ] = "Edit with External Tool..." ; \
 
+#define ITEM_SAVE_GRAPHIC \
+    Identifier = SID_SAVE_GRAPHIC ; \
+    Command = ".uno:SaveGraphic" ; \
+    Text [ en-US ] = "Save Graphic..." ; \
+
 #define ITEM_VIEW_ATTR_ZOOM \
     Identifier = SID_ATTR_ZOOM ; \
     Command = ".uno:Zoom" ; \
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index db8753e..eef88b6 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -957,9 +957,10 @@
 #define SID_INSERT_FORM_HSCROLL                         (SID_SVX_START+1112)
 #define SID_EXTERNAL_EDIT                               (SID_SVX_START+1113)
 #define SID_ATTR_PAGE_SHARED_FIRST                      (SID_SVX_START+1114)
+#define SID_SAVE_GRAPHIC                                (SID_SVX_START+1115)
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               (SID_EXTERNAL_EDIT + 1)
+#define SID_SVX_FIRSTFREE                               (SID_SAVE_GRAPHIC + 1)
 
 // --------------------------------------------------------------------------
 // Overflow check for slot IDs
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 8b168c8..5344e17 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5972,6 +5972,30 @@ SfxVoidItem ExternalEdit SID_EXTERNAL_EDIT
     GroupId = GID_GRAPHIC;
 ]
 
+SfxVoidItem SaveGraphic SID_SAVE_GRAPHIC
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_MODIFY;
+]
+
 //--------------------------------------------------------------------------
 SfxBoolItem Init3D SID_3D_INIT
 
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 97ebfc5..80349f5 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -668,8 +668,7 @@ included in c-context files, so c++ style stuff will cause 
problems.
 #define FN_FORMAT_APPLY_DEFAULT             (FN_FORMAT2 + 157)
 #define FN_FORMAT_APPLY_TEXTBODY            (FN_FORMAT2 + 158)
 #define FN_REMOVE_DIRECT_CHAR_FORMATS       (FN_FORMAT2 + 159)
-
-#define FN_SAVE_GRAPHIC                     (FN_FORMAT2 + 160)
+//free (160)
 
 /*--------------------------------------------------------------------
     Region: Extras
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index 69e546c..85a94eb 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -47,7 +47,6 @@
 #define CMD_FN_EDIT_FOOTNOTE                        ".uno:EditFootnote"
 #define CMD_FN_FORMAT_FRAME_DLG                     ".uno:FrameDialog"
 #define CMD_FN_FORMAT_GRAFIC_DLG                    ".uno:GraphicDialog"
-#define CMD_FN_SAVE_GRAPHIC                         ".uno:SaveGraphic"
 #define CMD_FN_NUM_BULLET_UP                        ".uno:IncrementLevel"
 #define CMD_FN_EDIT_IDX_ENTRY_DLG                   ".uno:IndexEntryDialog"
 #define CMD_FN_INSERT_FLD_AUTHOR                    ".uno:InsertAuthorField"
diff --git a/sw/sdi/_grfsh.sdi b/sw/sdi/_grfsh.sdi
index 42d9666..678cf28 100644
--- a/sw/sdi/_grfsh.sdi
+++ b/sw/sdi/_grfsh.sdi
@@ -52,7 +52,7 @@ interface BaseTextGraphic
     ]
 
 
-    FN_SAVE_GRAPHIC // status(final|play)
+    SID_SAVE_GRAPHIC
     [
         ExecMethod = Execute ;
         StateMethod = GetAttrState ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 7e9680e..28e0233 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3437,30 +3437,6 @@ SfxVoidItem GraphicDialog FN_FORMAT_GRAFIC_DLG
     ToolBoxConfig = TRUE,
     GroupId = GID_GRAPHIC;
 ]
-//--------------------------------------------------------------------------
-SfxVoidItem SaveGraphic FN_SAVE_GRAPHIC
-()
-[
-    /* flags: */
-    AutoUpdate = FALSE,
-    Cachable = Cachable,
-    FastCall = FALSE,
-    HasCoreId = FALSE,
-    HasDialog = FALSE,
-    ReadOnlyDoc = TRUE,
-    Toggle = FALSE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-    Synchron;
-
-    /* config: */
-    AccelConfig = TRUE,
-    MenuConfig = TRUE,
-    StatusBarConfig = FALSE,
-    ToolBoxConfig = TRUE,
-    GroupId = GID_GRAPHIC;
-]
 
 //--------------------------------------------------------------------------
 SfxVoidItem Grow FN_GROW_FONT_SIZE
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 8b31291..837fb1f 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -1280,18 +1280,10 @@ Menu MN_GRF_POPUPMENU
             HelpId = CMD_FN_FORMAT_GRAFIC_DLG ;
             Text [ en-US ] = "~Picture..." ;
         };
-        MenuItem
-        {
-            Identifier = FN_SAVE_GRAPHIC;
-            HelpId = CMD_FN_SAVE_GRAPHIC;
-            Text [ en-US ] = "Save Graphics..." ;
-        };
         MN_FRM_CAPTION_ITEM
         SEPARATOR;
-        MenuItem
-        {
-           ITEM_EXTERNAL_EDIT
-        };
+        MenuItem { ITEM_SAVE_GRAPHIC };
+        MenuItem { ITEM_EXTERNAL_EDIT };
         SEPARATOR;
         MenuItem
         {
diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc
index f137d2a..7792db6 100644
--- a/sw/source/ui/docvw/docvw.hrc
+++ b/sw/source/ui/docvw/docvw.hrc
@@ -25,7 +25,7 @@
 #define MN_READONLY_OPENURL             (RC_DOCVW_BEGIN + 2)
 #define MN_READONLY_OPENURLNEW          (RC_DOCVW_BEGIN + 3)
 #define MN_READONLY_EDITDOC             (RC_DOCVW_BEGIN + 4)
-    // FREE, formerly known as MN_READONLY_BROWSE_STOP
+// free (5)
 #define MN_READONLY_BROWSE_BACKWARD     (RC_DOCVW_BEGIN + 6)
 #define MN_READONLY_BROWSE_FORWARD      (RC_DOCVW_BEGIN + 7)
 #define MN_READONLY_SELECTION_MODE      (RC_DOCVW_BEGIN + 8)
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 06caa06..984568c 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -113,7 +113,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
             GetView().ExecuteScan( rReq );
             break;
         }
-        case FN_SAVE_GRAPHIC:
+        case SID_SAVE_GRAPHIC:
         {
             const Graphic *pGraphic;
             if(0 != (pGraphic = rSh.GetGraphic()))
@@ -554,14 +554,11 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
             if( bParentCntProt || !bIsGrfCntnt )
                 bDisable = sal_True;
             break;
-        case FN_SAVE_GRAPHIC:
+        case SID_SAVE_GRAPHIC:
             if( rSh.GetGraphicType() == GRAPHIC_NONE )
                 bDisable = sal_True;
         break;
         case SID_EXTERNAL_EDIT:
-            /*
-             * If the Graphic is None type it should be externally editable
-             */
             if( rSh.GetGraphicType() == GRAPHIC_NONE )
                 bDisable = sal_True;
         break;
commit 982db7bc6b82185202fb1a31ab29398b68c75073
Author: Tomaž Vajngerl <qui...@gmail.com>
Date:   Sun Jul 1 16:46:25 2012 +0200

    Move "save graphic" dialog title to svx.
    
    Change-Id: I1200e66f010525d989bed801240de6813ddf751c

diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index 75b2339..fde9c9b 100644
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -1069,10 +1069,6 @@ String STR_TITLE_RENAMESLIDE
 {
     Text [ en-US ] = "Rename Slide";
 };
-String STR_TITLE_SAVE_AS_PICTURE
-{
-    Text [ en-US ] = "Save as Picture";
-};
 String STR_DESC_RENAMESLIDE
 {
     Text [ en-US ] = "Name";
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
index 7adefbf..7ac6784 100644
--- a/sd/source/ui/inc/strings.hrc
+++ b/sd/source/ui/inc/strings.hrc
@@ -397,7 +397,7 @@
 #define STR_TASKPANEL_LAYOUT_MENU_TITLE                 (RID_APP_START+713)
 #define STR_GRAPHICS_STYLE_FAMILY                       (RID_APP_START+715)
 
-#define STR_TITLE_SAVE_AS_PICTURE                       (RID_APP_START+716)
+// free
 #define STR_CELL_STYLE_FAMILY                           (RID_APP_START+717)
 
 #define STR_NAVIGATOR_SHOW_NAMED_SHAPES                 (RID_APP_START+718)
@@ -410,14 +410,14 @@
 #define STR_INSERT_PICTURE                              (RID_APP_START+724)
 #define STR_INSERT_MOVIE                                (RID_APP_START+725)
 
-#define STRING_DRAG_AND_DROP_PAGES                     (RID_APP_START+726)
-#define STRING_DRAG_AND_DROP_SLIDES                    (RID_APP_START+727)
-#define STRING_START_SLIDESHOW                         (RID_APP_START+728)
-#define STRING_HIDE_SLIDE                              (RID_APP_START+729)
-#define STRING_SHOW_SLIDE                              (RID_APP_START+730)
-#define STRING_DUPLICATE_SLIDE                         (RID_APP_START+731)
+#define STRING_DRAG_AND_DROP_PAGES          (RID_APP_START+726)
+#define STRING_DRAG_AND_DROP_SLIDES         (RID_APP_START+727)
+#define STRING_START_SLIDESHOW              (RID_APP_START+728)
+#define STRING_HIDE_SLIDE               (RID_APP_START+729)
+#define STRING_SHOW_SLIDE               (RID_APP_START+730)
+#define STRING_DUPLICATE_SLIDE              (RID_APP_START+731)
 
-#define STR_ACC_DIALOG_DESC                            (RID_APP_START+732)
+#define STR_ACC_DIALOG_DESC                     (RID_APP_START+732)
 
 /******************************************************************************
 * The ids in glob.hrc start at RID_APP_START+750!
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index cf152d7..cae5703 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -2,7 +2,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2011 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -56,6 +56,7 @@ $(eval $(call gb_SrsTarget_set_include,svx/res,\
 
 $(eval $(call gb_SrsTarget_add_files,svx/res,\
     svx/source/accessibility/accessibility.src \
+    svx/source/core/graphichelper.src \
     svx/source/dialog/bmpmask.src \
     svx/source/dialog/contdlg.src \
     svx/source/dialog/ctredlin.src \
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index f95678e..fce189b 100644
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -136,7 +136,7 @@
 #define RID_SW_TP_OPTTABLE_PAGE         (RID_OFA_START + 210)
 #define RID_SW_TP_REDLINE_OPT           (RID_OFA_START + 212)
 #define RID_SW_TP_OPTCOMPATIBILITY_PAGE (RID_OFA_START + 255)
-#define RID_SW_TP_COMPARISON_OPT               (RID_OFA_START + 257)
+#define RID_SW_TP_COMPARISON_OPT        (RID_OFA_START + 257)
 #define RID_SW_TP_HTML_CONTENT_OPT      (RID_OFA_START + 240)
 #define RID_SW_TP_HTML_OPTPRINT_PAGE    (RID_OFA_START + 242)
 #define RID_SW_TP_HTML_OPTTABLE_PAGE    (RID_OFA_START + 243)
@@ -237,7 +237,6 @@
 #define RID_SVXBMP_FONTWORK_FORM11          (RID_SVX_START + 104)
 #define RID_SVXBMP_FONTWORK_FORM12          (RID_SVX_START + 105)
 
-
 #define RID_SVXCTRL_COLOR                   (RID_SVX_START + 117)
 
 // for Toolbox-Control style
@@ -867,7 +866,8 @@
 #define RID_SVXSTR_ACCESSIBILITY_START      (RID_SVX_START + 860)
 //      RID_SVXSTR_ACCESSIBILITY_END        (RID_SVX_START + 950)
 
-// 984: free
+#define RID_SVXSTR_EXPORT_GRAPHIC_TITLE     (RID_SVX_START + 984)
+
 #define RID_SVXFLOAT_EXTRUSION_DIRECTION    (RID_SVX_START + 985)
 
 #define RID_SVX_EXTRUSION_BAR               (RID_SVX_START + 986)
diff --git a/svx/source/core/graphichelper.cxx 
b/svx/source/core/graphichelper.cxx
index faec3b2..3e73c99 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -33,6 +33,8 @@
 #include <sfx2/docfile.hxx>
 #include <svx/xoutbmp.hxx>
 #include <sfx2/filedlghelper.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
 
 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
@@ -85,10 +87,8 @@ String GraphicHelper::ExportGraphic( const Graphic 
&rGraphic, const String &rGrf
 
     // fish out the graphic's name
     String aName = rGrfName;
-    printf("Name: %s\n", aName.GetBuffer());
 
-    //aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
-    aDlgHelper.SetTitle( String("Title") );
+    aDlgHelper.SetTitle( SVX_RESSTR(RID_SVXSTR_EXPORT_GRAPHIC_TITLE));
     aDlgHelper.SetDisplayDirectory( 
aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
     INetURLObject aURL;
     aURL.SetSmartURL( aName );
diff --git a/svx/source/core/graphichelper.src 
b/svx/source/core/graphichelper.src
new file mode 100644
index 0000000..44b8810
--- /dev/null
+++ b/svx/source/core/graphichelper.src
@@ -0,0 +1,24 @@
+/*
+ * 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>
+
+String RID_SVXSTR_EXPORT_GRAPHIC_TITLE
+{
+    Text [ en-US ] = "Graphics Export" ;
+};
diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc
index 25571d9..f137d2a 100644
--- a/sw/source/ui/docvw/docvw.hrc
+++ b/sw/source/ui/docvw/docvw.hrc
@@ -48,7 +48,6 @@
 #define MN_READONLY_BACKGROUNDTOGALLERY (RC_DOCVW_BEGIN + 60)
 
 
-#define STR_EXPORT_GRAFIK_TITLE         (RC_DOCVW_BEGIN + 1)
 #define STR_CHAIN_OK                    (RC_DOCVW_BEGIN + 2)
 #define STR_CHAIN_NOT_EMPTY             (RC_DOCVW_BEGIN + 3)
 #define STR_CHAIN_IS_IN_CHAIN           (RC_DOCVW_BEGIN + 4)
diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src
index 6787306..9ea90f7 100644
--- a/sw/source/ui/docvw/docvw.src
+++ b/sw/source/ui/docvw/docvw.src
@@ -199,10 +199,6 @@ Menu MN_READONLY_POPUP
         };
     };
 };
-String STR_EXPORT_GRAFIK_TITLE
-{
-    Text [ en-US ] = "Graphics Export" ;
-};
 String STR_CHAIN_OK
 {
     Text [ en-US ] = "Click the left mouse button to link the frames." ;
commit 8c1aafe8c20b6de8e13b4ce0eb34bb1b1f04fc0f
Author: Tomaž Vajngerl <qui...@gmail.com>
Date:   Sat Jun 30 23:46:33 2012 +0200

    Change "Save graphic" and "Save picture as" to common code.
    
    Change-Id: Id860b3220bde3d43eec7c74711e6938e68d01d56

diff --git a/sc/source/ui/drawfunc/graphsh.cxx 
b/sc/source/ui/drawfunc/graphsh.cxx
index 92a2899..f2258e8 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -173,7 +173,6 @@ void ScGraphicShell::GetExternalEditState( SfxItemSet& rSet 
)
     ScDrawView* pView = GetViewData()->GetScDrawView();
     const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     bool bEnable = false;
-    printf("ZO!\n");
     if( rMarkList.GetMarkCount() == 1 )
     {
         SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx
index f6eddc0..6f20cf9 100644
--- a/sd/inc/sdgrffilter.hxx
+++ b/sd/inc/sdgrffilter.hxx
@@ -36,11 +36,10 @@ public:
 
     virtual ~SdGRFFilter (void);
 
-    sal_Bool        Import();
-    sal_Bool        Export();
+    sal_Bool    Import();
+    sal_Bool    Export();
 
-    static void             SaveGraphic( const 
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
-    static void             HandleGraphicFilterError( sal_uInt16 nFilterError, 
sal_uLong nStreamError = ERRCODE_NONE );
+    static void HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong 
nStreamError = ERRCODE_NONE );
 };
 
 #endif // _SD_SDGRFFILTER_HXX
diff --git a/sd/source/filter/grf/sdgrffilter.cxx 
b/sd/source/filter/grf/sdgrffilter.cxx
index 2ad8a7a..67307a5 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -59,11 +59,7 @@
 // --
 #include <comphelper/processfactory.hxx>
 #include <unotools/pathoptions.hxx>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <sfx2/filedlghelper.hxx>
-#include <tools/urlobj.hxx>
 #include <svtools/filter.hxx>
 #include <svx/xoutbmp.hxx>
 
@@ -379,176 +375,4 @@ sal_Bool SdGRFFilter::Export()
     return bRet;
 }
 
-void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< 
::com::sun::star::drawing::XShape >& xShape )
-{
-    try
-    {
-        Reference< XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
-
-        Reference< XGraphicProvider > xProvider( 
GraphicProvider::create(xContext) );
-        Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW );
-
-        // detect mime type of graphic
-        OUString aMimeType;
-        OUString sGraphicURL;
-
-        // first try to detect from graphic object
-        Reference< XPropertySet > xGraphicSet( xShapeSet->getPropertyValue( 
"Graphic" ), UNO_QUERY_THROW );
-        xShapeSet->getPropertyValue( "GraphicURL" ) >>= sGraphicURL;
-
-        bool bIsLinked = !sGraphicURL.isEmpty() && 
sGraphicURL.equals("vnd.sun.star.GraphicObject:");
-
-        if( !bIsLinked )
-               xGraphicSet->getPropertyValue( "MimeType" ) >>= aMimeType;
-
-        if( bIsLinked || aMimeType == "image/x-vclgraphic" || 
aMimeType.isEmpty() )
-        {
-            // this failed, try to detect it from graphic stream and URL
-            OUString aURL( sGraphicURL );
-
-            if( aURL.isEmpty() )
-                xShapeSet->getPropertyValue( "GraphicStreamURL" ) >>= aURL;
-
-            {
-                Reference< XInputStream > xGraphStream( 
xShapeSet->getPropertyValue( "GraphicStream" ), UNO_QUERY );
-                PropertyValues aDesc(2);
-                aDesc[0].Name = "URL";
-                aDesc[0].Value <<= aURL;
-                aDesc[1].Name = "InputStream";
-                aDesc[1].Value <<= xGraphStream;
-
-                Reference< XPropertySet > xDescSet( 
xProvider->queryGraphicDescriptor( aDesc ), UNO_QUERY_THROW );
-
-                xDescSet->getPropertyValue( "MimeType" ) >>= aMimeType;
-            }
-        }
-
-        if( aMimeType == "image/x-vclgraphic" || aMimeType.isEmpty() )
-        {
-            // this also failed, now set a mimetype that fits graphic best
-
-            // gif for animated pixel
-            // png for non animated pixel
-            // svm for vector format
-            sal_Int8 nGraphicType = 0;
-            xGraphicSet->getPropertyValue( "GraphicType" ) >>= nGraphicType;
-            switch( nGraphicType )
-            {
-            case ::com::sun::star::graphic::GraphicType::VECTOR:
-                aMimeType = "image/x-svm";
-                break;
-
-            case ::com::sun::star::graphic::GraphicType::PIXEL:
-                {
-                    sal_Bool bAnimated = sal_False;
-                    xGraphicSet->getPropertyValue( "Animated" ) >>= bAnimated;
-
-                    if( bAnimated )
-                    {
-                        aMimeType = "image/gif";
-                        break;
-                    }
-                }
-            default:
-                aMimeType = "image/png";
-                break;
-            }
-        }
-
-        // init dialog
-        SvtPathOptions aPathOpt;
-        String sGrfPath( aPathOpt.GetGraphicPath() );
-
-        FileDialogHelper aDlgHelper( 
TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
-        Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
-
-        String aTitle( SdResId( STR_TITLE_SAVE_AS_PICTURE ) );
-        aDlgHelper.SetTitle( aTitle );
-
-        INetURLObject aPath;
-        aPath.SetSmartURL( sGrfPath);
-        xFP->setDisplayDirectory( 
aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
-
-        // populate filter dialog filter list and select default filter to 
match graphic mime type
-
-        GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
-        Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
-        OUString aDefaultFormatName;
-        sal_uInt16 nCount = rGF.GetExportFormatCount();
-
-        std::map< OUString, OUString > aMimeTypeMap;
-
-        for ( sal_uInt16 i = 0; i < nCount; i++ )
-        {
-            const OUString aExportFormatName( rGF.GetExportFormatName( i ) );
-            const OUString aFilterMimeType( rGF.GetExportFormatMediaType( i ) 
);
-            xFltMgr->appendFilter( aExportFormatName, rGF.GetExportWildcard( i 
) );
-            aMimeTypeMap[ aExportFormatName ] = aFilterMimeType;
-            if( aMimeType == aFilterMimeType )
-                aDefaultFormatName = aExportFormatName;
-        }
-
-        if( aDefaultFormatName.isEmpty() )
-        {
-            nCount = rGF.GetImportFormatCount();
-            for( sal_uInt16 i = 0; i < nCount; i++ )
-            {
-                const OUString aFilterMimeType( rGF.GetImportFormatMediaType( 
i ) );
-                if( aMimeType == aFilterMimeType )
-                {
-                    aDefaultFormatName = rGF.GetImportFormatName( i );
-                    xFltMgr->appendFilter( aDefaultFormatName,  
rGF.GetImportWildcard( i ) );
-                    aMimeTypeMap[ aDefaultFormatName ] = aFilterMimeType;
-                    break;
-                }
-            }
-        }
-
-        if( aDefaultFormatName.isEmpty() )
-            aDefaultFormatName = "PNG - Portable Network Graphic";
-
-        xFltMgr->setCurrentFilter( aDefaultFormatName );
-
-        // execute dialog
-
-        if( aDlgHelper.Execute() == ERRCODE_NONE )
-        {
-            OUString sPath( xFP->getFiles().getConstArray()[0] );
-            aPath.SetSmartURL( sPath);
-            sGrfPath = aPath.GetPath();
-
-            OUString aExportMimeType( 
aMimeTypeMap[xFltMgr->getCurrentFilter()] );
-
-            Reference< XInputStream > xGraphStream;
-            if( aMimeType == aExportMimeType )
-                xShapeSet->getPropertyValue( "GraphicStream" ) >>= 
xGraphStream;
-
-            if( xGraphStream.is() )
-            {
-                Reference< XSimpleFileAccess2 > xFileAccess( 
SimpleFileAccess::create(xContext) );
-                xFileAccess->writeFile( sPath, xGraphStream );
-            }
-            else
-            {
-                PropertyValues aDesc(2);
-                aDesc[0].Name = "URL";
-                aDesc[0].Value <<= sPath;
-                aDesc[1].Name = "MimeType";
-                aDesc[1].Value <<= aExportMimeType;
-                Reference< XGraphic > xGraphic( xShapeSet->getPropertyValue( 
"Graphic" ), UNO_QUERY_THROW );
-                xProvider->storeGraphic( xGraphic, aDesc );
-            }
-        }
-    }
-    catch( Exception& )
-    {
-        OSL_FAIL(
-            (rtl::OString("SdGRFFilter::SaveGraphic(), "
-                    "exception caught: ") +
-            rtl::OUStringToOString(
-                comphelper::anyToString( cppu::getCaughtException() ),
-                RTL_TEXTENCODING_UTF8 )).getStr() );
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 5f20f72..c9f49e6 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -47,7 +47,7 @@
 #include <basic/sbstar.hxx>
 #include <editeng/flditem.hxx>
 #include <svx/xlineit0.hxx>
-
+#include <svx/graphichelper.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/xlnwtit.hxx>
 #include <svx/svdoattr.hxx>
@@ -936,11 +936,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
             if( rMarkList.GetMarkCount() == 1 )
             {
-                SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( 
rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
-                if(pGrafObj )
+                SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+                if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj 
)->GetGraphicType() == GRAPHIC_BITMAP )
                 {
-                    ::com::sun::star::uno::Reference< 
::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), 
com::sun::star::uno::UNO_QUERY );
-                    SdGRFFilter::SaveGraphic( xShape );
+                    GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj 
)->GetGraphicObject() );
+                    {
+                        GraphicHelper::ExportGraphic( 
aGraphicObject.GetGraphic(), String("") );
+                    }
                 }
             }
             Cancel();
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 8361ec1..3dfdc23 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -2,7 +2,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2011 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -93,6 +93,7 @@ $(eval $(call gb_Library_use_external,svxcore,icuuc))
 $(eval $(call gb_Library_add_exception_objects,svxcore,\
     svx/source/core/coreservices \
     svx/source/core/extedit \
+    svx/source/core/graphichelper \
     svx/source/customshapes/EnhancedCustomShape2d \
     svx/source/customshapes/EnhancedCustomShapeGeometry \
     svx/source/customshapes/EnhancedCustomShapeTypeNames \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index b6888d1..f5dcfb6 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -554,5 +554,6 @@ $(eval $(call 
gb_Package_add_file,svx_inc,inc/svx/colrctrl.hxx,svx/colrctrl.hxx)
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx))
 $(eval $(call 
gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/extedit.hxx,svx/extedit.hxx))
+$(eval $(call 
gb_Package_add_file,svx_inc,inc/svx/graphichelper.hxx,svx/graphichelper.hxx))
 
 # vim: set noet sw=4 ts=4:
diff --git a/svx/inc/svx/extedit.hxx b/svx/inc/svx/extedit.hxx
index b286ad8..3760c54 100644
--- a/svx/inc/svx/extedit.hxx
+++ b/svx/inc/svx/extedit.hxx
@@ -29,7 +29,7 @@
 #include <vcl/graph.hxx>
 #include <svtools/grfmgr.hxx>
 #include <vcl/timer.hxx>
-#include "svx/svxdllapi.h"
+#include <svx/svxdllapi.h>
 
 class SVX_DLLPUBLIC ExternalToolEdit
 {
diff --git a/svx/inc/svx/graphichelper.hxx b/svx/inc/svx/graphichelper.hxx
new file mode 100644
index 0000000..81600b5
--- /dev/null
+++ b/svx/inc/svx/graphichelper.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GRAPHICHELPER_HXX
+#define _GRAPHICHELPER_HXX
+
+#include <vcl/graph.hxx>
+#include <svx/svxdllapi.h>
+
+class SVX_DLLPUBLIC GraphicHelper
+{
+
+public:
+    static void GetPreferedExtension( String &rExt, const Graphic &rGrf );
+    static String ExportGraphic( const Graphic &rGraphic, const String 
&rGrfName );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index eddb16a..c52d0cf 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -23,6 +23,7 @@
  */
 
 #include <svx/extedit.hxx>
+#include <svx/graphichelper.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
 #include <osl/file.hxx>
@@ -96,37 +97,6 @@ void ExternalToolEdit::threadWorker(void* pThreadData)
     xSystemShellExecute->execute( pData->m_aFileName, rtl::OUString(),  
com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
 }
 
-
-void GetPreferedExtension( String &rExt, const Graphic &rGrf )
-{
-    // then propose the "best" filter using the native-info, if applicable
-    const sal_Char* pExt = "png";
-    switch( const_cast<Graphic&>(rGrf).GetLink().GetType() )
-    {
-        case GFX_LINK_TYPE_NATIVE_GIF:
-            pExt = "gif";
-            break;
-        case GFX_LINK_TYPE_NATIVE_TIF:
-            pExt = "tif";
-            break;
-        case GFX_LINK_TYPE_NATIVE_WMF:
-            pExt = "wmf";
-            break;
-        case GFX_LINK_TYPE_NATIVE_MET:
-            pExt = "met";
-            break;
-        case GFX_LINK_TYPE_NATIVE_PCT:
-            pExt = "pct";
-            break;
-        case GFX_LINK_TYPE_NATIVE_JPG:
-            pExt = "jpg";
-            break;
-        default:
-            break;
-    }
-    rExt.AssignAscii( pExt );
-}
-
 void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
 {
     //Get the graphic from the GraphicObject
@@ -135,7 +105,7 @@ void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
 
     //get the Preferred File Extension for this graphic
     String fExtension;
-    GetPreferedExtension(fExtension, aGraphic);
+    GraphicHelper::GetPreferedExtension(fExtension, aGraphic);
 
     //Create the temp File
     rtl::OUString tempFileBase, tempFileName;
diff --git a/svx/source/core/graphichelper.cxx 
b/svx/source/core/graphichelper.cxx
new file mode 100644
index 0000000..faec3b2
--- /dev/null
+++ b/svx/source/core/graphichelper.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/string.hxx>
+#include <svx/graphichelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/filter.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/xoutbmp.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
+
+void GraphicHelper::GetPreferedExtension( String &rExtension, const Graphic 
&rGraphic )
+{
+    // propose the "best" filter using the native-info, if applicable
+    const sal_Char* pExtension = "png";
+    switch( const_cast<Graphic&>( rGraphic ).GetLink().GetType() )
+    {
+        case GFX_LINK_TYPE_NATIVE_GIF:
+            pExtension = "gif";
+            break;
+        case GFX_LINK_TYPE_NATIVE_TIF:
+            pExtension = "tif";
+            break;
+        case GFX_LINK_TYPE_NATIVE_WMF:
+            pExtension = "wmf";
+            break;
+        case GFX_LINK_TYPE_NATIVE_MET:
+            pExtension = "met";
+            break;
+        case GFX_LINK_TYPE_NATIVE_PCT:
+            pExtension = "pct";
+            break;
+        case GFX_LINK_TYPE_NATIVE_JPG:
+            pExtension = "jpg";
+            break;
+        default:
+            break;
+    }
+    rExtension.AssignAscii( pExtension );
+}
+
+String GraphicHelper::ExportGraphic( const Graphic &rGraphic, const String 
&rGrfName )
+{
+    SvtPathOptions aPathOpt;
+    String sGrfPath( aPathOpt.GetGraphicPath() );
+
+    FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 
0 );
+    Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+    INetURLObject aPath;
+    aPath.SetSmartURL( sGrfPath );
+
+    // fish out the graphic's name
+    String aName = rGrfName;
+    printf("Name: %s\n", aName.GetBuffer());
+
+    //aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
+    aDlgHelper.SetTitle( String("Title") );
+    aDlgHelper.SetDisplayDirectory( 
aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+    INetURLObject aURL;
+    aURL.SetSmartURL( aName );
+    aDlgHelper.SetFileName( aURL.GetName() );
+
+    GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
+    const sal_uInt16 nCount = rGF.GetExportFormatCount();
+
+    String aExt( aURL.GetExtension() );
+    if( !aExt.Len() )
+        GetPreferedExtension( aExt, rGraphic );
+
+    aExt.ToLowerAscii();
+    sal_uInt16 nDfltFilter = USHRT_MAX;
+
+    Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+
+    for ( sal_uInt16 i = 0; i < nCount; i++ )
+    {
+        xFltMgr->appendFilter( rGF.GetExportFormatName( i ), 
rGF.GetExportWildcard( i ) );
+        if ( COMPARE_EQUAL == 
aExt.CompareIgnoreCaseToAscii(rGF.GetExportFormatShortName( i ).ToLowerAscii() 
))
+            nDfltFilter = i;
+    }
+    if ( USHRT_MAX == nDfltFilter )
+    {
+        // "wrong" extension?
+        GetPreferedExtension( aExt, rGraphic );
+        for ( sal_uInt16 i = 0; i < nCount; ++i )
+            if ( aExt == rGF.GetExportFormatShortName( i ).ToLowerAscii() )
+            {
+                nDfltFilter =  i;
+                break;
+            }
+    }
+
+    if( USHRT_MAX != nDfltFilter )
+    {
+        xFltMgr->setCurrentFilter( rGF.GetExportFormatName( nDfltFilter ) ) ;
+
+        if( aDlgHelper.Execute() == ERRCODE_NONE )
+        {
+            String sPath( xFP->getFiles().getConstArray()[0] );
+            // remember used path - please don't optimize away!
+            aPath.SetSmartURL( sPath);
+            sGrfPath = aPath.GetPath();
+
+            if( rGrfName.Len() &&
+                 nDfltFilter == rGF.GetExportFormatNumber( 
xFltMgr->getCurrentFilter()))
+            {
+                // try to save the original graphic
+                SfxMedium aIn( rGrfName, STREAM_READ | STREAM_NOCREATE );
+                if( aIn.GetInStream() && !aIn.GetInStream()->GetError() )
+                {
+                    SfxMedium aOut( sPath, STREAM_WRITE | 
STREAM_SHARE_DENYNONE);
+                    if( aOut.GetOutStream() && 
!aOut.GetOutStream()->GetError())
+                    {
+                        *aOut.GetOutStream() << *aIn.GetInStream();
+                        if ( 0 == aIn.GetError() )
+                        {
+                            aOut.Close();
+                            aOut.Commit();
+                            if ( 0 == aOut.GetError() )
+                                return sPath;
+                        }
+                    }
+                }
+            }
+
+            sal_uInt16 nFilter;
+            if ( !xFltMgr->getCurrentFilter().isEmpty() && 
rGF.GetExportFormatCount() )
+                nFilter = rGF.GetExportFormatNumber( 
xFltMgr->getCurrentFilter() );
+            else
+                nFilter = GRFILTER_FORMAT_DONTKNOW;
+            String aFilter( rGF.GetExportFormatShortName( nFilter ) );
+            XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter,
+                                        XOUTBMP_DONT_EXPAND_FILENAME|
+                                        XOUTBMP_DONT_ADD_EXTENSION|
+                                        XOUTBMP_USE_NATIVE_IF_POSSIBLE );
+            return sPath;
+        }
+    }
+    return String();
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx
index 068ec3e..607145c 100644
--- a/sw/source/ui/docvw/romenu.cxx
+++ b/sw/source/ui/docvw/romenu.cxx
@@ -28,25 +28,17 @@
 
 #include <hintids.hxx>
 
-
-#include <tools/urlobj.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/msgbox.hxx>
-#include <sot/formats.hxx>
 #include <svl/eitem.hxx>
 #include <svl/stritem.hxx>
-#include <unotools/pathoptions.hxx>
-#include <svtools/filter.hxx>
 #include <svtools/imap.hxx>
 #include <svtools/inetimg.hxx>
 #include <svtools/transfer.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/dispatch.hxx>
-#include <svx/xoutbmp.hxx>
 #include <svx/gallery.hxx>
+#include <svx/graphichelper.hxx>
 #include <editeng/brshitem.hxx>
 
-
 #include <frmatr.hxx>
 #include <fmturl.hxx>
 #include <fmtinfmt.hxx>
@@ -62,34 +54,12 @@
 #include <cmdid.h>
 #include <helpid.h>
 #include <docvw.hrc>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <sfx2/filedlghelper.hxx>
 
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star;
-using namespace ::com::sun::star::ui::dialogs;
 using namespace ::sfx2;
 
-void GetPreferedExtension( String &rExt, const Graphic &rGrf )
-{
-    // then propose the "best" filter using the native-info, if applicable
-    const sal_Char* pExt = "png";
-    switch( const_cast<Graphic&>(rGrf).GetLink().GetType() )
-    {
-        case GFX_LINK_TYPE_NATIVE_GIF:      pExt = "gif"; break;
-        case GFX_LINK_TYPE_NATIVE_TIF:      pExt = "tif"; break;
-        case GFX_LINK_TYPE_NATIVE_WMF:      pExt = "wmf"; break;
-        case GFX_LINK_TYPE_NATIVE_MET:      pExt = "met"; break;
-        case GFX_LINK_TYPE_NATIVE_PCT:      pExt = "pct"; break;
-        case GFX_LINK_TYPE_NATIVE_JPG:      pExt = "jpg"; break;
-        default:; //prevent warning
-    }
-    rExt.AssignAscii( pExt );
-}
-
 SwReadOnlyPopup::~SwReadOnlyPopup()
 {
     delete pImageMap;
@@ -403,104 +373,7 @@ String SwReadOnlyPopup::SaveGraphic( sal_uInt16 nId )
         else
             return aEmptyStr;
     }
-    return ExportGraphic( aGraphic, sGrfName );
-}
-
-String ExportGraphic( const Graphic &rGraphic, const String &rGrfName )
-{
-    SvtPathOptions aPathOpt;
-    String sGrfPath( aPathOpt.GetGraphicPath() );
-
-    FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 
0 );
-    Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
-
-    INetURLObject aPath;
-    aPath.SetSmartURL( sGrfPath );
-
-    // fish out the graphic's name
-    String aName = rGrfName;
-
-    aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
-    aDlgHelper.SetDisplayDirectory( 
aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
-    INetURLObject aURL;
-    aURL.SetSmartURL( aName );
-    aDlgHelper.SetFileName( aURL.GetName() );
-
-    GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
-    const sal_uInt16 nCount = rGF.GetExportFormatCount();
-
-    String aExt( aURL.GetExtension() );
-    if( !aExt.Len() )
-        GetPreferedExtension( aExt, rGraphic );
-
-    aExt.ToLowerAscii();
-    sal_uInt16 nDfltFilter = USHRT_MAX;
-
-    Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
-
-    for ( sal_uInt16 i = 0; i < nCount; i++ )
-    {
-        xFltMgr->appendFilter( rGF.GetExportFormatName( i ), 
rGF.GetExportWildcard( i ) );
-        if ( COMPARE_EQUAL == 
aExt.CompareIgnoreCaseToAscii(rGF.GetExportFormatShortName( i ).ToLowerAscii() 
))
-            nDfltFilter = i;
-    }
-    if ( USHRT_MAX == nDfltFilter )
-    {
-        // "wrong" extension?
-        GetPreferedExtension( aExt, rGraphic );
-        for ( sal_uInt16 i = 0; i < nCount; ++i )
-            if ( aExt == rGF.GetExportFormatShortName( i ).ToLowerAscii() )
-            {
-                nDfltFilter =  i;
-                break;
-            }
-    }
-
-    if( USHRT_MAX != nDfltFilter )
-    {
-        xFltMgr->setCurrentFilter( rGF.GetExportFormatName( nDfltFilter ) ) ;
-
-        if( aDlgHelper.Execute() == ERRCODE_NONE )
-        {
-            String sPath( xFP->getFiles().getConstArray()[0] );
-            // remember used path - please don't optimize away!
-            aPath.SetSmartURL( sPath);
-            sGrfPath = aPath.GetPath();
-
-            if( rGrfName.Len() &&
-                 nDfltFilter == rGF.GetExportFormatNumber( 
xFltMgr->getCurrentFilter()))
-            {
-                // try to save the original graphic
-                SfxMedium aIn( rGrfName, STREAM_READ | STREAM_NOCREATE );
-                if( aIn.GetInStream() && !aIn.GetInStream()->GetError() )
-                {
-                    SfxMedium aOut( sPath, STREAM_WRITE | 
STREAM_SHARE_DENYNONE);
-                    if( aOut.GetOutStream() && 
!aOut.GetOutStream()->GetError())
-                    {
-                        *aOut.GetOutStream() << *aIn.GetInStream();
-                        if ( 0 == aIn.GetError() )
-                        {
-                            aOut.Close();
-                            aOut.Commit();
-                            if ( 0 == aOut.GetError() )
-                                return sPath;
-                        }
-                    }
-                }
-            }
-
-            sal_uInt16 nFilter;
-            if ( !xFltMgr->getCurrentFilter().isEmpty() && 
rGF.GetExportFormatCount() )
-                nFilter = rGF.GetExportFormatNumber( 
xFltMgr->getCurrentFilter() );
-            else
-                nFilter = GRFILTER_FORMAT_DONTKNOW;
-            String aFilter( rGF.GetExportFormatShortName( nFilter ) );
-            XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter,
-                                        
XOUTBMP_DONT_EXPAND_FILENAME|XOUTBMP_DONT_ADD_EXTENSION );
-            return sPath;
-        }
-    }
-    return aEmptyStr;
+    return GraphicHelper::ExportGraphic( aGraphic, sGrfName );
 }
 
 
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index f472841..06caa06 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -71,6 +71,7 @@
 #include <shells.hrc>
 #include <popup.hrc>
 #include <svx/extedit.hxx>
+#include <svx/graphichelper.hxx>
 #define SwGrfShell
 #include <sfx2/msg.hxx>
 #include "swslots.hxx"
@@ -119,7 +120,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
             {
                 String sGrfNm, sFilterNm;
                 rSh.GetGrfNms( &sGrfNm, &sFilterNm );
-                ExportGraphic( *pGraphic, sGrfNm );
+                GraphicHelper::ExportGraphic( *pGraphic, sGrfNm );
             }
         }
         break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to