fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / drawfunc / chartsh.cxx
blob07752f6aac77b34a26dc17f28e2046ec8b136a6e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/svdoole2.hxx>
21 #include <svx/svdobj.hxx>
22 #include <svx/graphichelper.hxx>
24 #include <svl/srchitem.hxx>
25 #include <sfx2/app.hxx>
26 #include <sfx2/objface.hxx>
27 #include <sfx2/request.hxx>
28 #include <sfx2/sidebar/EnumContext.hxx>
29 #include <svl/whiter.hxx>
30 #include <vcl/msgbox.hxx>
32 #include "chartsh.hxx"
33 #include "drwlayer.hxx"
34 #include "sc.hrc"
35 #include "viewdata.hxx"
36 #include "document.hxx"
37 #include "docpool.hxx"
38 #include "drawview.hxx"
39 #include "scresid.hxx"
41 #define ScChartShell
42 #include "scslots.hxx"
44 using namespace css::uno;
46 namespace drawing = com::sun::star::drawing;
48 SFX_IMPL_INTERFACE(ScChartShell, ScDrawShell)
50 void ScChartShell::InitInterface_Impl()
52 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_SERVER,
53 RID_DRAW_OBJECTBAR);
55 GetStaticInterface()->RegisterPopupMenu(ScResId(RID_POPUP_CHART));
58 TYPEINIT1( ScChartShell, ScDrawShell );
60 ScChartShell::ScChartShell(ScViewData* pData) :
61 ScDrawShell(pData)
63 SetHelpId( HID_SCSHELL_CHARTSH );
64 SetName( OUString("ChartObject") );
65 SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Chart));
68 ScChartShell::~ScChartShell()
72 void ScChartShell::GetExportAsGraphicState( SfxItemSet& rSet )
74 ScDrawView* pView = GetViewData()->GetScDrawView();
75 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
76 bool bEnable = false;
77 if( rMarkList.GetMarkCount() == 1 )
79 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
81 if( pObj && pObj->ISA( SdrOle2Obj ) )
82 bEnable = true;
85 if( !bEnable )
86 rSet.DisableItem( SID_EXPORT_AS_GRAPHIC );
89 void ScChartShell::ExecuteExportAsGraphic( SfxRequest& )
91 ScDrawView* pView = GetViewData()->GetScDrawView();
92 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
94 if( rMarkList.GetMarkCount() == 1 )
96 SdrObject* pObject = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
98 if( pObject && pObject->ISA( SdrOle2Obj ) )
100 Reference< drawing::XShape > xSourceDoc = Reference< drawing::XShape >( pObject->getUnoShape(), UNO_QUERY_THROW );
101 GraphicHelper::SaveShapeAsGraphic( xSourceDoc );
105 Invalidate();
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */