desktop/source/lib/init.cxx |1 +
filter/source/svg/svgexport.cxx |6 +-
filter/source/svg/svgfilter.cxx | 10 ++
filter/source/svg/svgfilter.hxx |1 +
filter/source/svg/svgwriter.cxx | 22 +-
filter/source/svg/svgwriter.hxx |2 ++
sfx2/source/doc/objstor.cxx | 15 +++
sw/inc/cmdid.h |1 +
sw/inc/unoprnms.hxx |1 +
sw/source/core/unocore/unoframe.cxx | 16 +++-
sw/source/core/unocore/unomap1.cxx |1 +
11 files changed, 73 insertions(+), 3 deletions(-)
New commits:
commit c5833988681caa30b612105bb1eb3a362de9b0f9
Author: Szymon Kłos
AuthorDate: Mon Jan 31 17:15:21 2022 +0100
Commit: Szymon Kłos
CommitDate: Wed Feb 2 18:25:29 2022 +0100
lok: render image preview with lower resolution
renderShapeSelection callback is used to render
image previews which are later used during
eg. rotation.
Do not render preview with original size which
slows down app a lot. Use 1280x720 max.
Change-Id: Ia8365a67d87cea869ef74cb70ce4830439a523b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129230
Tested-by: Jenkins CollaboraOffice
Reviewed-by: Mert Tumer
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0c93a7f9d626..5721b56573d6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3839,6 +3839,7 @@ static size_t
doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
}
aMediaDescriptor["SelectionOnly"] <<= true;
aMediaDescriptor["OutputStream"] <<= xOut;
+aMediaDescriptor["IsPreview"] <<= true; // will down-scale graphics
xStorable->storeToURL("private:stream",
aMediaDescriptor.getAsConstPropertyValueList());
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index f5ab1a67b94a..b0110e71c297 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -797,7 +797,9 @@ bool SVGFilter::implExportWriterTextGraphic( const
Reference< view::XSelectionSu
const Graphic aOriginalGraphic(xOriginalGraphic);
uno::Reference xTransformedGraphic;
-xPropertySet->getPropertyValue("TransformedGraphic") >>=
xTransformedGraphic;
+xPropertySet->getPropertyValue(
+mbIsPreview ? OUString("GraphicPreview") :
OUString("TransformedGraphic"))
+>>= xTransformedGraphic;
if (!xTransformedGraphic.is())
return false;
@@ -973,6 +975,8 @@ bool SVGFilter::implExportDocument()
mpSVGWriter->SetEmbeddedBitmapRefs( );
implExportTiledBackground();
}
+if( mbIsPreview )
+mpSVGWriter->SetPreviewMode();
// #i124608# export a given object selection, so no MasterPage
export at all
if (!mbExportShapeSelection)
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 5677d63fcc6c..25c96c3d1848 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -90,6 +90,7 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >&
rxCtx ) :
mbExportShapeSelection(false),
maFilterData(),
mxDefaultPage(),
+mbIsPreview(false),
mbWriterFilter(false),
mbCalcFilter(false),
mbImpressFilter(false),
@@ -119,6 +120,15 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence<
PropertyValue >& rDescripto
if(mxSrcDoc.is())
{
+for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
+{
+if (rDescriptor[nInd].Name == "IsPreview")
+{
+rDescriptor[nInd].Value >>= mbIsPreview;
+break;
+}
+}
+
for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
{
if (rDescriptor[nInd].Name == "FilterName")
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index ae9418ea49c5..d95710ca3e40 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -218,6 +218,7 @@ private:
Sequence< PropertyValue > maFilterData;
Reference< css::drawing::XDrawPage > mxDefaultPage;
std::vector< Reference< css::drawing::XDrawPage > > mSelectedPages;
+boolmbIsPreview;
boolmbWriterFilter;
boolmbCalcFilter;
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 694cc073a81c..006a2ca48073 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2867,7 +2867,27 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx&
rBmpEx,
}
}
-if( bCached || GraphicConverter::Export( aOStm, rBmpEx,
ConvertDataFormat::PNG ) ==