diff options
-rw-r--r-- | sc/inc/sc.hrc | 4 | ||||
-rw-r--r-- | sc/sdi/chartsh.sdi | 11 | ||||
-rw-r--r-- | sc/sdi/scalc.sdi | 34 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/chartsh.cxx | 55 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/objdraw.src | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/chartsh.hxx | 3 |
6 files changed, 98 insertions, 15 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index e47ee571890e..efec7ab11b6a 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -529,6 +529,9 @@ #define SID_NEW_SLOTS (SID_KEYFUNC_END) #define SID_NEW_TABLENAME (SID_NEW_SLOTS+1) + +#define SID_EXPORT_AS_GRAPHIC (SID_NEW_SLOTS+2) + #define FID_MERGE_TOGGLE (SID_NEW_SLOTS+10) #define SID_ATTR_ROWHEADERS (SID_NEW_SLOTS+11) #define SID_ATTR_COLHEADERS (SID_NEW_SLOTS+12) @@ -1126,4 +1129,3 @@ #define RID_SCPAGE_DEFAULTS (SC_OOO_BUILD_START + 10) #endif - diff --git a/sc/sdi/chartsh.sdi b/sc/sdi/chartsh.sdi index c050a7c59b82..ce000437afa4 100644 --- a/sc/sdi/chartsh.sdi +++ b/sc/sdi/chartsh.sdi @@ -16,7 +16,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - // =========================================================================== +interface ChartSelection +{ + SID_EXPORT_AS_GRAPHIC + [ + ExecMethod = ExecuteExportAsGraphic; + StateMethod = GetExportAsGraphicState; + ] +} + shell ScChartShell : ScDrawShell { + import ChartSelection; } diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 5b9cda68177d..14fb8cc980ca 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -24,7 +24,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -//-------------------------------------------------------------------------- + SfxVoidItem AcceptChanges FID_CHG_ACCEPT () [ @@ -2919,10 +2919,10 @@ SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER Synchron; /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, GroupId = GID_OPTIONS; ] @@ -8342,3 +8342,27 @@ SfxVoidItem EnterString SID_ENTER_STRING ToolBoxConfig = FALSE, GroupId = GID_INTERN; ] + +SfxVoidItem ExportAsGraphic SID_EXPORT_AS_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_CHART; +] diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx index 414063394aeb..251fa5d5b044 100644 --- a/sc/source/ui/drawfunc/chartsh.cxx +++ b/sc/source/ui/drawfunc/chartsh.cxx @@ -17,8 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <editeng/eeitem.hxx> -#include <svx/fontwork.hxx> +#include <svx/svdoole2.hxx> +#include <svx/svdobj.hxx> +#include <svx/graphichelper.hxx> + #include <svl/srchitem.hxx> #include <sfx2/app.hxx> #include <sfx2/objface.hxx> @@ -34,15 +36,13 @@ #include "docpool.hxx" #include "drawview.hxx" #include "scresid.hxx" -#include <svx/svdobj.hxx> #define ScChartShell #include "scslots.hxx" - SFX_IMPL_INTERFACE(ScChartShell, ScDrawShell, ScResId(SCSTR_CHARTSHELL) ) { - SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER, + SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_SERVER, ScResId(RID_DRAW_OBJECTBAR) ); SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_CHART) ); } @@ -52,14 +52,55 @@ TYPEINIT1( ScChartShell, ScDrawShell ); ScChartShell::ScChartShell(ScViewData* pData) : ScDrawShell(pData) { - SetHelpId(HID_SCSHELL_CHARTSH); - SetName(rtl::OUString("ChartObject")); + SetHelpId( HID_SCSHELL_CHARTSH ); + SetName( OUString("ChartObject") ); } ScChartShell::~ScChartShell() { } +void ScChartShell::GetExportAsGraphicState( SfxItemSet& rSet ) +{ + ScDrawView* pView = GetViewData()->GetScDrawView(); + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + bool bEnable = false; + if( rMarkList.GetMarkCount() == 1 ) + { + SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + + if( pObj && pObj->ISA( SdrOle2Obj ) ) + bEnable = true; + } + + if( !bEnable ) + rSet.DisableItem( SID_EXPORT_AS_GRAPHIC ); +} + +void ScChartShell::ExecuteExportAsGraphic( SfxRequest& ) +{ + ScDrawView* pView = GetViewData()->GetScDrawView(); + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + + if( rMarkList.GetMarkCount() == 1 ) + { + SdrObject* pObject = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + + if( pObject && pObject->ISA( SdrOle2Obj ) ) + { + SdrOle2Obj* aOle2Object = ((SdrOle2Obj*) pObject)->Clone(); + aOle2Object->NbcResize(Point(), Fraction(1,1), Fraction(1,1)); + Graphic* pGraphic = aOle2Object->GetGraphic(); + if( pGraphic != NULL ) + { + String sGrfNm, sFilterNm; + GraphicHelper::ExportGraphic( *pGraphic, String("") ); + } + } + } + + Invalidate(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src index a2ed29eaabca..3263ec310525 100644 --- a/sc/source/ui/drawfunc/objdraw.src +++ b/sc/source/ui/drawfunc/objdraw.src @@ -619,6 +619,12 @@ Menu RID_POPUP_CHART MenuItem { Separator = TRUE ; }; //------------------------------ ITEM_GROUP_MENU + MenuItem + { + Identifier = SID_EXPORT_AS_GRAPHIC ; + Command = ".uno:ExportAsGraphic" ; + Text [ en-US ] = "Export as graphic.." ; + }; }; }; diff --git a/sc/source/ui/inc/chartsh.hxx b/sc/source/ui/inc/chartsh.hxx index 9de99ea28e8c..3e2eddfb787b 100644 --- a/sc/source/ui/inc/chartsh.hxx +++ b/sc/source/ui/inc/chartsh.hxx @@ -23,7 +23,6 @@ #include <sfx2/shell.hxx> #include "shellids.hxx" #include <sfx2/module.hxx> -#include <svx/svdmark.hxx> class ScViewData; @@ -39,6 +38,8 @@ public: ScChartShell(ScViewData* pData); virtual ~ScChartShell(); + void ExecuteExportAsGraphic(SfxRequest& rReq); + void GetExportAsGraphicState(SfxItemSet &rSet); }; #endif |