diff options
author | Eike Rathke <erack@redhat.com> | 2017-09-22 14:02:20 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-09-22 21:52:30 +0200 |
commit | 3b06d9df29dc2aef568bad5bbe10c57e78bbb81a (patch) | |
tree | eaede36ba4366729bd35d68cde580985171e4fe5 | |
parent | d4b6e524398d83a500647d6a721b703dee767f06 (diff) |
Introduce DocumentToGraphicRenderer::isShapeSelected()
Change-Id: I66fc0e39a7a35969b937253c88326516949ea7e7
Reviewed-on: https://gerrit.libreoffice.org/42653
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | include/svtools/DocumentToGraphicRenderer.hxx | 21 | ||||
-rw-r--r-- | svtools/source/filter/DocumentToGraphicRenderer.cxx | 24 |
2 files changed, 45 insertions, 0 deletions
diff --git a/include/svtools/DocumentToGraphicRenderer.hxx b/include/svtools/DocumentToGraphicRenderer.hxx index 80f37df3c56e..5ed6f2ce4434 100644 --- a/include/svtools/DocumentToGraphicRenderer.hxx +++ b/include/svtools/DocumentToGraphicRenderer.hxx @@ -30,6 +30,16 @@ #include <svtools/svtdllapi.h> +namespace com { namespace sun { namespace star { + namespace drawing { + class XShapes; + class XShape; + } + namespace frame { + class XController; + } +}}} + class SVT_DLLPUBLIC DocumentToGraphicRenderer { const css::uno::Reference<css::lang::XComponent>& mxDocument; @@ -63,6 +73,17 @@ public: Graphic renderToGraphic( sal_Int32 nCurrentPage, Size aDocumentSizePixel, Size aTargetSizePixel, Color aPageColor); + + /** Determine whether rxController has a css::view::XSelectionSupplier at + which either a css::drawing::XShapes or css::drawing::XShape is + selected. XShapes has precedence over XShape. + + Call only if the SelectionOnly property was set. + */ + static bool isShapeSelected( + css::uno::Reference< css::drawing::XShapes > & rxShapes, + css::uno::Reference< css::drawing::XShape > & rxShape, + const css::uno::Reference< css::frame::XController > & rxController ); }; #endif diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 180631cf56e4..8bf5120078bc 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -31,6 +31,8 @@ #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <toolkit/helper/vclunohelper.hxx> @@ -227,4 +229,26 @@ sal_Int32 DocumentToGraphicRenderer::getCurrentPageWriter() return xCursor->getPage(); } +// static +bool DocumentToGraphicRenderer::isShapeSelected( + css::uno::Reference< css::drawing::XShapes > & rxShapes, + css::uno::Reference< css::drawing::XShape > & rxShape, + const css::uno::Reference< css::frame::XController > & rxController ) +{ + bool bShape = false; + if (rxController.is()) + { + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( rxController, uno::UNO_QUERY); + if (xSelectionSupplier.is()) + { + uno::Any aAny( xSelectionSupplier->getSelection()); + if (aAny >>= rxShapes) + bShape = true; + else if (aAny >>= rxShape) + bShape = true; + } + } + return bShape; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |