Kaydet (Commit) 5214e841 authored tarafından Eike Rathke's avatar Eike Rathke

Detect Writer doc independent of selection, we'll need that later

Change-Id: Ieddbcd3e8b750ec4b32643aec0433f8638ee46ee
Reviewed-on: https://gerrit.libreoffice.org/42495Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst cb9d99db
...@@ -34,12 +34,13 @@ class SVT_DLLPUBLIC DocumentToGraphicRenderer ...@@ -34,12 +34,13 @@ class SVT_DLLPUBLIC DocumentToGraphicRenderer
{ {
const css::uno::Reference<css::lang::XComponent>& mxDocument; const css::uno::Reference<css::lang::XComponent>& mxDocument;
css::uno::Reference<css::frame::XModel> mxModel; css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::frame::XController> mxController; css::uno::Reference<css::frame::XController> mxController;
css::uno::Reference<css::view::XRenderable> mxRenderable; css::uno::Reference<css::view::XRenderable> mxRenderable;
css::uno::Reference<css::awt::XToolkit> mxToolkit; css::uno::Reference<css::awt::XToolkit> mxToolkit;
css::uno::Any maSelection; css::uno::Any maSelection;
bool mbSelectionOnly; bool mbSelectionOnly;
bool mbIsWriter;
bool hasSelection() const; bool hasSelection() const;
......
...@@ -45,8 +45,22 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent ...@@ -45,8 +45,22 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
mxController( mxModel->getCurrentController() ), mxController( mxModel->getCurrentController() ),
mxRenderable (mxDocument, uno::UNO_QUERY ), mxRenderable (mxDocument, uno::UNO_QUERY ),
mxToolkit( VCLUnoHelper::CreateToolkit() ), 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()) if (mbSelectionOnly && mxController.is())
{ {
try try
...@@ -57,18 +71,13 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent ...@@ -57,18 +71,13 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
uno::Any aViewSelection( xSelSup->getSelection()); uno::Any aViewSelection( xSelSup->getSelection());
if (aViewSelection.hasValue()) if (aViewSelection.hasValue())
{ {
maSelection = aViewSelection;
/* FIXME: Writer always has a selection even if nothing is /* FIXME: Writer always has a selection even if nothing is
* selected, but passing a selection to * selected, but passing a selection to
* XRenderable::render() it always renders an empty page. * XRenderable::render() it always renders an empty page.
* So disable the selection already here. The current page * So disable the selection already here. The current page
* the cursor is on is rendered. */ * the cursor is on is rendered. */
uno::Reference< lang::XServiceInfo > xServiceInfo( mxDocument, uno::UNO_QUERY); if (!mbIsWriter)
if (xServiceInfo.is()) maSelection = aViewSelection;
{
if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
maSelection = uno::Any();
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment