Drop Macromedia Flash export filter
Flash technology is going to be retired by the end of 2020 by Adobe: https://theblog.adobe.com/adobe-flash-update/ With this ahead doesn't make much sense for LO 7.0 to support exporting presentations and drawings to swf anymore. Change-Id: Ic2c6e95db2f56bcd4eb25abdd0a6748aee9b0e4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92507 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
11ef83aa64
commit
63e43c1db9
@@ -260,7 +260,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \
|
||||
|
||||
$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,graphicfilter, \
|
||||
svgfilter \
|
||||
flash \
|
||||
wpftdraw \
|
||||
graphicfilter \
|
||||
))
|
||||
|
||||
@@ -490,14 +490,6 @@ filter/qa/cppunit/filters-tiff-test.cxx:19
|
||||
_Bool itiGraphicImport(class SvStream &,class Graphic &,class FilterConfigItem *)
|
||||
class FilterConfigItem *
|
||||
0
|
||||
filter/source/flash/swfwriter.hxx:304
|
||||
void swf::Writer::gotoFrame(unsigned short)
|
||||
unsigned short nFrame
|
||||
0
|
||||
filter/source/flash/swfwriter.hxx:322
|
||||
void swf::Writer::Impl_writePolygon(const class tools::Polygon &,_Bool,const class Color &,const class Color &)
|
||||
_Bool bFilled
|
||||
1
|
||||
filter/source/graphicfilter/eps/eps.cxx:91
|
||||
enum (anonymous namespace)::NMode operator|(enum (anonymous namespace)::NMode,enum (anonymous namespace)::NMode)
|
||||
enum (anonymous namespace)::NMode a
|
||||
|
||||
@@ -226,10 +226,6 @@ extensions/source/propctrlr/taborder.hxx:59
|
||||
void pcr::TabOrderDialog::TabOrderDialog(class weld::Window *,const class com::sun::star::uno::Reference<class com::sun::star::awt::XTabControllerModel> &,const class com::sun::star::uno::Reference<class com::sun::star::awt::XControlContainer> &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &)
|
||||
class weld::Window * pParent
|
||||
impl_getDefaultDialogFrame_nothrow()
|
||||
filter/source/flash/swfwriter.hxx:140
|
||||
void swf::FlashFont::FlashFont(const class vcl::Font &,unsigned short)
|
||||
unsigned short nId
|
||||
createID()
|
||||
forms/source/component/ListBox.cxx:1541
|
||||
class com::sun::star::uno::Any lcl_getSingleSelectedEntryAny(const class com::sun::star::uno::Sequence<short> &,const class std::__debug::vector<class connectivity::ORowSetValue, class std::allocator<class connectivity::ORowSetValue> > &)
|
||||
const class std::__debug::vector<class connectivity::ORowSetValue, class std::allocator<class connectivity::ORowSetValue> > & _rStringList
|
||||
|
||||
@@ -262,10 +262,6 @@ filter/source/config/cache/filtercache.hxx:332
|
||||
_Bool filter::config::FilterCache::isFillState(enum filter::config::FilterCache::EFillState) const
|
||||
enum filter::config::FilterCache::EFillState eRequired
|
||||
2
|
||||
filter/source/flash/swfwriter.hxx:301
|
||||
void swf::Writer::waitOnClick(unsigned short)
|
||||
unsigned short nDepth
|
||||
10
|
||||
filter/source/graphicfilter/eps/eps.cxx:91
|
||||
enum (anonymous namespace)::NMode operator|(enum (anonymous namespace)::NMode,enum (anonymous namespace)::NMode)
|
||||
enum (anonymous namespace)::NMode b
|
||||
|
||||
@@ -87,7 +87,6 @@ public:
|
||||
|| fn == SRCDIR "/svx/source/dialog/_bmpmask.cxx"
|
||||
|| fn == SRCDIR "/media/noel/disk2/libo4/cui/source/dialogs/SignSignatureLineDialog.cxx"
|
||||
|| fn == SRCDIR "/filter/source/msfilter/msdffimp.cxx"
|
||||
|| fn == SRCDIR "/filter/source/flash/swffilter.cxx"
|
||||
|| fn == SRCDIR "/cui/source/dialogs/SignSignatureLineDialog.cxx"
|
||||
|| fn == SRCDIR "/cui/source/dialogs/screenshotannotationdlg.cxx"
|
||||
|| fn == SRCDIR "/cui/source/options/optupdt.cxx"
|
||||
|
||||
@@ -184,10 +184,6 @@ editeng/source/editeng/impedit.hxx:458
|
||||
ImpEditEngine aSelFuncSet class EditSelFunctionSet
|
||||
extensions/source/bibliography/datman.cxx:403
|
||||
(anonymous namespace)::DBChangeDialog_Impl aConfig class DBChangeDialogConfig_Impl
|
||||
filter/source/flash/swfwriter.hxx:391
|
||||
swf::Writer maMovieTempFile utl::TempFile
|
||||
filter/source/flash/swfwriter.hxx:392
|
||||
swf::Writer maFontsTempFile utl::TempFile
|
||||
filter/source/graphicfilter/icgm/chart.hxx:49
|
||||
DataNode nBoxX1 sal_Int16
|
||||
filter/source/graphicfilter/icgm/chart.hxx:50
|
||||
|
||||
@@ -18,8 +18,6 @@ extensions/source/scanner/sanedlg.hxx:87
|
||||
_Bool SaneDlg::LoadState()
|
||||
extensions/source/scanner/sanedlg.hxx:101
|
||||
_Bool SaneDlg::SetAdjustedNumericalValue(const char *,double,int)
|
||||
filter/source/flash/swfexporter.hxx:85
|
||||
_Bool swf::FlashExporter::exportAll(const class com::sun::star::uno::Reference<class com::sun::star::lang::XComponent> &,const class com::sun::star::uno::Reference<class com::sun::star::io::XOutputStream> &,const class com::sun::star::uno::Reference<class com::sun::star::task::XStatusIndicator> &)
|
||||
i18nlangtag/source/languagetag/languagetag.cxx:277
|
||||
const class rtl::OUString & LanguageTagImpl::getBcp47() const
|
||||
idlc/inc/aststack.hxx:38
|
||||
|
||||
@@ -242,7 +242,6 @@ static const ExtensionMap aImpressExtensionMap[] =
|
||||
{ "pps", "MS PowerPoint 97 Autoplay" },
|
||||
{ "ppt", "MS PowerPoint 97" },
|
||||
{ "svg", "impress_svg_Export" },
|
||||
{ "swf", "impress_flash_Export" },
|
||||
{ "xhtml", "XHTML Impress File" },
|
||||
{ "png", "impress_png_Export"},
|
||||
{ nullptr, nullptr }
|
||||
@@ -255,7 +254,6 @@ static const ExtensionMap aDrawExtensionMap[] =
|
||||
{ "odg", "draw8" },
|
||||
{ "pdf", "draw_pdf_Export" },
|
||||
{ "svg", "draw_svg_Export" },
|
||||
{ "swf", "draw_flash_Export" },
|
||||
{ "xhtml", "XHTML Draw File" },
|
||||
{ "png", "draw_png_Export"},
|
||||
{ nullptr, nullptr }
|
||||
|
||||
@@ -692,7 +692,6 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ
|
||||
eps_Encapsulated_PostScript \
|
||||
gif_Graphics_Interchange \
|
||||
graphic_HTML \
|
||||
graphic_SWF \
|
||||
jpg_JPEG \
|
||||
met_OS2_Metafile \
|
||||
mov_MOV \
|
||||
@@ -748,7 +747,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
|
||||
draw_bmp_Export \
|
||||
draw_emf_Export \
|
||||
draw_eps_Export \
|
||||
draw_flash_Export \
|
||||
draw_gif_Export \
|
||||
draw_html_Export \
|
||||
draw_jpg_Export \
|
||||
@@ -765,7 +763,6 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impressgraphics_
|
||||
eps_Encapsulated_PostScript \
|
||||
gif_Graphics_Interchange \
|
||||
graphic_HTML \
|
||||
graphic_SWF \
|
||||
impress_CGM_Computer_Graphics_Metafile \
|
||||
jpg_JPEG \
|
||||
met_OS2_Metafile \
|
||||
@@ -788,7 +785,6 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic
|
||||
impress_bmp_Export \
|
||||
impress_emf_Export \
|
||||
impress_eps_Export \
|
||||
impress_flash_Export \
|
||||
impress_gif_Export \
|
||||
impress_html_Export \
|
||||
impress_jpg_Export \
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# This file incorporates work covered by the following license notice:
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed
|
||||
# with this work for additional information regarding copyright
|
||||
# ownership. The ASF licenses this file to you under the Apache
|
||||
# License, Version 2.0 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
#
|
||||
|
||||
$(eval $(call gb_Library_Library,flash))
|
||||
|
||||
$(eval $(call gb_Library_set_componentfile,flash,filter/source/flash/flash))
|
||||
|
||||
$(eval $(call gb_Library_use_sdk_api,flash))
|
||||
|
||||
$(eval $(call gb_Library_use_libraries,flash,\
|
||||
svt \
|
||||
vcl \
|
||||
utl \
|
||||
tl \
|
||||
i18nlangtag \
|
||||
comphelper \
|
||||
basegfx \
|
||||
cppuhelper \
|
||||
cppu \
|
||||
sal \
|
||||
salhelper \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_use_externals,flash,\
|
||||
boost_headers \
|
||||
zlib \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,flash,\
|
||||
filter/source/flash/impswfdialog \
|
||||
filter/source/flash/swfdialog \
|
||||
filter/source/flash/swfexporter \
|
||||
filter/source/flash/swffilter \
|
||||
filter/source/flash/swfuno \
|
||||
filter/source/flash/swfwriter \
|
||||
filter/source/flash/swfwriter1 \
|
||||
filter/source/flash/swfwriter2 \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
@@ -23,7 +23,6 @@ $(eval $(call gb_Module_add_targets,filter,\
|
||||
CustomTarget_svg \
|
||||
Library_gie \
|
||||
Library_filterconfig \
|
||||
Library_flash \
|
||||
Library_icg \
|
||||
Library_msfilter \
|
||||
Library_odfflatxml \
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
$(eval $(call gb_UIConfig_UIConfig,filter))
|
||||
|
||||
$(eval $(call gb_UIConfig_add_uifiles,filter,\
|
||||
filter/uiconfig/ui/impswfdialog \
|
||||
filter/uiconfig/ui/pdfgeneralpage \
|
||||
filter/uiconfig/ui/pdflinkspage \
|
||||
filter/uiconfig/ui/pdfoptionsdialog \
|
||||
|
||||
@@ -44,7 +44,6 @@ filter/ui/pdflinkspage.ui
|
||||
filter/ui/pdfsignpage.ui
|
||||
filter/ui/xmlfiltertabpagegeneral.ui
|
||||
filter/ui/xmlfiltertabpagetransformation.ui
|
||||
filter/ui/impswfdialog.ui
|
||||
filter/ui/testxmlfilter.ui
|
||||
filter/ui/warnpdfdialog.ui
|
||||
filter/ui/xmlfiltersettings.ui
|
||||
|
||||
@@ -274,7 +274,6 @@ int getFlatTypeRank(const OUString& rType)
|
||||
|
||||
// Export only
|
||||
"writer_layout_dump_xml",
|
||||
"graphic_SWF",
|
||||
"graphic_HTML",
|
||||
|
||||
// Internal use only
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<node oor:name="draw_flash_Export" oor:op="replace">
|
||||
<prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
|
||||
<prop oor:name="UIComponent"><value>com.sun.star.Impress.FlashExportDialog</value></prop>
|
||||
<prop oor:name="FilterService"><value>com.sun.star.comp.Impress.FlashExportFilter</value></prop>
|
||||
<prop oor:name="UserData"><value></value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value xml:lang="en-US">Macromedia Flash (SWF)</value>
|
||||
</prop>
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>graphic_SWF</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
|
||||
</node>
|
||||
@@ -1,30 +0,0 @@
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<node oor:name="impress_flash_Export" oor:op="replace">
|
||||
<prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
|
||||
<prop oor:name="UIComponent"><value>com.sun.star.Impress.FlashExportDialog</value></prop>
|
||||
<prop oor:name="FilterService"><value>com.sun.star.comp.Impress.FlashExportFilter</value></prop>
|
||||
<prop oor:name="UserData"><value></value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value xml:lang="en-US">Macromedia Flash (SWF)</value>
|
||||
</prop>
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>graphic_SWF</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
|
||||
</node>
|
||||
@@ -1,29 +0,0 @@
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
<node oor:name="graphic_SWF" oor:op="replace" >
|
||||
<prop oor:name="DetectService"/>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>swf</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="Preferred"><value>false</value></prop>
|
||||
<prop oor:name="PreferredFilter"/>
|
||||
<prop oor:name="UIName">
|
||||
<value>Macromedia Flash (SWF)</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||
prefix="flash" xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.Impress.FlashExportDialog">
|
||||
<service name="com.sun.star.Impress.FlashExportDialog"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.Impress.FlashExportFilter">
|
||||
<service name="com.sun.star.document.ExportFilter"/>
|
||||
</implementation>
|
||||
</component>
|
||||
@@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
|
||||
#include "impswfdialog.hxx"
|
||||
#include <tools/solar.h>
|
||||
|
||||
using namespace com::sun::star::uno;
|
||||
using namespace com::sun::star::beans;
|
||||
|
||||
|
||||
ImpSWFDialog::ImpSWFDialog(weld::Window* pParent, Sequence< PropertyValue >& rFilterData)
|
||||
: GenericDialogController(pParent, "filter/ui/impswfdialog.ui", "ImpSWFDialog")
|
||||
, maConfigItem("Office.Common/Filter/Flash/Export/", &rFilterData)
|
||||
, mxNumFldQuality(m_xBuilder->weld_spin_button("quality"))
|
||||
, mxCheckExportAll(m_xBuilder->weld_check_button("exportall"))
|
||||
, mxCheckExportBackgrounds(m_xBuilder->weld_check_button("exportbackgrounds"))
|
||||
, mxCheckExportBackgroundObjects(m_xBuilder->weld_check_button("exportbackgroundobjects"))
|
||||
, mxCheckExportSlideContents(m_xBuilder->weld_check_button("exportslidecontents"))
|
||||
, mxCheckExportSound(m_xBuilder->weld_check_button("exportsound"))
|
||||
, mxCheckExportOLEAsJPEG(m_xBuilder->weld_check_button("exportoleasjpeg"))
|
||||
, mxCheckExportMultipleFiles(m_xBuilder->weld_check_button("exportmultiplefiles"))
|
||||
{
|
||||
const sal_Int32 nCompressMode = maConfigItem.ReadInt32( "CompressMode", 75 );
|
||||
mxNumFldQuality->set_value(nCompressMode);
|
||||
|
||||
mxCheckExportAll->set_active(true);
|
||||
mxCheckExportSlideContents->set_active(true);
|
||||
mxCheckExportSound->set_active(true);
|
||||
|
||||
mxCheckExportAll->connect_toggled(LINK(this, ImpSWFDialog, OnToggleCheckbox));
|
||||
|
||||
mxCheckExportBackgrounds->set_sensitive(false);
|
||||
mxCheckExportBackgroundObjects->set_sensitive(false);
|
||||
mxCheckExportSlideContents->set_sensitive(false);
|
||||
}
|
||||
|
||||
ImpSWFDialog::~ImpSWFDialog()
|
||||
{
|
||||
}
|
||||
|
||||
Sequence< PropertyValue > ImpSWFDialog::GetFilterData()
|
||||
{
|
||||
sal_Int32 nCompressMode = static_cast<sal_Int32>(mxNumFldQuality->get_value());
|
||||
maConfigItem.WriteInt32( "CompressMode" , nCompressMode );
|
||||
maConfigItem.WriteBool( "ExportAll", mxCheckExportAll->get_active() );
|
||||
maConfigItem.WriteBool( "ExportBackgrounds", mxCheckExportBackgrounds->get_active() );
|
||||
maConfigItem.WriteBool( "ExportBackgroundObjects", mxCheckExportBackgroundObjects->get_active() );
|
||||
maConfigItem.WriteBool( "ExportSlideContents", mxCheckExportSlideContents->get_active() );
|
||||
maConfigItem.WriteBool( "ExportSound", mxCheckExportSound->get_active() );
|
||||
maConfigItem.WriteBool( "ExportOLEAsJPEG", mxCheckExportOLEAsJPEG->get_active() );
|
||||
maConfigItem.WriteBool( "ExportMultipleFiles", mxCheckExportMultipleFiles->get_active() );
|
||||
|
||||
Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(ImpSWFDialog, OnToggleCheckbox, weld::ToggleButton&, void)
|
||||
{
|
||||
mxCheckExportBackgrounds->set_sensitive(!mxCheckExportBackgrounds->get_sensitive());
|
||||
mxCheckExportBackgroundObjects->set_sensitive(!mxCheckExportBackgroundObjects->get_sensitive());
|
||||
mxCheckExportSlideContents->set_sensitive(!mxCheckExportSlideContents->get_sensitive());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_FILTER_SOURCE_FLASH_IMPSWFDIALOG_HXX
|
||||
#define INCLUDED_FILTER_SOURCE_FLASH_IMPSWFDIALOG_HXX
|
||||
|
||||
#include <com/sun/star/uno/Sequence.h>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include <vcl/weld.hxx>
|
||||
|
||||
class ImpSWFDialog : public weld::GenericDialogController
|
||||
{
|
||||
private:
|
||||
FilterConfigItem maConfigItem;
|
||||
|
||||
std::unique_ptr<weld::SpinButton> mxNumFldQuality;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportAll;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportBackgrounds;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportBackgroundObjects;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportSlideContents;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportSound;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportOLEAsJPEG;
|
||||
std::unique_ptr<weld::CheckButton> mxCheckExportMultipleFiles;
|
||||
|
||||
DECL_LINK(OnToggleCheckbox, weld::ToggleButton&, void);
|
||||
|
||||
public:
|
||||
ImpSWFDialog(weld::Window* pParent,
|
||||
css::uno::Sequence< css::beans::PropertyValue >& rFilterData );
|
||||
virtual ~ImpSWFDialog() override;
|
||||
|
||||
css::uno::Sequence< css::beans::PropertyValue > GetFilterData();
|
||||
};
|
||||
|
||||
#endif // INCLUDED_FILTER_SOURCE_FLASH_IMPSWFDIALOG_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,212 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
|
||||
#include "swfdialog.hxx"
|
||||
#include "swfuno.hxx"
|
||||
#include "impswfdialog.hxx"
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <cppuhelper/queryinterface.hxx>
|
||||
#include <com/sun/star/view/XRenderable.hpp>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::beans;
|
||||
using namespace ::com::sun::star::frame;
|
||||
using namespace ::com::sun::star::view;
|
||||
using namespace ::com::sun::star::document;
|
||||
|
||||
#define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
|
||||
|
||||
|
||||
OUString SWFDialog_getImplementationName ()
|
||||
{
|
||||
return SERVICE_NAME;
|
||||
}
|
||||
|
||||
|
||||
Sequence< OUString > SWFDialog_getSupportedServiceNames()
|
||||
{
|
||||
Sequence<OUString> aRet { SERVICE_NAME };
|
||||
return aRet;
|
||||
}
|
||||
|
||||
|
||||
Reference< XInterface > SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
|
||||
{
|
||||
return static_cast<cppu::OWeakObject*>(new SWFDialog( comphelper::getComponentContext(rSMgr) ));
|
||||
}
|
||||
|
||||
#undef SERVICE_NAME
|
||||
|
||||
SWFDialog::SWFDialog( const Reference< XComponentContext> &rxContext ) :
|
||||
OGenericUnoDialog( rxContext )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SWFDialog::~SWFDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Any SAL_CALL SWFDialog::queryInterface( const Type& rType )
|
||||
{
|
||||
Any aReturn = OGenericUnoDialog::queryInterface( rType );
|
||||
|
||||
if( !aReturn.hasValue() )
|
||||
aReturn = ::cppu::queryInterface( rType,
|
||||
static_cast< XPropertyAccess* >( this ),
|
||||
static_cast< XExporter* >( this ) );
|
||||
|
||||
return aReturn;
|
||||
}
|
||||
|
||||
|
||||
void SAL_CALL SWFDialog::acquire()
|
||||
throw ()
|
||||
{
|
||||
OWeakObject::acquire();
|
||||
}
|
||||
|
||||
|
||||
void SAL_CALL SWFDialog::release()
|
||||
throw ()
|
||||
{
|
||||
OWeakObject::release();
|
||||
}
|
||||
|
||||
|
||||
Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId()
|
||||
{
|
||||
return css::uno::Sequence<sal_Int8>();
|
||||
}
|
||||
|
||||
|
||||
OUString SAL_CALL SWFDialog::getImplementationName()
|
||||
{
|
||||
return SWFDialog_getImplementationName();
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
|
||||
{
|
||||
return SWFDialog_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::DialogController> SWFDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
|
||||
{
|
||||
std::unique_ptr<weld::DialogController> xRet;
|
||||
|
||||
if (mxSrcDoc.is())
|
||||
{
|
||||
/* TODO: From the controller we may get information what page is visible and what shapes
|
||||
are selected, if we optionally want to limit output to that
|
||||
Any aSelection;
|
||||
|
||||
try
|
||||
{
|
||||
Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
|
||||
|
||||
if( xController.is() )
|
||||
{
|
||||
Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
|
||||
|
||||
if( xView.is() )
|
||||
xView->getSelection() >>= aSelection;
|
||||
}
|
||||
}
|
||||
catch( RuntimeException )
|
||||
{
|
||||
}
|
||||
*/
|
||||
xRet.reset(new ImpSWFDialog(Application::GetFrameWeld(rParent), maFilterData));
|
||||
}
|
||||
|
||||
return xRet;
|
||||
}
|
||||
|
||||
void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
|
||||
{
|
||||
if (nExecutionResult && m_xDialog)
|
||||
maFilterData = static_cast<ImpSWFDialog*>(m_xDialog.get())->GetFilterData();
|
||||
|
||||
destroyDialog();
|
||||
}
|
||||
|
||||
Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
|
||||
{
|
||||
Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
|
||||
return xInfo;
|
||||
}
|
||||
|
||||
::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
|
||||
{
|
||||
return *getArrayHelper();
|
||||
}
|
||||
|
||||
::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
|
||||
{
|
||||
Sequence< Property > aProps;
|
||||
describeProperties(aProps);
|
||||
return new ::cppu::OPropertyArrayHelper( aProps );
|
||||
}
|
||||
|
||||
Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
|
||||
{
|
||||
sal_Int32 i, nCount;
|
||||
|
||||
for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
|
||||
{
|
||||
if ( maMediaDescriptor[ i ].Name == "FilterData" )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i == nCount )
|
||||
maMediaDescriptor.realloc( ++nCount );
|
||||
|
||||
maMediaDescriptor[ i ].Name = "FilterData";
|
||||
maMediaDescriptor[ i ].Value <<= maFilterData;
|
||||
|
||||
return maMediaDescriptor;
|
||||
}
|
||||
|
||||
|
||||
void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
|
||||
{
|
||||
maMediaDescriptor = rProps;
|
||||
|
||||
for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
|
||||
{
|
||||
if ( maMediaDescriptor[ i ].Name == "FilterData" )
|
||||
{
|
||||
maMediaDescriptor[ i ].Value >>= maFilterData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
|
||||
{
|
||||
mxSrcDoc = xDoc;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,78 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_FILTER_SOURCE_FLASH_SWFDIALOG_HXX
|
||||
#define INCLUDED_FILTER_SOURCE_FLASH_SWFDIALOG_HXX
|
||||
|
||||
#include <com/sun/star/beans/XPropertyAccess.hpp>
|
||||
#include <com/sun/star/document/XExporter.hpp>
|
||||
|
||||
#include <comphelper/proparrhlp.hxx>
|
||||
#include <svtools/genericunodialog.hxx>
|
||||
|
||||
|
||||
namespace vcl { class Window; }
|
||||
|
||||
|
||||
class SWFDialog final:
|
||||
public ::svt::OGenericUnoDialog,
|
||||
public ::comphelper::OPropertyArrayUsageHelper< SWFDialog >,
|
||||
public css::beans::XPropertyAccess,
|
||||
public css::document::XExporter
|
||||
{
|
||||
private:
|
||||
|
||||
css::uno::Sequence< css::beans::PropertyValue > maMediaDescriptor;
|
||||
css::uno::Sequence< css::beans::PropertyValue > maFilterData;
|
||||
css::uno::Reference< css::lang::XComponent > mxSrcDoc;
|
||||
|
||||
// XInterface
|
||||
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
|
||||
virtual void SAL_CALL acquire() throw () override;
|
||||
virtual void SAL_CALL release() throw () override;
|
||||
|
||||
// OGenericUnoDialog
|
||||
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
|
||||
virtual void executedDialog( sal_Int16 nExecutionResult ) override;
|
||||
virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
|
||||
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
|
||||
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
|
||||
|
||||
// XPropertyAccess
|
||||
using ::cppu::OPropertySetHelper::getPropertyValues;
|
||||
using ::cppu::OPropertySetHelper::setPropertyValues;
|
||||
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues( ) override;
|
||||
virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< css::beans::PropertyValue >& aProps ) override;
|
||||
|
||||
// XExporter
|
||||
virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
|
||||
|
||||
public:
|
||||
|
||||
explicit SWFDialog( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
||||
virtual ~SWFDialog() override;
|
||||
};
|
||||
|
||||
|
||||
#endif // INCLUDED_FILTER_SOURCE_FLASH_SWFDIALOG_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,725 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <com/sun/star/awt/Rectangle.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
|
||||
#include <com/sun/star/drawing/XMasterPageTarget.hpp>
|
||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||
#include <com/sun/star/container/XIndexAccess.hpp>
|
||||
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <vcl/gdimtf.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/graphicfilter.hxx>
|
||||
#include <vcl/gdimetafiletools.hxx>
|
||||
#include <memory>
|
||||
|
||||
#include "swfexporter.hxx"
|
||||
#include "swfwriter.hxx"
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::drawing;
|
||||
using namespace ::com::sun::star::task;
|
||||
using namespace ::swf;
|
||||
|
||||
using com::sun::star::io::XOutputStream;
|
||||
using com::sun::star::beans::PropertyValue;
|
||||
using com::sun::star::container::XIndexAccess;
|
||||
using com::sun::star::beans::XPropertySet;
|
||||
using com::sun::star::lang::XComponent;
|
||||
using com::sun::star::lang::XServiceInfo;
|
||||
|
||||
|
||||
PageInfo::PageInfo()
|
||||
: mnBackgroundID( 0 )
|
||||
, mnObjectsID( 0)
|
||||
, mnForegroundID( 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PageInfo::~PageInfo()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FlashExporter::FlashExporter(
|
||||
const Reference< XComponentContext > &rxContext,
|
||||
|
||||
// #i56084# variables for selection export
|
||||
const Reference< XShapes >& rxSelectedShapes,
|
||||
const Reference< XDrawPage >& rxSelectedDrawPage,
|
||||
|
||||
sal_Int32 nJPEGCompressMode,
|
||||
bool bExportOLEAsJPEG)
|
||||
: mxContext(rxContext)
|
||||
// #i56084# variables for selection export
|
||||
, mxSelectedShapes(rxSelectedShapes)
|
||||
, mxSelectedDrawPage(rxSelectedDrawPage)
|
||||
, mbExportSelection(false)
|
||||
|
||||
, mnDocWidth(0)
|
||||
, mnDocHeight(0)
|
||||
, mnJPEGcompressMode(nJPEGCompressMode)
|
||||
, mbExportOLEAsJPEG(bExportOLEAsJPEG)
|
||||
, mbPresentation(true)
|
||||
, mnPageNumber(-1)
|
||||
{
|
||||
if(mxSelectedDrawPage.is() && mxSelectedShapes.is() && mxSelectedShapes->getCount())
|
||||
{
|
||||
// #i56084# determine export selection
|
||||
mbExportSelection = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FlashExporter::~FlashExporter()
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
|
||||
void FlashExporter::Flush()
|
||||
{
|
||||
mpWriter.reset();
|
||||
maPagesMap.clear();
|
||||
}
|
||||
|
||||
|
||||
const sal_uInt16 cBackgroundDepth = 2;
|
||||
const sal_uInt16 cBackgroundObjectsDepth = 3;
|
||||
const sal_uInt16 cPageObjectsDepth = 4;
|
||||
const sal_uInt16 cWaitButtonDepth = 10;
|
||||
|
||||
bool FlashExporter::exportAll( const Reference< XComponent >& xDoc, Reference< XOutputStream > const &xOutputStream, Reference< XStatusIndicator> const &xStatusIndicator )
|
||||
{
|
||||
Reference< XServiceInfo > xDocServInfo( xDoc, UNO_QUERY );
|
||||
if( xDocServInfo.is() )
|
||||
mbPresentation = xDocServInfo->supportsService( "com.sun.star.presentation.PresentationDocument" );
|
||||
|
||||
Reference< XDrawPagesSupplier > xDrawPagesSupplier(xDoc, UNO_QUERY);
|
||||
if(!xDrawPagesSupplier.is())
|
||||
return false;
|
||||
|
||||
Reference< XIndexAccess > xDrawPages = xDrawPagesSupplier->getDrawPages();
|
||||
if(!xDrawPages.is())
|
||||
return false;
|
||||
|
||||
Reference< XDrawPage > xDrawPage;
|
||||
|
||||
// #i56084# set xDrawPage directly when exporting selection
|
||||
if(mbExportSelection)
|
||||
{
|
||||
xDrawPage = mxSelectedDrawPage;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDrawPages->getByIndex(0) >>= xDrawPage;
|
||||
}
|
||||
|
||||
Reference< XPropertySet > xProp( xDrawPage, UNO_QUERY );
|
||||
try
|
||||
{
|
||||
xProp->getPropertyValue( "Width" ) >>= mnDocWidth;
|
||||
xProp->getPropertyValue( "Height" ) >>= mnDocHeight;
|
||||
|
||||
sal_Int32 nOutputWidth = 14400;
|
||||
sal_Int32 nOutputHeight = (nOutputWidth * mnDocHeight ) / mnDocWidth;
|
||||
mpWriter.reset(new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
OSL_ASSERT( false );
|
||||
return false; // no writer, no cookies
|
||||
}
|
||||
|
||||
// #i56084# nPageCount is 1 when exporting selection
|
||||
const sal_Int32 nPageCount = mbExportSelection ? 1 : xDrawPages->getCount();
|
||||
|
||||
if ( xStatusIndicator.is() )
|
||||
{
|
||||
xStatusIndicator->start("Macromedia Flash (SWF)", nPageCount);
|
||||
}
|
||||
|
||||
for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++)
|
||||
{
|
||||
// #i56084# keep PageNumber? We could determine the PageNumber of the single to-be-exported page
|
||||
// when exporting the selection, but this is only used for swf internal, so no need to do so (AFAIK)
|
||||
mnPageNumber = nPage + 1;
|
||||
|
||||
if ( xStatusIndicator.is() )
|
||||
xStatusIndicator->setValue( nPage );
|
||||
|
||||
// #i56084# get current xDrawPage when not exporting selection; else already set above
|
||||
if(!mbExportSelection)
|
||||
{
|
||||
xDrawPages->getByIndex(nPage) >>= xDrawPage;
|
||||
}
|
||||
|
||||
if( !xDrawPage.is())
|
||||
continue;
|
||||
|
||||
Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
|
||||
if( mbPresentation )
|
||||
{
|
||||
bool bVisible = false;
|
||||
xPropSet->getPropertyValue( "Visible" ) >>= bVisible;
|
||||
if( !bVisible )
|
||||
continue;
|
||||
}
|
||||
|
||||
// #i56084# no background when exporting selection
|
||||
if(!mbExportSelection)
|
||||
{
|
||||
exportBackgrounds( xDrawPage, nPage, false );
|
||||
exportBackgrounds( xDrawPage, nPage, true );
|
||||
}
|
||||
|
||||
maPagesMap[nPage].mnForegroundID = mpWriter->startSprite();
|
||||
|
||||
// #i56084# directly export selection in export selection mode
|
||||
if(mbExportSelection)
|
||||
{
|
||||
exportShapes( mxSelectedShapes, false, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
exportDrawPageContents( xDrawPage, false, false );
|
||||
}
|
||||
|
||||
mpWriter->endSprite();
|
||||
|
||||
// AS: If the background is different than the previous slide,
|
||||
// we have to remove the old one and place the new one.
|
||||
if (nPage)
|
||||
{
|
||||
if (maPagesMap[nPage].mnBackgroundID != maPagesMap[nPage-1].mnBackgroundID)
|
||||
{
|
||||
mpWriter->removeShape(cBackgroundDepth);
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, cBackgroundDepth, 0, 0 );
|
||||
}
|
||||
|
||||
if (maPagesMap[nPage].mnObjectsID != maPagesMap[nPage-1].mnObjectsID)
|
||||
{
|
||||
mpWriter->removeShape(cBackgroundObjectsDepth);
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, cBackgroundObjectsDepth, 0, 0 );
|
||||
}
|
||||
|
||||
// AS: Remove the Foreground of the previous slide.
|
||||
mpWriter->removeShape(cPageObjectsDepth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, cBackgroundDepth, 0, 0 );
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, cBackgroundObjectsDepth, 0, 0 );
|
||||
}
|
||||
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnForegroundID, cPageObjectsDepth, 0, 0 );
|
||||
|
||||
mpWriter->waitOnClick( cWaitButtonDepth );
|
||||
mpWriter->showFrame();
|
||||
}
|
||||
|
||||
mpWriter->removeShape( cBackgroundDepth );
|
||||
mpWriter->removeShape( cBackgroundObjectsDepth );
|
||||
mpWriter->removeShape( cPageObjectsDepth );
|
||||
mpWriter->gotoFrame( 0 );
|
||||
mpWriter->showFrame();
|
||||
|
||||
mpWriter->storeTo( xOutputStream );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool FlashExporter::exportSlides( const Reference< XDrawPage >& xDrawPage, Reference< XOutputStream > const &xOutputStream )
|
||||
{
|
||||
Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
|
||||
if( !xDrawPage.is() || !xPropSet.is() )
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
if( !mpWriter )
|
||||
{
|
||||
xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth;
|
||||
xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight;
|
||||
|
||||
mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
|
||||
}
|
||||
|
||||
if( mbPresentation )
|
||||
{
|
||||
bool bVisible = false;
|
||||
xPropSet->getPropertyValue( "Visible" ) >>= bVisible;
|
||||
if( !bVisible )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
OSL_ASSERT( false );
|
||||
}
|
||||
|
||||
exportDrawPageContents(xDrawPage, true, false);
|
||||
|
||||
mpWriter->storeTo( xOutputStream );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
sal_uInt16 FlashExporter::exportBackgrounds( const Reference< XDrawPage >& xDrawPage, Reference< XOutputStream > const &xOutputStream, sal_uInt16 nPage, bool bExportObjects )
|
||||
{
|
||||
Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
|
||||
if( !xDrawPage.is() || !xPropSet.is() )
|
||||
return 0;
|
||||
|
||||
if( !mpWriter )
|
||||
{
|
||||
xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth;
|
||||
xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight;
|
||||
|
||||
mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
|
||||
}
|
||||
|
||||
sal_uInt16 ret = exportBackgrounds(xDrawPage, nPage, bExportObjects);
|
||||
|
||||
if (ret != nPage)
|
||||
return ret;
|
||||
|
||||
if (bExportObjects)
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnObjectsID, uInt16_(1), 0, 0 );
|
||||
else
|
||||
mpWriter->placeShape( maPagesMap[nPage].mnBackgroundID, uInt16_(0), 0, 0 );
|
||||
|
||||
mpWriter->storeTo( xOutputStream );
|
||||
|
||||
return nPage;
|
||||
}
|
||||
|
||||
sal_uInt16 FlashExporter::exportBackgrounds( Reference< XDrawPage > const & xDrawPage, sal_uInt16 nPage, bool bExportObjects )
|
||||
{
|
||||
Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
|
||||
if( !xDrawPage.is() || !xPropSet.is() )
|
||||
return 0;
|
||||
|
||||
bool bBackgroundVisible = true;
|
||||
bool bBackgroundObjectsVisible = true;
|
||||
|
||||
if( mbPresentation )
|
||||
{
|
||||
xPropSet->getPropertyValue( "IsBackgroundVisible" ) >>= bBackgroundVisible;
|
||||
xPropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bBackgroundObjectsVisible;
|
||||
}
|
||||
|
||||
|
||||
if (bExportObjects)
|
||||
{
|
||||
if (bBackgroundObjectsVisible)
|
||||
{
|
||||
Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
|
||||
if( !xMasterPageTarget.is() )
|
||||
{
|
||||
maPagesMap[nPage].mnObjectsID = 0xffff;
|
||||
return 0xffff;
|
||||
}
|
||||
Reference<XDrawPage> aTemp = xMasterPageTarget->getMasterPage();
|
||||
sal_uInt16 ret = exportMasterPageObjects(nPage, aTemp);
|
||||
if (ret != nPage)
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
maPagesMap[nPage].mnObjectsID = 0xffff;
|
||||
return 0xffff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bBackgroundVisible)
|
||||
{
|
||||
sal_uInt16 ret = exportDrawPageBackground(nPage, xDrawPage);
|
||||
|
||||
if (ret != nPage)
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
maPagesMap[nPage].mnBackgroundID = 0xffff;
|
||||
return 0xffff;
|
||||
}
|
||||
}
|
||||
|
||||
return nPage;
|
||||
}
|
||||
|
||||
|
||||
static sal_Int32 nPlaceDepth;
|
||||
// AS: A Slide can have a private background or use its masterpage's background.
|
||||
// We use the checksums on the metafiles to tell if backgrounds are the same and
|
||||
// should be reused. The return value indicates which slide's background to use.
|
||||
// If the return value != nPage, then there is no background (if == -1) or the
|
||||
// background has already been exported.
|
||||
sal_uInt16 FlashExporter::exportDrawPageBackground(sal_uInt16 nPage, Reference< XDrawPage > const & xPage)
|
||||
{
|
||||
sal_uInt16 rBackgroundID;
|
||||
|
||||
GDIMetaFile aMtfPrivate, aMtfMaster;
|
||||
Reference< XComponent > xComponent( xPage, UNO_QUERY );
|
||||
|
||||
Reference< XMasterPageTarget > xMasterPageTarget( xPage, UNO_QUERY );
|
||||
if( !xMasterPageTarget.is() )
|
||||
return 0xffff;
|
||||
|
||||
Reference< XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
|
||||
if( !xMasterPage.is())
|
||||
return 0xffff;
|
||||
|
||||
Reference< XComponent > xCompMaster( xMasterPage, UNO_QUERY );
|
||||
|
||||
getMetaFile( xCompMaster, aMtfMaster, true );
|
||||
getMetaFile( xComponent, aMtfPrivate, true );
|
||||
|
||||
BitmapChecksum masterchecksum = aMtfMaster.GetChecksum();
|
||||
BitmapChecksum privatechecksum = aMtfPrivate.GetChecksum();
|
||||
|
||||
// AS: If the slide has its own background
|
||||
if (privatechecksum)
|
||||
{
|
||||
ChecksumCache::iterator it = gPrivateCache.find(privatechecksum);
|
||||
|
||||
// AS: and we've previously encountered this background, just return
|
||||
// the previous index.
|
||||
if (gPrivateCache.end() != it)
|
||||
{
|
||||
maPagesMap[nPage].mnBackgroundID =
|
||||
maPagesMap[it->second].mnBackgroundID;
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
// AS: Otherwise, cache this checksum.
|
||||
gPrivateCache[privatechecksum] = nPage;
|
||||
|
||||
rBackgroundID = mpWriter->defineShape( aMtfPrivate );
|
||||
|
||||
maPagesMap[nPage].mnBackgroundID = rBackgroundID;
|
||||
return nPage;
|
||||
}
|
||||
}
|
||||
|
||||
// AS: Ok, no private background. Use the master page's.
|
||||
// AS: Have we already exported this master page?
|
||||
ChecksumCache::iterator it = gMasterCache.find(masterchecksum);
|
||||
|
||||
if (gMasterCache.end() != it)
|
||||
{
|
||||
maPagesMap[nPage].mnBackgroundID =
|
||||
maPagesMap[it->second].mnBackgroundID;
|
||||
|
||||
return it->second; // AS: Yes, so don't export it again.
|
||||
}
|
||||
|
||||
gMasterCache[masterchecksum] = nPage;
|
||||
|
||||
rBackgroundID = mpWriter->defineShape( aMtfMaster );
|
||||
|
||||
maPagesMap[nPage].mnBackgroundID = rBackgroundID;
|
||||
|
||||
return nPage;
|
||||
}
|
||||
|
||||
sal_uInt16 FlashExporter::exportMasterPageObjects(sal_uInt16 nPage, Reference< XDrawPage > const & xMasterPage)
|
||||
{
|
||||
BitmapChecksum shapesum = ActionSummer(xMasterPage);
|
||||
|
||||
ChecksumCache::iterator it = gObjectCache.find(shapesum);
|
||||
|
||||
if (gObjectCache.end() != it)
|
||||
{
|
||||
maPagesMap[nPage].mnObjectsID =
|
||||
maPagesMap[it->second].mnObjectsID;
|
||||
|
||||
return it->second; // AS: Yes, so don't export it again.
|
||||
}
|
||||
|
||||
gObjectCache[shapesum] = nPage;
|
||||
|
||||
sal_uInt16 rObjectsID = mpWriter->startSprite();
|
||||
exportDrawPageContents( xMasterPage, false, true );
|
||||
mpWriter->endSprite();
|
||||
|
||||
maPagesMap[nPage].mnObjectsID = rObjectsID;
|
||||
|
||||
return nPage;
|
||||
}
|
||||
|
||||
|
||||
/** export's the definition of the shapes inside this drawing page and adds the
|
||||
shape infos to the current PageInfo */
|
||||
void FlashExporter::exportDrawPageContents( const Reference< XDrawPage >& xPage, bool bStream, bool bMaster )
|
||||
{
|
||||
exportShapes(xPage, bStream, bMaster);
|
||||
}
|
||||
|
||||
|
||||
/** export's the definition of the shapes inside this XShapes container and adds the
|
||||
shape infos to the current PageInfo */
|
||||
void FlashExporter::exportShapes( const Reference< XShapes >& xShapes, bool bStream, bool bMaster )
|
||||
{
|
||||
OSL_ENSURE( (xShapes->getCount() <= 0xffff), "overflow in FlashExporter::exportDrawPageContents()" );
|
||||
|
||||
sal_uInt16 nShapeCount = static_cast<sal_uInt16>(std::min( xShapes->getCount(), sal_Int32(0xffff) ));
|
||||
sal_uInt16 nShape;
|
||||
|
||||
Reference< XShape > xShape;
|
||||
|
||||
for( nShape = 0; nShape < nShapeCount; nShape++ )
|
||||
{
|
||||
xShapes->getByIndex( nShape ) >>= xShape;
|
||||
|
||||
if( xShape.is() )
|
||||
{
|
||||
Reference< XShapes > xShapes2( xShape, UNO_QUERY );
|
||||
if( xShapes2.is() && xShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
|
||||
// export the contents of group shapes, but we only ever stream at the top
|
||||
// recursive level anyway, so pass false for streaming.
|
||||
exportShapes( xShapes2, false, bMaster);
|
||||
else
|
||||
exportShape( xShape, bMaster);
|
||||
}
|
||||
|
||||
if (bStream)
|
||||
mpWriter->showFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** export this shape definition and adds it's info to the current PageInfo */
|
||||
void FlashExporter::exportShape( const Reference< XShape >& xShape, bool bMaster )
|
||||
{
|
||||
Reference< XPropertySet > xPropSet( xShape, UNO_QUERY );
|
||||
if( !xPropSet.is() )
|
||||
return;
|
||||
|
||||
if( mbPresentation )
|
||||
{
|
||||
try
|
||||
{
|
||||
// skip empty presentation objects
|
||||
bool bEmpty = false;
|
||||
xPropSet->getPropertyValue( "IsEmptyPresentationObject" ) >>= bEmpty;
|
||||
if( bEmpty )
|
||||
return;
|
||||
|
||||
// don't export presentation placeholders on masterpage
|
||||
// they can be non empty when user edits the default texts
|
||||
if( bMaster )
|
||||
{
|
||||
OUString aShapeType( xShape->getShapeType() );
|
||||
if( aShapeType == "com.sun.star.presentation.TitleTextShape" ||
|
||||
aShapeType == "com.sun.star.presentation.OutlinerShape" ||
|
||||
aShapeType == "com.sun.star.presentation.HeaderShape" ||
|
||||
aShapeType == "com.sun.star.presentation.FooterShape" ||
|
||||
aShapeType == "com.sun.star.presentation.SlideNumberShape" ||
|
||||
aShapeType == "com.sun.star.presentation.DateTimeShape" )
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
// TODO: If we are exporting a draw, this property is not available
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
css::awt::Rectangle aBoundRect;
|
||||
xPropSet->getPropertyValue( "BoundRect" ) >>= aBoundRect;
|
||||
|
||||
std::unique_ptr<ShapeInfo> pShapeInfo(new ShapeInfo());
|
||||
pShapeInfo->mnX = aBoundRect.X;
|
||||
pShapeInfo->mnY = aBoundRect.Y;
|
||||
pShapeInfo->mnWidth = aBoundRect.Width;
|
||||
pShapeInfo->mnHeight = aBoundRect.Height;
|
||||
|
||||
GDIMetaFile aMtf;
|
||||
Reference< XComponent > xComponent( xShape, UNO_QUERY );
|
||||
|
||||
bool bIsOleObject = xShape->getShapeType() == "com.sun.star.presentation.OLE2Shape" || xShape->getShapeType() == "com.sun.star.drawing.OLE2Shape";
|
||||
|
||||
getMetaFile( xComponent, aMtf );
|
||||
|
||||
// AS: If it's an OLE object, then export a JPEG if the user requested.
|
||||
// In this case, we use the bounding rect info generated in the first getMetaFile
|
||||
// call, and then clear the metafile and add a BMP action. This may be turned into
|
||||
// a JPEG, depending on what gives the best compression.
|
||||
if (bIsOleObject && mbExportOLEAsJPEG)
|
||||
getMetaFile( xComponent, aMtf, false, true );
|
||||
|
||||
sal_uInt16 nID;
|
||||
BitmapChecksum checksum = aMtf.GetChecksum();
|
||||
|
||||
ChecksumCache::iterator it = gMetafileCache.find(checksum);
|
||||
|
||||
if (gMetafileCache.end() != it)
|
||||
nID = it->second;
|
||||
else
|
||||
{
|
||||
nID = mpWriter->defineShape( aMtf );
|
||||
gMetafileCache[checksum] = nID;
|
||||
}
|
||||
|
||||
if (!nID)
|
||||
return;
|
||||
|
||||
pShapeInfo->mnID = nID;
|
||||
|
||||
// pPageInfo->addShape( pShapeInfo );
|
||||
|
||||
mpWriter->placeShape( pShapeInfo->mnID, uInt16_(nPlaceDepth++), pShapeInfo->mnX, pShapeInfo->mnY );
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
OSL_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool FlashExporter::getMetaFile( Reference< XComponent > const &xComponent, GDIMetaFile& rMtf, bool bOnlyBackground /* = false */, bool bExportAsJPEG /* = false */)
|
||||
{
|
||||
if( !mxGraphicExporter.is() )
|
||||
mxGraphicExporter = GraphicExportFilter::create( mxContext );
|
||||
|
||||
utl::TempFile aFile;
|
||||
aFile.EnableKillingFile();
|
||||
|
||||
Sequence< PropertyValue > aFilterData(bExportAsJPEG ? 3 : 2);
|
||||
aFilterData[0].Name = "Version";
|
||||
aFilterData[0].Value <<= sal_Int32(6000);
|
||||
aFilterData[1].Name = "PageNumber";
|
||||
aFilterData[1].Value <<= mnPageNumber;
|
||||
|
||||
if(bExportAsJPEG)
|
||||
{
|
||||
aFilterData[2].Name = "Translucent";
|
||||
aFilterData[2].Value <<= true;
|
||||
}
|
||||
|
||||
Sequence< PropertyValue > aDescriptor( bOnlyBackground ? 4 : 3 );
|
||||
aDescriptor[0].Name = "FilterName";
|
||||
|
||||
// AS: If we've been asked to export as an image, then use the BMP filter.
|
||||
// Otherwise, use SVM. This is useful for things that don't convert well as
|
||||
// metafiles, like the occasional OLE object.
|
||||
aDescriptor[0].Value <<= bExportAsJPEG ? OUString("PNG") : OUString("SVM");
|
||||
|
||||
aDescriptor[1].Name = "URL";
|
||||
aDescriptor[1].Value <<= aFile.GetURL();
|
||||
aDescriptor[2].Name = "FilterData";
|
||||
aDescriptor[2].Value <<= aFilterData;
|
||||
if( bOnlyBackground )
|
||||
{
|
||||
aDescriptor[3].Name = "ExportOnlyBackground";
|
||||
aDescriptor[3].Value <<= bOnlyBackground;
|
||||
}
|
||||
mxGraphicExporter->setSourceDocument( xComponent );
|
||||
mxGraphicExporter->filter( aDescriptor );
|
||||
|
||||
if (bExportAsJPEG)
|
||||
{
|
||||
Graphic aGraphic;
|
||||
GraphicFilter aFilter(false);
|
||||
|
||||
aFilter.ImportGraphic( aGraphic, aFile.GetURL(), *aFile.GetStream( StreamMode::READ ) );
|
||||
BitmapEx rBitmapEx( aGraphic.GetBitmapEx().GetBitmap(), Color(255,255,255) );
|
||||
|
||||
tools::Rectangle clipRect;
|
||||
for( size_t i = 0, nCount = rMtf.GetActionSize(); i < nCount; i++ )
|
||||
{
|
||||
const MetaAction* pAction = rMtf.GetAction( i );
|
||||
if (pAction->GetType() == MetaActionType::ISECTRECTCLIPREGION)
|
||||
{
|
||||
const MetaISectRectClipRegionAction* pA = static_cast<const MetaISectRectClipRegionAction*>(pAction);
|
||||
clipRect = pA->GetRect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
MetaBmpExScaleAction *pmetaAct = new MetaBmpExScaleAction(Point(clipRect.Left(), clipRect.Top()), Size(clipRect.GetWidth(), clipRect.GetHeight()), rBitmapEx);
|
||||
|
||||
rMtf.Clear();
|
||||
rMtf.AddAction(pmetaAct);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
rMtf.Read( *aFile.GetStream( StreamMode::READ ) );
|
||||
|
||||
if(usesClipActions(rMtf))
|
||||
{
|
||||
// #i121267# It is necessary to prepare the metafile since the export does *not* support
|
||||
// clip regions. This tooling method clips the geometry content of the metafile internally
|
||||
// against its own clip regions, so that the export is safe to ignore clip regions
|
||||
clipMetafileContentAgainstOwnRegions(rMtf);
|
||||
}
|
||||
}
|
||||
|
||||
return rMtf.GetActionSize() != 0;
|
||||
}
|
||||
|
||||
BitmapChecksum FlashExporter::ActionSummer(Reference< XShape > const & xShape)
|
||||
{
|
||||
Reference< XShapes > xShapes( xShape, UNO_QUERY );
|
||||
|
||||
if( xShapes.is() )
|
||||
{
|
||||
return ActionSummer(xShapes);
|
||||
}
|
||||
else
|
||||
{
|
||||
Reference< XComponent > xComponentShape( xShape, UNO_QUERY );
|
||||
|
||||
GDIMetaFile aMtf;
|
||||
getMetaFile( xComponentShape, aMtf);
|
||||
|
||||
return aMtf.GetChecksum();
|
||||
}
|
||||
}
|
||||
|
||||
BitmapChecksum FlashExporter::ActionSummer(Reference< XShapes > const & xShapes)
|
||||
{
|
||||
sal_uInt32 nShapeCount = xShapes->getCount();
|
||||
BitmapChecksum shapecount = 0;
|
||||
|
||||
Reference< XShape > xShape2;
|
||||
|
||||
for( sal_uInt32 nShape = 0; nShape < nShapeCount; nShape++ )
|
||||
{
|
||||
xShapes->getByIndex( nShape ) >>= xShape2;
|
||||
|
||||
shapecount += ActionSummer(xShape2);
|
||||
}
|
||||
|
||||
return shapecount;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,137 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
#ifndef INCLUDED_FILTER_SOURCE_FLASH_SWFEXPORTER_HXX
|
||||
#define INCLUDED_FILTER_SOURCE_FLASH_SWFEXPORTER_HXX
|
||||
|
||||
#include <com/sun/star/lang/XComponent.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/task/XStatusIndicator.hpp>
|
||||
#include <com/sun/star/drawing/XDrawPage.hpp>
|
||||
#include <com/sun/star/drawing/XGraphicExportFilter.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <vcl/checksum.hxx>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
typedef ::std::map<BitmapChecksum, sal_uInt16> ChecksumCache;
|
||||
|
||||
class GDIMetaFile;
|
||||
|
||||
namespace swf {
|
||||
|
||||
class Writer;
|
||||
|
||||
|
||||
class ShapeInfo
|
||||
{
|
||||
public:
|
||||
sal_uInt16 mnID; // the character id for the sprite definition of this shape
|
||||
|
||||
sal_Int32 mnX;
|
||||
sal_Int32 mnY;
|
||||
|
||||
sal_Int32 mnWidth;
|
||||
sal_Int32 mnHeight;
|
||||
|
||||
ShapeInfo() :
|
||||
mnID(0), mnX(0), mnY(0), mnWidth(0), mnHeight(0) {}
|
||||
};
|
||||
|
||||
|
||||
struct PageInfo
|
||||
{
|
||||
sal_uInt16 mnBackgroundID;
|
||||
sal_uInt16 mnObjectsID;
|
||||
sal_uInt16 mnForegroundID;
|
||||
|
||||
PageInfo();
|
||||
~PageInfo();
|
||||
};
|
||||
|
||||
|
||||
class FlashExporter
|
||||
{
|
||||
public:
|
||||
FlashExporter(
|
||||
const css::uno::Reference< css::uno::XComponentContext >& rxContext,
|
||||
|
||||
// #i56084# variables for selection export
|
||||
const css::uno::Reference< css::drawing::XShapes >& rxSelectedShapes,
|
||||
const css::uno::Reference< css::drawing::XDrawPage >& rxSelectedDrawPage,
|
||||
|
||||
sal_Int32 nJPEGCompressMode,
|
||||
bool bExportOLEAsJPEG);
|
||||
~FlashExporter();
|
||||
|
||||
void Flush();
|
||||
|
||||
bool exportAll( const css::uno::Reference< css::lang::XComponent >& xDoc, css::uno::Reference< css::io::XOutputStream > const &xOutputStream, css::uno::Reference< css::task::XStatusIndicator> const &xStatusIndicator );
|
||||
bool exportSlides( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage, css::uno::Reference< css::io::XOutputStream > const &xOutputStream);
|
||||
sal_uInt16 exportBackgrounds( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage, css::uno::Reference< css::io::XOutputStream > const &xOutputStream, sal_uInt16 nPage, bool bExportObjects );
|
||||
sal_uInt16 exportBackgrounds( css::uno::Reference< css::drawing::XDrawPage > const & xDrawPage, sal_uInt16 nPage, bool bExportObjects );
|
||||
|
||||
ChecksumCache gMasterCache;
|
||||
ChecksumCache gPrivateCache;
|
||||
ChecksumCache gObjectCache;
|
||||
ChecksumCache gMetafileCache;
|
||||
|
||||
private:
|
||||
css::uno::Reference< css::uno::XComponentContext > mxContext;
|
||||
|
||||
// #i56084# variables for selection export
|
||||
const css::uno::Reference< css::drawing::XShapes > mxSelectedShapes;
|
||||
const css::uno::Reference< css::drawing::XDrawPage > mxSelectedDrawPage;
|
||||
bool mbExportSelection;
|
||||
|
||||
css::uno::Reference< css::drawing::XGraphicExportFilter > mxGraphicExporter;
|
||||
|
||||
::std::map<sal_uInt32, PageInfo> maPagesMap;
|
||||
|
||||
sal_uInt16 exportDrawPageBackground(sal_uInt16 nPage, css::uno::Reference< css::drawing::XDrawPage > const & xPage);
|
||||
sal_uInt16 exportMasterPageObjects(sal_uInt16 nPage, css::uno::Reference< css::drawing::XDrawPage > const & xMasterPage);
|
||||
|
||||
void exportDrawPageContents( const css::uno::Reference< css::drawing::XDrawPage >& xPage, bool bStream, bool bMaster );
|
||||
void exportShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes, bool bStream, bool bMaster );
|
||||
void exportShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bMaster);
|
||||
|
||||
BitmapChecksum ActionSummer(css::uno::Reference< css::drawing::XShape > const & xShape);
|
||||
BitmapChecksum ActionSummer(css::uno::Reference< css::drawing::XShapes > const & xShapes);
|
||||
|
||||
bool getMetaFile( css::uno::Reference< css::lang::XComponent > const &xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
|
||||
|
||||
std::unique_ptr<Writer> mpWriter;
|
||||
|
||||
sal_Int32 mnDocWidth;
|
||||
sal_Int32 mnDocHeight;
|
||||
|
||||
sal_Int32 mnJPEGcompressMode;
|
||||
|
||||
bool mbExportOLEAsJPEG;
|
||||
|
||||
bool mbPresentation;
|
||||
|
||||
sal_Int32 mnPageNumber;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,521 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <com/sun/star/frame/Desktop.hpp>
|
||||
#include <com/sun/star/frame/XStorable.hpp>
|
||||
#include <com/sun/star/document/XFilter.hpp>
|
||||
#include <com/sun/star/document/XExporter.hpp>
|
||||
#include <com/sun/star/lang/XInitialization.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||
#include <com/sun/star/drawing/XDrawView.hpp>
|
||||
#include <com/sun/star/container/XIndexAccess.hpp>
|
||||
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
|
||||
#include <com/sun/star/io/IOException.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
|
||||
#include <com/sun/star/drawing/XDrawPage.hpp>
|
||||
#include <com/sun/star/drawing/XShapes.hpp>
|
||||
#include <com/sun/star/frame/XController.hpp>
|
||||
#include <com/sun/star/view/XSelectionSupplier.hpp>
|
||||
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <osl/file.hxx>
|
||||
|
||||
#include "swfexporter.hxx"
|
||||
#include "swfuno.hxx"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::frame;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::drawing;
|
||||
using namespace ::com::sun::star::task;
|
||||
using namespace ::com::sun::star::view;
|
||||
|
||||
using ::com::sun::star::lang::XComponent;
|
||||
using ::com::sun::star::beans::PropertyValue;
|
||||
using ::com::sun::star::io::XOutputStream;
|
||||
using ::com::sun::star::container::XIndexAccess;
|
||||
|
||||
namespace swf {
|
||||
|
||||
namespace {
|
||||
|
||||
class OslOutputStreamWrapper : public ::cppu::WeakImplHelper<css::io::XOutputStream>
|
||||
{
|
||||
osl::File maFile;
|
||||
|
||||
public:
|
||||
explicit OslOutputStreamWrapper(const OUString& rFileName) : maFile(rFileName)
|
||||
{
|
||||
osl_removeFile(rFileName.pData);
|
||||
(void)maFile.open(osl_File_OpenFlag_Create|osl_File_OpenFlag_Write);
|
||||
}
|
||||
|
||||
// css::io::XOutputStream
|
||||
virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
|
||||
virtual void SAL_CALL flush( ) override;
|
||||
virtual void SAL_CALL closeOutput( ) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void SAL_CALL OslOutputStreamWrapper::writeBytes( const css::uno::Sequence< sal_Int8 >& aData )
|
||||
{
|
||||
sal_uInt64 uBytesToWrite = aData.getLength();
|
||||
sal_uInt64 uBytesWritten = 0;
|
||||
|
||||
sal_Int8 const * pBuffer = aData.getConstArray();
|
||||
|
||||
while( uBytesToWrite )
|
||||
{
|
||||
osl::File::RC eRC = maFile.write( pBuffer, uBytesToWrite, uBytesWritten);
|
||||
|
||||
switch( eRC )
|
||||
{
|
||||
case osl::File::E_INVAL: // the format of the parameters was not valid
|
||||
case osl::File::E_FBIG: // File too large
|
||||
|
||||
case osl::File::E_AGAIN: // Operation would block
|
||||
case osl::File::E_BADF: // Bad file
|
||||
case osl::File::E_FAULT: // Bad address
|
||||
case osl::File::E_INTR: // function call was interrupted
|
||||
case osl::File::E_IO: // I/O error
|
||||
case osl::File::E_NOLCK: // No record locks available
|
||||
case osl::File::E_NOLINK: // Link has been severed
|
||||
case osl::File::E_NOSPC: // No space left on device
|
||||
case osl::File::E_NXIO: // No such device or address
|
||||
throw css::io::IOException(); // TODO: Better error handling
|
||||
default: break;
|
||||
}
|
||||
|
||||
uBytesToWrite -= uBytesWritten;
|
||||
pBuffer += uBytesWritten;
|
||||
}
|
||||
}
|
||||
|
||||
void SAL_CALL OslOutputStreamWrapper::flush( )
|
||||
{
|
||||
}
|
||||
|
||||
void SAL_CALL OslOutputStreamWrapper::closeOutput( )
|
||||
{
|
||||
osl::File::RC eRC = maFile.close();
|
||||
|
||||
switch( eRC )
|
||||
{
|
||||
case osl::File::E_INVAL: // the format of the parameters was not valid
|
||||
|
||||
case osl::File::E_BADF: // Bad file
|
||||
case osl::File::E_INTR: // function call was interrupted
|
||||
case osl::File::E_NOLINK: // Link has been severed
|
||||
case osl::File::E_NOSPC: // No space left on device
|
||||
case osl::File::E_IO: // I/O error
|
||||
throw css::io::IOException(); // TODO: Better error handling
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class FlashExportFilter : public cppu::WeakImplHelper
|
||||
<
|
||||
css::document::XFilter,
|
||||
css::document::XExporter,
|
||||
css::lang::XInitialization,
|
||||
css::lang::XServiceInfo
|
||||
>
|
||||
{
|
||||
Reference< XComponent > mxDoc;
|
||||
Reference< XComponentContext > mxContext;
|
||||
Reference< XStatusIndicator> mxStatusIndicator;
|
||||
|
||||
// #i56084# variables for selection export
|
||||
Reference< XShapes > mxSelectedShapes;
|
||||
Reference< XDrawPage > mxSelectedDrawPage;
|
||||
bool mbExportSelection;
|
||||
|
||||
public:
|
||||
explicit FlashExportFilter( const Reference< XComponentContext > &rxContext);
|
||||
|
||||
// XFilter
|
||||
virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) override;
|
||||
|
||||
void ExportAsMultipleFiles( const Sequence< PropertyValue >& aDescriptor );
|
||||
void ExportAsSingleFile( const Sequence< PropertyValue >& aDescriptor );
|
||||
|
||||
virtual void SAL_CALL cancel( ) override;
|
||||
|
||||
// XExporter
|
||||
virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) override;
|
||||
|
||||
// XInitialization
|
||||
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
||||
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
FlashExportFilter::FlashExportFilter(const Reference< XComponentContext > &rxContext)
|
||||
: mxDoc()
|
||||
, mxContext(rxContext)
|
||||
, mxStatusIndicator()
|
||||
, mxSelectedShapes()
|
||||
, mxSelectedDrawPage()
|
||||
, mbExportSelection(false)
|
||||
{
|
||||
}
|
||||
|
||||
static OUString exportBackground(FlashExporter &aFlashExporter, const Reference< XDrawPage >& xDrawPage, const OUString& sPath, sal_uInt32 nPage, const char* suffix)
|
||||
{
|
||||
OUString filename = "slide" + OUString::number(nPage+1) + OUString::createFromAscii(suffix) + ".swf";
|
||||
OUString fullpath = sPath + "/" + filename;
|
||||
|
||||
// AS: If suffix is "o" then the last parameter is true (for exporting objects).
|
||||
Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
|
||||
sal_uInt16 nCached = aFlashExporter.exportBackgrounds( xDrawPage, xOutputStreamWrap, sal::static_int_cast<sal_uInt16>( nPage ), *suffix == 'o' );
|
||||
aFlashExporter.Flush();
|
||||
xOutputStreamWrap.clear();
|
||||
|
||||
if (nCached != nPage)
|
||||
{
|
||||
osl_removeFile(fullpath.pData);
|
||||
if ( 0xffff == nCached )
|
||||
return "NULL";
|
||||
else
|
||||
return "slide" + OUString::number(nCached+1) + OUString::createFromAscii(suffix) + ".swf";
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
template <typename TYPE>
|
||||
static TYPE findPropertyValue(const Sequence< PropertyValue >& aPropertySequence, const char* name, TYPE def)
|
||||
{
|
||||
TYPE temp = TYPE();
|
||||
|
||||
sal_Int32 nLength = aPropertySequence.getLength();
|
||||
const PropertyValue * pValue = aPropertySequence.getConstArray();
|
||||
|
||||
for ( sal_Int32 i = 0 ; i < nLength; i++)
|
||||
{
|
||||
if ( pValue[i].Name.equalsAsciiL ( name, strlen(name) ) )
|
||||
{
|
||||
pValue[i].Value >>= temp;
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL FlashExportFilter::filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor )
|
||||
{
|
||||
mxStatusIndicator = findPropertyValue<Reference<XStatusIndicator> >(aDescriptor, "StatusIndicator", mxStatusIndicator);
|
||||
|
||||
Sequence< PropertyValue > aFilterData;
|
||||
aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
|
||||
|
||||
// #i56084# check if selection shall be exported only; if yes, get the selected page and the selection itself
|
||||
if(findPropertyValue<bool>(aDescriptor, "SelectionOnly", false))
|
||||
{
|
||||
Reference< XDesktop2 > xDesktop(Desktop::create(mxContext));
|
||||
|
||||
if(xDesktop.is())
|
||||
{
|
||||
Reference< XFrame > xFrame(xDesktop->getCurrentFrame());
|
||||
|
||||
if(xFrame.is())
|
||||
{
|
||||
Reference< XController > xController(xFrame->getController());
|
||||
|
||||
if(xController.is())
|
||||
{
|
||||
Reference< XDrawView > xDrawView(xController, UNO_QUERY);
|
||||
|
||||
if(xDrawView.is())
|
||||
{
|
||||
mxSelectedDrawPage = xDrawView->getCurrentPage();
|
||||
}
|
||||
|
||||
if(mxSelectedDrawPage.is())
|
||||
{
|
||||
Reference< XSelectionSupplier > xSelection(xController, UNO_QUERY);
|
||||
|
||||
if(xSelection.is())
|
||||
{
|
||||
xSelection->getSelection() >>= mxSelectedShapes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mxSelectedDrawPage.is() && mxSelectedShapes.is() && mxSelectedShapes->getCount())
|
||||
{
|
||||
// #i56084# to export selection we need the selected page and the selected shapes.
|
||||
// There must be shapes selected, else fallback to regular export (export all)
|
||||
mbExportSelection = true;
|
||||
}
|
||||
|
||||
// #i56084# no multiple files (suppress) when selection since selection can only export a single page
|
||||
if (!mbExportSelection && findPropertyValue<bool>(aFilterData, "ExportMultipleFiles", false ))
|
||||
{
|
||||
ExportAsMultipleFiles(aDescriptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExportAsSingleFile(aDescriptor);
|
||||
}
|
||||
|
||||
if( mxStatusIndicator.is() )
|
||||
mxStatusIndicator->end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// AS: When exporting as multiple files, each background, object layer, and slide gets its own
|
||||
// file. Additionally, a file called BackgroundConfig.txt is generated, indicating which
|
||||
// background and objects (if any) go with each slide. The files are named slideNb.swf,
|
||||
// slideNo.swf, and slideNp.swf, where N is the slide number, and b=background, o=objects, and
|
||||
// p=slide contents. Note that under normal circumstances, there will be very few b and o files.
|
||||
|
||||
// AS: HACK! Right now, I create a directory as a sibling to the swf file selected in the Export
|
||||
// dialog. This directory is called presentation.sxi-swf-files. The name of the swf file selected
|
||||
// in the Export dialog has no impact on this. All files created are placed in this directory.
|
||||
void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& aDescriptor)
|
||||
{
|
||||
Reference< XDrawPagesSupplier > xDrawPagesSupplier(mxDoc, UNO_QUERY);
|
||||
if(!xDrawPagesSupplier.is())
|
||||
return;
|
||||
|
||||
Reference< XIndexAccess > xDrawPages = xDrawPagesSupplier->getDrawPages();
|
||||
if(!xDrawPages.is())
|
||||
return;
|
||||
|
||||
Reference< XDesktop2 > rDesktop = Desktop::create( mxContext );
|
||||
|
||||
Reference< XStorable > xStorable(rDesktop->getCurrentComponent(), UNO_QUERY);
|
||||
if (!xStorable.is())
|
||||
return;
|
||||
|
||||
Reference< XDrawPage > xDrawPage;
|
||||
|
||||
Reference< XFrame > rFrame = rDesktop->getCurrentFrame();
|
||||
Reference< XDrawView > rDrawView( rFrame->getController(), UNO_QUERY );
|
||||
|
||||
Reference< XDrawPage > rCurrentPage = rDrawView->getCurrentPage();
|
||||
|
||||
Sequence< PropertyValue > aFilterData;
|
||||
|
||||
aFilterData = findPropertyValue<Sequence< PropertyValue > >(aDescriptor, "FilterData", aFilterData);
|
||||
|
||||
//AS: Do a bunch of path mangling to figure out where to put the files.
|
||||
|
||||
OUString sOriginalPath = findPropertyValue<OUString>(aDescriptor, "URL", OUString());
|
||||
|
||||
// AS: sPath is the parent directory, where everything else exists (like the sxi,
|
||||
// the -swf-files folder, the -audio files, etc.
|
||||
sal_Int32 lastslash = sOriginalPath.lastIndexOf('/');
|
||||
OUString sPath( sOriginalPath.copy(0, lastslash) );
|
||||
|
||||
OUString sPresentation(xStorable->getLocation());
|
||||
|
||||
lastslash = sPresentation.lastIndexOf('/') + 1;
|
||||
sal_Int32 lastdot = sPresentation.lastIndexOf('.');
|
||||
|
||||
// AS: The name of the presentation, without 3 character extension.
|
||||
OUString sPresentationName;
|
||||
if (lastdot < 0) // fdo#71309 in case file has no name
|
||||
sPresentationName = sPresentation.copy(lastslash);
|
||||
else
|
||||
sPresentationName = sPresentation.copy(lastslash, lastdot - lastslash);
|
||||
|
||||
OUString fullpath, swfdirpath, backgroundfilename, objectsfilename;
|
||||
|
||||
swfdirpath = sPath + "/" + sPresentationName + ".sxi-swf-files";
|
||||
|
||||
osl_createDirectory( swfdirpath.pData );
|
||||
|
||||
fullpath = swfdirpath + "/backgroundconfig.txt";
|
||||
|
||||
oslFileHandle aBackgroundConfig( nullptr );
|
||||
|
||||
// AS: Only export the background config if we're exporting all of the pages, otherwise we'll
|
||||
// screw it up.
|
||||
bool bExportAll = findPropertyValue<bool>(aFilterData, "ExportAll", true);
|
||||
if (bExportAll)
|
||||
{
|
||||
osl_removeFile(fullpath.pData);
|
||||
osl_openFile( fullpath.pData, &aBackgroundConfig, osl_File_OpenFlag_Create | osl_File_OpenFlag_Write );
|
||||
|
||||
sal_uInt64 bytesWritten;
|
||||
osl_writeFile(aBackgroundConfig, "slides=", strlen("slides="), &bytesWritten);
|
||||
}
|
||||
|
||||
// TODO: check for errors
|
||||
|
||||
FlashExporter aFlashExporter(
|
||||
mxContext,
|
||||
mxSelectedShapes,
|
||||
mxSelectedDrawPage,
|
||||
findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
|
||||
findPropertyValue<bool>(aFilterData, "ExportOLEAsJPEG", false));
|
||||
|
||||
const sal_Int32 nPageCount = xDrawPages->getCount();
|
||||
if ( mxStatusIndicator.is() )
|
||||
mxStatusIndicator->start( "Saving :", nPageCount);
|
||||
|
||||
for(sal_Int32 nPage = 0; nPage < nPageCount; nPage++)
|
||||
{
|
||||
if ( mxStatusIndicator.is() )
|
||||
mxStatusIndicator->setValue( nPage );
|
||||
xDrawPages->getByIndex(nPage) >>= xDrawPage;
|
||||
|
||||
// AS: If we're only exporting the current page, then skip the rest.
|
||||
if (!bExportAll && xDrawPage != rCurrentPage)
|
||||
continue;
|
||||
|
||||
// AS: Export the background, the background objects, and then the slide contents.
|
||||
if (bExportAll || findPropertyValue<bool>(aFilterData, "ExportBackgrounds", true))
|
||||
{
|
||||
backgroundfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "b");
|
||||
}
|
||||
|
||||
if (bExportAll || findPropertyValue<bool>(aFilterData, "ExportBackgroundObjects", true))
|
||||
{
|
||||
objectsfilename = exportBackground(aFlashExporter, xDrawPage, swfdirpath, nPage, "o");
|
||||
}
|
||||
|
||||
if (bExportAll || findPropertyValue<bool>(aFilterData, "ExportSlideContents", true))
|
||||
{
|
||||
fullpath = swfdirpath + "/slide"+ OUString::number(nPage+1) + "p.swf";
|
||||
|
||||
Reference<XOutputStream> xOutputStreamWrap(*(new OslOutputStreamWrapper(fullpath)), UNO_QUERY);
|
||||
bool ret = aFlashExporter.exportSlides( xDrawPage, xOutputStreamWrap );
|
||||
aFlashExporter.Flush();
|
||||
xOutputStreamWrap.clear();
|
||||
|
||||
if (!ret)
|
||||
osl_removeFile(fullpath.pData);
|
||||
}
|
||||
|
||||
// AS: Write out to the background config what backgrounds and objects this
|
||||
// slide used.
|
||||
if (bExportAll)
|
||||
{
|
||||
OUString temp = backgroundfilename + "|" + objectsfilename;
|
||||
OString ASCIItemp(temp.getStr(), temp.getLength(), RTL_TEXTENCODING_ASCII_US);
|
||||
|
||||
sal_uInt64 bytesWritten;
|
||||
osl_writeFile(aBackgroundConfig, ASCIItemp.getStr(), ASCIItemp.getLength(), &bytesWritten);
|
||||
|
||||
if (nPage < nPageCount - 1)
|
||||
osl_writeFile(aBackgroundConfig, "|", 1, &bytesWritten);
|
||||
}
|
||||
}
|
||||
|
||||
if (bExportAll)
|
||||
osl_closeFile(aBackgroundConfig);
|
||||
}
|
||||
|
||||
void FlashExportFilter::ExportAsSingleFile(const Sequence< PropertyValue >& aDescriptor)
|
||||
{
|
||||
Reference < XOutputStream > xOutputStream = findPropertyValue<Reference<XOutputStream> >(aDescriptor, "OutputStream", nullptr);
|
||||
Sequence< PropertyValue > aFilterData;
|
||||
|
||||
if (!xOutputStream.is() )
|
||||
{
|
||||
OSL_ASSERT ( false );
|
||||
return;
|
||||
}
|
||||
|
||||
FlashExporter aFlashExporter(
|
||||
mxContext,
|
||||
mxSelectedShapes,
|
||||
mxSelectedDrawPage,
|
||||
findPropertyValue<sal_Int32>(aFilterData, "CompressMode", 75),
|
||||
findPropertyValue<bool>(aFilterData, "ExportOLEAsJPEG", false));
|
||||
|
||||
aFlashExporter.exportAll( mxDoc, xOutputStream, mxStatusIndicator );
|
||||
}
|
||||
|
||||
|
||||
void SAL_CALL FlashExportFilter::cancel( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// XExporter
|
||||
void SAL_CALL FlashExportFilter::setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc )
|
||||
{
|
||||
mxDoc = xDoc;
|
||||
}
|
||||
|
||||
|
||||
// XInitialization
|
||||
void SAL_CALL FlashExportFilter::initialize( const css::uno::Sequence< css::uno::Any >& /* aArguments */ )
|
||||
{
|
||||
}
|
||||
|
||||
OUString FlashExportFilter_getImplementationName ()
|
||||
{
|
||||
return "com.sun.star.comp.Impress.FlashExportFilter";
|
||||
}
|
||||
|
||||
Sequence< OUString > FlashExportFilter_getSupportedServiceNames( )
|
||||
{
|
||||
Sequence<OUString> aRet { "com.sun.star.document.ExportFilter" };
|
||||
return aRet;
|
||||
}
|
||||
|
||||
Reference< XInterface > FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
|
||||
{
|
||||
return static_cast<cppu::OWeakObject*>(new FlashExportFilter( comphelper::getComponentContext(rSMgr) ));
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
OUString SAL_CALL FlashExportFilter::getImplementationName( )
|
||||
{
|
||||
return FlashExportFilter_getImplementationName();
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL FlashExportFilter::supportsService( const OUString& rServiceName )
|
||||
{
|
||||
return cppu::supportsService( this, rServiceName );
|
||||
}
|
||||
|
||||
css::uno::Sequence< OUString > SAL_CALL FlashExportFilter::getSupportedServiceNames( )
|
||||
{
|
||||
return FlashExportFilter_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <cppuhelper/factory.hxx>
|
||||
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
|
||||
|
||||
#include "swfuno.hxx"
|
||||
|
||||
using namespace ::cppu;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::registry;
|
||||
|
||||
using namespace ::swf;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
SAL_DLLPUBLIC_EXPORT void * flash_component_getFactory(
|
||||
const char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
|
||||
{
|
||||
void * pRet = nullptr;
|
||||
|
||||
if( pServiceManager )
|
||||
{
|
||||
Reference< XSingleServiceFactory > xFactory;
|
||||
|
||||
OUString implName = OUString::createFromAscii( pImplName );
|
||||
if ( implName == FlashExportFilter_getImplementationName() )
|
||||
{
|
||||
xFactory = createSingleFactory(
|
||||
static_cast< XMultiServiceFactory * >( pServiceManager ),
|
||||
OUString::createFromAscii( pImplName ),
|
||||
FlashExportFilter_createInstance, FlashExportFilter_getSupportedServiceNames() );
|
||||
|
||||
}
|
||||
else if ( implName == SWFDialog_getImplementationName() )
|
||||
{
|
||||
xFactory = createSingleFactory(
|
||||
static_cast< XMultiServiceFactory * >( pServiceManager ),
|
||||
OUString::createFromAscii( pImplName ),
|
||||
SWFDialog_createInstance, SWFDialog_getSupportedServiceNames() );
|
||||
}
|
||||
|
||||
if (xFactory.is())
|
||||
{
|
||||
xFactory->acquire();
|
||||
pRet = xFactory.get();
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_FILTER_SOURCE_FLASH_SWFUNO_HXX
|
||||
#define INCLUDED_FILTER_SOURCE_FLASH_SWFUNO_HXX
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
namespace com { namespace sun { namespace star {
|
||||
namespace lang { class XMultiSerivceFactory; }
|
||||
namespace uno { class XInterface; }
|
||||
} } }
|
||||
|
||||
namespace swf {
|
||||
|
||||
/// @throws css::uno::RuntimeException
|
||||
OUString FlashExportFilter_getImplementationName();
|
||||
|
||||
/// @throws css::uno::RuntimeException
|
||||
css::uno::Sequence<OUString>
|
||||
FlashExportFilter_getSupportedServiceNames();
|
||||
|
||||
/// @throws css::uno::Exception
|
||||
css::uno::Reference<css::uno::XInterface>
|
||||
FlashExportFilter_createInstance(
|
||||
css::uno::Reference<css::lang::XMultiServiceFactory> const & rSMgr);
|
||||
|
||||
}
|
||||
|
||||
/// @throws css::uno::RuntimeException
|
||||
OUString SWFDialog_getImplementationName ();
|
||||
|
||||
/// @throws css::uno::RuntimeException
|
||||
css::uno::Sequence<OUString> SWFDialog_getSupportedServiceNames();
|
||||
|
||||
/// @throws css::uno::Exception
|
||||
css::uno::Reference<css::uno::XInterface> SWFDialog_createInstance(
|
||||
css::uno::Reference<css::lang::XMultiServiceFactory> const & rSMgr);
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,418 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include "swfwriter.hxx"
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/gdimtf.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
|
||||
using namespace ::swf;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::io;
|
||||
|
||||
|
||||
static MapMode aTWIPSMode( MapUnit::MapTwip );
|
||||
static MapMode a100thmmMode( MapUnit::Map100thMM );
|
||||
|
||||
static sal_Int32 map100thmm( sal_Int32 n100thMM )
|
||||
{
|
||||
Point aPoint( n100thMM, n100thMM );
|
||||
sal_Int32 nX = OutputDevice::LogicToLogic( aPoint, a100thmmMode, aTWIPSMode ).X();
|
||||
return nX;
|
||||
}
|
||||
|
||||
|
||||
Writer::Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int32 nDocWidth, sal_Int32 nDocHeight, sal_Int32 nJPEGcompressMode )
|
||||
: mnDocWidth( map100thmm(nDocWidth) ),
|
||||
mnDocHeight( map100thmm(nDocHeight) ),
|
||||
mnDocXScale( static_cast<double>(nTWIPWidthOutput) / mnDocWidth ),
|
||||
mnDocYScale( static_cast<double>(nTWIPHeightOutput) / mnDocHeight ),
|
||||
mpClipPolyPolygon( nullptr ),
|
||||
mnNextId( 1 ),
|
||||
mnFrames( 0 ),
|
||||
mnGlobalTransparency(0),
|
||||
mnJPEGCompressMode(nJPEGcompressMode)
|
||||
{
|
||||
mpVDev->EnableOutput( false );
|
||||
|
||||
maMovieTempFile.EnableKillingFile();
|
||||
maFontsTempFile.EnableKillingFile();
|
||||
|
||||
mpMovieStream = maMovieTempFile.GetStream( StreamMode::WRITE|StreamMode::TRUNC );
|
||||
mpFontsStream = maFontsTempFile.GetStream( StreamMode::WRITE|StreamMode::TRUNC );
|
||||
|
||||
// define an invisible button with the size of a page
|
||||
tools::Rectangle aRect( 0, 0, static_cast<long>( mnDocWidth * mnDocXScale ), static_cast<long>( mnDocHeight * mnDocYScale ) );
|
||||
tools::Polygon aPoly( aRect );
|
||||
FillStyle aFill( COL_WHITE );
|
||||
sal_uInt16 nWhiteBackgroundShapeId = defineShape( aPoly, aFill );
|
||||
|
||||
::basegfx::B2DHomMatrix m; // #i73264#
|
||||
mnPageButtonId = createID();
|
||||
startTag( TAG_DEFINEBUTTON );
|
||||
mpTag->addUI16( mnPageButtonId ); // character id for button
|
||||
|
||||
// button records
|
||||
mpTag->addUI8( 0x08 ); // only hit state
|
||||
mpTag->addUI16( nWhiteBackgroundShapeId ); // shape id of background rectangle
|
||||
mpTag->addUI16( 0 ); // depth for button DANGER!
|
||||
mpTag->addMatrix( m ); // identity matrix
|
||||
mpTag->addUI8( 0 ); // empty color transform
|
||||
|
||||
// mpTag->addUI8( 0 ); // end of button records
|
||||
|
||||
// action records
|
||||
mpTag->addUI8( 0x06 ); // ActionPlay
|
||||
mpTag->addUI8( 0 ); // end of action records
|
||||
|
||||
endTag();
|
||||
|
||||
// place a shape that clips shapes depth 2-3 to document boundaries
|
||||
// placeShape( mnWhiteBackgroundShapeId, 1, 0, 0, 4 );
|
||||
}
|
||||
|
||||
|
||||
Writer::~Writer()
|
||||
{
|
||||
mpVDev.disposeAndClear();
|
||||
}
|
||||
|
||||
|
||||
static void ImplCopySvStreamToXOutputStream( SvStream& rIn, Reference< XOutputStream > const &xOut )
|
||||
{
|
||||
sal_uInt32 nBufferSize = 64*1024;
|
||||
|
||||
sal_uInt32 nSize = rIn.TellEnd();
|
||||
rIn.Seek( STREAM_SEEK_TO_BEGIN );
|
||||
|
||||
Sequence< sal_Int8 > aBuffer( std::min( nBufferSize, nSize ) );
|
||||
|
||||
while( nSize )
|
||||
{
|
||||
if( nSize < nBufferSize )
|
||||
{
|
||||
nBufferSize = nSize;
|
||||
aBuffer.realloc( nSize );
|
||||
}
|
||||
|
||||
sal_uInt32 nRead = rIn.ReadBytes(aBuffer.getArray(), nBufferSize);
|
||||
DBG_ASSERT( nRead == nBufferSize, "ImplCopySvStreamToXOutputStream failed!" );
|
||||
xOut->writeBytes( aBuffer );
|
||||
|
||||
if( nRead == 0 )
|
||||
break;
|
||||
|
||||
nSize -= nRead;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Writer::storeTo( Reference< XOutputStream > const &xOutStream )
|
||||
{
|
||||
for (auto & font : maFonts)
|
||||
{
|
||||
font->write( *mpFontsStream );
|
||||
font.reset();
|
||||
}
|
||||
maFonts.clear();
|
||||
|
||||
// Endtag
|
||||
mpMovieStream->WriteUInt16( 0 );
|
||||
|
||||
Tag aHeader( 0xff );
|
||||
|
||||
aHeader.addUI8( 'F' );
|
||||
aHeader.addUI8( 'W' );
|
||||
aHeader.addUI8( 'S' );
|
||||
aHeader.addUI8( 5 );
|
||||
|
||||
sal_uInt32 nSizePos = aHeader.Tell();
|
||||
|
||||
aHeader.WriteUInt32( 0 );
|
||||
|
||||
tools::Rectangle aDocRect( 0, 0, static_cast<long>(mnDocWidth*mnDocXScale), static_cast<long>(mnDocHeight*mnDocYScale) );
|
||||
|
||||
aHeader.addRect( aDocRect );
|
||||
|
||||
// frame delay in 8.8 fixed number of frames per second
|
||||
aHeader.addUI8( 0 );
|
||||
aHeader.addUI8( 12 );
|
||||
|
||||
aHeader.addUI16( uInt16_(mnFrames) );
|
||||
|
||||
const sal_uInt32 nSize = aHeader.Tell() + mpFontsStream->Tell() + mpMovieStream->Tell();
|
||||
|
||||
aHeader.Seek( nSizePos );
|
||||
aHeader.WriteUInt32( nSize );
|
||||
|
||||
ImplCopySvStreamToXOutputStream( aHeader, xOutStream );
|
||||
ImplCopySvStreamToXOutputStream( *mpFontsStream, xOutStream );
|
||||
ImplCopySvStreamToXOutputStream( *mpMovieStream, xOutStream );
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 Writer::startSprite()
|
||||
{
|
||||
sal_uInt16 nShapeId = createID();
|
||||
mvSpriteStack.push(mpSprite.release());
|
||||
mpSprite.reset(new Sprite( nShapeId ));
|
||||
return nShapeId;
|
||||
}
|
||||
|
||||
|
||||
void Writer::endSprite()
|
||||
{
|
||||
if( !mpSprite )
|
||||
return;
|
||||
|
||||
startTag( TAG_END );
|
||||
endTag();
|
||||
|
||||
mpSprite->write( *mpMovieStream );
|
||||
mpSprite.reset();
|
||||
|
||||
if (!mvSpriteStack.empty())
|
||||
{
|
||||
mpSprite.reset( mvSpriteStack.top() );
|
||||
mvSpriteStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Writer::placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y )
|
||||
{
|
||||
startTag( TAG_PLACEOBJECT2 );
|
||||
|
||||
BitStream aBits;
|
||||
|
||||
aBits.writeUB( sal_uInt32(0), 1 ); // Has Clip Actions?
|
||||
aBits.writeUB( 0, 1 ); // reserved
|
||||
aBits.writeUB( sal_uInt32(0), 1 ); // has a name
|
||||
aBits.writeUB( 0, 1 ); // no ratio
|
||||
aBits.writeUB( 0, 1 ); // no color transform
|
||||
aBits.writeUB( 1, 1 ); // has a matrix
|
||||
aBits.writeUB( 1, 1 ); // places a character
|
||||
aBits.writeUB( 0, 1 ); // does not define a character to be moved
|
||||
|
||||
mpTag->addBits( aBits );
|
||||
mpTag->addUI16( nDepth ); // depth
|
||||
mpTag->addUI16( nID ); // character Id
|
||||
|
||||
// #i73264#
|
||||
const basegfx::B2DHomMatrix aMatrix(basegfx::utils::createTranslateB2DHomMatrix(
|
||||
Int16_(static_cast<long>(map100thmm(x)*mnDocXScale)),
|
||||
Int16_(static_cast<long>(map100thmm(y)*mnDocYScale))));
|
||||
mpTag->addMatrix( aMatrix ); // transformation matrix
|
||||
|
||||
endTag();
|
||||
}
|
||||
|
||||
|
||||
void Writer::removeShape( sal_uInt16 nDepth )
|
||||
{
|
||||
startTag( TAG_REMOVEOBJECT2 );
|
||||
mpTag->addUI16( nDepth ); // depth
|
||||
endTag();
|
||||
}
|
||||
|
||||
|
||||
void Writer::startTag( sal_uInt8 nTagId )
|
||||
{
|
||||
DBG_ASSERT( mpTag == nullptr, "Last tag was not ended");
|
||||
|
||||
mpTag.reset( new Tag( nTagId ) );
|
||||
}
|
||||
|
||||
|
||||
void Writer::endTag()
|
||||
{
|
||||
sal_uInt8 nTag = mpTag->getTagId();
|
||||
|
||||
if( mpSprite && ( (nTag == TAG_END) || (nTag == TAG_SHOWFRAME) || (nTag == TAG_DOACTION) || (nTag == TAG_STARTSOUND) || (nTag == TAG_PLACEOBJECT) || (nTag == TAG_PLACEOBJECT2) || (nTag == TAG_REMOVEOBJECT2) || (nTag == TAG_FRAMELABEL) ) )
|
||||
{
|
||||
mpSprite->addTag( std::move(mpTag) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mpTag->write( *mpMovieStream );
|
||||
mpTag.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Writer::showFrame()
|
||||
{
|
||||
startTag( TAG_SHOWFRAME );
|
||||
endTag();
|
||||
|
||||
if(nullptr == mpSprite)
|
||||
mnFrames++;
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 Writer::defineShape( const GDIMetaFile& rMtf )
|
||||
{
|
||||
mpVDev->SetMapMode( rMtf.GetPrefMapMode() );
|
||||
Impl_writeActions( rMtf );
|
||||
|
||||
sal_uInt16 nId = 0;
|
||||
if (maShapeIds.empty())
|
||||
return nId;
|
||||
|
||||
{
|
||||
nId = startSprite();
|
||||
sal_uInt16 iDepth = 1;
|
||||
for (auto const& shape : maShapeIds)
|
||||
{
|
||||
placeShape( shape, iDepth++, 0, 0 );
|
||||
}
|
||||
endSprite();
|
||||
}
|
||||
|
||||
maShapeIds.clear();
|
||||
|
||||
return nId;
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 Writer::defineShape( const tools::Polygon& rPoly, const FillStyle& rFillStyle )
|
||||
{
|
||||
const tools::PolyPolygon aPolyPoly( rPoly );
|
||||
return defineShape( aPolyPoly, rFillStyle );
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 Writer::defineShape( const tools::PolyPolygon& rPolyPoly, const FillStyle& rFillStyle )
|
||||
{
|
||||
sal_uInt16 nShapeId = createID();
|
||||
|
||||
// start a DefineShape3 tag
|
||||
startTag( TAG_DEFINESHAPE3 );
|
||||
|
||||
mpTag->addUI16( nShapeId );
|
||||
mpTag->addRect( rPolyPoly.GetBoundRect() );
|
||||
|
||||
|
||||
// FILLSTYLEARRAY
|
||||
mpTag->addUI8( 1 ); // FillStyleCount
|
||||
|
||||
// FILLSTYLE
|
||||
rFillStyle.addTo( mpTag.get() );
|
||||
|
||||
// LINESTYLEARRAY
|
||||
mpTag->addUI8( 0 ); // LineStyleCount
|
||||
|
||||
// Number of fill and line index bits to 1
|
||||
mpTag->addUI8( 0x11 );
|
||||
|
||||
BitStream aBits;
|
||||
|
||||
const sal_uInt16 nCount = rPolyPoly.Count();
|
||||
sal_uInt16 i;
|
||||
for( i = 0; i < nCount; i++ )
|
||||
{
|
||||
const tools::Polygon& rPoly = rPolyPoly[ i ];
|
||||
if( rPoly.GetSize() )
|
||||
Impl_addPolygon( aBits, rPoly, true );
|
||||
}
|
||||
|
||||
Impl_addEndShapeRecord( aBits );
|
||||
|
||||
mpTag->addBits( aBits );
|
||||
endTag();
|
||||
|
||||
return nShapeId;
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 Writer::defineShape( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nLineWidth, const Color& rLineColor )
|
||||
{
|
||||
sal_uInt16 nShapeId = createID();
|
||||
|
||||
// start a DefineShape3 tag
|
||||
startTag( TAG_DEFINESHAPE3 );
|
||||
|
||||
mpTag->addUI16( nShapeId );
|
||||
mpTag->addRect( rPolyPoly.GetBoundRect() );
|
||||
|
||||
|
||||
// FILLSTYLEARRAY
|
||||
mpTag->addUI8( 0 ); // FillStyleCount
|
||||
|
||||
// LINESTYLEARRAY
|
||||
mpTag->addUI8( 1 ); // LineStyleCount
|
||||
|
||||
// LINESTYLE
|
||||
mpTag->addUI16( nLineWidth ); // Width of line in twips
|
||||
mpTag->addRGBA( rLineColor ); // Color
|
||||
|
||||
// Number of fill and line index bits to 1
|
||||
mpTag->addUI8( 0x11 );
|
||||
|
||||
BitStream aBits;
|
||||
|
||||
const sal_uInt16 nCount = rPolyPoly.Count();
|
||||
sal_uInt16 i;
|
||||
for( i = 0; i < nCount; i++ )
|
||||
{
|
||||
const tools::Polygon& rPoly = rPolyPoly[ i ];
|
||||
if( rPoly.GetSize() )
|
||||
Impl_addPolygon( aBits, rPoly, false );
|
||||
}
|
||||
|
||||
Impl_addEndShapeRecord( aBits );
|
||||
|
||||
mpTag->addBits( aBits );
|
||||
endTag();
|
||||
|
||||
return nShapeId;
|
||||
}
|
||||
|
||||
|
||||
void Writer::stop()
|
||||
{
|
||||
startTag( TAG_DOACTION );
|
||||
mpTag->addUI8( 0x07 );
|
||||
mpTag->addUI8( 0 );
|
||||
endTag();
|
||||
}
|
||||
|
||||
|
||||
void Writer::waitOnClick( sal_uInt16 nDepth )
|
||||
{
|
||||
placeShape( uInt16_( mnPageButtonId ), nDepth, 0, 0 );
|
||||
stop();
|
||||
showFrame();
|
||||
removeShape( nDepth );
|
||||
}
|
||||
|
||||
|
||||
/** inserts a doaction tag with an ActionGotoFrame */
|
||||
void Writer::gotoFrame( sal_uInt16 nFrame )
|
||||
{
|
||||
startTag( TAG_DOACTION );
|
||||
mpTag->addUI8( 0x81 );
|
||||
mpTag->addUI16( 2 );
|
||||
mpTag->addUI16( nFrame );
|
||||
mpTag->addUI8( 0 );
|
||||
endTag();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,406 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_FILTER_SOURCE_FLASH_SWFWRITER_HXX
|
||||
#define INCLUDED_FILTER_SOURCE_FLASH_SWFWRITER_HXX
|
||||
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/i18n/XBreakIterator.hpp>
|
||||
#include <vcl/checksum.hxx>
|
||||
#include <vcl/font.hxx>
|
||||
#include <vcl/gradient.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
#include <unotools/tempfile.hxx>
|
||||
#include <tools/color.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
#include <tools/stream.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <map>
|
||||
|
||||
class GDIMetaFile;
|
||||
class BitmapEx;
|
||||
class Gradient;
|
||||
class SvtGraphicFill;
|
||||
class SvtGraphicStroke;
|
||||
class LineInfo;
|
||||
namespace basegfx { class B2DPolygon; }
|
||||
namespace tools
|
||||
{
|
||||
class Polygon;
|
||||
class PolyPolygon;
|
||||
}
|
||||
|
||||
inline sal_uInt16 uInt16_( sal_Int32 nValue )
|
||||
{
|
||||
OSL_ENSURE( (nValue >= 0) && (static_cast<sal_uInt32>(nValue) <= 0xffff), "overflow while converting sal_Int32 to sal_uInt16" );
|
||||
return static_cast<sal_uInt16>(nValue);
|
||||
}
|
||||
|
||||
inline sal_Int16 Int16_( sal_Int32 nValue )
|
||||
{
|
||||
OSL_ENSURE( (nValue >= -32768) && (nValue <= 32767), "overflow while converting sal_Int32 to sal_Int16" );
|
||||
return static_cast<sal_Int16>(nValue);
|
||||
}
|
||||
|
||||
class VirtualDevice;
|
||||
|
||||
sal_uInt16 getMaxBitsSigned( sal_Int32 nValue );
|
||||
|
||||
namespace swf {
|
||||
|
||||
const sal_uInt8 TAG_END = 0;
|
||||
const sal_uInt8 TAG_SHOWFRAME = 1;
|
||||
|
||||
const sal_uInt8 TAG_DEFINEBUTTON = 7;
|
||||
|
||||
const sal_uInt8 TAG_BACKGROUNDCOLOR = 9;
|
||||
|
||||
const sal_uInt8 TAG_DOACTION = 12;
|
||||
const sal_uInt8 TAG_STARTSOUND = 15;
|
||||
|
||||
const sal_uInt8 TAG_SOUNDSTREAMBLOCK = 19;
|
||||
const sal_uInt8 TAG_SOUNDSTREAMHEAD = 18;
|
||||
const sal_uInt8 TAG_SOUNDSTREAMHEAD2 = 45;
|
||||
|
||||
const sal_uInt8 TAG_JPEGTABLES = 8;
|
||||
const sal_uInt8 TAG_DEFINEBITS = 6;
|
||||
const sal_uInt8 TAG_DEFINEBITSLOSSLESS = 20;
|
||||
const sal_uInt8 TAG_DEFINEBITSJPEG2 = 21;
|
||||
const sal_uInt8 TAG_DEFINEBITSJPEG3 = 35;
|
||||
const sal_uInt8 TAG_DEFINEBITSLOSSLESS2 = 36;
|
||||
const sal_uInt8 TAG_DEFINEEDITTEXT= 37;
|
||||
const sal_uInt8 TAG_PLACEOBJECT = 4;
|
||||
const sal_uInt8 TAG_PLACEOBJECT2 = 26;
|
||||
const sal_uInt8 TAG_REMOVEOBJECT2 = 28;
|
||||
|
||||
const sal_uInt8 TAG_DEFINEFONT = 10;
|
||||
const sal_uInt8 TAG_DEFINETEXT = 11;
|
||||
const sal_uInt8 TAG_DEFINESHAPE3 = 32;
|
||||
const sal_uInt8 TAG_DEFINESPRITE = 39;
|
||||
|
||||
const sal_uInt8 TAG_FRAMELABEL = 43;
|
||||
|
||||
const sal_uInt8 TAG_HEADER = 0xff;
|
||||
|
||||
|
||||
/** converts a double to a 16.16 flash fixed value */
|
||||
sal_uInt32 getFixed( double fValue );
|
||||
|
||||
|
||||
typedef ::std::map<BitmapChecksum, sal_uInt16> ChecksumCache;
|
||||
|
||||
/** container class to create bit structures */
|
||||
class BitStream
|
||||
{
|
||||
public:
|
||||
BitStream();
|
||||
|
||||
void writeUB( sal_uInt32 nValue, sal_uInt16 nBits );
|
||||
void writeSB( sal_Int32 nValue, sal_uInt16 nBits );
|
||||
void writeFB( sal_uInt32 nValue, sal_uInt16 nBits );
|
||||
|
||||
void pad();
|
||||
void writeTo( SvStream& out );
|
||||
|
||||
sal_uInt32 getOffset() const;
|
||||
private:
|
||||
|
||||
std::vector< sal_uInt8 > maData;
|
||||
sal_uInt8 mnBitPos;
|
||||
sal_uInt8 mnCurrentByte;
|
||||
};
|
||||
|
||||
|
||||
/** this class collects all used glyphs for a given fonts and maps
|
||||
characters to glyph ids.
|
||||
*/
|
||||
class FlashFont
|
||||
{
|
||||
public:
|
||||
FlashFont( const vcl::Font& rFont, sal_uInt16 nId );
|
||||
~FlashFont();
|
||||
|
||||
sal_uInt16 getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev );
|
||||
|
||||
void write( SvStream& out );
|
||||
|
||||
sal_uInt16 getID() const { return mnId; }
|
||||
const vcl::Font& getFont() const { return maFont; }
|
||||
|
||||
private:
|
||||
const vcl::Font maFont;
|
||||
std::map<sal_uInt16, sal_uInt16> maGlyphIndex;
|
||||
sal_uInt16 mnNextIndex;
|
||||
sal_uInt16 mnId;
|
||||
BitStream maGlyphData;
|
||||
std::vector< sal_uInt16 > maGlyphOffsets;
|
||||
};
|
||||
|
||||
/** this class helps creating flash tags */
|
||||
class Tag : public SvMemoryStream
|
||||
{
|
||||
public:
|
||||
explicit Tag( sal_uInt8 nTagId );
|
||||
|
||||
sal_uInt8 getTagId() const { return mnTagId; }
|
||||
|
||||
void write( SvStream& out );
|
||||
|
||||
void addUI32( sal_uInt32 nValue );
|
||||
void addUI16( sal_uInt16 nValue );
|
||||
void addUI8( sal_uInt8 nValue );
|
||||
void addBits( BitStream& rIn );
|
||||
|
||||
void addRGBA( const Color& rColor );
|
||||
void addRGB( const Color& rColor );
|
||||
void addRect( const tools::Rectangle& rRect );
|
||||
void addMatrix( const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
|
||||
void addStream( SvStream& rIn );
|
||||
|
||||
static void writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
|
||||
static void writeRect( SvStream& rOut, const tools::Rectangle& rRect );
|
||||
|
||||
private:
|
||||
sal_uInt8 mnTagId;
|
||||
};
|
||||
|
||||
|
||||
/** this class helps to define flash sprites */
|
||||
class Sprite
|
||||
{
|
||||
public:
|
||||
explicit Sprite( sal_uInt16 nId );
|
||||
~Sprite();
|
||||
|
||||
void write( SvStream& out );
|
||||
void addTag( std::unique_ptr<Tag> pNewTag );
|
||||
|
||||
private:
|
||||
std::vector< std::unique_ptr<Tag> > maTags;
|
||||
sal_uInt16 mnId;
|
||||
sal_uInt32 mnFrames;
|
||||
};
|
||||
|
||||
|
||||
/** this class stores a flash fill style for shapes */
|
||||
class FillStyle
|
||||
{
|
||||
public:
|
||||
enum FillStyleType { solid = 0x00, linear_gradient = 0x10, radial_gradient = 0x12, tiled_bitmap = 0x40, clipped_bitmap = 0x41 };
|
||||
|
||||
/** this c'tor creates a solid fill style */
|
||||
explicit FillStyle( const Color& rSolidColor );
|
||||
|
||||
/** this c'tor creates a linear or radial gradient fill style */
|
||||
FillStyle( const tools::Rectangle& rBoundRect, const Gradient& rGradient );
|
||||
|
||||
/** this c'tor creates a tiled or clipped bitmap fill style */
|
||||
FillStyle( sal_uInt16 nBitmapId, bool bClipped, const ::basegfx::B2DHomMatrix& rMatrix ); // #i73264#
|
||||
|
||||
void addTo( Tag* pTag ) const;
|
||||
|
||||
private:
|
||||
void Impl_addGradient( Tag* pTag ) const;
|
||||
|
||||
FillStyleType meType;
|
||||
::basegfx::B2DHomMatrix maMatrix; // #i73264#
|
||||
sal_uInt16 mnBitmapId;
|
||||
Color maColor;
|
||||
Gradient maGradient;
|
||||
tools::Rectangle maBoundRect;
|
||||
};
|
||||
|
||||
|
||||
/** this class creates a flash movie from vcl geometry */
|
||||
class Writer
|
||||
{
|
||||
friend class FlashFont;
|
||||
|
||||
public:
|
||||
/** creates a writer for a new flash movie.
|
||||
nDocWidth and nDocHeight are the dimensions of the movie.
|
||||
They must be in 100th/mm.
|
||||
|
||||
An invisible shape with the size of the document is placed at depth 1
|
||||
and it clips all shapes on depth 2 and 3.
|
||||
*/
|
||||
Writer( sal_Int32 nTWIPWidthOutput, sal_Int32 nTWIPHeightOutput, sal_Int32 nDocWidth, sal_Int32 nDocHeight, sal_Int32 nJPEGcompressMode );
|
||||
~Writer();
|
||||
|
||||
void storeTo( css::uno::Reference< css::io::XOutputStream > const &xOutStream );
|
||||
|
||||
// geometry
|
||||
void setClipping( const tools::PolyPolygon* pClipPolyPolygon );
|
||||
|
||||
/** defines a flash shape from a filled polygon.
|
||||
The coordinates must be in twips */
|
||||
sal_uInt16 defineShape( const tools::Polygon& rPoly, const FillStyle& rFillStyle );
|
||||
|
||||
/** defines a flash shape from a filled polypolygon.
|
||||
The coordinates must be in twips */
|
||||
sal_uInt16 defineShape( const tools::PolyPolygon& rPolyPoly, const FillStyle& rFillStyle );
|
||||
|
||||
/** defines a flash shape from an outlined polypolygon.
|
||||
The coordinates must be in twips */
|
||||
sal_uInt16 defineShape( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nLineWidth, const Color& rLineColor );
|
||||
|
||||
/** defines a flash shape from a vcl metafile.
|
||||
The mapmode of the metafile is used to map all coordinates to twips.
|
||||
A character id of a flash sprite is returned that contains all geometry
|
||||
from the metafile.
|
||||
*/
|
||||
sal_uInt16 defineShape( const GDIMetaFile& rMtf );
|
||||
|
||||
/** defines a bitmap and returns its flash id.
|
||||
*/
|
||||
sal_uInt16 defineBitmap( const BitmapEx& bmpSource, sal_Int32 nJPEGQualityLevel );
|
||||
|
||||
// control tags
|
||||
|
||||
/** inserts a place shape tag into the movie stream or the current sprite */
|
||||
void placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y );
|
||||
|
||||
/** inserts a remove shape tag into the movie stream or the current sprite */
|
||||
void removeShape( sal_uInt16 nDepth );
|
||||
|
||||
/** inserts a show frame tag into the movie stream or the current sprite */
|
||||
void showFrame();
|
||||
|
||||
/** creates a new sprite and sets it as the current sprite for editing.
|
||||
Only one sprite can be edited at one time */
|
||||
sal_uInt16 startSprite();
|
||||
|
||||
/** ends editing of the current sprites and adds it to the movie stream */
|
||||
void endSprite();
|
||||
|
||||
/** inserts a doaction tag with an ActionStop */
|
||||
void stop();
|
||||
|
||||
/** inserts a doaction tag with an ActionStop, place a button on depth nDepth that
|
||||
continues playback on click */
|
||||
void waitOnClick( sal_uInt16 nDepth );
|
||||
|
||||
/** inserts a doaction tag with an ActionGotoFrame */
|
||||
void gotoFrame( sal_uInt16 nFrame );
|
||||
|
||||
private:
|
||||
Point map( const Point& rPoint ) const;
|
||||
Size map( const Size& rSize ) const;
|
||||
void map( tools::PolyPolygon& rPolyPolygon ) const;
|
||||
sal_Int32 mapRelative( sal_Int32 n100thMM ) const;
|
||||
|
||||
void startTag( sal_uInt8 nTagId );
|
||||
void endTag();
|
||||
sal_uInt16 createID() { return mnNextId++; }
|
||||
|
||||
void Impl_writeBmp( sal_uInt16 nBitmapId, sal_uInt32 width, sal_uInt32 height, sal_uInt8 const *pCompressed, sal_uInt32 compressed_size );
|
||||
void Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const tools::Rectangle& rClipRect, bool bMap );
|
||||
void Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal_uInt32 nJpgDataLength, sal_uInt8 const *pCompressed, sal_uInt32 compressed_size );
|
||||
void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
|
||||
void Impl_writeActions( const GDIMetaFile& rMtf );
|
||||
void Impl_writePolygon( const tools::Polygon& rPoly, bool bFilled );
|
||||
void Impl_writePolygon( const tools::Polygon& rPoly, bool bFilled, const Color& rFillColor, const Color& rLineColor );
|
||||
void Impl_writePolyPolygon( const tools::PolyPolygon& rPolyPoly, bool bFilled, sal_uInt8 nTransparence = 0);
|
||||
void Impl_writePolyPolygon( const tools::PolyPolygon& rPolyPoly, bool bFilled, const Color& rFillColor, const Color& rLineColor );
|
||||
void Impl_writeText( const Point& rPos, const OUString& rText, const long* pDXArray, long nWidth );
|
||||
void Impl_writeText( const Point& rPos, const OUString& rText, const long* pDXArray, long nWidth, Color aTextColor );
|
||||
void Impl_writeGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
|
||||
void Impl_writeLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = nullptr );
|
||||
void Impl_writeRect( const tools::Rectangle& rRect, long nRadX, long nRadY );
|
||||
void Impl_writeEllipse( const Point& rCenter, long nRadX, long nRadY );
|
||||
bool Impl_writeFilling( SvtGraphicFill const & rFilling );
|
||||
bool Impl_writeStroke( SvtGraphicStroke const & rStroke );
|
||||
|
||||
FlashFont& Impl_getFont( const vcl::Font& rFont );
|
||||
|
||||
static void Impl_addPolygon( BitStream& rBits, const tools::Polygon& rPoly, bool bFilled );
|
||||
|
||||
static void Impl_addShapeRecordChange( BitStream& rBits, sal_Int16 dx, sal_Int16 dy, bool bFilled );
|
||||
static void Impl_addStraightEdgeRecord( BitStream& rBits, sal_Int16 dx, sal_Int16 dy );
|
||||
static void Impl_addCurvedEdgeRecord( BitStream& rBits, sal_Int16 control_dx, sal_Int16 control_dy, sal_Int16 anchor_dx, sal_Int16 anchor_dy );
|
||||
static void Impl_addEndShapeRecord( BitStream& rBits );
|
||||
|
||||
static void Impl_addStraightLine( BitStream& rBits,
|
||||
Point& rLastPoint,
|
||||
const double P2x, const double P2y );
|
||||
static void Impl_addQuadBezier( BitStream& rBits,
|
||||
Point& rLastPoint,
|
||||
const double P2x, const double P2y,
|
||||
const double P3x, const double P3y );
|
||||
static void Impl_quadBezierApprox( BitStream& rBits,
|
||||
Point& rLastPoint,
|
||||
const double d2,
|
||||
const double P1x, const double P1y,
|
||||
const double P2x, const double P2y,
|
||||
const double P3x, const double P3y,
|
||||
const double P4x, const double P4y );
|
||||
|
||||
css::uno::Reference < css::i18n::XBreakIterator > const & Impl_GetBreakIterator();
|
||||
|
||||
private:
|
||||
css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator;
|
||||
|
||||
std::vector<std::unique_ptr<FlashFont>> maFonts;
|
||||
|
||||
sal_Int32 mnDocWidth;
|
||||
sal_Int32 mnDocHeight;
|
||||
|
||||
// AS: Scaling factor for output.
|
||||
double mnDocXScale;
|
||||
double mnDocYScale;
|
||||
|
||||
sal_uInt16 mnPageButtonId;
|
||||
|
||||
VclPtrInstance<VirtualDevice> mpVDev;
|
||||
|
||||
const tools::PolyPolygon* mpClipPolyPolygon;
|
||||
|
||||
/** holds the information of the objects defined in the movie stream
|
||||
while executing defineShape
|
||||
*/
|
||||
std::vector<sal_uInt16> maShapeIds;
|
||||
|
||||
std::unique_ptr<Tag> mpTag;
|
||||
std::unique_ptr<Sprite> mpSprite;
|
||||
std::stack<Sprite*> mvSpriteStack;
|
||||
ChecksumCache mBitmapCache;
|
||||
|
||||
sal_uInt16 mnNextId;
|
||||
sal_uInt32 mnFrames;
|
||||
|
||||
utl::TempFile maMovieTempFile;
|
||||
utl::TempFile maFontsTempFile;
|
||||
|
||||
SvStream* mpMovieStream;
|
||||
SvStream* mpFontsStream;
|
||||
|
||||
sal_uInt8 mnGlobalTransparency;
|
||||
sal_Int32 mnJPEGCompressMode;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,631 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include "swfwriter.hxx"
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
using namespace ::swf;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::io;
|
||||
|
||||
|
||||
static sal_uInt16 getMaxBitsUnsigned( sal_uInt32 nValue )
|
||||
{
|
||||
sal_uInt16 nBits = 0;
|
||||
|
||||
while( nValue )
|
||||
{
|
||||
nBits++;
|
||||
nValue >>= 1;
|
||||
}
|
||||
|
||||
return nBits;
|
||||
}
|
||||
|
||||
|
||||
sal_uInt16 getMaxBitsSigned( sal_Int32 nValue )
|
||||
{
|
||||
if( nValue < 0 )
|
||||
nValue *= -1;
|
||||
|
||||
return getMaxBitsUnsigned( static_cast< sal_uInt32 >(nValue) ) + 1;
|
||||
}
|
||||
|
||||
|
||||
BitStream::BitStream()
|
||||
{
|
||||
mnBitPos = 8;
|
||||
mnCurrentByte = 0;
|
||||
}
|
||||
|
||||
|
||||
void BitStream::writeUB( sal_uInt32 nValue, sal_uInt16 nBits )
|
||||
{
|
||||
while( nBits != 0 )
|
||||
{
|
||||
mnCurrentByte |= nValue << (32 - nBits) >> (32 - mnBitPos);
|
||||
|
||||
if ( nBits > mnBitPos )
|
||||
{
|
||||
nBits = nBits - mnBitPos;
|
||||
mnBitPos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mnBitPos = sal::static_int_cast<sal_uInt8>( mnBitPos - nBits );
|
||||
nBits = 0;
|
||||
}
|
||||
|
||||
if( 0 == mnBitPos )
|
||||
pad();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BitStream::writeSB( sal_Int32 nValue, sal_uInt16 nBits )
|
||||
{
|
||||
writeUB( static_cast< sal_uInt32 >(nValue), nBits );
|
||||
}
|
||||
|
||||
|
||||
void BitStream::writeFB( sal_uInt32 nValue, sal_uInt16 nBits )
|
||||
{
|
||||
writeUB( nValue, nBits );
|
||||
}
|
||||
|
||||
|
||||
void BitStream::pad()
|
||||
{
|
||||
if( 8 != mnBitPos )
|
||||
{
|
||||
maData.push_back( mnCurrentByte );
|
||||
mnCurrentByte = 0;
|
||||
mnBitPos = 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BitStream::writeTo( SvStream& out )
|
||||
{
|
||||
pad();
|
||||
|
||||
for (auto const& data : maData)
|
||||
{
|
||||
out.WriteUChar(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sal_uInt32 BitStream::getOffset() const
|
||||
{
|
||||
return maData.size();
|
||||
}
|
||||
|
||||
|
||||
Tag::Tag( sal_uInt8 nTagId )
|
||||
{
|
||||
mnTagId = nTagId;
|
||||
}
|
||||
|
||||
|
||||
void Tag::write( SvStream &out )
|
||||
{
|
||||
sal_uInt32 nSz = TellEnd();
|
||||
Seek( STREAM_SEEK_TO_BEGIN );
|
||||
|
||||
if( mnTagId != 0xff )
|
||||
{
|
||||
bool bLarge = nSz > 62;
|
||||
|
||||
sal_uInt16 nCode = ( mnTagId << 6 ) | ( bLarge ? 0x3f : uInt16_(nSz) );
|
||||
|
||||
out.WriteUChar( nCode );
|
||||
out.WriteUChar( nCode >> 8 );
|
||||
|
||||
if( bLarge )
|
||||
{
|
||||
sal_uInt32 nTmp = nSz;
|
||||
|
||||
out.WriteUChar( nTmp );
|
||||
nTmp >>= 8;
|
||||
out.WriteUChar( nTmp );
|
||||
nTmp >>= 8;
|
||||
out.WriteUChar( nTmp );
|
||||
nTmp >>= 8;
|
||||
out.WriteUChar( nTmp );
|
||||
}
|
||||
}
|
||||
|
||||
out.WriteBytes( GetData(), nSz );
|
||||
}
|
||||
#if 0
|
||||
|
||||
|
||||
void Tag::addI32( sal_Int32 nValue )
|
||||
{
|
||||
addUI32( static_cast<sal_uInt32>( nValue ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Tag::addUI32( sal_uInt32 nValue )
|
||||
{
|
||||
WriteUInt32( nValue );
|
||||
}
|
||||
#if 0
|
||||
|
||||
|
||||
void Tag::addI16( sal_Int16 nValue )
|
||||
{
|
||||
addUI16( static_cast<sal_uInt16>( nValue ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Tag::addUI16( sal_uInt16 nValue )
|
||||
{
|
||||
WriteUChar( nValue );
|
||||
WriteUChar( nValue >> 8 );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addUI8( sal_uInt8 nValue )
|
||||
{
|
||||
WriteUChar( nValue );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addBits( BitStream& rIn )
|
||||
{
|
||||
rIn.writeTo( *this );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addRGBA( const Color& rColor )
|
||||
{
|
||||
addUI8( rColor.GetRed() );
|
||||
addUI8( rColor.GetGreen() );
|
||||
addUI8( rColor.GetBlue() );
|
||||
addUI8( 0xff - rColor.GetTransparency() );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addRGB( const Color& rColor )
|
||||
{
|
||||
addUI8( rColor.GetRed() );
|
||||
addUI8( rColor.GetGreen() );
|
||||
addUI8( rColor.GetBlue() );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addRect( const tools::Rectangle& rRect )
|
||||
{
|
||||
writeRect( *this, rRect );
|
||||
}
|
||||
|
||||
|
||||
void Tag::writeRect( SvStream& rOut, const tools::Rectangle& rRect )
|
||||
{
|
||||
BitStream aBits;
|
||||
|
||||
sal_Int32 minX, minY, maxX, maxY;
|
||||
|
||||
if( rRect.Left() < rRect.Right() )
|
||||
{
|
||||
minX = rRect.Left();
|
||||
maxX = rRect.Right();
|
||||
}
|
||||
else
|
||||
{
|
||||
maxX = rRect.Left();
|
||||
minX = rRect.Right();
|
||||
}
|
||||
|
||||
|
||||
if( rRect.Top() < rRect.Bottom() )
|
||||
{
|
||||
minY = rRect.Top();
|
||||
maxY = rRect.Bottom();
|
||||
}
|
||||
else
|
||||
{
|
||||
maxY = rRect.Top();
|
||||
minY = rRect.Bottom();
|
||||
}
|
||||
|
||||
// AS: Figure out the maximum number of bits required to represent any of the
|
||||
// rectangle coordinates. Since minX or minY could be negative, they could
|
||||
// actually require more bits than maxX or maxY.
|
||||
// AS: Christian, can they be negative, or is that a wasted check?
|
||||
// CL: I think so, f.e. for shapes that have the top and/or left edge outside
|
||||
// the page origin
|
||||
sal_uInt8 nBits1 = sal::static_int_cast<sal_uInt8>( std::max( getMaxBitsSigned( minX ), getMaxBitsSigned( minY ) ) );
|
||||
sal_uInt8 nBits2 = sal::static_int_cast<sal_uInt8>( std::max( getMaxBitsSigned( maxX ), getMaxBitsSigned( maxY ) ) );
|
||||
sal_uInt8 nBitsMax = std::max( nBits1, nBits2 );
|
||||
|
||||
aBits.writeUB( nBitsMax, 5 );
|
||||
aBits.writeSB( minX, nBitsMax );
|
||||
aBits.writeSB( maxX, nBitsMax );
|
||||
aBits.writeSB( minY, nBitsMax );
|
||||
aBits.writeSB( maxY, nBitsMax );
|
||||
|
||||
aBits.writeTo( rOut );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addMatrix( const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
|
||||
{
|
||||
writeMatrix( *this, rMatrix );
|
||||
}
|
||||
|
||||
|
||||
void Tag::writeMatrix( SvStream& rOut, const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
|
||||
{
|
||||
|
||||
BitStream aBits;
|
||||
|
||||
const bool bHasScale = rMatrix.get(0, 0) != 1.0 || rMatrix.get(1, 1) != 1.0;
|
||||
|
||||
aBits.writeUB( int(bHasScale), 1 );
|
||||
|
||||
if( bHasScale )
|
||||
{
|
||||
sal_uInt8 nScaleBits = 31;
|
||||
|
||||
aBits.writeUB( nScaleBits, 5 );
|
||||
aBits.writeFB( getFixed( rMatrix.get(0, 0) ), nScaleBits ); // Scale X
|
||||
aBits.writeFB( getFixed( rMatrix.get(1, 1) ), nScaleBits ); // Scale Y
|
||||
}
|
||||
|
||||
const bool bHasRotate = rMatrix.get(0, 1) != 0.0 || rMatrix.get(1, 0) != 0.0;
|
||||
|
||||
aBits.writeUB( int(bHasRotate), 1 );
|
||||
|
||||
if( bHasRotate )
|
||||
{
|
||||
sal_uInt8 nRotateBits = 31;
|
||||
|
||||
aBits.writeUB( nRotateBits, 5 );
|
||||
aBits.writeFB( getFixed( rMatrix.get(0, 1) ), nRotateBits ); // RotateSkew0
|
||||
aBits.writeFB( getFixed( rMatrix.get(1, 0) ), nRotateBits ); // RotateSkew1
|
||||
}
|
||||
|
||||
sal_uInt8 nTranslateBits = 16;
|
||||
|
||||
aBits.writeUB( nTranslateBits, 5 );
|
||||
aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(0, 2)), nTranslateBits ); // Translate X
|
||||
aBits.writeSB( static_cast<sal_Int16>(rMatrix.get(1, 2)), nTranslateBits ); // Translate Y
|
||||
|
||||
aBits.writeTo( rOut );
|
||||
}
|
||||
|
||||
|
||||
void Tag::addStream( SvStream& rIn )
|
||||
{
|
||||
(*this).WriteStream( rIn );
|
||||
}
|
||||
|
||||
|
||||
Sprite::Sprite( sal_uInt16 nId )
|
||||
: mnId( nId ), mnFrames(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Sprite::~Sprite()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Sprite::write( SvStream& out )
|
||||
{
|
||||
SvMemoryStream aTmp;
|
||||
for (auto const& tag : maTags)
|
||||
tag->write( aTmp );
|
||||
|
||||
if( !mnFrames )
|
||||
mnFrames = 1;
|
||||
|
||||
aTmp.Seek(0);
|
||||
|
||||
Tag aTag( TAG_DEFINESPRITE );
|
||||
aTag.addUI16( mnId );
|
||||
aTag.addUI16( uInt16_( mnFrames ) );
|
||||
aTag.addStream( aTmp );
|
||||
aTag.write( out );
|
||||
}
|
||||
|
||||
|
||||
void Sprite::addTag( std::unique_ptr<Tag> pNewTag )
|
||||
{
|
||||
if( pNewTag->getTagId() == TAG_SHOWFRAME )
|
||||
mnFrames++;
|
||||
|
||||
maTags.push_back( std::move(pNewTag) );
|
||||
}
|
||||
|
||||
|
||||
sal_uInt32 swf::getFixed( double fValue )
|
||||
{
|
||||
sal_Int16 nUpper = static_cast<sal_Int16>(floor(fValue));
|
||||
sal_uInt16 nLower = static_cast<sal_uInt16>((fValue - floor(fValue))*0x10000);
|
||||
|
||||
sal_uInt32 temp = static_cast<sal_Int32>(nUpper)<<16;
|
||||
temp |= nLower;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
/** constructs a new flash font for the given VCL Font */
|
||||
FlashFont::FlashFont( const vcl::Font& rFont, sal_uInt16 nId )
|
||||
: maFont( rFont ), mnNextIndex(0), mnId( nId )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FlashFont::~FlashFont()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** gets the glyph id for the given character. The glyphs are created on demand */
|
||||
sal_uInt16 FlashFont::getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev )
|
||||
{
|
||||
// see if we already created a glyph for this character
|
||||
std::map<sal_uInt16, sal_uInt16>::iterator aIter( maGlyphIndex.find(nChar) );
|
||||
if( aIter != maGlyphIndex.end() )
|
||||
{
|
||||
return aIter->second;
|
||||
}
|
||||
|
||||
// if not, we create one now
|
||||
|
||||
maGlyphIndex[nChar] = mnNextIndex;
|
||||
|
||||
vcl::Font aOldFont( pVDev->GetFont() );
|
||||
vcl::Font aNewFont( aOldFont );
|
||||
aNewFont.SetAlignment( ALIGN_BASELINE );
|
||||
pVDev->SetFont( aNewFont );
|
||||
aOldFont.SetOrientation(0);
|
||||
|
||||
// let the virtual device convert the character to polygons
|
||||
tools::PolyPolygon aPolyPoly;
|
||||
pVDev->GetTextOutline( aPolyPoly, OUString(sal_Unicode(nChar)) );
|
||||
|
||||
maGlyphOffsets.push_back( uInt16_( maGlyphData.getOffset() ) );
|
||||
|
||||
// Number of fill and line index bits set to 1
|
||||
maGlyphData.writeUB( 0x11, 8 );
|
||||
|
||||
const sal_uInt16 nCount = aPolyPoly.Count();
|
||||
sal_uInt16 i,n;
|
||||
for( i = 0; i < nCount; i++ )
|
||||
{
|
||||
tools::Polygon& rPoly = aPolyPoly[ i ];
|
||||
|
||||
const sal_uInt16 nSize = rPoly.GetSize();
|
||||
if( nSize )
|
||||
{
|
||||
// convert polygon to flash EM_SQUARE (1024x1024)
|
||||
for( n = 0; n < nSize; n++ )
|
||||
{
|
||||
Point aPoint( rPoly[n] );
|
||||
aPoint.setX( static_cast<long>((double(aPoint.X()) * 1024.0 ) / double(aOldFont.GetFontHeight())) );
|
||||
aPoint.setY( static_cast<long>((double(aPoint.Y()) * 1024.0 ) / double(aOldFont.GetFontHeight())) );
|
||||
rPoly[n] = aPoint;
|
||||
}
|
||||
Writer::Impl_addPolygon( maGlyphData, rPoly, true );
|
||||
}
|
||||
}
|
||||
Writer::Impl_addEndShapeRecord( maGlyphData );
|
||||
|
||||
maGlyphData.pad();
|
||||
|
||||
pVDev->SetFont( aOldFont );
|
||||
|
||||
return mnNextIndex++;
|
||||
}
|
||||
|
||||
|
||||
void FlashFont::write( SvStream& out )
|
||||
{
|
||||
Tag aTag( TAG_DEFINEFONT );
|
||||
|
||||
aTag.addUI16( mnId );
|
||||
|
||||
sal_uInt16 nGlyphs = uInt16_( maGlyphOffsets.size() );
|
||||
sal_uInt16 nOffset = nGlyphs * sizeof( sal_uInt16 );
|
||||
|
||||
for (auto const& glyphOffset : maGlyphOffsets)
|
||||
aTag.addUI16( nOffset + glyphOffset );
|
||||
|
||||
aTag.addBits( maGlyphData );
|
||||
|
||||
aTag.write( out );
|
||||
}
|
||||
|
||||
|
||||
/** this c'tor creates a solid fill style */
|
||||
FillStyle::FillStyle( const Color& rSolidColor )
|
||||
: meType(solid )
|
||||
, mnBitmapId(0)
|
||||
, maColor(rSolidColor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** this c'tor creates a tiled or clipped bitmap fill style */
|
||||
FillStyle::FillStyle( sal_uInt16 nBitmapId, bool bClipped, const ::basegfx::B2DHomMatrix& rMatrix ) // #i73264#
|
||||
: meType( bClipped ? clipped_bitmap : tiled_bitmap ),
|
||||
maMatrix( rMatrix ),
|
||||
mnBitmapId( nBitmapId )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static FillStyle::FillStyleType Impl_getFillStyleType( const Gradient& rGradient )
|
||||
{
|
||||
switch( rGradient.GetStyle() )
|
||||
{
|
||||
case GradientStyle::Elliptical:
|
||||
case GradientStyle::Radial:
|
||||
return FillStyle::radial_gradient;
|
||||
// case GradientStyle::Axial:
|
||||
// case GradientStyle::Square:
|
||||
// case GradientStyle::Rect:
|
||||
// case GradientStyle::Linear:
|
||||
default:
|
||||
return FillStyle::linear_gradient;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** this c'tor creates a linear or radial gradient fill style */
|
||||
FillStyle::FillStyle( const tools::Rectangle& rBoundRect, const Gradient& rGradient )
|
||||
: meType(Impl_getFillStyleType(rGradient))
|
||||
, mnBitmapId(0)
|
||||
, maGradient(rGradient)
|
||||
, maBoundRect(rBoundRect)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FillStyle::addTo( Tag* pTag ) const
|
||||
{
|
||||
pTag->addUI8( sal::static_int_cast<sal_uInt8>( meType ) );
|
||||
switch( meType )
|
||||
{
|
||||
case solid:
|
||||
pTag->addRGBA( maColor );
|
||||
break;
|
||||
case linear_gradient:
|
||||
case radial_gradient:
|
||||
Impl_addGradient( pTag );
|
||||
break;
|
||||
case tiled_bitmap:
|
||||
case clipped_bitmap:
|
||||
pTag->addUI16( mnBitmapId );
|
||||
pTag->addMatrix( maMatrix );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct GradRecord
|
||||
{
|
||||
sal_uInt8 mnRatio;
|
||||
Color maColor;
|
||||
|
||||
GradRecord( sal_uInt8 nRatio, const Color& rColor ) : mnRatio( nRatio ), maColor( rColor ) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// TODO: better emulation of our gradients
|
||||
void FillStyle::Impl_addGradient( Tag* pTag ) const
|
||||
{
|
||||
std::vector< struct GradRecord > aGradientRecords;
|
||||
basegfx::B2DHomMatrix m(basegfx::utils::createRotateB2DHomMatrix((maGradient.GetAngle() - 900) * F_PI1800));
|
||||
|
||||
switch( maGradient.GetStyle() )
|
||||
{
|
||||
case GradientStyle::Elliptical:
|
||||
case GradientStyle::Radial:
|
||||
{
|
||||
aGradientRecords.emplace_back( 0x00, maGradient.GetEndColor() );
|
||||
aGradientRecords.emplace_back( 0xff, maGradient.GetStartColor() );
|
||||
|
||||
double tx = ( maGradient.GetOfsX() * 32768.0 ) / 100.0;
|
||||
double ty = ( maGradient.GetOfsY() * 32768.0 ) / 100.0;
|
||||
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
|
||||
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
|
||||
|
||||
m.scale( 1.2, 1.2 );
|
||||
|
||||
if( scalex > scaley )
|
||||
{
|
||||
double scale_move = scaley / scalex;
|
||||
|
||||
m.translate( tx, scale_move * ty );
|
||||
|
||||
|
||||
m.scale( scalex, scalex );
|
||||
}
|
||||
else
|
||||
{
|
||||
double scale_move = scalex / scaley;
|
||||
|
||||
m.translate( scale_move * tx, ty );
|
||||
|
||||
|
||||
m.scale( scaley, scaley );
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case GradientStyle::Axial:
|
||||
{
|
||||
aGradientRecords.emplace_back( 0x00, maGradient.GetEndColor() );
|
||||
aGradientRecords.emplace_back( 0x80, maGradient.GetStartColor() );
|
||||
aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() );
|
||||
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
|
||||
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
|
||||
m.translate( 32768.0 / 2.0, 32768.0 / 2.0 );
|
||||
m.scale( scalex, scaley );
|
||||
}
|
||||
break;
|
||||
case GradientStyle::Square:
|
||||
case GradientStyle::Rect:
|
||||
case GradientStyle::Linear:
|
||||
{
|
||||
aGradientRecords.emplace_back( 0x00, maGradient.GetStartColor() );
|
||||
aGradientRecords.emplace_back( 0xff, maGradient.GetEndColor() );
|
||||
double scalex = static_cast<double>(maBoundRect.GetWidth()) / 32768.0;
|
||||
double scaley = static_cast<double>(maBoundRect.GetHeight()) / 32768.0;
|
||||
|
||||
m.scale( scalex, scaley );
|
||||
|
||||
m.translate( maBoundRect.GetWidth() / 2.0, maBoundRect.GetHeight() / 2.0 );
|
||||
}
|
||||
break;
|
||||
case GradientStyle::FORCE_EQUAL_SIZE: break;
|
||||
}
|
||||
|
||||
m.translate( maBoundRect.Left(), maBoundRect.Top() );
|
||||
|
||||
pTag->addMatrix( m );
|
||||
|
||||
DBG_ASSERT( aGradientRecords.size() < 8, "Illegal FlashGradient!" );
|
||||
|
||||
pTag->addUI8( static_cast<sal_uInt8>( aGradientRecords.size() ) );
|
||||
|
||||
for (auto const& gradientRecord : aGradientRecords)
|
||||
{
|
||||
pTag->addUI8( gradientRecord.mnRatio );
|
||||
pTag->addRGBA( gradientRecord.maColor );
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1,277 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface domain="flt">
|
||||
<requires lib="gtk+" version="3.18"/>
|
||||
<object class="GtkAdjustment" id="adjustmentquality">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkDialog" id="ImpSWFDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes" context="impswfdialog|ImpSWFDialog">Flash (SWF) Options</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="default_width">0</property>
|
||||
<property name="default_height">0</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="ok">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="help">
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="secondary">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" context="impswfdialog|label1">1: min. quality
|
||||
100: max. quality</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">fill</property>
|
||||
<property name="mnemonic_widget">quality</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="quality">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="activates_default">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="input_purpose">digits</property>
|
||||
<property name="adjustment">adjustmentquality</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportall">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportall">Export _all slides (uncheck to export current slide)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportmultiplefiles">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportmultiplefiles">Export as _multiple files</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">20</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportbackgrounds">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportbackgrounds">Export _backgrounds</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportbackgroundobjects">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportbackgroundobjects">Export back_ground objects</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportslidecontents">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportslidecontents">Export _slide contents</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportsound">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportsound">Export _Verilogix Slide Annotations</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="exportoleasjpeg">
|
||||
<property name="label" translatable="yes" context="impswfdialog|exportoleasjpeg">Export OLE objects as _JPEG images</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-5">ok</action-widget>
|
||||
<action-widget response="-6">cancel</action-widget>
|
||||
<action-widget response="-11">help</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -228,7 +228,6 @@ certain functionality.
|
||||
|
||||
@li @c filter.config
|
||||
@li @c filter.eps
|
||||
@li @c filter.flash
|
||||
@li @c filter.icgm
|
||||
@li @c filter.ms - escher import/export
|
||||
@li @c filter.odfflatxml
|
||||
|
||||
@@ -27,7 +27,6 @@ $(eval $(call gb_Rdb_add_components,services,\
|
||||
embeddedobj/util/embobj \
|
||||
eventattacher/source/evtatt \
|
||||
filter/source/config/cache/filterconfig1 \
|
||||
filter/source/flash/flash \
|
||||
filter/source/graphic/graphicfilter \
|
||||
filter/source/msfilter/msfilter \
|
||||
filter/source/odfflatxml/odfflatxml \
|
||||
|
||||
@@ -99,9 +99,3 @@ en-US = "SVG Export"
|
||||
|
||||
[STR_DESC_MODULE_OPTIONAL_GRFFLT_SVG]
|
||||
en-US = "SVG Export Filter"
|
||||
|
||||
[STR_NAME_MODULE_OPTIONAL_GRFFLT_FLASH]
|
||||
en-US = "Macromedia Flash (SWF)"
|
||||
|
||||
[STR_DESC_MODULE_OPTIONAL_GRFFLT_FLASH]
|
||||
en-US = "Macromedia Flash (SWF) Export Filter"
|
||||
|
||||
@@ -967,7 +967,6 @@ namespace sfx2
|
||||
sal_Int32 nHTMLIndex = -1;
|
||||
sal_Int32 nXHTMLIndex = -1;
|
||||
sal_Int32 nPDFIndex = -1;
|
||||
sal_Int32 nFlashIndex = -1;
|
||||
OUString sUIName;
|
||||
OUString sExtensions;
|
||||
std::vector< ExportFilter > aImportantFilterGroup;
|
||||
@@ -1007,18 +1006,6 @@ namespace sfx2
|
||||
aImportantFilterGroup.insert( aIter, aExportFilter );
|
||||
nPDFIndex = 0;
|
||||
}
|
||||
else if ( nFlashIndex == -1 && sTypeName == "graphic_SWF" )
|
||||
{
|
||||
std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin();
|
||||
if ( nHTMLIndex != -1 )
|
||||
++aIter;
|
||||
if ( nXHTMLIndex != -1 )
|
||||
++aIter;
|
||||
if ( nPDFIndex != -1 )
|
||||
++aIter;
|
||||
aImportantFilterGroup.insert( aIter, aExportFilter );
|
||||
nFlashIndex = 0;
|
||||
}
|
||||
else
|
||||
aFilterGroup.push_back( aExportFilter );
|
||||
}
|
||||
|
||||
@@ -4439,19 +4439,6 @@ filter/source/config/cache/querytokenizer.hxx
|
||||
filter/source/config/cache/registration.cxx
|
||||
filter/source/config/cache/typedetection.cxx
|
||||
filter/source/config/cache/typedetection.hxx
|
||||
filter/source/flash/impswfdialog.cxx
|
||||
filter/source/flash/impswfdialog.hxx
|
||||
filter/source/flash/swfdialog.cxx
|
||||
filter/source/flash/swfdialog.hxx
|
||||
filter/source/flash/swfexporter.cxx
|
||||
filter/source/flash/swfexporter.hxx
|
||||
filter/source/flash/swffilter.cxx
|
||||
filter/source/flash/swfuno.cxx
|
||||
filter/source/flash/swfuno.hxx
|
||||
filter/source/flash/swfwriter.cxx
|
||||
filter/source/flash/swfwriter.hxx
|
||||
filter/source/flash/swfwriter1.cxx
|
||||
filter/source/flash/swfwriter2.cxx
|
||||
filter/source/graphic/GraphicExportFilter.cxx
|
||||
filter/source/graphic/GraphicExportFilter.hxx
|
||||
filter/source/graphic/Services.cxx
|
||||
|
||||
@@ -100,7 +100,6 @@ application/x-rad rad
|
||||
application/x-rpm rpm spm
|
||||
application/x-sh sh
|
||||
application/x-shar shar
|
||||
application/x-shockwave-flash swf
|
||||
application/x-stuffit sit
|
||||
application/x-sv4cpio sv4cpio
|
||||
application/x-sv4crc sv4crc
|
||||
@@ -179,8 +178,6 @@ audio/vnd.rn-realaudio ra
|
||||
application/smil smi smil
|
||||
text/vnd.rn-realtext rt
|
||||
video/vnd.rn-realvideo rv
|
||||
image/vnd.rn-realflash rf swf
|
||||
application/x-shockwave-flash2-preview rf swf
|
||||
application/sdp sdp
|
||||
application/x-sdp sdp
|
||||
application/vnd.rn-realmedia rm
|
||||
|
||||
@@ -65,8 +65,6 @@
|
||||
#Impress/Draw
|
||||
@{libreoffice_ext} += [pP][pP][tTsS]{,x,X}
|
||||
@{libreoffice_ext} += [pP][oO][tT]{,m,M}
|
||||
#Flash
|
||||
@{libreoffice_ext} += [sS][wW][fF]
|
||||
#Photoshop
|
||||
@{libreoffice_ext} += [pP][sS][dD]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user