summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-19 20:43:02 +0200
committerEike Rathke <erack@redhat.com>2017-09-19 20:43:57 +0200
commit5214e841b6ca5362f94d59f940ec3947978c1abe (patch)
treeee0b50084f0fcf989847d09dc8ec1de62f8fe0d2 /svtools
parentcb9d99dbb5a7249ca7437bd5c30c6c9374089a16 (diff)
Detect Writer doc independent of selection, we'll need that later
Change-Id: Ieddbcd3e8b750ec4b32643aec0433f8638ee46ee Reviewed-on: https://gerrit.libreoffice.org/42495 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/DocumentToGraphicRenderer.cxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index 524c30afcd64..5b125bbdebd3 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -45,8 +45,22 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
mxController( mxModel->getCurrentController() ),
mxRenderable (mxDocument, uno::UNO_QUERY ),
mxToolkit( VCLUnoHelper::CreateToolkit() ),
- mbSelectionOnly( bSelectionOnly )
+ mbSelectionOnly( bSelectionOnly ),
+ mbIsWriter( false )
{
+ try
+ {
+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxDocument, uno::UNO_QUERY);
+ if (xServiceInfo.is())
+ {
+ if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
+ mbIsWriter = true;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ }
+
if (mbSelectionOnly && mxController.is())
{
try
@@ -57,18 +71,13 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
uno::Any aViewSelection( xSelSup->getSelection());
if (aViewSelection.hasValue())
{
- maSelection = aViewSelection;
/* FIXME: Writer always has a selection even if nothing is
* selected, but passing a selection to
* XRenderable::render() it always renders an empty page.
* So disable the selection already here. The current page
* the cursor is on is rendered. */
- uno::Reference< lang::XServiceInfo > xServiceInfo( mxDocument, uno::UNO_QUERY);
- if (xServiceInfo.is())
- {
- if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
- maSelection = uno::Any();
- }
+ if (!mbIsWriter)
+ maSelection = aViewSelection;
}
}
}