22#include <com/sun/star/drawing/GraphicExportFilter.hpp>
23#include <com/sun/star/drawing/XShape.hpp>
24#include <com/sun/star/drawing/XShapes.hpp>
25#include <com/sun/star/frame/XModel.hpp>
39 , mbSelectionOnly(false)
52 return "com.sun.star.comp.GraphicExportFilter";
56 return {
"com.sun.star.document.ExportFilter" };
61 OUString aInternalFilterName;
63 for (
const beans::PropertyValue& rProperty : rProperties )
65 if ( rProperty.Name ==
"FilterName" )
67 rProperty.Value >>= aInternalFilterName;
68 const sal_Int32 nLen = aInternalFilterName.getLength();
69 aInternalFilterName = aInternalFilterName.replaceFirst(
"calc_",
"");
70 if (aInternalFilterName.getLength() == nLen)
71 aInternalFilterName = aInternalFilterName.replaceFirst(
"writer_",
"");
72 if (aInternalFilterName.getLength() == nLen)
73 aInternalFilterName = aInternalFilterName.replaceFirst(
"web_",
"");
74 if (aInternalFilterName.getLength() == nLen)
75 aInternalFilterName = aInternalFilterName.replaceFirst(
"draw_",
"");
76 if (aInternalFilterName.getLength() == nLen)
77 aInternalFilterName = aInternalFilterName.replaceFirst(
"impress_",
"");
79 else if ( rProperty.Name ==
"FilterData" )
83 else if ( rProperty.Name ==
"OutputStream" )
87 else if ( rProperty.Name ==
"SelectionOnly" )
95 if ( rProp.Name ==
"PixelWidth" )
99 else if ( rProp.Name ==
"PixelHeight" )
105 if ( aInternalFilterName.isEmpty() )
113 for ( nFormat = 0; nFormat < nFilterCount; nFormat++ )
118 if ( nFormat < nFilterCount )
133 uno::Reference< frame::XController >
xController(
xModel->getCurrentController());
136 uno::Reference< drawing::XShapes > xShapes;
137 uno::Reference< drawing::XShape > xShape;
156 aTargetSizePixel = aDocumentSizePixel;
174 aOutputStream.WriteStream( aMemStream );
183 const css::uno::Sequence< css::beans::PropertyValue > & rDescriptor,
184 const css::uno::Reference< css::drawing::XShapes > & rxShapes,
185 const css::uno::Reference< css::drawing::XShape > & rxShape )
const
187 uno::Reference< lang::XComponent > xSourceDoc;
189 xSourceDoc.set( rxShapes, uno::UNO_QUERY_THROW );
190 else if (rxShape.is())
191 xSourceDoc.set( rxShape, uno::UNO_QUERY_THROW );
192 if (!xSourceDoc.is())
195 uno::Reference< drawing::XGraphicExportFilter > xGraphicExporter =
196 drawing::GraphicExportFilter::create(
mxContext );
197 if (!xGraphicExporter.is())
202 uno::Sequence< beans::PropertyValue > aDescriptor( rDescriptor);
203 for (sal_Int32
i = 0;
i < aDescriptor.getLength(); ++
i)
205 if (aDescriptor[
i].
Name ==
"FilterName")
212 xGraphicExporter->setSourceDocument( xSourceDoc );
213 return xGraphicExporter->filter( aDescriptor );
229extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
231 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * filter_GraphicExportFilter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
constexpr OUStringLiteral sServiceName
Graphic renderToGraphic(sal_Int32 nCurrentPage, Size aDocumentSizePixel, Size aTargetSizePixel, Color aPageColor, bool bExtOutDevData)
sal_Int32 getCurrentPage()
Size getDocumentSizeInPixels(sal_Int32 nCurrentPage)
static bool isShapeSelected(css::uno::Reference< css::drawing::XShapes > &rxShapes, css::uno::Reference< css::drawing::XShape > &rxShape, const css::uno::Reference< css::frame::XController > &rxController)
css::uno::Sequence< css::beans::PropertyValue > maFilterDataSequence
virtual void SAL_CALL cancel() override
virtual ~GraphicExportFilter() override
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
bool filterExportShape(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::uno::Reference< css::drawing::XShape > &rxShape) const
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor) override
virtual OUString SAL_CALL getImplementationName() override
void gatherProperties(const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDocument) override
css::uno::Reference< css::io::XOutputStream > mxOutputStream
bool filterRenderDocument() const
css::uno::Reference< css::lang::XComponent > mxDocument
GraphicExportFilter(css::uno::Reference< css::uno::XComponentContext > xContext)
OUString maFilterExtension
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
static GraphicFilter & GetGraphicFilter()
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
sal_uInt16 GetExportFormatCount() const
OUString GetExportFormatShortName(sal_uInt16 nFormat)
OUString GetExportInternalFilterName(sal_uInt16 nFormat)
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
sal_uInt64 Seek(sal_uInt64 nPos)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Reference< XController > xController
Reference< XModel > xModel