summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-24 22:31:34 +0200
committerEike Rathke <erack@redhat.com>2017-07-24 23:32:49 +0200
commita7a99a574660fc62a9514b2ed3f8ddfe8ad8540c (patch)
treed88f51f469c5623e96c0bb93dfa1868a7f619a48 /filter/source
parentd30ae9c17ba51a55dd491f4c91712860b495f424 (diff)
Export to PNG: use selection if Selection is selected
The SelectionOnly property from the export file dialog was not passed down from GraphicExportFilter::filter() to DocumentToGraphicRenderer so that always passed a component model instead of a selection object to the implementation of XRenderable (getRendererCount(), getRenderer(), render()) Also have GraphicExportDialog consider the selection so the DocumentToGraphicRenderer at its GraphicExportOptionsDialog calls XRenderable the same. Change-Id: I976bf16cf87cf5ca2678bdba7adfaf61c2063168 Reviewed-on: https://gerrit.libreoffice.org/40380 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/graphic/GraphicExportDialog.cxx12
-rw-r--r--filter/source/graphic/GraphicExportDialog.hxx1
-rw-r--r--filter/source/graphic/GraphicExportFilter.cxx7
-rw-r--r--filter/source/graphic/GraphicExportFilter.hxx1
4 files changed, 17 insertions, 4 deletions
diff --git a/filter/source/graphic/GraphicExportDialog.cxx b/filter/source/graphic/GraphicExportDialog.cxx
index 4cd6346ae3c7..4f1d47acaf68 100644
--- a/filter/source/graphic/GraphicExportDialog.cxx
+++ b/filter/source/graphic/GraphicExportDialog.cxx
@@ -35,8 +35,9 @@ using namespace css::uno;
using namespace css::beans;
using namespace css::lang;
-GraphicExportDialog::GraphicExportDialog( const Reference< XComponentContext >& )
- : meFieldUnit(FUNIT_NONE)
+GraphicExportDialog::GraphicExportDialog( const Reference< XComponentContext >& ) :
+ meFieldUnit(FUNIT_NONE),
+ mbSelectionOnly(false)
{
}
@@ -84,6 +85,10 @@ void GraphicExportDialog::setPropertyValues( const Sequence<PropertyValue>& aPro
{
maMediaDescriptor[ i ].Value >>= maFilterDataSequence;
}
+ else if ( maMediaDescriptor[ i ].Name == "SelectionOnly" )
+ {
+ maMediaDescriptor[ i ].Value >>= mbSelectionOnly;
+ }
}
}
@@ -96,7 +101,8 @@ void GraphicExportDialog::setTitle( const OUString& aTitle )
sal_Int16 GraphicExportDialog::execute()
{
sal_Int16 nReturn = ui::dialogs::ExecutableDialogResults::CANCEL;
- ScopedVclPtrInstance< GraphicExportOptionsDialog > graphicExportOptionsDialog( Application::GetDefDialogParent(), mxSourceDocument );
+ ScopedVclPtrInstance< GraphicExportOptionsDialog > graphicExportOptionsDialog( Application::GetDefDialogParent(),
+ mxSourceDocument, mbSelectionOnly );
if (graphicExportOptionsDialog->Execute() == RET_OK )
{
maFilterDataSequence = graphicExportOptionsDialog->getFilterData();
diff --git a/filter/source/graphic/GraphicExportDialog.hxx b/filter/source/graphic/GraphicExportDialog.hxx
index bad51f9ae1ee..dcbb8e5bcd9d 100644
--- a/filter/source/graphic/GraphicExportDialog.hxx
+++ b/filter/source/graphic/GraphicExportDialog.hxx
@@ -48,6 +48,7 @@ class GraphicExportDialog : public cppu::WeakImplHelper
OUString maDialogTitle;
FieldUnit meFieldUnit;
+ bool mbSelectionOnly;
public:
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index 15dea5400298..e4279513416e 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -26,6 +26,7 @@
GraphicExportFilter::GraphicExportFilter( const Reference<XComponentContext>& )
: mTargetWidth(0)
, mTargetHeight(0)
+ , mbSelectionOnly(false)
{}
GraphicExportFilter::~GraphicExportFilter()
@@ -56,6 +57,10 @@ void GraphicExportFilter::gatherProperties( const Sequence<PropertyValue>& rProp
{
aProperty.Value >>= mxOutputStream;
}
+ else if ( aProperty.Name == "SelectionOnly" )
+ {
+ aProperty.Value >>= mbSelectionOnly;
+ }
}
for ( sal_Int32 i = 0; i < mFilterDataSequence.getLength(); i++ )
@@ -93,7 +98,7 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence<PropertyValue>& rD
{
gatherProperties(rDescriptor);
- DocumentToGraphicRenderer aRenderer( mxDocument );
+ DocumentToGraphicRenderer aRenderer( mxDocument, mbSelectionOnly );
sal_Int32 aCurrentPage = aRenderer.getCurrentPageWriter();
Size aDocumentSizePixel = aRenderer.getDocumentSizeInPixels(aCurrentPage);
diff --git a/filter/source/graphic/GraphicExportFilter.hxx b/filter/source/graphic/GraphicExportFilter.hxx
index 1f639ca9d775..1514bdefa774 100644
--- a/filter/source/graphic/GraphicExportFilter.hxx
+++ b/filter/source/graphic/GraphicExportFilter.hxx
@@ -48,6 +48,7 @@ class GraphicExportFilter :
sal_Int32 mTargetWidth;
sal_Int32 mTargetHeight;
+ bool mbSelectionOnly;
public:
explicit GraphicExportFilter( const Reference<XComponentContext>& rxContext );