[Libreoffice-commits] core.git: include/svtools svtools/source
Eike Rathke
erack at redhat.com
Tue Sep 19 18:44:24 UTC 2017
include/svtools/DocumentToGraphicRenderer.hxx | 13 +++++-----
svtools/source/filter/DocumentToGraphicRenderer.cxx | 25 +++++++++++++-------
2 files changed, 24 insertions(+), 14 deletions(-)
New commits:
commit 5214e841b6ca5362f94d59f940ec3947978c1abe
Author: Eike Rathke <erack at redhat.com>
Date: Tue Sep 19 20:43:02 2017 +0200
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 at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/include/svtools/DocumentToGraphicRenderer.hxx b/include/svtools/DocumentToGraphicRenderer.hxx
index 2240b160d79b..80f37df3c56e 100644
--- a/include/svtools/DocumentToGraphicRenderer.hxx
+++ b/include/svtools/DocumentToGraphicRenderer.hxx
@@ -34,12 +34,13 @@ class SVT_DLLPUBLIC DocumentToGraphicRenderer
{
const css::uno::Reference<css::lang::XComponent>& mxDocument;
- css::uno::Reference<css::frame::XModel> mxModel;
- css::uno::Reference<css::frame::XController> mxController;
- css::uno::Reference<css::view::XRenderable> mxRenderable;
- css::uno::Reference<css::awt::XToolkit> mxToolkit;
- css::uno::Any maSelection;
- bool mbSelectionOnly;
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::frame::XController> mxController;
+ css::uno::Reference<css::view::XRenderable> mxRenderable;
+ css::uno::Reference<css::awt::XToolkit> mxToolkit;
+ css::uno::Any maSelection;
+ bool mbSelectionOnly;
+ bool mbIsWriter;
bool hasSelection() const;
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;
}
}
}
More information about the Libreoffice-commits
mailing list