diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-15 09:35:28 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-15 10:10:51 +0200 |
commit | 2dde1db05700df2f8a2c2be0e451a42e091cbbfc (patch) | |
tree | 8ca597213321b277b09f43a413c06ba2e2b6258a | |
parent | 05a940f993dfdd9546c8108526a483c1d6e6377c (diff) |
oox: generate data, not code for drawingML export adjustment values
Change-Id: I5898314c630348552ca2e0a6df1cc76972e3974c
-rw-r--r-- | oox/CustomTarget_generated.mk | 10 | ||||
-rw-r--r-- | oox/Module_oox.mk | 1 | ||||
-rw-r--r-- | oox/Package_generated.mk | 16 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 30 | ||||
-rw-r--r-- | oox/source/export/preset-definitions-to-shape-types.pl | 32 | ||||
-rw-r--r-- | scp2/InstallModule_ooo.mk | 1 | ||||
-rw-r--r-- | scp2/source/ooo/module_filter.scp | 35 | ||||
-rw-r--r-- | setup_native/source/packinfo/packinfo_office.txt | 15 |
8 files changed, 119 insertions, 21 deletions
diff --git a/oox/CustomTarget_generated.mk b/oox/CustomTarget_generated.mk index 1e7408ae2507..0b81f11eb9f4 100644 --- a/oox/CustomTarget_generated.mk +++ b/oox/CustomTarget_generated.mk @@ -23,6 +23,15 @@ $(oox_MISC)/vmlexport-shape-types.cxx : \ mkdir -p $(dir $@) perl $^ > $@.in_progress 2> $@.log && mv $@.in_progress $@ +$(oox_MISC)/oox-drawingml-adj-names : \ + $(SRCDIR)/oox/source/export/preset-definitions-to-shape-types.pl \ + $(SRCDIR)/oox/source/drawingml/customshapes/presetShapeDefinitions.xml \ + $(SRCDIR)/oox/source/export/presetTextWarpDefinitions.xml \ + $(SRCDIR)/oox/CustomTarget_generated.mk + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,PRL,1) + mkdir -p $(dir $@) + perl $< --drawingml-adj-names-data $(filter-out $<,$^) > $@.in_progress 2> $@.log && mv $@.in_progress $@ + $(oox_INC)/tokenhash.inc : $(oox_MISC)/tokenhash.gperf $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,GPF,1) $(GPERF) --compare-strncmp --switch=2 --readonly-tables $< | sed -e 's/(char\*)0/(char\*)0, 0/g' | grep -v '^#line' > $@ @@ -50,6 +59,7 @@ $(eval $(call oox_GenTarget,tokens,token,tokenhash.gperf)) $(call gb_CustomTarget_get_target,oox/generated) : \ $(oox_MISC)/vmlexport-shape-types.cxx \ + $(oox_MISC)/oox-drawingml-adj-names \ $(oox_INC)/tokenhash.inc \ $(oox_INC)/tokennames.inc \ $(oox_INC)/namespacenames.inc \ diff --git a/oox/Module_oox.mk b/oox/Module_oox.mk index c086254b9218..8556f4e1bbcd 100644 --- a/oox/Module_oox.mk +++ b/oox/Module_oox.mk @@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,oox)) $(eval $(call gb_Module_add_targets,oox,\ CustomTarget_generated \ Library_oox \ + Package_generated \ )) # vim: set noet sw=4 ts=4: diff --git a/oox/Package_generated.mk b/oox/Package_generated.mk new file mode 100644 index 000000000000..e23366292ecf --- /dev/null +++ b/oox/Package_generated.mk @@ -0,0 +1,16 @@ +# -*- 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/. +# + +$(eval $(call gb_Package_Package,oox_generated,$(call gb_CustomTarget_get_workdir,oox/generated))) + +$(eval $(call gb_Package_add_files,oox_generated,$(LIBO_SHARE_FOLDER)/filter,\ + misc/oox-drawingml-adj-names \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a99430a149e6..ff5ad3d75ca4 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_folders.h> +#include "rtl/bootstrap.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/export/drawingml.hxx" #include "oox/export/utils.hxx" @@ -101,9 +103,6 @@ using ::sax_fastparser::FSHelperPtr; DBG(extern void dump_pset(Reference< XPropertySet > rXPropSet)); -// Defined in generated code. -extern std::map< OString, std::vector<OString> > ooxDrawingMLGetAdjNames(); - namespace oox { namespace drawingml { @@ -1789,9 +1788,30 @@ void DrawingML::WritePresetShape( const char* pShape ) mpFS->endElementNS( XML_a, XML_prstGeom ); } +std::map< OString, std::vector<OString> > lcl_getAdjNames() +{ + std::map< OString, std::vector<OString> > aRet; + + OUString aPath("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/filter/oox-drawingml-adj-names"); + rtl::Bootstrap::expandMacros(aPath); + SvFileStream aStream(aPath, STREAM_READ); + if (aStream.GetError() != ERRCODE_NONE) + SAL_WARN("oox", "failed to open oox-drawingml-adj-names"); + OString aLine; + bool bNotDone = aStream.ReadLine(aLine); + while (bNotDone) + { + OString aKey = aLine.getToken(0, '\t'); + OString aValue = aLine.getToken(1, '\t'); + aRet[aKey].push_back(aValue); + bNotDone = aStream.ReadLine(aLine); + } + return aRet; +} + void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const PropertyValue& rProp ) { - static std::map< OString, std::vector<OString> > aAdjMap = ooxDrawingMLGetAdjNames(); + static std::map< OString, std::vector<OString> > aAdjMap = lcl_getAdjNames(); // If there are predefined adj names for this shape type, look them up now. std::vector<OString> aAdjustments; if (aAdjMap.find(OString(pShape)) != aAdjMap.end()) @@ -1813,7 +1833,7 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool b EscherPropertyContainer::LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted ); sal_Int32 nValue, nLength = aAdjustmentSeq.getLength(); - //aAdjustments will give info about the number of adj values for a particular geomtery.For example for hexagon aAdjustments.size() will be 2 and for circular arrow it will be 5 as per ooxDrawingMLGetAdjNames. + //aAdjustments will give info about the number of adj values for a particular geomtery.For example for hexagon aAdjustments.size() will be 2 and for circular arrow it will be 5 as per lcl_getAdjNames. if(aAdjustments.size() == static_cast<sal_uInt32>(nLength))// In case there is a mismatch do not write the XML_gd tag. { for( sal_Int32 i=0; i < nLength; i++ ) diff --git a/oox/source/export/preset-definitions-to-shape-types.pl b/oox/source/export/preset-definitions-to-shape-types.pl index 8f5904d791e8..005d9cdc5e21 100644 --- a/oox/source/export/preset-definitions-to-shape-types.pl +++ b/oox/source/export/preset-definitions-to-shape-types.pl @@ -46,7 +46,12 @@ sub show_call_stack print STDERR "--- End stack trace ---\n"; } +my $drawingml_adj_names_data = 0; my $src_shapes = shift; +if ($src_shapes eq "--drawingml-adj-names-data") { + $drawingml_adj_names_data = 1; + $src_shapes = shift; +} my $src_text = shift; usage() if ( !defined( $src_shapes ) || !defined( $src_text ) || @@ -1187,6 +1192,17 @@ if ( !defined( $result_shapes{'textBox'} ) ) { } # Generate the code +if ($drawingml_adj_names_data eq 1) { + foreach my $adj_name (keys %adj_names) + { + foreach my $adj (@{$adj_names{$adj_name}}) + { + print "$adj_name\t$adj\n"; + } + } + exit 0; +} + print <<EOF; // Shape types generated from // '$src_shapes' @@ -1231,22 +1247,6 @@ for ( my $i = 0; $i < 203; ++$i ) { print <<EOF; }; -std::map< OString, std::vector<OString> > ooxDrawingMLGetAdjNames() -{ - std::map< OString, std::vector<OString> > aMap; -EOF - -foreach my $adj_name (keys %adj_names) -{ - foreach my $adj (@{$adj_names{$adj_name}}) - { - print " aMap[\"$adj_name\"].push_back(\"$adj\");\n"; - } -} - -print <<EOF; - return aMap; -} EOF # vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: # diff --git a/scp2/InstallModule_ooo.mk b/scp2/InstallModule_ooo.mk index 8eafe810947a..4396ef4f2a8f 100644 --- a/scp2/InstallModule_ooo.mk +++ b/scp2/InstallModule_ooo.mk @@ -124,6 +124,7 @@ $(eval $(call gb_InstallModule_add_scpfiles,scp2/ooo,\ $(if $(filter WNTGCC,$(OS)$(COM)),\ scp2/source/ooo/mingw_dlls \ ) \ + scp2/source/ooo/module_filter \ )) $(eval $(call gb_InstallModule_add_localized_scpfiles,scp2/ooo,\ diff --git a/scp2/source/ooo/module_filter.scp b/scp2/source/ooo/module_filter.scp new file mode 100644 index 000000000000..2caac9cfec93 --- /dev/null +++ b/scp2/source/ooo/module_filter.scp @@ -0,0 +1,35 @@ +/* -*- 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/. + */ + +#include "macros.inc" + +Module gid_Module_Filter + Name = "Filter Data"; + Description = "Filter Data"; + PackageInfo = "packinfo_office.txt"; + ParentID = gid_Module_Root_Brand; + Styles = (HIDDEN_ROOT); + Dirs = (gid_Dir_Share_Filter); + Files = ( + gid_File_Dat_OoxDrawingmlAdjNames); +End + +Directory gid_Dir_Share_Filter + ParentID = gid_Brand_Dir_Share; + DosName = "filter"; +End + +File gid_File_Dat_OoxDrawingmlAdjNames + TXT_FILE_BODY; + Dir = gid_Dir_Share_Filter; + Name = "oox-drawingml-adj-names"; + Styles = (PACKED); +End + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index 2980c2b7c669..f35fe79723c2 100644 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -1244,6 +1244,21 @@ packageversion = "%PACKAGEVERSION" End Start +module = "gid_Module_Filter" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-filter-data" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION")" +packagename = "%BASISPACKAGEPREFIX%PRODUCTVERSION-filter-data" +requires = "%BASISPACKAGEPREFIX%PRODUCTVERSION-core01 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core02 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core03 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core04 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core05 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core06 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION,%BASISPACKAGEPREFIX%PRODUCTVERSION-core07 %PACKAGEVERSION %PACKAGEVERSION-%PACKAGEREVISION" +linuxpatchrequires = "" +copyright = "2012 The Document Foundation" +solariscopyright = "solariscopyrightfile" +vendor = "The Document Foundation" +description = "Filter data for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start module = "gid_Module_Reportbuilder" solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-extension-report-builder" solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION")" |