summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-01-18 14:07:56 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-01-19 08:21:09 +0100
commit189f4d3b3ee5807e1140b6c417a3b2687dfdd2a3 (patch)
tree427e41a98175e4d210de9a81ea298fc304ecf158 /svtools
parent16fffbe869785dffeda9ae0d9f7c18a6559a2093 (diff)
Redaction: Adjust offset for multiple Calc pages
* Add an enum and some methods to DocumentToGraphicRenderer to differentiate between the doc/module types: isWriter(), isCalc(), isImpress() * Put some checks for module/doc type * The result seems ok for a Calc document of multiple sheets with hundreds of pages Change-Id: Idf3e1966d4239df30a48a947a95c9085c25ee1bb Reviewed-on: https://gerrit.libreoffice.org/66605 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/DocumentToGraphicRenderer.cxx58
1 files changed, 53 insertions, 5 deletions
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index 5ea3982d0e00..192d84e7c869 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -49,7 +49,7 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
mxController( mxModel->getCurrentController() ),
mxRenderable (mxDocument, uno::UNO_QUERY ),
mxToolkit( VCLUnoHelper::CreateToolkit() ),
- mbIsWriter( false )
+ meDocType( UNKNOWN )
{
try
{
@@ -57,7 +57,13 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
if (xServiceInfo.is())
{
if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
- mbIsWriter = true;
+ meDocType = WRITER;
+ else if (xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
+ meDocType = CALC;
+ else if (xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument"))
+ meDocType = IMPRESS;
+ else
+ meDocType = UNKNOWN;
}
}
catch (const uno::Exception&)
@@ -80,7 +86,7 @@ DocumentToGraphicRenderer::DocumentToGraphicRenderer( const Reference<XComponent
* XRenderable::render() it always renders an empty page.
* So disable the selection already here. The current page
* the cursor is on is rendered. */
- if (!mbIsWriter)
+ if (!isWriter())
maSelection = aViewSelection;
}
}
@@ -116,7 +122,7 @@ uno::Any DocumentToGraphicRenderer::getSelection() const
}
Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage,
- Point* pDocumentPosition)
+ Point* pDocumentPosition, Point* pCalcPagePosition, Size* pCalcPageSize)
{
Reference< awt::XDevice > xDevice(mxToolkit->createScreenCompatibleDevice( 32, 32 ) );
@@ -135,7 +141,9 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage,
renderProperties[3].Value <<= true;
awt::Size aSize;
+ awt::Size aCalcPageSize;
awt::Point aPos;
+ awt::Point aCalcPos;
sal_Int32 nPages = mxRenderable->getRendererCount( selection, renderProperties );
if (nPages >= nCurrentPage)
@@ -151,6 +159,14 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage,
{
aResult[nProperty].Value >>= aPos;
}
+ else if (aResult[nProperty].Name == "CalcPagePos")
+ {
+ aResult[nProperty].Value >>= aCalcPos;
+ }
+ else if (aResult[nProperty].Name == "CalcPageContentSize")
+ {
+ aResult[nProperty].Value >>= aCalcPageSize;
+ }
}
}
@@ -158,6 +174,14 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage,
{
*pDocumentPosition = Point(aPos.X, aPos.Y);
}
+ if (pCalcPagePosition)
+ {
+ *pCalcPagePosition = Point(aCalcPos.X, aCalcPos.Y);
+ }
+ if (pCalcPageSize)
+ {
+ *pCalcPageSize = Size(aCalcPageSize.Width, aCalcPageSize.Height);
+ }
return Size( aSize.Width, aSize.Height );
}
@@ -246,7 +270,7 @@ sal_Int32 DocumentToGraphicRenderer::getCurrentPage()
if (hasSelection())
return 1;
- if (mbIsWriter)
+ if (isWriter())
return getCurrentPageWriter();
/* TODO: other application specific page detection? */
@@ -307,4 +331,28 @@ bool DocumentToGraphicRenderer::isShapeSelected(
return bShape;
}
+bool DocumentToGraphicRenderer::isWriter() const
+{
+ if (meDocType == WRITER)
+ return true;
+ else
+ return false;
+}
+
+bool DocumentToGraphicRenderer::isCalc() const
+{
+ if (meDocType == CALC)
+ return true;
+ else
+ return false;
+}
+
+bool DocumentToGraphicRenderer::isImpress() const
+{
+ if (meDocType == IMPRESS)
+ return true;
+ else
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */