[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - desktop/source filter/source

2022-04-06 Thread Mert Tumer (via logerrit)
 desktop/source/lib/init.cxx|9 -
 filter/source/storagefilterdetect/filterdetect.cxx |7 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 8461a6428c8e0e4e21cd8d340a389e34b64b68de
Author: Mert Tumer 
AuthorDate: Wed Apr 6 16:59:53 2022 +0300
Commit: Gökay ŞATIR 
CommitDate: Wed Apr 6 18:36:08 2022 +0200

lok: load template documents as regular documents

otherwise lok cannot save them directly because
libreoffice will try to open a save-as dialog
For odg, change the draw8_template type draw8

Signed-off-by: Mert Tumer 
Change-Id: I34b0ed03adcac89eaa926f8ae6c57e6f622a90f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132633
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fdf93283101f..3e4265969053 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2540,7 +2540,7 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
  Application::SetDialogCancelMode(DialogCancelMode::LOKSilent);
 }
 
-uno::Sequence aFilterOptions(3);
+uno::Sequence aFilterOptions(4);
 aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions",
0,
uno::makeAny(aOptions),
@@ -2587,6 +2587,13 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
 aFilterOptions[3].Value <<= nUpdateDoc;
 */
 
+// set this explicitly false to be able to load template files
+// as regular files, otherwise we cannot save them; it will try
+// to bring saveas dialog which cannot work with LOK case
+aFilterOptions[3].Name = "AsTemplate";
+aFilterOptions[3].Value <<= false;
+
+
 const int nThisDocumentId = nDocumentIdCounter++;
 SfxViewShell::SetCurrentDocId(ViewShellDocId(nThisDocumentId));
 uno::Reference xComponent = 
xComponentLoader->loadComponentFromURL(
diff --git a/filter/source/storagefilterdetect/filterdetect.cxx 
b/filter/source/storagefilterdetect/filterdetect.cxx
index f2eba546a4d3..64ee68175473 100644
--- a/filter/source/storagefilterdetect/filterdetect.cxx
+++ b/filter/source/storagefilterdetect/filterdetect.cxx
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace ::com::sun::star;
 using utl::MediaDescriptor;
 
@@ -102,6 +104,11 @@ OUString SAL_CALL 
StorageFilterDetect::detect(uno::SequencegetPropertyValue( "MediaType" ) >>= aMediaType;
 aTypeName = getInternalFromMediaType( aMediaType );
+if (comphelper::LibreOfficeKit::isActive() && aTypeName == 
"draw8_template")
+{
+// save it as draw8 instead of template format
+aTypeName = "draw8";
+}
 }
 
 catch( const lang::WrappedTargetException& aWrap )


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - desktop/source filter/source sfx2/source sw/inc sw/source

2022-02-03 Thread Szymon Kłos (via logerrit)
 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 d01b1b174f4e18b8bef23f7409d4e9cf4f07d232
Author: Szymon Kłos 
AuthorDate: Mon Jan 31 17:15:21 2022 +0100
Commit: Szymon Kłos 
CommitDate: Thu Feb 3 10:06:16 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/+/129376
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 920041060d88..4693e79ec3f6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3969,6 +3969,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 fc8de3b18f68..d0eb6b9c6a8c 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -802,7 +802,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;
@@ -978,6 +980,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 8025550b5837..67ff2dd80680 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -82,6 +82,7 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& 
rxCtx ) :
 mbExportShapeSelection(false),
 maFilterData(),
 mxDefaultPage(),
+mbIsPreview(false),
 mbWriterFilter(false),
 mbCalcFilter(false),
 mbImpressFilter(false),
@@ -111,6 +112,15 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< 
PropertyValue >& rDescripto
 
 if(mxSrcDoc.is())
 {
+for (const PropertyValue& rProp : rDescriptor)
+{
+if (rProp.Name == "IsPreview")
+{
+rProp.Value >>= mbIsPreview;
+break;
+}
+}
+
 for (const PropertyValue& rProp : rDescriptor)
 {
 if (rProp.Name == "FilterName")
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index aab158971e0b..975eb4ae2d02 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -209,6 +209,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 f5c96878d4f4..9677c9e092fd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2949,7 +2949,27 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& 
rBmpEx,
 }
 }
 
-if( !(bCached || GraphicConverter::Export( aOStm, rBmpEx, 
ConvertDataFormat::PNG ) == ERRCODE_NONE) )
+const BitmapEx* pBitmap = 
+std::unique_ptr pNewBitmap;
+
+// for