[Libreoffice-commits] core.git: include/svtools svtools/source
Eike Rathke
erack at redhat.com
Tue Sep 19 17:09:48 UTC 2017
include/svtools/DocumentToGraphicRenderer.hxx | 6 ++
svtools/source/filter/DocumentToGraphicRenderer.cxx | 42 +++++++++++---------
2 files changed, 31 insertions(+), 17 deletions(-)
New commits:
commit cb6cbbd5cad2ea0433cf5cc3ced8491f5c400a38
Author: Eike Rathke <erack at redhat.com>
Date: Tue Sep 19 19:08:14 2017 +0200
Introduce DocumentToGraphicRenderer::hasSelection() and maSelection
Change-Id: Ib7a9df04eb1b8646e20f58c3f9af3ee2dbbb13db
Reviewed-on: https://gerrit.libreoffice.org/42489
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 450672ebe7ad..2240b160d79b 100644
--- a/include/svtools/DocumentToGraphicRenderer.hxx
+++ b/include/svtools/DocumentToGraphicRenderer.hxx
@@ -38,8 +38,14 @@ class SVT_DLLPUBLIC DocumentToGraphicRenderer
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 hasSelection() const;
+
+ /** Always something even if hasSelection() is false (in which case the
+ selection is mxDocument).
+ */
css::uno::Any getSelection() const;
sal_Int32 getCurrentPageWriter();
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index 459bfb925174..8cf4e0e53a77 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -46,22 +46,6 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
mxToolkit( VCLUnoHelper::CreateToolkit() ),
mbSelectionOnly( bSelectionOnly )
{
-}
-
-DocumentToGraphicRenderer::~DocumentToGraphicRenderer()
-{
-}
-
-Size DocumentToGraphicRenderer::getDocumentSizeInPixels(sal_Int32 nCurrentPage)
-{
- Size aSize100mm = getDocumentSizeIn100mm(nCurrentPage);
- return Application::GetDefaultDevice()->LogicToPixel( aSize100mm, MapUnit::Map100thMM );
-}
-
-uno::Any DocumentToGraphicRenderer::getSelection() const
-{
- uno::Any aSelection;
- aSelection <<= mxDocument; // default: render whole document
if (mbSelectionOnly && mxController.is())
{
try
@@ -71,13 +55,37 @@ uno::Any DocumentToGraphicRenderer::getSelection() const
{
uno::Any aViewSelection( xSelSup->getSelection());
if (aViewSelection.hasValue())
- aSelection = aViewSelection;
+ maSelection = aViewSelection;
}
}
catch (const uno::Exception&)
{
}
}
+}
+
+DocumentToGraphicRenderer::~DocumentToGraphicRenderer()
+{
+}
+
+Size DocumentToGraphicRenderer::getDocumentSizeInPixels(sal_Int32 nCurrentPage)
+{
+ Size aSize100mm = getDocumentSizeIn100mm(nCurrentPage);
+ return Application::GetDefaultDevice()->LogicToPixel( aSize100mm, MapUnit::Map100thMM );
+}
+
+bool DocumentToGraphicRenderer::hasSelection() const
+{
+ return maSelection.hasValue();
+}
+
+uno::Any DocumentToGraphicRenderer::getSelection() const
+{
+ uno::Any aSelection;
+ if (hasSelection())
+ aSelection <<= maSelection;
+ else
+ aSelection <<= mxDocument; // default: render whole document
return aSelection;
}
More information about the Libreoffice-commits
mailing list