summaryrefslogtreecommitdiffstats
path: root/include/filter
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /include/filter
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/filter')
-rw-r--r--include/filter/dllapi.h34
-rw-r--r--include/filter/msfilter/classids.hxx47
-rw-r--r--include/filter/msfilter/countryid.hxx307
-rw-r--r--include/filter/msfilter/dffpropset.hxx74
-rw-r--r--include/filter/msfilter/dffrecordheader.hxx64
-rw-r--r--include/filter/msfilter/escherex.hxx1221
-rw-r--r--include/filter/msfilter/mscodec.hxx499
-rw-r--r--include/filter/msfilter/msdffimp.hxx809
-rw-r--r--include/filter/msfilter/msfilterdllapi.h35
-rw-r--r--include/filter/msfilter/msocximex.hxx84
-rw-r--r--include/filter/msfilter/msoleexp.hxx56
-rw-r--r--include/filter/msfilter/mstoolbar.hxx355
-rw-r--r--include/filter/msfilter/msvbahelper.hxx116
-rw-r--r--include/filter/msfilter/rtfutil.hxx78
-rw-r--r--include/filter/msfilter/svdfppt.hxx1488
-rw-r--r--include/filter/msfilter/svxmsbas.hxx73
-rw-r--r--include/filter/msfilter/util.hxx145
-rw-r--r--include/filter/msfilter/ww8fields.hxx130
18 files changed, 5615 insertions, 0 deletions
diff --git a/include/filter/dllapi.h b/include/filter/dllapi.h
new file mode 100644
index 000000000..526a1f7bd
--- /dev/null
+++ b/include/filter/dllapi.h
@@ -0,0 +1,34 @@
+/* -*- 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_DLLAPI_H
+#define INCLUDED_FILTER_DLLAPI_H
+
+#include <sal/config.h>
+#include <sal/types.h>
+
+#if defined FILTER_DLLIMPLEMENTATION
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/classids.hxx b/include/filter/msfilter/classids.hxx
new file mode 100644
index 000000000..8394a716b
--- /dev/null
+++ b/include/filter/msfilter/classids.hxx
@@ -0,0 +1,47 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+#define INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+
+#define MSO_EQUATION2_CLASSID \
+ 0x00021700L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EQUATION3_CLASSID \
+ 0x0002ce02L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_WW8_CLASSID \
+ 0x00020906L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL5_CLASSID \
+ 0x00020810L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL8_CLASSID \
+ 0x00020820L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_EXCEL8_CHART_CLASSID \
+ 0x00020821L, 0x0000, 0x0000, \
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
+
+#define MSO_PPT8_CLASSID \
+ 0x64818d10L, 0x4f9b, 0x11cf, \
+ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8
+
+#define MSO_PPT8_SLIDE_CLASSID \
+ 0x64818d11L, 0x4f9b, 0x11cf, \
+ 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8
+
+#endif // INCLUDED_FILTER_MSFILTER_CLASSIDS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/countryid.hxx b/include/filter/msfilter/countryid.hxx
new file mode 100644
index 000000000..b55e1d9cf
--- /dev/null
+++ b/include/filter/msfilter/countryid.hxx
@@ -0,0 +1,307 @@
+/* -*- 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_MSFILTER_COUNTRYID_HXX
+#define INCLUDED_FILTER_MSFILTER_COUNTRYID_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <sal/types.h>
+
+
+namespace msfilter {
+
+// Windows Country IDs ========================================================
+
+/** Represents a Windows country ID.
+
+ The country IDs used in Windows are equal to the international calling
+ code of each country, i.e. the code 353 represents Ireland (+353).
+
+ ATTENTION: These country codes are not supposed to be used anywhere in core
+ structures! They shall ONLY be used in the import/export filters for
+ Microsoft Office documents!
+ */
+typedef sal_uInt16 CountryId;
+
+const CountryId COUNTRY_DONTKNOW = 0;
+const CountryId COUNTRY_USA = 1;
+const CountryId COUNTRY_DOMINICAN_REPUBLIC = 1; // NANP
+const CountryId COUNTRY_GUAM = 1; // NANP
+const CountryId COUNTRY_JAMAICA = 1; // NANP
+const CountryId COUNTRY_PUERTO_RICO = 1; // NANP
+const CountryId COUNTRY_TRINIDAD_Y_TOBAGO = 1; // NANP
+const CountryId COUNTRY_CANADA = 2;
+const CountryId COUNTRY_RUSSIA = 7;
+const CountryId COUNTRY_KAZAKHSTAN = 7; // no own ID
+const CountryId COUNTRY_TATARSTAN = 7; // no own ID
+const CountryId COUNTRY_EGYPT = 20;
+const CountryId COUNTRY_SOUTH_AFRICA = 27;
+const CountryId COUNTRY_GREECE = 30;
+const CountryId COUNTRY_NETHERLANDS = 31;
+const CountryId COUNTRY_BELGIUM = 32;
+const CountryId COUNTRY_FRANCE = 33;
+const CountryId COUNTRY_SPAIN = 34;
+const CountryId COUNTRY_HUNGARY = 36;
+const CountryId COUNTRY_ITALY = 39;
+const CountryId COUNTRY_ROMANIA = 40;
+const CountryId COUNTRY_SWITZERLAND = 41;
+const CountryId COUNTRY_AUSTRIA = 43;
+const CountryId COUNTRY_UNITED_KINGDOM = 44;
+const CountryId COUNTRY_DENMARK = 45;
+const CountryId COUNTRY_SWEDEN = 46;
+const CountryId COUNTRY_NORWAY = 47;
+const CountryId COUNTRY_POLAND = 48;
+const CountryId COUNTRY_GERMANY = 49;
+const CountryId COUNTRY_PERU = 51;
+const CountryId COUNTRY_MEXICO = 52;
+const CountryId COUNTRY_CUBA = 53;
+const CountryId COUNTRY_ARGENTINA = 54;
+const CountryId COUNTRY_BRAZIL = 55;
+const CountryId COUNTRY_CHILE = 56;
+const CountryId COUNTRY_COLOMBIA = 57;
+const CountryId COUNTRY_VENEZUELA = 58;
+const CountryId COUNTRY_MALAYSIA = 60;
+const CountryId COUNTRY_AUSTRALIA = 61;
+const CountryId COUNTRY_INDONESIA = 62;
+const CountryId COUNTRY_PHILIPPINES = 63;
+const CountryId COUNTRY_NEW_ZEALAND = 64;
+const CountryId COUNTRY_SINGAPORE = 65;
+const CountryId COUNTRY_THAILAND = 66;
+const CountryId COUNTRY_JAPAN = 81;
+const CountryId COUNTRY_SOUTH_KOREA = 82;
+const CountryId COUNTRY_VIET_NAM = 84;
+const CountryId COUNTRY_PR_CHINA = 86;
+const CountryId COUNTRY_TIBET = 86; // no own ID
+const CountryId COUNTRY_TURKEY = 90;
+const CountryId COUNTRY_INDIA = 91;
+const CountryId COUNTRY_PAKISTAN = 92;
+const CountryId COUNTRY_AFGHANISTAN = 93;
+const CountryId COUNTRY_SRI_LANKA = 94;
+const CountryId COUNTRY_MYANMAR = 95;
+const CountryId COUNTRY_MOROCCO = 212;
+const CountryId COUNTRY_ALGERIA = 213;
+const CountryId COUNTRY_TUNISIA = 216;
+const CountryId COUNTRY_LIBYA = 218;
+const CountryId COUNTRY_GAMBIA = 220;
+const CountryId COUNTRY_SENEGAL = 221;
+const CountryId COUNTRY_MAURITANIA = 222;
+const CountryId COUNTRY_MALI = 223;
+const CountryId COUNTRY_GUINEA = 224;
+const CountryId COUNTRY_COTE_D_IVOIRE = 225;
+const CountryId COUNTRY_BURKINA_FARSO = 226;
+const CountryId COUNTRY_NIGER = 227;
+const CountryId COUNTRY_TOGO = 228;
+const CountryId COUNTRY_BENIN = 229;
+const CountryId COUNTRY_MAURITIUS = 230;
+const CountryId COUNTRY_LIBERIA = 231;
+const CountryId COUNTRY_SIERRA_LEONE = 232;
+const CountryId COUNTRY_GHANA = 233;
+const CountryId COUNTRY_NIGERIA = 234;
+const CountryId COUNTRY_CHAD = 235;
+const CountryId COUNTRY_CENTRAL_AFR_REP = 236;
+const CountryId COUNTRY_CAMEROON = 237;
+const CountryId COUNTRY_CAPE_VERDE = 238;
+const CountryId COUNTRY_SAO_TOME = 239;
+const CountryId COUNTRY_EQUATORIAL_GUINEA = 240;
+const CountryId COUNTRY_GABON = 241;
+const CountryId COUNTRY_CONGO = 242;
+const CountryId COUNTRY_ZAIRE = 243;
+const CountryId COUNTRY_ANGOLA = 244;
+const CountryId COUNTRY_GUINEA_BISSAU = 245;
+const CountryId COUNTRY_DIEGO_GARCIA = 246;
+const CountryId COUNTRY_ASCENSION_ISLAND = 247;
+const CountryId COUNTRY_SEYCHELLES = 248;
+const CountryId COUNTRY_SUDAN = 249;
+const CountryId COUNTRY_RWANDA = 250;
+const CountryId COUNTRY_ETHIOPIA = 251;
+const CountryId COUNTRY_SOMALIA = 252;
+const CountryId COUNTRY_DJIBOUTI = 253;
+const CountryId COUNTRY_KENYA = 254;
+const CountryId COUNTRY_TANZANIA = 255;
+const CountryId COUNTRY_UGANDA = 256;
+const CountryId COUNTRY_BURUNDI = 257;
+const CountryId COUNTRY_MOZAMBIQUE = 258;
+const CountryId COUNTRY_ZANZIBAR = 259;
+const CountryId COUNTRY_ZAMBIA = 260;
+const CountryId COUNTRY_MADAGASCAR = 261;
+const CountryId COUNTRY_REUNION = 262;
+const CountryId COUNTRY_ZIMBABWE = 263;
+const CountryId COUNTRY_NAMIBIA = 264;
+const CountryId COUNTRY_MALAWI = 265;
+const CountryId COUNTRY_LESOTHO = 266;
+const CountryId COUNTRY_BOTSWANA = 267;
+const CountryId COUNTRY_SWAZILAND = 268;
+const CountryId COUNTRY_COMOROS_MAYOTTE = 269;
+const CountryId COUNTRY_ST_HELENA = 290;
+const CountryId COUNTRY_ERITREA = 291;
+const CountryId COUNTRY_ARUBA = 297;
+const CountryId COUNTRY_FAEROE_ISLANDS = 298;
+const CountryId COUNTRY_GREEN_ISLAND = 299;
+const CountryId COUNTRY_GIBRALTAR = 350;
+const CountryId COUNTRY_PORTUGAL = 351;
+const CountryId COUNTRY_LUXEMBOURG = 352;
+const CountryId COUNTRY_IRELAND = 353;
+const CountryId COUNTRY_ICELAND = 354;
+const CountryId COUNTRY_ALBANIA = 355;
+const CountryId COUNTRY_MALTA = 356;
+const CountryId COUNTRY_CYPRUS = 357;
+const CountryId COUNTRY_FINLAND = 358;
+const CountryId COUNTRY_BULGARIA = 359;
+const CountryId COUNTRY_LITHUANIA = 370;
+const CountryId COUNTRY_LATVIA = 371;
+const CountryId COUNTRY_ESTONIA = 372;
+const CountryId COUNTRY_MOLDOVA = 373;
+const CountryId COUNTRY_ARMENIA = 374;
+const CountryId COUNTRY_BELARUS = 375;
+const CountryId COUNTRY_ANDORRA = 376;
+const CountryId COUNTRY_MONACO = 377;
+const CountryId COUNTRY_SAN_MARINO = 378;
+const CountryId COUNTRY_VATICAN_CITY = 379;
+const CountryId COUNTRY_UKRAINE = 380;
+const CountryId COUNTRY_SERBIA = 381;
+const CountryId COUNTRY_CROATIA = 385;
+const CountryId COUNTRY_SLOVENIA = 386;
+const CountryId COUNTRY_BOSNIA = 387;
+const CountryId COUNTRY_MACEDONIA = 389;
+const CountryId COUNTRY_CZECH = 420;
+const CountryId COUNTRY_SLOVAK = 421;
+const CountryId COUNTRY_LIECHTENSTEIN = 423;
+const CountryId COUNTRY_FALKLAND_ISLANDS = 500;
+const CountryId COUNTRY_BELIZE = 501;
+const CountryId COUNTRY_GUATEMALA = 502;
+const CountryId COUNTRY_EL_SALVADOR = 503;
+const CountryId COUNTRY_HONDURAS = 504;
+const CountryId COUNTRY_NICARAGUA = 505;
+const CountryId COUNTRY_COSTA_RICA = 506;
+const CountryId COUNTRY_PANAMA = 507;
+const CountryId COUNTRY_ST_PIERRE = 508;
+const CountryId COUNTRY_HAITI = 509;
+const CountryId COUNTRY_GUADELOUPE = 590;
+const CountryId COUNTRY_BOLIVIA = 591;
+const CountryId COUNTRY_GUYANA = 592;
+const CountryId COUNTRY_ECUADOR = 593;
+const CountryId COUNTRY_FRENCH_GUIANA = 594;
+const CountryId COUNTRY_PARAGUAY = 595;
+const CountryId COUNTRY_MARTINIQUE = 596;
+const CountryId COUNTRY_SURINAME = 597;
+const CountryId COUNTRY_URUGUAY = 598;
+const CountryId COUNTRY_NETHERL_ANTILLES = 599;
+const CountryId COUNTRY_EAST_TIMOR = 670;
+const CountryId COUNTRY_ANTARCTICA = 672;
+const CountryId COUNTRY_BRUNEI_DARUSSALAM = 673;
+const CountryId COUNTRY_NARUPU = 674;
+const CountryId COUNTRY_PAPUA_NEW_GUINEA = 675;
+const CountryId COUNTRY_TONGA = 676;
+const CountryId COUNTRY_SOLOMON_ISLANDS = 677;
+const CountryId COUNTRY_VANUATU = 678;
+const CountryId COUNTRY_FIJI = 679;
+const CountryId COUNTRY_PALAU = 680;
+const CountryId COUNTRY_WALLIS_AND_FUTUNA = 681;
+const CountryId COUNTRY_COOK_ISLANDS = 682;
+const CountryId COUNTRY_NIUE_ISLAND = 683;
+const CountryId COUNTRY_AMERICAN_SAMOA = 684;
+const CountryId COUNTRY_WESTERN_SAMOA = 685;
+const CountryId COUNTRY_KIRIBATI = 686;
+const CountryId COUNTRY_NEW_CALEDONIA = 687;
+const CountryId COUNTRY_TUVALU = 688;
+const CountryId COUNTRY_FRENCH_POLYNESIA = 689;
+const CountryId COUNTRY_TOKELAU = 690;
+const CountryId COUNTRY_MICRONESIA = 691;
+const CountryId COUNTRY_MARSHALL_ISLANDS = 692;
+const CountryId COUNTRY_NORTH_KOREA = 850;
+const CountryId COUNTRY_HONG_KONG = 852;
+const CountryId COUNTRY_MACAU = 853;
+const CountryId COUNTRY_CAMBODIA = 855;
+const CountryId COUNTRY_LAOS = 856;
+const CountryId COUNTRY_BANGLADESH = 880;
+const CountryId COUNTRY_TAIWAN = 886;
+const CountryId COUNTRY_MALDIVES = 960;
+const CountryId COUNTRY_LEBANON = 961;
+const CountryId COUNTRY_JORDAN = 962;
+const CountryId COUNTRY_SYRIA = 963;
+const CountryId COUNTRY_IRAQ = 964;
+const CountryId COUNTRY_KUWAIT = 965;
+const CountryId COUNTRY_SAUDI_ARABIA = 966;
+const CountryId COUNTRY_YEMEN = 967;
+const CountryId COUNTRY_OMAN = 968;
+const CountryId COUNTRY_PALESTINE = 970;
+const CountryId COUNTRY_UAE = 971;
+const CountryId COUNTRY_ISRAEL = 972;
+const CountryId COUNTRY_BAHRAIN = 973;
+const CountryId COUNTRY_QATAR = 974;
+const CountryId COUNTRY_BHUTAN = 975;
+const CountryId COUNTRY_MONGOLIA = 976;
+const CountryId COUNTRY_NEPAL = 977;
+const CountryId COUNTRY_IRAN = 981;
+const CountryId COUNTRY_TAJIKISTAN = 992;
+const CountryId COUNTRY_TURKMENISTAN = 993;
+const CountryId COUNTRY_AZERBAIJAN = 994;
+const CountryId COUNTRY_GEORGIA = 995;
+const CountryId COUNTRY_KYRGYZSTAN = 996;
+const CountryId COUNTRY_UZBEKISTAN = 998;
+
+// Country ID <-> Language type conversion ====================================
+
+/** Converts a language type to a Windows country ID.
+
+ The function regards the sub type of the passed language, and tries to
+ return the appropriate country, i.e. COUNTRY_IRELAND for
+ LANGUAGE_ENGLISH_EIRE.
+
+ A few countries do not have an own associated country ID. Most of these
+ countries are mapped to another related country, i.e. Kazakhstan is
+ mapped to Russia.
+
+ If no country can be found, the value COUNTRY_DONTKNOW will be returned.
+
+ @param eLanguage
+ A language type, defined in tools/lang.hxx.
+
+ @return
+ The best Windows country ID for the passed language type, or
+ COUNTRY_DONTKNOW on error.
+ */
+MSFILTER_DLLPUBLIC CountryId ConvertLanguageToCountry( LanguageType eLanguage );
+
+/** Converts a Windows country ID to a language type.
+
+ The function returns the most used language for the passed country
+ (hopefully), i.e. LANGUAGE_ENGLISH_EIRE for COUNTRY_IRELAND.
+
+ If the passed country ID is not valid, the value LANGUAGE_DONTKNOW will be
+ returned.
+
+ @param eCountry
+ A Windows country ID, defined above.
+
+ @return
+ The most used language type in the passed country, or LANGUAGE_DONTKNOW
+ on error.
+ */
+MSFILTER_DLLPUBLIC LanguageType ConvertCountryToLanguage( CountryId eCountry );
+
+
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
new file mode 100644
index 000000000..6e7ca4a41
--- /dev/null
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -0,0 +1,74 @@
+/* -*- 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_MSFILTER_DFFPROPSET_HXX
+#define INCLUDED_FILTER_MSFILTER_DFFPROPSET_HXX
+
+#include <vector>
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/solar.h>
+
+class SvStream;
+
+struct DffPropFlags
+{
+ bool bSet : 1;
+ bool bComplex : 1;
+ bool bBlip : 1;
+ bool bSoftAttr : 1;
+};
+
+struct DffPropSetEntry
+{
+ DffPropFlags aFlags;
+ sal_uInt16 nComplexIndexOrFlagsHAttr;
+ sal_uInt32 nContent;
+};
+
+class MSFILTER_DLLPUBLIC DffPropSet
+{
+ private:
+ DffPropSetEntry* mpPropSetEntries;
+ std::vector< sal_uInt32 > maOffsets;
+
+ void ReadPropSet( SvStream&, bool );
+
+ public:
+ explicit DffPropSet();
+ ~DffPropSet();
+
+ bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
+ bool IsHardAttribute( sal_uInt32 nId ) const;
+ sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault ) const;
+ /** Returns a boolean property by its real identifier. */
+ bool GetPropertyBool( sal_uInt32 nId ) const;
+ /** Returns a string property. */
+ OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
+ bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
+ void InitializePropSet( sal_uInt16 nPropSetType ) const;
+ static sal_uLong SanitizeEndPos(SvStream &rIn, sal_uLong nEndRecPos);
+
+ friend SvStream& ReadDffPropSet( SvStream& rIn, DffPropSet& rPropSet );
+ friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffrecordheader.hxx b/include/filter/msfilter/dffrecordheader.hxx
new file mode 100644
index 000000000..acd0d2539
--- /dev/null
+++ b/include/filter/msfilter/dffrecordheader.hxx
@@ -0,0 +1,64 @@
+/* -*- 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_MSFILTER_DFFRECORDHEADER_HXX
+#define INCLUDED_FILTER_MSFILTER_DFFRECORDHEADER_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+
+class MSFILTER_DLLPUBLIC DffRecordHeader
+{
+public:
+ sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
+ sal_uInt16 nRecInstance;
+ sal_uInt16 nImpVerInst;
+ sal_uInt16 nRecType;
+ sal_uInt32 nRecLen;
+ sal_uLong nFilePos;
+
+ DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
+ nRecType(0), nRecLen(0), nFilePos(0) {}
+ bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
+ sal_uLong GetRecBegFilePos() const { return nFilePos; }
+ sal_uLong GetRecEndFilePos() const
+ { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
+ bool SeekToEndOfRecord(SvStream& rIn) const
+ {
+ sal_uInt64 const nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+ return checkSeek(rIn, nPos);
+ }
+ bool SeekToContent(SvStream& rIn) const
+ {
+ sal_uInt64 const nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+ return checkSeek(rIn, nPos);
+ }
+ bool SeekToBegOfRecord(SvStream& rIn) const
+ {
+ return checkSeek(rIn, nFilePos);
+ }
+
+ MSFILTER_DLLPUBLIC friend bool ReadDffRecordHeader(SvStream& rIn, DffRecordHeader& rRec);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
new file mode 100644
index 000000000..ac6b4cc00
--- /dev/null
+++ b/include/filter/msfilter/escherex.hxx
@@ -0,0 +1,1221 @@
+/* -*- 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_MSFILTER_ESCHEREX_HXX
+#define INCLUDED_FILTER_MSFILTER_ESCHEREX_HXX
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vcl/GraphicObject.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/msdffdef.hxx>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <vcl/mapmod.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+class Color;
+
+namespace com::sun::star {
+ namespace awt { struct Rectangle; }
+ namespace beans { class XPropertySet; }
+ namespace drawing { struct EnhancedCustomShapeParameter; }
+ namespace drawing { struct Hatch; }
+}
+
+namespace tools {
+ class Polygon;
+ class PolyPolygon;
+}
+
+ /*Record Name FBT-Value Instance Contents Wrd Exl PPT Ver*/
+// In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
+#define ESCHER_DggContainer 0xF000u /* per-document data X X X */
+#define ESCHER_Dgg 0xF006u /* an FDGG and several FIDCLs X X X 0 */
+#define ESCHER_OPT 0xF00Bu /* count of properties the document-wide default shape properties X X X 3 */
+#define ESCHER_SplitMenuColors 0xF11Eu /* count of colors the colors in the top-level split menus X X X 0 */
+#define ESCHER_BstoreContainer 0xF001u /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
+#define ESCHER_BSE 0xF007u /* BLIP type an FBSE (one per BLIP) X X X 2 */
+#define ESCHER_BlipFirst 0xF018u /* range of fbts reserved for various kinds of BLIPs X X X */
+
+#define ESCHER_DgContainer 0xF002u /* per-sheet/page/slide data X X X */
+#define ESCHER_Dg 0xF008u /* drawing ID an FDG X X X 0 */
+#define ESCHER_SpgrContainer 0xF003u /* several SpContainers, the first of which is the group shape itself X X X */
+#define ESCHER_SpContainer 0xF004u /* a shape X X X */
+#define ESCHER_Spgr 0xF009u /* an FSPGR; only present if the shape is a group shape X X X 1 */
+#define ESCHER_Sp 0xF00Au /* shape type an FSP X X X 2 */
+//#define ESCHER_OPT 0xF00Bu /* count of properties a shape property table X X X 3 */
+#define ESCHER_ClientTextbox 0xF00Du /* host-defined the text in the textbox, in host-defined format X X X */
+#define ESCHER_ChildAnchor 0xF00Fu /* a RECT, in units relative to the parent group X X X 0 */
+#define ESCHER_ClientAnchor 0xF010u /* host-defined the location of the shape, in a host-defined format X X X */
+#define ESCHER_ClientData 0xF011u /* host-defined host-specific data X X X */
+#define ESCHER_SolverContainer 0xF005u /* count of rules the rules governing shapes X X X */
+#define ESCHER_ConnectorRule 0xF012u /* an FConnectorRule X X 1 */
+#define ESCHER_UDefProp 0xF122u
+
+enum class ShapeFlag : sal_uInt32
+{
+ NONE = 0x000,
+ Group = 0x001, /* shape is a group shape */
+ Child = 0x002, /* shape is a child shape */
+ Patriarch = 0x004, /* shape is the topmost group shape.
+ Exactly one of these per drawing. */
+ Deleted = 0x008, /* shape has been deleted */
+ OLEShape = 0x010, /* shape is an OLE object */
+ HaveMaster = 0x020, /* shape has a valid master in hspMaster property */
+ FlipH = 0x040, /* shape is flipped horizontally */
+ FlipV = 0x080, /* shape is flipped vertically */
+ Connector = 0x100, /* shape is a connector shape */
+ HaveAnchor = 0x200, /* shape has an anchor of some kind */
+ Background = 0x400, /* shape is a background shape */
+ HaveShapeProperty = 0x800 /* shape has a shape type property */
+}; /* 20 bits unused */
+namespace o3tl {
+ template<> struct typed_flags<ShapeFlag> : is_typed_flags<ShapeFlag, 0x00000FFF> {};
+}
+
+#define ESCHER_ShpInst_Min 0
+#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
+#define ESCHER_ShpInst_Rectangle 1
+#define ESCHER_ShpInst_RoundRectangle 2
+#define ESCHER_ShpInst_Ellipse 3
+#define ESCHER_ShpInst_Arc 19
+#define ESCHER_ShpInst_Line 20
+#define ESCHER_ShpInst_StraightConnector1 32
+#define ESCHER_ShpInst_BentConnector2 33
+#define ESCHER_ShpInst_BentConnector3 34
+#define ESCHER_ShpInst_CurvedConnector3 38
+#define ESCHER_ShpInst_PictureFrame 75
+#define ESCHER_ShpInst_TextPlainText 136
+#define ESCHER_ShpInst_TextDeflateInflateDeflate 167
+#define ESCHER_ShpInst_TextSlantUp 172
+#define ESCHER_ShpInst_HostControl 201
+#define ESCHER_ShpInst_TextBox 202
+#define ESCHER_ShpInst_COUNT 203
+#define ESCHER_ShpInst_Max 0x0FFF
+#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
+
+enum ESCHER_BlibType
+{ // GEL provided types...
+ ERROR = 0, // An error occurred during loading
+ UNKNOWN, // An unknown blip type
+ EMF, // Windows Enhanced Metafile
+ WMF, // Windows Metafile
+ PICT, // Macintosh PICT
+ PEG, // JFIF
+ PNG, // PNG
+ DIB, // Windows DIB
+ FirstClient = 32, // First client defined blip type
+ LastClient = 255 // Last client defined blip type
+};
+
+
+enum ESCHER_FillStyle
+{
+ ESCHER_FillSolid, // Fill with a solid color
+ ESCHER_FillPattern, // Fill with a pattern (bitmap)
+ ESCHER_FillTexture, // A texture (pattern with its own color map)
+ ESCHER_FillPicture, // Center a picture in the shape
+ ESCHER_FillShade, // Shade from start to end points
+ ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
+ ESCHER_FillShadeShape, // Shade from shape outline to end point
+ ESCHER_FillShadeScale,
+ ESCHER_FillShadeTitle,
+ ESCHER_FillBackground
+};
+
+enum ESCHER_wMode
+{
+ ESCHER_wColor, // only used for predefined shades
+ ESCHER_wAutomatic, // depends on object type
+ ESCHER_wGrayScale, // shades of gray only
+ ESCHER_wLightGrayScale, // shades of light gray only
+ ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_wGrayOutline, // pure gray and white
+ ESCHER_wBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_wHighContrast, // pure black and white mode (no grays)
+ ESCHER_wBlack, // solid black msobwWhite, // solid white
+ ESCHER_wDontShow, // object not drawn
+ ESCHER_wNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_ShapePath
+{
+ ESCHER_ShapeLines, // A line of straight segments
+ ESCHER_ShapeLinesClosed, // A closed polygonal object
+ ESCHER_ShapeCurves, // A line of Bezier curve segments
+ ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
+ ESCHER_ShapeComplex // pSegmentInfo must be non-empty
+};
+
+
+enum ESCHER_WrapMode
+{
+ ESCHER_WrapSquare,
+ ESCHER_WrapByPoints,
+ ESCHER_WrapNone,
+ ESCHER_WrapTopBottom,
+ ESCHER_WrapThrough
+};
+
+
+enum ESCHER_bwMode
+{
+ ESCHER_bwColor, // only used for predefined shades
+ ESCHER_bwAutomatic, // depends on object type
+ ESCHER_bwGrayScale, // shades of gray only
+ ESCHER_bwLightGrayScale, // shades of light gray only
+ ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_bwGrayOutline, // pure gray and white
+ ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_bwHighContrast, // pure black and white mode (no grays)
+ ESCHER_bwBlack, // solid black
+ ESCHER_bwWhite, // solid white
+ ESCHER_bwDontShow, // object not drawn
+ ESCHER_bwNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_AnchorText
+{
+ ESCHER_AnchorTop,
+ ESCHER_AnchorMiddle,
+ ESCHER_AnchorBottom,
+ ESCHER_AnchorTopCentered,
+ ESCHER_AnchorMiddleCentered,
+ ESCHER_AnchorBottomCentered,
+ ESCHER_AnchorTopBaseline,
+ ESCHER_AnchorBottomBaseline,
+ ESCHER_AnchorTopCenteredBaseline,
+ ESCHER_AnchorBottomCenteredBaseline
+};
+
+// connector style
+enum ESCHER_cxSTYLE
+{
+ ESCHER_cxstyleStraight = 0,
+ ESCHER_cxstyleBent,
+ ESCHER_cxstyleCurved,
+ ESCHER_cxstyleNone
+};
+
+// text flow
+enum ESCHER_txfl
+{
+ ESCHER_txflHorzN, // Horizontal non-@
+ ESCHER_txflTtoBA, // Top to Bottom @-font
+ ESCHER_txflBtoT, // Bottom to Top non-@
+ ESCHER_txflTtoBN, // Top to Bottom non-@
+ ESCHER_txflHorzA, // Horizontal @-font
+ ESCHER_txflVertN // Vertical, non-@
+};
+
+
+// flags for pictures
+enum ESCHER_BlipFlags
+{
+ ESCHER_BlipFlagDefault = 0,
+ ESCHER_BlipFlagComment = 0, // Blip name is a comment
+ ESCHER_BlipFlagFile, // Blip name is a file name
+ ESCHER_BlipFlagURL, // Blip name is a full URL
+ ESCHER_BlipFlagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ ESCHER_BlipFlagDoNotSave = 4,
+ ESCHER_BlipFlagLinkToFile = 8
+};
+
+// dashed line style
+enum ESCHER_LineDashing
+{
+ ESCHER_LineSolid, // Solid (continuous) pen
+ ESCHER_LineDashSys, // PS_DASH system dash style
+ ESCHER_LineDotSys, // PS_DOT system dash style
+ ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
+ ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ ESCHER_LineDotGEL, // square dot style
+ ESCHER_LineDashGEL, // dash style
+ ESCHER_LineLongDashGEL, // long dash style
+ ESCHER_LineDashDotGEL, // dash short dash
+ ESCHER_LineLongDashDotGEL, // long dash short dash
+ ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// line end effect
+enum ESCHER_LineEnd
+{
+ ESCHER_LineNoEnd,
+ ESCHER_LineArrowEnd,
+ ESCHER_LineArrowStealthEnd,
+ ESCHER_LineArrowDiamondEnd,
+ ESCHER_LineArrowOvalEnd,
+ ESCHER_LineArrowOpenEnd
+};
+
+// size of arrowhead
+enum ESCHER_LineWidth
+{
+ ESCHER_LineNarrowArrow,
+ ESCHER_LineMediumWidthArrow,
+ ESCHER_LineWideArrow
+};
+
+// size of arrowhead
+enum ESCHER_LineEndLength
+{
+ ESCHER_LineShortArrow,
+ ESCHER_LineMediumLenArrow,
+ ESCHER_LineLongArrow
+};
+
+// line join style.
+enum ESCHER_LineJoin
+{
+ ESCHER_LineJoinBevel, // Join edges by a straight line
+ ESCHER_LineJoinMiter, // Extend edges until they join
+ ESCHER_LineJoinRound // Draw an arc between the two edges
+};
+
+// line cap style (applies to ends of dash segments too).
+enum ESCHER_LineCap
+{
+ ESCHER_LineEndCapRound, // Rounded ends - the default
+ ESCHER_LineEndCapSquare, // Square protrudes by half line width
+ ESCHER_LineEndCapFlat // Line ends at end point
+};
+
+enum MSOPATHTYPE
+{
+ msopathLineTo, // Draw a straight line (one point)
+ msopathCurveTo, // Draw a cubic Bezier curve (three points)
+ msopathMoveTo, // Move to a new point (one point)
+ msopathClose, // Close a sub - path (no points)
+ msopathEnd, // End a path (no points)
+ msopathEscape, // Escape code
+ msopathClientEscape, // Escape code interpreted by the client
+ msopathInvalid // Invalid - should never be found
+};
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+// Transform
+#define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
+// Protection
+#define ESCHER_Prop_LockAgainstGrouping 127 /* bool Do not group this shape */
+// Text
+#define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
+#define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
+#define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
+#define ESCHER_Prop_dxTextRight 131 /* LONG */
+#define ESCHER_Prop_dyTextBottom 132 /* LONG */
+#define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
+#define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
+#define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
+#define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
+#define ESCHER_Prop_FitTextToShape 191 /* bool Size text to fit shape size */
+// GeoText
+#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
+#define ESCHER_Prop_gtextSize 195 /* LONG default point size */
+#define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
+// Blip
+#define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
+#define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
+#define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
+#define ESCHER_Prop_cropFromRight 259 /* LONG */
+#define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
+#define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
+#define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
+#define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
+#define ESCHER_Prop_pictureActive 319 /* bool Server is active (OLE objects only) */
+// Geometry
+#define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
+#define ESCHER_Prop_geoTop 321 /* LONG */
+#define ESCHER_Prop_geoRight 322 /* LONG */
+#define ESCHER_Prop_geoBottom 323 /* LONG */
+#define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
+#define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
+#define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
+#define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
+#define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
+#define ESCHER_Prop_fFillOK 383 /* bool OK to fill the shape through the UI or VBA? */
+// FillStyle
+#define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
+#define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
+#define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
+#define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
+#define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
+#define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
+#define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
+#define ESCHER_Prop_fillRectBottom 404 /* LONG */
+#define ESCHER_Prop_fNoFillHitTest 447 /* bool Hit test a shape as though filled */
+// LineStyle
+#define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
+#define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
+#define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
+#define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
+#define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
+#define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
+#define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
+#define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
+#define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
+#define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
+#define ESCHER_Prop_fNoLineDrawDash 511 /* bool Draw a dashed line if no line */
+// ShadowStyle
+#define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
+#define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
+#define ESCHER_Prop_fshadowObscured 575 /* bool Excel5-style shadow */
+// 3D Object
+#define ESCHER_Prop_fc3DLightFace 703 /* bool */
+// Shape
+#define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
+#define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
+#define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
+#define ESCHER_Prop_fBackground 831 /* bool If sal_True, this is the background shape. */
+// GroupShape
+#define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
+#define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
+#define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
+#define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
+#define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
+#define ESCHER_Prop_tableProperties 927
+#define ESCHER_Prop_tableRowProperties 928
+#define ESCHER_Prop_fHidden 958 /* bool Do not display */
+#define ESCHER_Prop_fPrint 959 /* bool Print this shape */
+
+
+#define ESCHER_Persist_PrivateEntry 0x80000000
+#define ESCHER_Persist_Dgg 0x00010000
+#define ESCHER_Persist_Dg 0x00020000
+#define ESCHER_Persist_CurrentPosition 0x00040000
+#define ESCHER_Persist_Grouping_Snap 0x00050000
+#define ESCHER_Persist_Grouping_Logic 0x00060000
+
+const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
+
+namespace com::sun::star {
+ namespace awt {
+ struct Gradient;
+ }
+ namespace drawing {
+ struct EnhancedCustomShapeAdjustmentValue;
+ class XShape;
+ class XShapes;
+ }
+}
+
+struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
+{
+ css::uno::Reference< css::drawing::XShape > mXConnector;
+ css::awt::Point maPointA;
+ css::uno::Reference< css::drawing::XShape > mXConnectToA;
+ css::awt::Point maPointB;
+ css::uno::Reference< css::drawing::XShape > mXConnectToB;
+
+ sal_uInt32 GetConnectorRule( bool bFirst );
+
+ EscherConnectorListEntry( css::uno::Reference< css::drawing::XShape > xC,
+ const css::awt::Point& rPA,
+ css::uno::Reference< css::drawing::XShape > xSA ,
+ const css::awt::Point& rPB,
+ css::uno::Reference< css::drawing::XShape > xSB ) :
+ mXConnector (std::move( xC )),
+ maPointA ( rPA ),
+ mXConnectToA(std::move( xSA )),
+ maPointB ( rPB ),
+ mXConnectToB(std::move( xSB )) {}
+
+ static sal_uInt32 GetClosestPoint( const tools::Polygon& rPoly, const css::awt::Point& rP );
+};
+
+struct MSFILTER_DLLPUBLIC EscherExContainer
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
+ ~EscherExContainer();
+};
+
+struct MSFILTER_DLLPUBLIC EscherExAtom
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
+ ~EscherExAtom();
+};
+
+struct EscherPropertyValueHelper
+{
+ static bool GetPropertyValue(
+ css::uno::Any& rAny,
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ const OUString& rPropertyName,
+ bool bTestPropertyAvailability = false
+ );
+
+ static css::beans::PropertyState GetPropertyState(
+ const css::uno::Reference < css::beans::XPropertySet > &,
+ const OUString& rPropertyName
+ );
+};
+
+
+struct EscherPersistEntry
+{
+ sal_uInt32 mnID;
+ sal_uInt32 mnOffset;
+
+ EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
+
+};
+
+
+class EscherBlibEntry
+{
+ friend class EscherGraphicProvider;
+ friend class EscherEx;
+
+ MapMode maPrefMapMode;
+ Size maPrefSize;
+
+ sal_uInt32 mnIdentifier[ 4 ];
+ sal_uInt32 mnPictureOffset; // offset to the graphic in PictureStreams
+ sal_uInt32 mnSize; // size of real graphic
+
+ sal_uInt32 mnRefCount; // !! reference count
+ sal_uInt32 mnSizeExtra; // !! size of preceding header
+
+ ESCHER_BlibType meBlibType;
+
+ bool mbIsEmpty;
+ bool mbIsNativeGraphicPossible;
+
+public:
+
+ EscherBlibEntry(
+ sal_uInt32 nPictureOffset,
+ const GraphicObject& rObj,
+ const OString& rId,
+ const GraphicAttr* pAttr
+ );
+
+ ~EscherBlibEntry();
+
+ void WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, sal_uInt32 nResize = 0 );
+ bool IsEmpty() const { return mbIsEmpty; };
+
+ bool operator==( const EscherBlibEntry& ) const;
+};
+
+
+enum class EscherGraphicProviderFlags {
+ NONE = 0,
+ UseInstances = 1,
+};
+namespace o3tl {
+ template<> struct typed_flags<EscherGraphicProviderFlags> : is_typed_flags<EscherGraphicProviderFlags, 0x01> {};
+}
+
+class MSFILTER_DLLPUBLIC EscherGraphicProvider
+{
+ EscherGraphicProviderFlags
+ mnFlags;
+ std::vector<std::unique_ptr<EscherBlibEntry>>
+ mvBlibEntrys;
+ OUString maBaseURI;
+
+protected:
+
+ sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
+
+public:
+
+ sal_uInt32 GetBlibStoreContainerSize( SvStream const * pMergePicStreamBSE = nullptr ) const;
+ void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = nullptr );
+ void WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize);
+ sal_uInt32 GetBlibID(
+ SvStream& rPicOutStream,
+ GraphicObject const & pGraphicObject,
+ const css::awt::Rectangle* pVisArea = nullptr,
+ const GraphicAttr* pGrafikAttr = nullptr,
+ const bool ooxmlExport = false
+ );
+ bool HasGraphics() const { return !mvBlibEntrys.empty(); };
+
+ void SetNewBlipStreamOffset( sal_Int32 nOffset );
+
+ bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
+
+ void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
+ const OUString& GetBaseURI() const { return maBaseURI; };
+
+ EscherGraphicProvider( EscherGraphicProviderFlags nFlags = EscherGraphicProviderFlags::NONE );
+ virtual ~EscherGraphicProvider();
+
+ EscherGraphicProvider& operator=( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
+ EscherGraphicProvider( EscherGraphicProvider const & ) = delete; // MSVC2015 workaround
+};
+
+struct EscherShapeListEntry;
+
+class MSFILTER_DLLPUBLIC EscherSolverContainer
+{
+ ::std::vector< std::unique_ptr<EscherShapeListEntry> > maShapeList;
+ ::std::vector< std::unique_ptr<EscherConnectorListEntry> > maConnectorList;
+
+public:
+
+ sal_uInt32 GetShapeId(
+ const css::uno::Reference< css::drawing::XShape > & rShape
+ ) const;
+
+ void AddShape(
+ const css::uno::Reference< css::drawing::XShape > &,
+ sal_uInt32 nId
+ );
+
+ void AddConnector(
+ const css::uno::Reference< css::drawing::XShape > &,
+ const css::awt::Point& rA,
+ css::uno::Reference< css::drawing::XShape > const &,
+ const css::awt::Point& rB,
+ css::uno::Reference< css::drawing::XShape > const & rConB
+ );
+
+ void WriteSolver( SvStream& );
+
+ EscherSolverContainer();
+ ~EscherSolverContainer();
+
+ EscherSolverContainer& operator=( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
+ EscherSolverContainer( EscherSolverContainer const & ) = delete; // MSVC2015 workaround
+};
+
+
+#define ESCHER_CREATEPOLYGON_LINE 1
+#define ESCHER_CREATEPOLYGON_POLYLINE 2
+#define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
+
+class SdrObjCustomShape;
+
+struct EscherPropSortStruct
+{
+ std::vector<sal_uInt8> nProp;
+ sal_uInt32 nPropValue;
+ sal_uInt16 nPropId;
+};
+
+typedef std::vector< EscherPropSortStruct > EscherProperties;
+
+class MSFILTER_DLLPUBLIC EscherPropertyContainer
+{
+ EscherGraphicProvider* pGraphicProvider;
+ SvStream* pPicOutStrm;
+ tools::Rectangle* pShapeBoundRect;
+
+ sal_uInt32 nCountCount;
+ sal_uInt32 nCountSize;
+
+ std::vector<EscherPropSortStruct>
+ pSortStruct;
+
+ bool bHasComplexData;
+
+
+ static sal_uInt32 ImplGetColor( const sal_uInt32 rColor, bool bSwap = true );
+ void ImplCreateGraphicAttributes(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nBlibId,
+ bool bCreateCroppingAttributes
+ );
+ bool ImplCreateEmbeddedBmp(GraphicObject const & rGraphicObject);
+
+ SAL_DLLPRIVATE explicit EscherPropertyContainer(
+ EscherGraphicProvider * pGraphProv, SvStream * pPiOutStrm,
+ tools::Rectangle * pBoundRect);
+
+public:
+
+ EscherPropertyContainer();
+ EscherPropertyContainer(
+ EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
+ SvStream* pPicOutStrm, // the GraphicProvider to be able to write
+ tools::Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
+ ); // under some circumstances the ShapeBoundRect
+ // is adjusted this will happen when rotated
+ // GraphicObjects are saved to PowerPoint
+ ~EscherPropertyContainer();
+
+ void AddOpt(
+ sal_uInt16 nPropID,
+ bool bBlib,
+ sal_uInt32 nSizeReduction,
+ SvMemoryStream& rStream);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ const OUString& rString);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_uInt32 nPropValue,
+ bool bBlib = false);
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ bool bBlib,
+ sal_uInt32 nPropValue,
+ const std::vector<sal_uInt8>& rProp);
+
+ bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
+
+ bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
+
+ const EscherProperties & GetOpts() const;
+
+ void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
+
+ void CreateShapeProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape
+ );
+ bool CreateOLEGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXOleObject
+ );
+ bool CreateGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ const GraphicObject& rGraphicObj
+ );
+ bool CreateMediaGraphicProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXMediaObject
+ );
+
+ /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
+ void CreateEmbeddedBitmapProperties(
+ css::uno::Reference<css::awt::XBitmap> const & rxBitmap,
+ css::drawing::BitmapMode eBitmapMode
+ );
+ /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
+ void CreateEmbeddedHatchProperties(
+ const css::drawing::Hatch& rHatch,
+ const Color& rBackColor,
+ bool bFillBackground
+ );
+
+ // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
+ // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
+ // will be created, containing the BLIP directly (e.g. for Excel charts).
+ bool CreateGraphicProperties(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ const OUString& rSource,
+ const bool bCreateFillBitmap,
+ const bool bCreateCroppingAttributes = false,
+ const bool bFillBitmapModeAllowed = true,
+ const bool bOOxmlExport = false
+ );
+
+ bool CreateBlipPropertiesforOLEControl( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const css::uno::Reference< css::drawing::XShape > & rXShape);
+
+ bool CreatePolygonProperties(
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nFlags,
+ bool bBezier,
+ css::awt::Rectangle& rGeoRect,
+ tools::Polygon const * pPolygon = nullptr
+ );
+
+ static sal_uInt32 GetGradientColor(
+ const css::awt::Gradient* pGradient,
+ sal_uInt32 nStartColor
+ );
+
+ void CreateGradientProperties( const css::awt::Gradient & rGradient );
+ void CreateGradientProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bTransparentGradient = false
+ );
+
+ void CreateLineProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge
+ );
+ void CreateFillProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge,
+ bool bTransparentGradient = false );
+ void CreateFillProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ bool bEdge,
+ const css::uno::Reference< css::drawing::XShape > & rXShape );
+ void CreateTextProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &,
+ sal_uInt32 nText,
+ const bool bIsCustomShape = false,
+ const bool bIsTextFrame = true
+ );
+
+ bool CreateConnectorProperties(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ EscherSolverContainer& rSolver,
+ css::awt::Rectangle& rGeoRect,
+ sal_uInt16& rShapeType,
+ ShapeFlag& rShapeFlags
+ );
+
+ // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
+ // It's active only when at least a FillStyle or LineStyle is set.
+ void CreateShadowProperties(
+ const css::uno::Reference< css::beans::XPropertySet > &
+ );
+
+ sal_Int32 GetValueForEnhancedCustomShapeParameter( const css::drawing::EnhancedCustomShapeParameter& rParameter,
+ const std::vector< sal_Int32 >& rEquationOrder, bool bAdjustTrans = false );
+ // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
+ void CreateCustomShapeProperties(
+ const MSO_SPT eShapeType,
+ const css::uno::Reference< css::drawing::XShape > &
+ );
+ bool IsFontWork() const;
+
+ // helper functions which are also used by the escher import
+ static tools::PolyPolygon GetPolyPolygon(
+ const css::uno::Reference< css::drawing::XShape > & rXShape
+ );
+ static tools::PolyPolygon GetPolyPolygon( const css::uno::Any& rSource );
+ static MSO_SPT GetCustomShapeType(
+ const css::uno::Reference< css::drawing::XShape > & rXShape,
+ ShapeFlag& nMirrorFlags,
+ OUString& rShapeType,
+ bool bOOXML = false
+ );
+
+ // helper functions which are also used in ooxml export
+ static bool GetLineArrow(
+ const bool bLineStart,
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ ESCHER_LineEnd& reLineEnd,
+ sal_Int32& rnArrowLength,
+ sal_Int32& rnArrowWidth
+ );
+
+ static bool IsDefaultObject(
+ const SdrObjCustomShape& rSdrObjCustomShape,
+ const MSO_SPT eShapeType);
+
+ static void LookForPolarHandles(
+ const MSO_SPT eShapeType,
+ sal_Int32& nAdjustmentsWhichNeedsToBeConverted
+ );
+ static bool GetAdjustmentValue( const css::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
+};
+
+
+class MSFILTER_DLLPUBLIC EscherPersistTable
+{
+
+public:
+ ::std::vector< std::unique_ptr<EscherPersistEntry> > maPersistTable;
+
+ bool PtIsID( sal_uInt32 nID );
+ void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ void PtDelete( sal_uInt32 nID );
+ sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
+ void PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
+ void PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+
+ EscherPersistTable();
+ virtual ~EscherPersistTable();
+
+ EscherPersistTable& operator=( EscherPersistTable const & ) = delete; // MSVC2015 workaround
+ EscherPersistTable( EscherPersistTable const & ) = delete; // MSVC2015 workaround
+};
+
+
+class EscherEx;
+
+/// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
+class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
+{
+public:
+ virtual ~EscherExClientRecord_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx ) const = 0;
+};
+
+
+/// abstract base class for ESCHER_ClientAnchor
+class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
+{
+public:
+ virtual ~EscherExClientAnchor_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx,
+ const tools::Rectangle& rRect ) = 0;
+};
+
+class InteractionInfo
+{
+ std::unique_ptr<SvMemoryStream> mpHyperlinkRecord;
+
+public:
+ InteractionInfo( SvMemoryStream* pStream )
+ {
+ mpHyperlinkRecord.reset( pStream );
+ }
+ const std::unique_ptr< SvMemoryStream >& getHyperlinkRecord() const { return mpHyperlinkRecord; }
+};
+
+class EscherExHostAppData
+{
+private:
+ EscherExClientAnchor_Base* pClientAnchor;
+ EscherExClientRecord_Base* pClientData;
+ EscherExClientRecord_Base* pClientTextbox;
+ InteractionInfo* pInteractionInfo;
+ // ignore single shape if entire pages are written
+ bool bDontWriteShape;
+
+public:
+ EscherExHostAppData() : pClientAnchor(nullptr), pClientData(nullptr),
+ pClientTextbox(nullptr), pInteractionInfo(nullptr), bDontWriteShape(false)
+ {}
+
+ void SetInteractionInfo( InteractionInfo* p )
+ { pInteractionInfo = p; }
+ void SetClientAnchor( EscherExClientAnchor_Base* p )
+ { pClientAnchor = p; }
+ void SetClientData( EscherExClientRecord_Base* p )
+ { pClientData = p; }
+ void SetClientTextbox( EscherExClientRecord_Base* p )
+ { pClientTextbox = p; }
+ void SetDontWriteShape( bool b )
+ { bDontWriteShape = b; }
+ InteractionInfo* GetInteractionInfo() const
+ { return pInteractionInfo; }
+ EscherExClientAnchor_Base* GetClientAnchor() const
+ { return pClientAnchor; }
+ EscherExClientRecord_Base* GetClientTextbox() const
+ { return pClientTextbox; }
+
+ void WriteClientAnchor( EscherEx& rEx, const tools::Rectangle& rRect )
+ { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
+ void WriteClientData( EscherEx& rEx )
+ { if( pClientData ) pClientData->WriteData( rEx ); }
+ void WriteClientTextbox( EscherEx& rEx )
+ { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
+
+ bool DontWriteShape() const { return bDontWriteShape; }
+};
+
+
+/** Instance for global DFF data, shared through various instances of EscherEx. */
+class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
+{
+public:
+ explicit EscherExGlobal();
+ virtual ~EscherExGlobal() override;
+
+ /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
+ sal_uInt32 GenerateDrawingId();
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table.
+ @param nDrawingId Drawing identifier has to be passed to be able to
+ generate shape identifiers for multiple drawings simultaneously. */
+ sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
+ /** Returns the number of shapes in the current drawing, based on number of
+ calls to the GenerateShapeId() function. */
+ sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
+ /** Returns the last shape identifier generated by the GenerateShapeId()
+ function. */
+ sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
+
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ void SetDggContainer() { mbHasDggCont = true; }
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ bool HasDggContainer() const { return mbHasDggCont; }
+ /** Returns the total size of the DGG atom (including header). */
+ sal_uInt32 GetDggAtomSize() const;
+ /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
+ void WriteDggAtom( SvStream& rStrm ) const;
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEESdrWriter.
+
+ On first invocation, this function calls the virtual member function
+ ImplQueryPictureStream(). The return value will be cached internally
+ for subsequent calls and for the GetPictureStream() function.
+ */
+ SvStream* QueryPictureStream();
+
+ /** Returns the picture stream if existing (queried), otherwise null. */
+ SvStream* GetPictureStream() { return mpPicStrm; }
+
+private:
+ /** Derived classes may implement to create a new stream used to store the
+ picture data.
+
+ The implementation has to take care about lifetime of the returned
+ stream (it will not be destructed automatically). This function is
+ called exactly once. The return value will be cached internally for
+ repeated calls of the public QueryPictureStream() function.
+ */
+ virtual SvStream* ImplQueryPictureStream();
+
+private:
+ struct ClusterEntry
+ {
+ sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
+ sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
+ explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
+ };
+
+ struct DrawingInfo
+ {
+ sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
+ sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
+ sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
+ explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
+ };
+ typedef ::std::vector< DrawingInfo > DrawingInfoVector;
+
+ std::vector< ClusterEntry > maClusterTable; /// List with cluster IDs (used object IDs in drawings).
+ DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
+ SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
+ bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
+ bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
+};
+
+class SdrObject;
+class SdrPage;
+class ImplEESdrWriter;
+
+class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
+{
+ protected:
+ std::shared_ptr<EscherExGlobal> mxGlobal;
+ ::std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter;
+ SvStream* mpOutStrm;
+ bool mbOwnsStrm;
+ sal_uInt32 mnStrmStartOfs;
+ std::vector< sal_uInt32 > mOffsets;
+ std::vector< sal_uInt16 > mRecTypes;
+
+ sal_uInt32 mnCurrentDg;
+ sal_uInt32 mnCountOfs;
+
+ sal_uInt32 mnGroupLevel;
+ SdrLayerID mnHellLayerId;
+
+ bool mbEscherSpgr;
+ bool mbEscherDg;
+ bool mbOOXML;
+ OUString mEditAs;
+
+
+ bool DoSeek( sal_uInt32 nKey );
+
+public:
+ explicit EscherEx( std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML = false );
+ virtual ~EscherEx() override;
+
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table. */
+ virtual sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
+
+ /** Returns the graphic provider from the global object that has been
+ passed to the constructor.
+ */
+ EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEESdrWriter.
+ */
+ SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
+
+ /// Inserts internal data into the EscherStream, this process
+ /// may and has to be executed only once
+ /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
+ /// merged into the MsofbtBSE Records of the EscherStream like it's
+ /// required for Excel (and maybe Word?)
+ void Flush( SvStream* pPicStreamMergeBSE = nullptr );
+
+ /** Inserts the passed number of bytes at the current position of the
+ output stream.
+
+ Inserts dummy bytes and moves all following stream data, and updates
+ all internal stream offsets stored in the PersistTable and the affected
+ container sizes, which makes this operation very expensive. (!)
+
+ @param nBytes The number of bytes to be inserted into the stream.
+
+ An atom that currently ends
+ exactly at the current stream position will not be expanded to
+ include the inserted data (used to insert e.g. a new atom after an
+ existing atom). Note that containers that end exactly at the
+ current stream position are always expanded to include the inserted
+ data.
+ */
+ void InsertAtCurrentPos( sal_uInt32 nBytes );
+
+ void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
+ void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
+ sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
+ bool SeekToPersistOffset( sal_uInt32 nKey );
+ void InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite mode), without that the
+ // current StreamPosition changes
+ void SetEditAs( const OUString& rEditAs );
+ const OUString& GetEditAs() const { return mEditAs; }
+ SvStream& GetStream() const { return *mpOutStrm; }
+ sal_uInt64 GetStreamPos() const { return mpOutStrm->Tell(); }
+
+ // features during the creation of the following Containers:
+
+ // ESCHER_DggContainer: an EscherDgg Atom is automatically being created and managed
+ // ESCHER_DgContainer: an EscherDg Atom is automatically being created and managed
+ // ESCHER_SpgrContainer:
+ // ESCHER_SpContainer:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ void BeginAtom();
+ void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ void AddChildAnchor( const tools::Rectangle& rRectangle );
+ void AddClientAnchor( const tools::Rectangle& rRectangle );
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect );
+ sal_uInt32 EnterGroup( const tools::Rectangle* pBoundRect = nullptr );
+ sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
+ void SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
+ void SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle& rRect );
+ virtual void LeaveGroup();
+
+ // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
+ virtual void AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID = 0 );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect);
+
+ static sal_uInt32 GetColor( const sal_uInt32 nColor );
+ static sal_uInt32 GetColor( const Color& rColor );
+
+ // ...Sdr... implemented in eschesdo.cxx
+
+ void AddSdrPage( const SdrPage& rPage, bool ooxmlExport = false );
+ void AddUnoShapes( const css::uno::Reference< css::drawing::XShapes >& rxShapes, bool ooxmlExport = false );
+
+ /// returns the ShapeID
+ sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
+ virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
+ {
+ // Required for Exporting VML shape
+ }
+
+ /// If objects are written through AddSdrObject the
+ /// SolverContainer has to be written, and maybe some
+ /// maintenance to be done.
+ void EndSdrObjectPage();
+
+ /// Called before a shape is written, application supplies
+ /// ClientRecords. May set AppData::bDontWriteShape so the
+ /// shape is ignored.
+ virtual EscherExHostAppData* StartShape(
+ const css::uno::Reference< css::drawing::XShape >& rShape,
+ const tools::Rectangle* pChildAnchor );
+
+ /// Called after a shape is written to inform the application
+ /// of the resulted shape type and ID.
+ virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
+
+ /// Called before an AdditionalText EnterGroup occurs.
+ /// The current shape will be written in three parts:
+ /// a group shape, the shape itself, and an extra textbox shape.
+ /// The complete flow is:
+ /// StartShape sets HostData1.
+ /// EnterAdditionalTextGroup sets HostData2, App may modify
+ /// HostData1 and keep track of the change.
+ /// The group shape is written with HostData2.
+ /// Another StartShape with the same (!) object sets HostData3.
+ /// The current shape is written with HostData3.
+ /// EndShape is called for the current shape.
+ /// Another StartShape with the same (!) object sets HostData4.
+ /// The textbox shape is written with HostData4.
+ /// EndShape is called for the textbox shape.
+ /// EndShape is called for the group shape, this provides
+ /// the same functionality as an ordinary recursive group.
+ virtual EscherExHostAppData* EnterAdditionalTextGroup();
+
+ /// Called if an ESCHER_Prop_lTxid shall be written
+ virtual sal_uInt32 QueryTextID( const css::uno::Reference< css::drawing::XShape >&, sal_uInt32 nShapeId );
+ // add a dummy rectangle shape into the escher stream
+ sal_uInt32 AddDummyShape();
+
+ static const SdrObject* GetSdrObject( const css::uno::Reference< css::drawing::XShape >& rXShape );
+
+ void SetHellLayerId( SdrLayerID nId ) { mnHellLayerId = nId; }
+ SdrLayerID GetHellLayerId() const { return mnHellLayerId; }
+
+private:
+ EscherEx( const EscherEx& ) = delete;
+ EscherEx& operator=( const EscherEx& ) = delete;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mscodec.hxx b/include/filter/msfilter/mscodec.hxx
new file mode 100644
index 000000000..90c39a8cc
--- /dev/null
+++ b/include/filter/msfilter/mscodec.hxx
@@ -0,0 +1,499 @@
+/* -*- 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_MSFILTER_MSCODEC_HXX
+#define INCLUDED_FILTER_MSFILTER_MSCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include <sal/types.h>
+#include <comphelper/hash.hxx>
+#include <vector>
+
+namespace com::sun::star {
+ namespace beans { struct NamedValue; }
+}
+
+namespace msfilter {
+
+
+/** Encodes and decodes data from protected MSO 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Xor95
+{
+public:
+ explicit MSCodec_Xor95(int nRotateDistance);
+ virtual ~MSCodec_Xor95();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void InitKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool InitCodec( const css::uno::Sequence< css::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ css::uno::Sequence< css::beans::NamedValue > GetEncryptionData();
+
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+ */
+ void InitCipher();
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes )=0;
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ void Skip( std::size_t nBytes );
+
+protected:
+ sal_uInt8 mpnKey[ 16 ] = {}; /// Encryption key.
+ std::size_t mnOffset; /// Key offset.
+
+private:
+ MSCodec_Xor95( const MSCodec_Xor95& ) = delete;
+ MSCodec_Xor95& operator=( const MSCodec_Xor95& ) = delete;
+
+ sal_uInt16 mnKey; /// Base key from password.
+ sal_uInt16 mnHash; /// Hash value from password.
+ int mnRotateDistance;
+};
+
+/** Encodes and decodes data from protected MSO XLS 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorXLS95 final : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorXLS95() : MSCodec_Xor95(2) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes ) override;
+};
+
+/** Encodes and decodes data from protected MSO Word 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorWord95 final : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorWord95() : MSCodec_Xor95(7) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, std::size_t nBytes ) override;
+};
+
+class MSFILTER_DLLPUBLIC MSCodec97
+{
+public:
+ MSCodec97(size_t nHashLen, OUString aEncKeyName);
+ virtual ~MSCodec97();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool InitCodec(const css::uno::Sequence< css::beans::NamedValue >& aData);
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ virtual css::uno::Sequence<css::beans::NamedValue> GetEncryptionData();
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) = 0;
+
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSaltData
+ Salt data block read from the file.
+ @param pSaltDigest
+ Salt digest read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey(const sal_uInt8* pSaltData, const sal_uInt8* pSaltDigest);
+
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) = 0;
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ virtual bool InitCipher(sal_uInt32 nCounter) = 0;
+
+ /** Encodes a block of memory.
+
+ @see rtl_cipher_encode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ unencoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Unencrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the encrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Encoding was successful (no error occurred).
+ */
+ bool Encode(const void* pData, std::size_t nDatLen,
+ sal_uInt8* pBuffer, std::size_t nBufLen);
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ encoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Encrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the decrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Decoding was successful (no error occurred).
+ */
+ bool Decode(const void* pData, std::size_t nDatLen,
+ sal_uInt8* pBuffer, std::size_t nBufLen);
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nDatLen
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ bool Skip(std::size_t nDatLen);
+
+ /* allows to get the unique document id from the codec
+ */
+ void GetDocId( sal_uInt8 pDocId[16] );
+
+private:
+ MSCodec97(const MSCodec97&) = delete;
+ MSCodec97& operator=(const MSCodec97&) = delete;
+
+protected:
+ OUString m_sEncKeyName;
+ size_t m_nHashLen;
+ rtlCipher m_hCipher;
+ std::vector<sal_uInt8> m_aDocId;
+ std::vector<sal_uInt8> m_aDigestValue;
+};
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Std97 final : public MSCodec97
+{
+public:
+ MSCodec_Std97();
+ virtual ~MSCodec_Std97() override;
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) override;
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ virtual bool InitCipher(sal_uInt32 nCounter) override;
+
+ /** Creates an MD5 digest of salt digest. */
+ void CreateSaltDigest(
+ const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
+
+ /** Gets salt data and salt digest.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSalt
+ Salt, a random number.
+ @param pSaltData
+ Salt data block generated from the salt.
+ @param pSaltDigest
+ Salt digest generated from the salt.
+ */
+ void GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16]);
+
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) override;
+
+private:
+ MSCodec_Std97( const MSCodec_Std97& ) = delete;
+ MSCodec_Std97& operator=( const MSCodec_Std97& ) = delete;
+
+ rtlDigest m_hDigest;
+};
+
+class MSFILTER_DLLPUBLIC MSCodec_CryptoAPI final : public MSCodec97
+{
+private:
+ css::uno::Sequence<sal_Int8> m_aStd97Key;
+public:
+ MSCodec_CryptoAPI();
+
+ virtual void InitKey(const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16]) override;
+ virtual bool InitCipher(sal_uInt32 nCounter) override;
+ virtual void GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* pDigest) override;
+ virtual css::uno::Sequence<css::beans::NamedValue> GetEncryptionData() override;
+};
+
+const sal_uInt32 ENCRYPTINFO_CRYPTOAPI = 0x00000004;
+const sal_uInt32 ENCRYPTINFO_DOCPROPS = 0x00000008;
+const sal_uInt32 ENCRYPTINFO_EXTERNAL = 0x00000010;
+const sal_uInt32 ENCRYPTINFO_AES = 0x00000020;
+
+const sal_uInt32 ENCRYPT_ALGO_AES128 = 0x0000660E;
+const sal_uInt32 ENCRYPT_ALGO_AES192 = 0x0000660F;
+const sal_uInt32 ENCRYPT_ALGO_AES256 = 0x00006610;
+const sal_uInt32 ENCRYPT_ALGO_RC4 = 0x00006801;
+
+const sal_uInt32 ENCRYPT_HASH_SHA1 = 0x00008004;
+
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_128 = 0x00000080;
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_192 = 0x000000C0;
+const sal_uInt32 ENCRYPT_KEY_SIZE_AES_256 = 0x00000100;
+
+const sal_uInt32 ENCRYPT_PROVIDER_TYPE_AES = 0x00000018;
+const sal_uInt32 ENCRYPT_PROVIDER_TYPE_RC4 = 0x00000001;
+
+// version of encryption info used in MS Office 1997 (major = 1, minor = 1)
+const sal_uInt32 VERSION_INFO_1997_FORMAT = 0x00010001;
+// version of encryption info used in MS Office 2007 (major = 3, minor = 2)
+const sal_uInt32 VERSION_INFO_2007_FORMAT = 0x00020003;
+// version of encryption info used in MS Office 2007 SP2 and older (major = 4, minor = 2)
+const sal_uInt32 VERSION_INFO_2007_FORMAT_SP2 = 0x00020004;
+
+// version of encryption info - agile (major = 4, minor = 4)
+const sal_uInt32 VERSION_INFO_AGILE = 0x00040004;
+
+const sal_uInt32 AGILE_ENCRYPTION_RESERVED = 0x00000040;
+
+const sal_uInt32 SALT_LENGTH = 16;
+const sal_uInt32 ENCRYPTED_VERIFIER_LENGTH = 16;
+
+struct MSFILTER_DLLPUBLIC EncryptionStandardHeader
+{
+ sal_uInt32 flags;
+ sal_uInt32 sizeExtra; // 0
+ sal_uInt32 algId; // if flag AES && CRYPTOAPI this defaults to 128-bit AES
+ sal_uInt32 algIdHash; // 0: determine by flags - defaults to SHA-1 if not external
+ sal_uInt32 keyBits; // key size in bits: 0 (determine by flags), 128, 192, 256
+ sal_uInt32 providedType; // AES or RC4
+ sal_uInt32 reserved1; // 0
+ sal_uInt32 reserved2; // 0
+
+ EncryptionStandardHeader();
+};
+
+struct MSFILTER_DLLPUBLIC EncryptionVerifierAES
+{
+ sal_uInt32 saltSize; // must be 0x00000010
+ sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value
+ sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value
+ sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm
+ sal_uInt8 encryptedVerifierHash[comphelper::SHA256_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted
+
+ EncryptionVerifierAES();
+};
+
+struct MSFILTER_DLLPUBLIC EncryptionVerifierRC4
+{
+ sal_uInt32 saltSize; // must be 0x00000010
+ sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value
+ sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value
+ sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm
+ sal_uInt8 encryptedVerifierHash[comphelper::SHA1_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted
+
+ EncryptionVerifierRC4();
+};
+
+struct MSFILTER_DLLPUBLIC StandardEncryptionInfo
+{
+ EncryptionStandardHeader header;
+ EncryptionVerifierAES verifier;
+};
+
+struct MSFILTER_DLLPUBLIC RC4EncryptionInfo
+{
+ EncryptionStandardHeader header;
+ EncryptionVerifierRC4 verifier;
+};
+
+} // namespace msfilter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
new file mode 100644
index 000000000..3dfd170bc
--- /dev/null
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -0,0 +1,809 @@
+/* -*- 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_MSFILTER_MSDFFIMP_HXX
+#define INCLUDED_FILTER_MSFILTER_MSDFFIMP_HXX
+
+#include <cstring>
+#include <map>
+#include <memory>
+#include <optional>
+#include <set>
+#include <utility>
+#include <vector>
+#include <unordered_map>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/stl_types.hxx>
+#include <filter/msfilter/dffpropset.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+#include <vcl/errcode.hxx>
+#include <tools/degree.hxx>
+#include <tools/gen.hxx>
+#include <tools/ref.hxx>
+#include <tools/solar.h>
+#include <tools/poly.hxx>
+#include <vcl/graph.hxx>
+
+class Color;
+class GDIMetaFile;
+class SotStorage;
+class SvStream;
+class SdrObject;
+class SdrOle2Obj;
+class SdrModel;
+class SwFlyFrameFormat;
+
+struct SvxMSDffBLIPInfos;
+struct SvxMSDffShapeInfo;
+struct SvxMSDffShapeOrder;
+
+class SvxMSDffManager;
+class SfxItemSet;
+struct DffObjData;
+class SvGlobalName;
+
+namespace com::sun::star {
+ namespace beans { class XPropertySet; }
+ namespace embed { class XEmbeddedObject; }
+ namespace embed { class XStorage; }
+}
+
+class MSFILTER_DLLPUBLIC SvxMSDffClientData
+{
+public:
+ virtual void NotifyFreeObj(SdrObject* pObj) = 0;
+ virtual ~SvxMSDffClientData() {}
+};
+
+class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
+{
+ const SvxMSDffManager& rManager;
+ std::unique_ptr<DffPropSet> pDefaultPropSet;
+
+ void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
+ void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData const & rObjData ) const;
+ void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
+ SfxItemSet& rSet,
+ const DffObjData& rObjData ) const;
+ void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269#
+ void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
+
+public:
+ Degree100 mnFix16Angle;
+ bool mbRotateGranientFillWithAngle;
+
+ explicit DffPropertyReader( const SvxMSDffManager& rManager );
+ ~DffPropertyReader();
+
+ DffPropertyReader& operator=( DffPropertyReader const & ) = delete; // MSVC2015 workaround
+ DffPropertyReader( DffPropertyReader const & ) = delete; // MSVC2015 workaround
+
+ static Degree100 Fix16ToAngle( sal_Int32 nAngle );
+
+#ifdef DBG_CUSTOMSHAPE
+ void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData, sal_uInt32 nShapeType = 0 ) const;
+#else
+ void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData ) const;
+#endif
+
+ void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData const & rObjData ) const;
+ void ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_FillType, double dTrans, double dBackTrans ) const;
+};
+
+#define COL_DEFAULT ::Color( 0xFA, 0xFB, 0xFC )
+
+typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
+
+inline constexpr OUStringLiteral SVEXT_PERSIST_STREAM = u"\002OlePres000";
+
+/// the following will be sorted by the order of their appearance:
+typedef std::vector<std::unique_ptr<SvxMSDffShapeOrder>> SvxMSDffShapeOrders;
+
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
+{
+ bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+struct CompareSvxMSDffShapeInfoByTxBxComp
+{
+ bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+
+// the following will be sorted explicitly:
+typedef ::std::set< std::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
+typedef ::std::multiset< std::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
+
+#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
+#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
+#define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this is stored in
+#define OLE_MATHTYPE_2_STARMATH 0x0001
+#define OLE_WINWORD_2_STARWRITER 0x0002
+#define OLE_EXCEL_2_STARCALC 0x0004
+#define OLE_POWERPOINT_2_STARIMPRESS 0x0008
+
+struct SvxMSDffConnectorRule
+{
+ sal_uInt32 nShapeA; ///< SPID of shape A
+ sal_uInt32 nShapeB; ///< SPID of shape B
+ sal_uInt32 nShapeC; ///< SPID of connector shape
+ sal_uInt32 ncptiA; ///< Connection site Index of shape A
+ sal_uInt32 ncptiB; ///< Connection site Index of shape B
+ ShapeFlag nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
+ ///< must be known when solving the Solver Container)
+ ShapeFlag nSpFlagsB; ///< SpFlags of shape B
+
+ SdrObject* pAObj; ///< pPtr of object (corresponding to shape A)
+ SdrObject* pBObj; ///< pPtr of object (corresponding to shape B)
+ SdrObject* pCObj; ///< pPtr of connector object
+
+ SvxMSDffConnectorRule()
+ : nShapeA(0)
+ , nShapeB(0)
+ , nShapeC(0)
+ , ncptiA(0)
+ , ncptiB(0)
+ , nSpFlagsA( ShapeFlag::NONE )
+ , nSpFlagsB( ShapeFlag::NONE )
+ , pAObj( nullptr )
+ , pBObj( nullptr )
+ , pCObj( nullptr )
+ {};
+
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
+{
+ ::std::vector< std::unique_ptr<SvxMSDffConnectorRule> > aCList;
+
+ SvxMSDffSolverContainer();
+ ~SvxMSDffSolverContainer();
+
+ SvxMSDffSolverContainer& operator=( SvxMSDffSolverContainer const & ) = delete; // MSVC2015 workaround
+ SvxMSDffSolverContainer( SvxMSDffSolverContainer const & ) = delete; // MSVC2015 workaround
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadSvxMSDffSolverContainer( SvStream& rIn, SvxMSDffSolverContainer& rAtom );
+};
+
+struct FIDCL
+{
+ sal_uInt32 dgid; ///< DG owning the SPIDs in this cluster
+};
+
+/// provided by SvxMSDffManager for each shape in a group
+struct MSDffTxId
+{
+ sal_uInt16 nTxBxS;
+ sal_uInt16 nSequence;
+ MSDffTxId()
+ : nTxBxS( 0 ), nSequence( 0 ) {}
+ MSDffTxId( const MSDffTxId& rCopy )
+ : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ) {}
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
+{
+ static const int RELTO_DEFAULT = 2;
+
+ SdrObject* pObj;
+ std::optional<tools::Polygon>
+ pWrapPolygon;
+ std::unique_ptr<char[]>
+ pClientAnchorBuffer;
+ sal_uInt32 nClientAnchorLen;
+ std::unique_ptr<char[]>
+ pClientDataBuffer;
+ sal_uInt32 nClientDataLen;
+ sal_uInt32 nXAlign;
+ std::optional<sal_uInt32> nXRelTo;
+ sal_uInt32 nYAlign;
+ std::optional<sal_uInt32> nYRelTo;
+ sal_uInt32 nGroupShapeBooleanProperties;
+ ShapeFlag nFlags;
+ sal_Int32 nDxTextLeft; ///< distance of text box from surrounding shape
+ sal_Int32 nDyTextTop;
+ sal_Int32 nDxTextRight;
+ sal_Int32 nDyTextBottom;
+ sal_Int32 nDxWrapDistLeft;
+ sal_Int32 nDyWrapDistTop;
+ sal_Int32 nDxWrapDistRight;
+ sal_Int32 nDyWrapDistBottom;
+ sal_Int32 nCropFromTop;
+ sal_Int32 nCropFromBottom;
+ sal_Int32 nCropFromLeft;
+ sal_Int32 nCropFromRight;
+ MSDffTxId aTextId; ///< identifier for text boxes
+ sal_uLong nNextShapeId; ///< for linked text boxes
+ sal_uLong nShapeId;
+ MSO_SPT eShapeType;
+ MSO_LineStyle eLineStyle; ///< border types
+ MSO_LineDashing eLineDashing;
+ bool bDrawHell :1;
+ bool bHidden :1;
+ bool bReplaceByFly :1;
+ bool bVFlip :1;
+ bool bHFlip :1;
+ bool bAutoWidth :1;
+ int relativeHorizontalWidth; ///< in 0.1% or -1 for none
+ bool isHorizontalRule;
+
+ SvxMSDffImportRec();
+ SvxMSDffImportRec(const SvxMSDffImportRec& rCopy);
+ ~SvxMSDffImportRec();
+
+ bool operator<( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId < rEntry.nShapeId; }
+
+private:
+ SvxMSDffImportRec &operator=(const SvxMSDffImportRec&) = delete;
+};
+
+/** block of parameters for import/export for a single call of
+ ImportObjAtCurrentStreamPos() */
+class MSFILTER_DLLPUBLIC SvxMSDffImportData final : public SvxMSDffClientData
+{
+private:
+ /** list of all SvxMSDffImportRec instances of/for a group */
+ typedef std::set<std::unique_ptr<SvxMSDffImportRec>,
+ comphelper::UniquePtrValueLess<SvxMSDffImportRec>> MSDffImportRecords;
+ MSDffImportRecords m_Records; ///< Shape pointer, Shape ids and private data
+ std::map<const SdrObject*, SvxMSDffImportRec*> m_ObjToRecMap;
+public:
+ tools::Rectangle aParentRect;///< Rectangle of the surrounding groups,
+ ///< which might have been provided externally
+
+ explicit SvxMSDffImportData(const tools::Rectangle& rParentRect);
+ SvxMSDffImportData& operator=( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ SvxMSDffImportData( SvxMSDffImportData const & ) = delete; // MSVC2015 workaround
+ virtual ~SvxMSDffImportData() override;
+ bool empty() const { return m_Records.empty(); }
+ void insert(std::unique_ptr<SvxMSDffImportRec> pImpRec);
+ size_t size() const { return m_Records.size(); }
+ SvxMSDffImportRec* find(const SdrObject* pObj);
+ MSDffImportRecords::const_iterator begin() const { return m_Records.begin(); }
+ MSDffImportRecords::const_iterator end() const { return m_Records.end(); }
+ virtual void NotifyFreeObj(SdrObject* pObj) override;
+};
+
+struct DffObjData
+{
+ const DffRecordHeader& rSpHd;
+
+ tools::Rectangle aBoundRect;
+ tools::Rectangle aChildAnchor;
+
+ sal_uInt32 nShapeId;
+ ShapeFlag nSpFlags;
+ MSO_SPT eShapeType;
+
+ bool bShapeType : 1;
+ bool bClientAnchor : 1;
+ bool bClientData : 1;
+ bool bChildAnchor : 1;
+ bool bOpt : 1;
+ bool bOpt2 : 1;
+ bool bRotateTextWithShape : 1;
+ bool bPageAnchor;
+ int nCalledByGroup;
+
+ DffObjData( const DffRecordHeader& rObjHd,
+ const tools::Rectangle& rBoundRect,
+ int nClByGroup ) :
+ rSpHd( rObjHd ),
+ aBoundRect( rBoundRect ),
+ nShapeId( 0 ),
+ nSpFlags( ShapeFlag::NONE ),
+ eShapeType( mso_sptNil ),
+ bShapeType( false ),
+ bClientAnchor( false ),
+ bClientData( false ),
+ bChildAnchor( false ),
+ bOpt( false ),
+ bOpt2( false ),
+ bRotateTextWithShape( true ),
+ bPageAnchor( true ),
+ nCalledByGroup( nClByGroup ){}
+
+ // Clone a DffObjData _o_ by replacing its rSpHd with a shared_ptr to another one
+ DffObjData( const std::shared_ptr<DffRecordHeader>& rObjHd, const DffObjData& o) :
+ rSpHd( *rObjHd ),
+ aBoundRect( o.aBoundRect ),
+ nShapeId( o.nShapeId ),
+ nSpFlags( o.nSpFlags ),
+ eShapeType( o.eShapeType ),
+ bShapeType( o.bShapeType ),
+ bClientAnchor( o.bClientAnchor ),
+ bClientData( o.bClientData ),
+ bChildAnchor( o.bChildAnchor ),
+ bOpt( o.bOpt ),
+ bOpt2( o.bOpt2 ),
+ bRotateTextWithShape( o.bRotateTextWithShape ),
+ bPageAnchor( o.bPageAnchor ),
+ nCalledByGroup( o.nCalledByGroup ){}
+};
+
+#define DFF_RECORD_MANAGER_BUF_SIZE 64
+
+struct DffRecordList
+{
+ sal_uInt32 nCount;
+ sal_uInt32 nCurrent;
+ DffRecordList* pPrev;
+ std::unique_ptr<DffRecordList>
+ pNext;
+
+ DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
+
+ explicit DffRecordList( DffRecordList* pList );
+ ~DffRecordList();
+};
+
+enum DffSeekToContentMode
+{
+ SEEK_FROM_BEGINNING,
+ SEEK_FROM_CURRENT,
+ SEEK_FROM_CURRENT_AND_RESTART
+};
+
+class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList
+{
+public:
+ DffRecordList* pCList;
+
+ void Clear();
+ void Consume( SvStream& rIn,
+ sal_uInt32 nStOfs = 0 );
+
+ bool SeekToContent( SvStream& rIn,
+ sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+ DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+
+ DffRecordManager();
+ explicit DffRecordManager( SvStream& rIn );
+
+ DffRecordHeader* Current();
+ DffRecordHeader* First();
+ DffRecordHeader* Next();
+ DffRecordHeader* Prev();
+ DffRecordHeader* Last();
+};
+
+/** abstract base class for Escher imports
+
+ Purpose: access to objects in Drawing File Format
+
+ Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
+ inheriting class(es) that is/are eventually used for PowerPoint, Word,
+ or Excel importing.
+
+ Status: Currently only access to BLIPs (will be extended later)
+*/
+class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
+{
+ std::unique_ptr<SvxMSDffBLIPInfos> m_pBLIPInfos;
+ std::unique_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_xShapeInfosByTxBxComp;
+ std::unique_ptr<SvxMSDffShapeInfos_ById> m_xShapeInfosById;
+ SvxMSDffShapeOrders m_aShapeOrders;
+ sal_uInt32 nOffsDgg;
+ sal_uInt16 nBLIPCount;
+ ShapeFlag nGroupShapeFlags;
+
+ void CheckTxBxStoryChain();
+ void GetFidclData(sal_uInt32 nOffsDgg);
+
+protected:
+ typedef std::map<sal_uInt32, sal_uInt64> OffsetMap;
+
+ OUString maBaseURL;
+ sal_uInt32 mnIdClusters; // while only knowing the shapeid
+ std::vector<FIDCL> maFidcls;
+ OffsetMap maDgOffsetTable; ///< array of fileoffsets
+
+ /** When importing Excel files, cell anchor computations for non-page-anchored
+ groups must be done after all nested groups have been processed; for each open
+ group, the pending data is stored here. The storage also holds a shared_ptr to
+ the DffObjData ow DffRecordHeader to avoid it going out of scope except when needed
+ */
+ std::vector< std::pair<DffObjData, std::shared_ptr<DffRecordHeader> > > maPendingGroupData;
+
+ friend class DffPropertyReader;
+
+ SvStream& rStCtrl;
+ SvStream* pStData;
+ SvStream* pStData2;
+ SdrModel* pSdrModel;
+
+ tools::Long nMapMul;
+ tools::Long nMapDiv;
+ tools::Long nMapXOfs;
+ tools::Long nMapYOfs;
+ tools::Long nEmuMul;
+ tools::Long nEmuDiv;
+ tools::Long nPntMul;
+ tools::Long nPntDiv;
+ bool bNeedMap;
+ sal_uInt32 nSvxMSDffSettings;
+ sal_uInt32 nSvxMSDffOLEConvFlags;
+
+ /** stores a reference to an imported SdrObject
+ with its shape id if it has one */
+ SvxMSDffShapeIdContainer maShapeIdContainer;
+
+ void GetCtrlData(sal_uInt32 nOffsDgg);
+ void GetDrawingGroupContainerData( SvStream& rSt,
+ sal_uInt32 nLenDgg );
+ // Add internal drawing container id as parameter to the sub methods of
+ // reading the control information about the drawing objects.
+ // The drawing container id is used to distinguish the text ids of drawing
+ // objects in different drawing containers.
+ void GetDrawingContainerData( SvStream& rSt,
+ sal_uInt32 nLenDg,
+ sal_uInt16 nDrawingContainerId );
+ bool GetShapeGroupContainerData( SvStream& rSt,
+ sal_uInt32 nLenShapeGroupCont,
+ bool bPatriarch,
+ sal_uInt16 nDrawingContainerId );
+ bool GetShapeContainerData( SvStream& rSt,
+ sal_uInt32 nLenShapeCont,
+ sal_uInt64 nPosGroup,
+ sal_uInt16 nDrawingContainerId );
+
+ SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& );
+ // #i32596# - pass <nCalledByGroup> to method
+ // Needed in Writer's Microsoft Word import to avoid import of OLE objects
+ // inside groups. Instead a graphic object is created.
+ virtual SdrObject* ImportOLE( sal_uInt32 nOLEId,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ const int _nCalledByGroup ) const;
+ static css::uno::Reference < css::embed::XEmbeddedObject > CheckForConvertToSOObj(
+ sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
+ const css::uno::Reference < css::embed::XStorage >& xDestStg,
+ const Graphic& rGrf,
+ const tools::Rectangle& rVisArea,
+ OUString const& rBaseURL);
+
+// the following methods need to be overridden for Excel imports
+ static void ProcessClientAnchor( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ std::unique_ptr<char[]>& rpBuff,
+ sal_uInt32& rBuffLen );
+ virtual void ProcessClientAnchor2( SvStream& rStData,
+ DffRecordHeader& rHd,
+ DffObjData& );
+ static void ProcessClientData( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ std::unique_ptr<char[]>& rpBuff,
+ sal_uInt32& rBuffLen );
+ virtual SdrObject* ProcessObj( SvStream& rSt,
+ DffObjData& rData,
+ SvxMSDffClientData& rClientData,
+ tools::Rectangle& rTextRect,
+ SdrObject* pObj);
+ void NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj);
+ void FreeObj(SvxMSDffClientData& rData, SdrObject* pObj);
+
+
+ /** Object finalization, used by the Excel filter to correctly
+ compute the object anchoring after nested objects have been imported.
+ */
+ virtual SdrObject* FinalizeObj(DffObjData& rData,
+ SdrObject* pObj);
+
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+
+ // Fontwork objects use a new implementation of ReadObjText because the old
+ // one does not properly import multiple paragraphs.
+ static void ReadObjText( const OUString& rText, SdrObject* pObj );
+
+// the following method needs to be overridden for the import of OLE objects
+ virtual bool GetOLEStorageName( sal_uInt32 nOLEId,
+ OUString& rStorageName,
+ tools::SvRef<SotStorage>& rSrcStorage,
+ css::uno::Reference < css::embed::XStorage >& xDestStg
+ ) const;
+
+ /** Prevent that (rounded) rectangles with wrapped text will always be
+ converted into SdrRectObj( SdrObjKind::Text ).
+
+ @return true means "conversion".
+ */
+ virtual bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
+
+public:
+ std::unique_ptr<DffPropertyReader> pSecPropSet;
+ std::unordered_map<sal_uInt32, Graphic> aEscherBlipCache;
+
+ DffRecordManager maShapeRecords;
+ Color mnDefaultColor;
+
+ bool mbSkipImages;
+
+ Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
+ Color MSO_CLR_ToColor( sal_uInt32 nColorCode,
+ sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
+ virtual bool SeekToShape( SvStream& rSt,
+ SvxMSDffClientData* pClientData,
+ sal_uInt32 nId ) const;
+ static bool SeekToRec( SvStream& rSt,
+ sal_uInt16 nRecId,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = nullptr,
+ sal_uLong nSkipCount = 0 );
+ bool SeekToRec2( sal_uInt16 nRecId1,
+ sal_uInt16 nRecId2,
+ sal_uLong nMaxFilePos ) const;
+
+ static OUString MSDFFReadZString( SvStream& rIn,
+ sal_uInt32 nMaxLen,
+ bool bUniCode);
+
+ [[nodiscard]] static bool ReadCommonRecordHeader( SvStream& rSt,
+ sal_uInt8& rVer,
+ sal_uInt16& rInst,
+ sal_uInt16& rFbt,
+ sal_uInt32& rLength);
+
+// TODO: provide proper documentation here
+ /** constructor
+
+ sets nBLIPCount
+
+ @param rStCtrl Management stream with containers, FBSE
+ objects and shapes (mandatory; stream needs
+ to be open already)
+ @param rBaseURL ???
+ @param nOffsDgg offset in rStrCtrl; beginning of the drawing
+ group container
+ @param pStData data stream in that the BLIPs are stored (if
+ NULL it is assumed that all BLIPs are also in
+ the rStCtrl; stream needs to be open already)
+ @param pSdrModel_ ??? (can be empty during Ctor call but needs
+ to be set via SetModel() later in that case!)
+ @param nApplicationScale ???
+ @param mnDefaultColor_ ???
+ @param nDefaultFontHeight_ ???
+ @param pStData2_ ???
+ @param bSkipImages skipping images for text extraction/indexing
+ */
+ SvxMSDffManager( SvStream& rStCtrl,
+ OUString aBaseURL,
+ sal_uInt32 nOffsDgg,
+ SvStream* pStData,
+ SdrModel* pSdrModel_,
+ tools::Long nApplicationScale,
+ Color mnDefaultColor_,
+ SvStream* pStData2_ = nullptr,
+ bool bSkipImages = false );
+
+ // in PPT the parameters DGGContainerOffset and PicStream are provided by an
+ // init method
+ SvxMSDffManager( SvStream& rStCtrl, OUString aBaseURL );
+ void InitSvxMSDffManager( sal_uInt32 nOffsDgg_,
+ SvStream* pStData_,
+ sal_uInt32 nSvxMSDffOLEConvFlags);
+ void SetDgContainer( SvStream& rSt );
+
+ virtual ~SvxMSDffManager();
+
+ sal_uInt32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; };
+ void SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; };
+
+ static bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
+ static void ReadObjText( SvStream& rStream, SdrObject* pObj );
+ static bool ConvertToOle2( SvStream& rStm,
+ sal_uInt32 nLen,
+ const GDIMetaFile*,
+ const tools::SvRef<SotStorage> & rDest );
+
+ void SetModel(SdrModel* pModel, tools::Long nApplicationScale);
+ SdrModel* GetModel() const { return pSdrModel; }
+ void Scale(sal_Int32& rVal) const;
+ void Scale(Point& rPos) const;
+ void Scale(Size& rSiz) const;
+ void ScaleEmu(sal_Int32& rVal) const;
+ sal_uInt32 ScalePt( sal_uInt32 nPt ) const;
+ sal_Int32 ScalePoint( sal_Int32 nVal ) const;
+
+// TODO: provide proper documentation here
+ /** Request for a specific BLIP.
+
+ @param[in] nIdx number of the requested BLIP (mandatory)
+ @param[out] rData already converted data (insert directly as graphics
+ into our documents)
+ @param pVisArea ???
+
+ @return true if successful, false otherwise
+ */
+ bool GetBLIP( sal_uLong nIdx, Graphic& rData, tools::Rectangle* pVisArea = nullptr );
+
+// TODO: provide proper documentation here
+ /** read a BLIP out of an already positioned stream
+
+ @param[in] rBLIPStream already positioned stream (mandatory)
+ @param[out] rData already converted data (insert directly as
+ graphics into our documents)
+ @param pVisArea ???
+
+ @return true if successful, false otherwise
+ */
+ static bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, tools::Rectangle* pVisArea = nullptr );
+
+ bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData);
+
+ SdrObject* ImportObj( SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId);
+ SdrObject* ImportGroup( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId );
+ SdrObject* ImportShape( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ SvxMSDffClientData& rData,
+ tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect,
+ int nCalledByGroup,
+ sal_Int32* pShapeId);
+
+ tools::Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ tools::Rectangle& aClientRect );
+ void GetGroupAnchors( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ tools::Rectangle& rGroupClientAnchor,
+ tools::Rectangle& rGroupChildAnchor,
+ const tools::Rectangle& rClientRect,
+ const tools::Rectangle& rGlobalChildRect );
+
+ const SvxMSDffShapeInfos_ById* GetShapeInfos() const
+ { return m_xShapeInfosById.get(); }
+
+ const SvxMSDffShapeOrders* GetShapeOrders() const
+ { return &m_aShapeOrders; }
+
+ void StoreShapeOrder(sal_uLong nId,
+ sal_uLong nTxBx,
+ SdrObject* pObject,
+ SwFlyFrameFormat* pFly = nullptr) const;
+
+ void ExchangeInShapeOrder(SdrObject const * pOldObject,
+ sal_uLong nTxBx,
+ SdrObject* pObject) const;
+
+ void RemoveFromShapeOrder( SdrObject const * pObject ) const;
+
+ static SdrOle2Obj* CreateSdrOLEFromStorage(
+ SdrModel& rSdrModel,
+ const OUString& rStorageName,
+ tools::SvRef<SotStorage> const & rSrcStorage,
+ const css::uno::Reference < css::embed::XStorage >& xDestStg,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ SvStream* pDataStrrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nAspect,
+ OUString const& rBaseURL);
+
+ /** Create connections between shapes.
+ This method should be called after a page is imported.
+
+ @param rSolver contains necessary data that is collected during the
+ import of each shape
+ */
+ static void SolveSolver( const SvxMSDffSolverContainer& rSolver );
+
+ static bool SetPropValue(
+ const css::uno::Any& rAny,
+ const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
+ const OUString& rPropertyName
+ );
+
+ /// Determines an ODF filter name (if there is one) for aGlobName.
+ static OUString GetFilterNameFromClassID(const SvGlobalName& aGlobName);
+ /// Extracts ODF data from rSrcStg.
+ static void ExtractOwnStream(SotStorage& rSrcStg, SvMemoryStream& rMemStream);
+
+ void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape );
+ void removeShapeId( SdrObject const * pShape );
+ SdrObject* getShapeForId( sal_Int32 nShapeId );
+};
+
+struct SvxMSDffShapeInfo
+{
+ sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uInt64 nFilePos; ///< offset of the shape in control stream for
+ ///< potential later access to it
+ sal_uInt32 nTxBxComp;
+
+ bool bReplaceByFly :1; ///< shape can be replaced by a frame in Writer
+
+ explicit SvxMSDffShapeInfo(sal_uInt64 nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
+ sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0):
+ nShapeId( nId ),
+ nFilePos( nFPos ),
+ nTxBxComp( (nSeqId << 16) + nBoxId )
+ {
+ bReplaceByFly = false;
+ }
+ SvxMSDffShapeInfo(const SvxMSDffShapeInfo& rInfo):
+ nShapeId( rInfo.nShapeId ),
+ nFilePos( rInfo.nFilePos ),
+ nTxBxComp( rInfo.nTxBxComp ),
+ bReplaceByFly( rInfo.bReplaceByFly )
+ {
+ }
+};
+
+
+struct SvxMSDffShapeOrder
+{
+ sal_uLong nShapeId; ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nTxBxComp; ///< chain or box number in the Text-Box-Story (or NULL)
+ SwFlyFrameFormat* pFly; ///< format of frame that was inserted as a replacement
+ ///< for a Sdr-Text object in Writer - needed for
+ ///< chaining!
+ SdrObject* pObj; ///< pointer to the draw object (or NULL if not used)
+
+ // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
+ // the shape order array. The Text-Box number and the object
+ // pointer are only stored if the shape is really imported.
+ explicit SvxMSDffShapeOrder( sal_uLong nId ):
+ nShapeId( nId ), nTxBxComp( 0 ), pFly( nullptr ), pObj( nullptr ){}
+
+ bool operator<( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp < rEntry.nTxBxComp); }
+};
+
+// the following will be sorted explicitly:
+struct CompareSvxMSDffShapeTxBxSort
+{
+ bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
+};
+class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msfilterdllapi.h b/include/filter/msfilter/msfilterdllapi.h
new file mode 100644
index 000000000..10532d165
--- /dev/null
+++ b/include/filter/msfilter/msfilterdllapi.h
@@ -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/.
+ *
+ * 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_MSFILTER_MSFILTERDLLAPI_H
+#define INCLUDED_FILTER_MSFILTER_MSFILTERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined MSFILTER_DLLIMPLEMENTATION
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define MSFILTER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msocximex.hxx b/include/filter/msfilter/msocximex.hxx
new file mode 100644
index 000000000..18bf41569
--- /dev/null
+++ b/include/filter/msfilter/msocximex.hxx
@@ -0,0 +1,84 @@
+/* -*- 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_MSFILTER_MSOCXIMEX_HXX
+#define INCLUDED_FILTER_MSFILTER_MSOCXIMEX_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+
+namespace com::sun::star {
+ namespace drawing{
+ class XDrawPage;
+ class XShape;
+ class XShapes;
+ }
+ namespace form{
+ class XFormComponent;
+ }
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace container{
+ class XIndexContainer;
+ }
+ namespace awt{
+ struct Size;
+ }
+ namespace frame{
+ class XModel;
+ }
+}
+
+class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls
+{
+public:
+ SvxMSConvertOCXControls( css::uno::Reference< css::frame::XModel > xModel );
+ virtual ~SvxMSConvertOCXControls();
+
+ virtual bool InsertControl(
+ const css::uno::Reference<
+ css::form::XFormComponent >& /*rFComp*/,
+ const css::awt::Size& /*rSize*/,
+ css::uno::Reference<
+ css::drawing::XShape >* /*pShape*/,
+ bool /*bFloatingCtrl*/ ) {return false;}
+
+ /*begin: Backwards compatibility with office 95 import, modify later*/
+ const css::uno::Reference< css::lang::XMultiServiceFactory > & GetServiceFactory();
+protected:
+ const css::uno::Reference< css::drawing::XShapes > & GetShapes();
+
+ const css::uno::Reference< css::container::XIndexContainer > & GetFormComps();
+
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+ // cached interfaces
+ css::uno::Reference< css::drawing::XDrawPage > xDrawPage;
+ css::uno::Reference< css::drawing::XShapes > xShapes;
+ css::uno::Reference< css::lang::XMultiServiceFactory > xServiceFactory;
+
+ // the only form
+ css::uno::Reference< css::container::XIndexContainer > xFormComps;
+
+ virtual void GetDrawPage();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msoleexp.hxx b/include/filter/msfilter/msoleexp.hxx
new file mode 100644
index 000000000..77b2cc3b4
--- /dev/null
+++ b/include/filter/msfilter/msoleexp.hxx
@@ -0,0 +1,56 @@
+/* -*- 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_MSFILTER_MSOLEEXP_HXX
+#define INCLUDED_FILTER_MSFILTER_MSOLEEXP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace embed { class XEmbeddedObject; }
+}
+
+namespace svt {
+ class EmbeddedObjectRef;
+}
+
+class SotStorage;
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this is stored in
+#define OLE_STARMATH_2_MATHTYPE 0x0001
+#define OLE_STARWRITER_2_WINWORD 0x0002
+#define OLE_STARCALC_2_EXCEL 0x0004
+#define OLE_STARIMPRESS_2_POWERPOINT 0x0008
+
+class MSFILTER_DLLPUBLIC SvxMSExportOLEObjects
+{
+ sal_uInt32 nConvertFlags;
+public:
+ SvxMSExportOLEObjects( sal_uInt32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {}
+
+ void ExportOLEObject( svt::EmbeddedObjectRef const & rObj, SotStorage& rDestStg );
+ void ExportOLEObject( const css::uno::Reference < css::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mstoolbar.hxx b/include/filter/msfilter/mstoolbar.hxx
new file mode 100644
index 000000000..46966d648
--- /dev/null
+++ b/include/filter/msfilter/mstoolbar.hxx
@@ -0,0 +1,355 @@
+/* -*- 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/.
+ */
+#ifndef INCLUDED_FILTER_MSFILTER_MSTOOLBAR_HXX
+#define INCLUDED_FILTER_MSFILTER_MSTOOLBAR_HXX
+
+#include <memory>
+#include <string_view>
+#include <vector>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/stream.hxx>
+#include <vcl/bitmapex.hxx>
+
+namespace com::sun::star {
+ namespace beans { struct PropertyValue; }
+ namespace container { class XIndexAccess; }
+ namespace graphic { class XGraphic; }
+ namespace ui { class XUIConfigurationManager; }
+ namespace ui { class XUIConfigurationManagerSupplier; }
+}
+
+class TBCHeader;
+
+class MSOCommandConvertor
+{
+public:
+ virtual ~MSOCommandConvertor() {}
+ virtual OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
+ virtual OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
+};
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
+{
+ struct iconcontrolitem
+ {
+ OUString sCommand;
+ css::uno::Reference< css::graphic::XGraphic > image;
+ };
+ std::vector< iconcontrolitem > iconcommands;
+ std::unique_ptr< MSOCommandConvertor > pMSOCmdConvertor;
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
+ SfxObjectShell& mrDocSh;
+ static void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, tools::Long nNewSize );
+public:
+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
+
+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
+ const css::uno::Reference< css::ui::XUIConfigurationManager >& getAppCfgManager() const { return m_xAppCfgMgr;}
+
+
+ static css::uno::Any createCommandFromMacro( std::u16string_view sCmd );
+
+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const OUString& sString );
+ void applyIcons();
+ OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
+ OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
+ SfxObjectShell& GetDocShell() { return mrDocSh; }
+ bool createMenu( const OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc );
+};
+
+class MSFILTER_DLLPUBLIC TBBase
+{
+friend class Indent;
+ static int nIndent; // num spaces to indent before printing
+protected:
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ static void indent_printf(FILE* fp, const char* format, ... );
+#endif
+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
+public:
+ TBBase() : nOffSet( 0 ) {}
+ virtual ~TBBase(){}
+
+ TBBase(TBBase const &) = default;
+ TBBase(TBBase &&) = default;
+ TBBase & operator =(TBBase const &) = default;
+ TBBase & operator =(TBBase &&) = default;
+
+ virtual bool Read(SvStream &rS) = 0;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
+#endif
+ sal_uInt32 GetOffset() const { return nOffSet; }
+};
+
+class Indent
+{
+public:
+ Indent( bool binit )
+ {
+ if ( binit )
+ TBBase::nIndent = 0;
+ else
+ TBBase::nIndent = TBBase::nIndent + 2;
+ }
+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
+};
+
+
+class MSFILTER_DLLPUBLIC WString final : public TBBase
+{
+ OUString sString;
+
+public:
+ WString(){};
+ bool Read(SvStream &rS) override;
+ const OUString& getString() const { return sString; }
+};
+
+class MSFILTER_DLLPUBLIC TBCExtraInfo final : public TBBase
+{
+ WString wstrHelpFile;
+ sal_Int32 idHelpContext;
+ WString wstrTag;
+ WString wstrOnAction;
+ WString wstrParam;
+ sal_Int8 tbcu;
+ sal_Int8 tbmg;
+
+ TBCExtraInfo(const TBCExtraInfo&) = delete;
+ TBCExtraInfo& operator = ( const TBCExtraInfo&) = delete;
+public:
+ TBCExtraInfo();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ OUString const & getOnAction() const;
+};
+
+class MSFILTER_DLLPUBLIC TBCGeneralInfo final : public TBBase
+{
+ sal_uInt8 bFlags;
+ WString customText;
+ WString descriptionText;
+ WString tooltip;
+ TBCExtraInfo extraInfo;
+
+public:
+ TBCGeneralInfo();
+ bool Read(SvStream &rS) override;
+ void ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
+ OUString const & CustomText() { return customText.getString(); }
+};
+
+class TBCBitMap final : public TBBase
+{
+friend class TBCBSpecific; // #FIXME hacky access, need to fix
+ sal_Int32 cbDIB;
+ BitmapEx mBitMap;
+public:
+ TBCBitMap();
+ virtual ~TBCBitMap() override;
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ // #FIXME Const-ness
+ BitmapEx& getBitMap() { return mBitMap;}
+};
+
+class MSFILTER_DLLPUBLIC TBCMenuSpecific final : public TBBase
+{
+ sal_Int32 tbid;
+ std::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
+public:
+ TBCMenuSpecific();
+ bool Read(SvStream &rS) override;
+ OUString Name();
+};
+
+class TBCCDData final : public TBBase
+{
+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
+
+public:
+ TBCCDData();
+ virtual ~TBCCDData() override;
+ bool Read(SvStream &rS) override;
+};
+
+class TBCComboDropdownSpecific final : public TBBase
+{
+ std::shared_ptr< TBCCDData > data;
+public:
+ TBCComboDropdownSpecific( const TBCHeader& header );
+ bool Read(SvStream &rS) override;
+};
+
+class TBCBSpecific final : public TBBase
+{
+ sal_uInt8 bFlags;
+ std::shared_ptr< TBCBitMap > icon; // optional
+ std::shared_ptr< TBCBitMap > iconMask; // optional
+ std::shared_ptr< sal_uInt16 > iBtnFace; // optional
+ std::shared_ptr< WString > wstrAcc; // optional
+
+public:
+ TBCBSpecific();
+ bool Read(SvStream &rS) override;
+ // #TODO just add a getGraphic member here
+ TBCBitMap* getIcon();
+ TBCBitMap* getIconMask();
+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
+};
+
+/* TBCHeader.tct controlSpecificInfo type
+
+0x01 (Button control) TBCBSpecific
+0x10 (ExpandingGrid control) TBCBSpecific
+0x0A (Popup control) TBCMenuSpecific
+0x0C (ButtonPopup control) TBCMenuSpecific
+0x0D (SplitButtonPopup control) TBCMenuSpecific
+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
+0x02 (Edit control) TBCComboDropdow nSpecific
+0x04 (ComboBox control) TBCComboDropdow nSpecific
+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
+0x03 (DropDown control) TBCComboDropdow nSpecific
+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
+0x0F (Label control) controlSpecificInfo MUST NOT exist
+0x12 (Grid control) controlSpecificInfo MUST NOT exist
+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
+
+*/
+class MSFILTER_DLLPUBLIC TBCHeader final : public TBBase
+{
+ sal_Int8 bSignature;
+ sal_Int8 bVersion;
+ sal_uInt8 bFlagsTCR;
+ sal_uInt8 tct;
+ sal_uInt16 tcid;
+ sal_uInt32 tbct;
+ sal_uInt8 bPriority;
+ std::shared_ptr< sal_uInt16 > width; //optional
+ std::shared_ptr< sal_uInt16 > height; //optional
+
+public:
+ TBCHeader();
+ virtual ~TBCHeader() override;
+
+ TBCHeader(TBCHeader const &) = default;
+ TBCHeader(TBCHeader &&) = default;
+ TBCHeader & operator =(TBCHeader const &) = default;
+ TBCHeader & operator =(TBCHeader &&) = default;
+
+ sal_uInt8 getTct() const { return tct; }
+ sal_uInt16 getTcID() const { return tcid; }
+ bool isVisible() const { return !( bFlagsTCR & 0x1 ); }
+ bool isBeginGroup() const { return ( bFlagsTCR & 0x2 ) != 0; }
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ sal_uInt32 getTbct() const { return tbct; };
+};
+
+class MSFILTER_DLLPUBLIC TBCData final : public TBBase
+{
+ TBCHeader rHeader;
+ TBCGeneralInfo controlGeneralInfo;
+ std::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
+ TBCData(const TBCData&) = delete;
+ TBCData& operator = ( const TBCData&) = delete;
+public:
+ TBCData( TBCHeader Header );
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ void ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
+ TBCMenuSpecific* getMenuSpecific();
+};
+
+class MSFILTER_DLLPUBLIC TB final : public TBBase
+{
+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
+ WString name; //Structure of type WString that specifies the toolbar name
+public:
+ TB();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+ sal_Int16 getcCL() const { return cCL; }
+ WString& getName(){ return name; }
+ bool IsEnabled() const;
+ bool IsMenuToolbar() const { return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
+};
+
+class MSFILTER_DLLPUBLIC SRECT final : public TBBase
+{
+public:
+ SRECT() : left(0), top(0), right(0), bottom(0) {}
+ sal_Int16 left;
+ sal_Int16 top;
+ sal_Int16 right;
+ sal_Int16 bottom;
+ bool Read( SvStream &rS ) override { rS.ReadInt16( left ).ReadInt16( top ).ReadInt16( right ).ReadInt16( bottom ); return true; }
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* fo ) override;
+#endif
+};
+
+
+class MSFILTER_DLLPUBLIC TBVisualData final : public TBBase
+{
+ sal_Int8 tbds;
+ sal_Int8 tbv;
+ sal_Int8 tbdsDock;
+ sal_Int8 iRow;
+
+ SRECT rcDock;
+ SRECT rcFloat;
+
+public:
+ TBVisualData();
+ bool Read(SvStream &rS) override;
+#ifdef DEBUG_FILTER_MSTOOLBAR
+ virtual void Print( FILE* ) override;
+#endif
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx
new file mode 100644
index 000000000..d5cb1e96f
--- /dev/null
+++ b/include/filter/msfilter/msvbahelper.hxx
@@ -0,0 +1,116 @@
+/* -*- 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_MSFILTER_MSVBAHELPER_HXX
+#define INCLUDED_FILTER_MSFILTER_MSVBAHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+namespace com::sun::star {
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+ namespace uno { class XInterface; }
+}
+
+class SfxObjectShell;
+
+namespace ooo::vba {
+
+
+struct MSFILTER_DLLPUBLIC MacroResolvedInfo
+{
+ SfxObjectShell* mpDocContext;
+ OUString msResolvedMacro;
+ bool mbFound;
+
+ explicit MacroResolvedInfo( SfxObjectShell* pDocContext = nullptr ) : mpDocContext( pDocContext ), mbFound( false ) {}
+};
+
+MSFILTER_DLLPUBLIC OUString makeMacroURL( std::u16string_view sMacroName );
+MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl );
+MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell const * pShell );
+MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName );
+MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
+MSFILTER_DLLPUBLIC bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet, const css::uno::Any& aCaller );
+/// @throws css::uno::RuntimeException
+MSFILTER_DLLPUBLIC css::awt::KeyEvent parseKeyEvent( const OUString& sKey );
+/// @throws css::uno::RuntimeException
+MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const css::uno::Reference< css::frame::XModel >& rxDoc, const css::awt::KeyEvent& rKeyEvent, const OUString& sMacro );
+
+
+typedef ::cppu::WeakImplHelper<
+ css::lang::XServiceInfo,
+ css::lang::XInitialization,
+ css::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
+
+class VBAMacroResolver final : public VBAMacroResolverBase
+{
+public:
+ explicit VBAMacroResolver();
+ virtual ~VBAMacroResolver() override;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName() override;
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rService ) override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() override;
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ virtual void SAL_CALL initialize(
+ const css::uno::Sequence< css::uno::Any >& rArgs ) override;
+
+ // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
+
+ virtual OUString SAL_CALL
+ resolveVBAMacroToScriptURL( const OUString& rVBAMacroName ) override;
+
+ virtual OUString SAL_CALL
+ resolveScriptURLtoVBAMacro( const OUString& rScriptURL ) override;
+
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpObjShell;
+ OUString maProjectName;
+};
+
+
+} // namespace ooo::vba
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/rtfutil.hxx b/include/filter/msfilter/rtfutil.hxx
new file mode 100644
index 000000000..fd7473149
--- /dev/null
+++ b/include/filter/msfilter/rtfutil.hxx
@@ -0,0 +1,78 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
+#define INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/textenc.h>
+#include <sal/types.h>
+#include <tools/solar.h>
+
+// RTF values are often multiplied by 2^16
+#define RTF_MULTIPLIER 65536
+
+class SvStream;
+
+namespace msfilter::rtfutil
+{
+/// Outputs a single character in hex form.
+MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen);
+
+/// Handles correct unicode and legacy export of a single character.
+MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc,
+ bool* pSuccess, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string.
+ *
+ * @param rStr the string to export
+ * @param eDestEnc the legacy encoding to use
+ * @param bUnicode if unicode output is wanted as well, or just legacy
+ */
+MSFILTER_DLLPUBLIC OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc,
+ bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string, when a
+ * '{' \upr '{' keyword ansi_text '}{\*' \ud '{' keyword Unicode_text '}}}'
+ * construct should be used.
+ *
+ * @param pToken the keyword
+ * @param rStr the text to export
+ * @param eDestEnc the legacy encoding to use
+ */
+MSFILTER_DLLPUBLIC OString OutStringUpr(const char* pToken, const OUString& rStr,
+ rtl_TextEncoding eDestEnc);
+
+/**
+ * Get the numeric value of a single character, representing a hex value.
+ *
+ * @return -1 on failure
+ */
+MSFILTER_DLLPUBLIC int AsHex(char ch);
+
+/// Writes binary data as a hex dump.
+MSFILTER_DLLPUBLIC OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize,
+ SvStream* pStream = nullptr, sal_uInt32 nLimit = 64);
+
+/**
+ * Extract OLE2 data from an \objdata hex dump.
+ */
+MSFILTER_DLLPUBLIC bool ExtractOLE2FromObjdata(const OString& rObjdata, SvStream& rOle2);
+
+/// Strips the header of a WMF file.
+MSFILTER_DLLPUBLIC bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, sal_uInt64& rSize);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
new file mode 100644
index 000000000..6fa9ffaf4
--- /dev/null
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -0,0 +1,1488 @@
+/* -*- 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_MSFILTER_SVDFPPT_HXX
+#define INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
+
+#include <algorithm>
+#include <cstddef>
+#include <memory>
+#include <vector>
+
+#include <optional>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <filter/msfilter/msocximex.hxx>
+#include <o3tl/enumarray.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+#include <tools/color.hxx>
+#include <tools/fontenum.hxx>
+#include <tools/gen.hxx>
+#include <tools/ref.hxx>
+#include <tools/solar.h>
+#include <vcl/graph.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace drawing { class XShape; }
+ namespace form { class XFormComponent; }
+ namespace frame { class XModel; }
+}
+
+class SdrPage;
+class SdrObject;
+class SvStream;
+class SfxItemSet;
+class SdrOutliner;
+class SfxStyleSheet;
+class SotStorage;
+class SvMemoryStream;
+class SvxNumberFormat;
+class PPTTextObj;
+enum class PptSlideLayout;
+enum class PptPlaceholder : sal_uInt8;
+
+#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
+
+struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
+{
+ sal_uInt32 nMagic;
+ sal_uInt32 nCurrentUserEdit;
+ sal_uInt16 nDocFileVersion;
+ sal_uInt8 nMajorVersion;
+ sal_uInt8 nMinorVersion;
+ OUString aCurrentUser;
+
+public:
+
+ PptCurrentUserAtom() : nMagic ( 0 ),
+ nCurrentUserEdit ( 0 ),
+ nDocFileVersion ( 0 ),
+ nMajorVersion ( 0 ),
+ nMinorVersion ( 0 ) {}
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadPptCurrentUserAtom( SvStream& rIn, PptCurrentUserAtom& rAtom );
+};
+
+struct MSFILTER_DLLPUBLIC PowerPointImportParam
+{
+ SvStream& rDocStream;
+ sal_uInt32 nImportFlags;
+ PptCurrentUserAtom aCurrentUserAtom;
+
+ PowerPointImportParam( SvStream& rDocStream );
+};
+
+struct SdHyperlinkEntry
+{
+ sal_uInt32 nIndex;
+ sal_Int32 nPrivate1;
+ sal_Int32 nPrivate2;
+ sal_Int32 nPrivate3;
+ sal_Int32 nInfo;
+ OUString aTarget;
+ OUString aSubAddress;
+
+ OUString aConvSubString;
+};
+
+// Helper class for reading the PPT InteractiveInfoAtom
+struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
+{
+ sal_uInt32 nSoundRef;
+ sal_uInt32 nExHyperlinkId;
+ sal_uInt8 nAction;
+ sal_uInt8 nOleVerb;
+ sal_uInt8 nJump;
+ sal_uInt8 nFlags;
+ sal_uInt8 nHyperlinkType;
+
+ // unknown, because total size is 16
+ sal_uInt8 nUnknown1;
+ sal_uInt8 nUnknown2;
+ sal_uInt8 nUnknown3;
+
+public:
+
+ MSFILTER_DLLPUBLIC friend SvStream& ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
+};
+
+enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
+
+enum PptPageFormat
+{ PPTPF_SCREEN,
+ PPTPF_USLETTER, // 8.5x11"
+ PPTPF_A4, // 210x297mm
+ PPTPF_35MMDIA, // DIA
+ PPTPF_OVERHEAD,
+ PPTPF_CUSTOM
+};
+
+// values for PPT_PST_TextHeaderAtom's sal_uLong
+enum PPT_TextHeader
+{
+ PPTTH_TITLE,
+ PPTTH_BODY,
+ PPTTH_NOTES,
+ PPTTH_NOTUSED,
+ PPTTH_OTHER, // Text in a Shape
+ PPTTH_CENTERBODY, // Subtitle in Title-Slide
+ PPTTH_CENTERTITLE, // Title in Title-Slide
+ PPTTH_HALFBODY, // Body in two-column slide
+ PPTTH_QUARTERBODY // Body in four-body slide
+};
+
+enum class TSS_Type : unsigned {
+ PageTitle = 0,
+ Body = 1,
+ Notes = 2,
+ Unused = 3,
+ TextInShape = 4,
+ Subtitle = 5,
+ Title = 6,
+ HalfBody = 7,
+ QuarterBody = 8,
+ LAST = QuarterBody,
+ Unknown = 0xffffffff // or invalid
+};
+
+const int nMaxPPTLevels = 10;
+
+// Object IDs for StarDraw UserData
+#define PPT_OBJECTINFO_ID (1)
+
+struct MSFILTER_DLLPUBLIC PptDocumentAtom
+{
+ Size aSlidesPageSize; // page size of the slides in 576DPI
+ Size aNotesPageSize; // page size of the notes in 576DPI
+ // avoid RatioAtom for the time being
+ sal_uInt32 nNotesMasterPersist; // 0=non-existent
+ sal_uInt32 nHandoutMasterPersist; // 0=non-existent
+ sal_uInt16 n1stPageNumber; // page number of the first slide
+ PptPageFormat eSlidesPageFormat; // page format of the slides
+ bool bEmbeddedTrueType : 1; // TrueType directly within the File?
+ bool bTitlePlaceholdersOmitted : 1;
+ bool bRightToLeft : 1;
+ bool bShowComments : 1;
+
+public:
+
+ PptDocumentAtom()
+ : nNotesMasterPersist(0)
+ , nHandoutMasterPersist(0)
+ , n1stPageNumber(0)
+ , eSlidesPageFormat(PPTPF_SCREEN)
+ , bEmbeddedTrueType(false)
+ , bTitlePlaceholdersOmitted(false)
+ , bRightToLeft(false)
+ , bShowComments(false)
+ {
+ }
+
+ Size const & GetSlidesPageSize() const { return aSlidesPageSize; }
+ Size const & GetNotesPageSize() const { return aNotesPageSize; }
+
+ friend SvStream& ReadPptDocumentAtom( SvStream& rIn, PptDocumentAtom& rAtom );
+};
+
+struct PptSlideLayoutAtom
+{
+ PptSlideLayout eLayout; // 0..18
+ PptPlaceholder aPlaceholderId[ 8 ];
+
+public:
+ PptSlideLayoutAtom() { Clear(); }
+ void Clear();
+
+ // SlideLayoutAtom is read without header!
+ friend SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom );
+};
+
+struct PptSlideAtom
+{
+ PptSlideLayoutAtom aLayout;
+ sal_uInt32 nMasterId;
+ sal_uInt32 nNotesId;
+ sal_uInt16 nFlags;
+
+public:
+ PptSlideAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptSlideAtom(SvStream& rIn, PptSlideAtom& rAtom);
+};
+
+struct PptSlidePersistAtom
+{
+ sal_uInt32 nPsrReference;
+ sal_uInt32 nFlags;
+ sal_uInt32 nNumberTexts;
+ sal_uInt32 nSlideId;
+ sal_uInt32 nReserved; // we will use nReserved temporarily to set the offset to SSSlideInfoAtom ( if possible )
+
+public:
+ PptSlidePersistAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptSlidePersistAtom(SvStream& rIn, PptSlidePersistAtom& rAtom);
+};
+
+struct PptNotesAtom
+{
+ sal_uInt32 nSlideId;
+ sal_uInt16 nFlags;
+
+public:
+ PptNotesAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptNotesAtom(SvStream& rIn, PptNotesAtom& rAtom);
+};
+
+struct PptColorSchemeAtom
+{
+ sal_uInt8 aData[32] = {};
+
+public:
+ PptColorSchemeAtom();
+ Color GetColor( sal_uInt16 nNum ) const;
+
+ friend SvStream& ReadPptColorSchemeAtom(SvStream& rIn, PptColorSchemeAtom& rAtom);
+};
+
+struct PptFontEntityAtom
+{
+ OUString aName;
+ sal_uInt8 lfClipPrecision;
+ sal_uInt8 lfQuality;
+
+ rtl_TextEncoding eCharSet;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ bool bAvailable;
+
+ friend SvStream& ReadPptFontEntityAtom(SvStream& rIn, PptFontEntityAtom& rAtom);
+};
+
+enum class PptViewTypeEnum : sal_uInt16
+{
+ NONE = 0,
+ Slide = 1,
+ SlideMaster = 2,
+ Notes = 3,
+ Handout = 4,
+ NotesMaster = 5,
+ OutlineMaster = 6,
+ Outline = 7,
+ SlideSorter = 8,
+ VisualBasic = 9,
+ TitleMaster = 10,
+ SlideShow = 11,
+ SlideShowFullScreen = 12,
+ NotesText = 13,
+ PrintPreview = 14,
+ Thumbnails = 15,
+ MasterThumbnails = 16,
+ PodiumSlideView = 17,
+ PodiumNotesView = 18,
+};
+
+struct PptUserEditAtom
+{
+ DffRecordHeader aHd;
+ sal_Int32 nLastSlideID; // ID of last visible slide
+ sal_uInt32 nVersion; // This is major/minor/build which did the edit
+ sal_uInt32 nOffsetLastEdit; // File offset of prev PptUserEditAtom
+ sal_uInt32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
+ sal_uInt32 nDocumentRef;
+ sal_uInt32 nMaxPersistWritten; // total number of Persist entries up to this point
+ PptViewTypeEnum eLastViewType; // enum view type
+
+public:
+ PptUserEditAtom()
+ : nLastSlideID( 0 )
+ , nVersion( 0 )
+ , nOffsetLastEdit( 0 )
+ , nOffsetPersistDirectory( 0 )
+ , nDocumentRef( 0 )
+ , nMaxPersistWritten( 0 )
+ , eLastViewType( PptViewTypeEnum::NONE )
+ {}
+
+ friend SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom );
+};
+
+struct PptOEPlaceholderAtom
+{
+ sal_uInt32 nPlacementId;
+ PptPlaceholder nPlaceholderId;
+ sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
+
+public:
+ PptOEPlaceholderAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
+};
+
+struct PPTStyleSheet;
+struct HeaderFooterEntry;
+struct PptSlidePersistEntry
+{
+ PptSlidePersistEntry(const PptSlidePersistEntry&) = delete;
+ PptSlidePersistEntry& operator=( const PptSlidePersistEntry& ) = delete;
+
+ PptSlidePersistAtom aPersistAtom;
+ PptSlideAtom aSlideAtom;
+ PptNotesAtom aNotesAtom;
+ PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom
+ std::unique_ptr<PPTStyleSheet> xStyleSheet; // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
+
+ sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
+ std::unique_ptr<HeaderFooterEntry> xHeaderFooterEntry;
+ std::unique_ptr<SvxMSDffSolverContainer> xSolverContainer;
+ sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
+ sal_uInt32 nSlidePersistEndOffset;
+ sal_uInt32 nBackgroundOffset; // fileoffset
+ sal_uInt32 nDrawingDgId; // valid, if not -1
+ std::unique_ptr<sal_uInt32[]>
+ pPresentationObjects; // if valid, this is a pointer to an array that includes the offsets to the presentation objects
+ // on this masterpage for each instance (0 - 8);
+ SdrObject* pBObj;
+
+ PptPageKind ePageKind;
+
+ bool bNotesMaster : 1; // for NotesMaster
+ bool bHandoutMaster : 1; // for HandoutMaster
+ bool bStarDrawFiller : 1; // special for StarDraw
+public:
+ PptSlidePersistEntry();
+ ~PptSlidePersistEntry();
+ sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; }
+};
+
+#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
+
+class MSFILTER_DLLPUBLIC PptSlidePersistList
+{
+private:
+ PptSlidePersistList(const PptSlidePersistList&) = delete;
+ PptSlidePersistList& operator=( const PptSlidePersistList& ) = delete;
+
+ typedef std::vector<std::unique_ptr<PptSlidePersistEntry>> Entries_t;
+ Entries_t mvEntries;
+
+public:
+ PptSlidePersistList();
+ ~PptSlidePersistList();
+
+ size_t size() const { return mvEntries.size(); }
+ bool is_null( size_t nIdx ) const { return mvEntries[ nIdx ] == nullptr; }
+ const PptSlidePersistEntry& operator[](size_t nIdx) const { return *mvEntries[ nIdx ]; }
+ PptSlidePersistEntry& operator[](size_t nIdx) { return *mvEntries[ nIdx ]; }
+ Entries_t::iterator begin() { return mvEntries.begin(); }
+ void insert( Entries_t::iterator it,
+ std::unique_ptr<PptSlidePersistEntry> pEntry )
+ {
+ mvEntries.insert(it, std::move(pEntry));
+ }
+ void push_back(std::unique_ptr<PptSlidePersistEntry> pEntry)
+ {
+ mvEntries.push_back(std::move(pEntry));
+ }
+
+ sal_uInt16 FindPage( sal_uInt32 nId ) const;
+};
+
+class SfxObjectShell;
+struct PPTOleEntry
+{
+ sal_uInt32 nId; // OleId
+ sal_uInt32 nRecHdOfs; // points to the record header: ExObjListHd
+ SfxObjectShell* pShell;
+ sal_uInt16 nType; // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
+ sal_uInt32 nAspect; // the aspect of the OLE object
+
+ PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp )
+ : nId(nid)
+ , nRecHdOfs(nOfs)
+ , pShell(pSh)
+ , nType(nT)
+ , nAspect(nAsp)
+ {}
+};
+
+struct PptExOleObjAtom
+{
+ sal_uInt32 nAspect;
+ sal_uInt32 nId;
+ sal_uInt32 nPersistPtr;
+
+public:
+
+ friend SvStream& ReadPptExOleObjAtom( SvStream& rIn, PptExOleObjAtom& rAtom );
+};
+
+// SdPage derives from SdrPage, is only known inside sd, and needs to be carried
+// around as an opaque pointer here:
+struct SdPageCapsule {
+ explicit SdPageCapsule(SdrPage * thePage): page(thePage) {}
+
+ SdrPage * page;
+};
+
+class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+ friend class ImplSdPPTImport;
+
+ PptDocumentAtom aDocAtom;
+ DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
+
+ ::std::vector< PPTOleEntry > aOleObjectList;
+
+ std::optional<std::vector<PptFontEntityAtom>> m_xFonts;
+
+ sal_uInt32 nStreamLen;
+
+ bool ReadString( OUString& rStr ) const;
+ // only for PowerPoint filter:
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+
+public:
+ using SvxMSDffManager::ReadObjText;
+
+ PowerPointImportParam& rImportParam;
+
+ SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrEscherImport() override;
+ virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const override;
+ virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override;
+ const PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
+ void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pObj ) override;
+ virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, DffObjData& rObj ) override;
+ void ImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry );
+};
+
+
+struct MSFILTER_DLLPUBLIC PPTFieldEntry
+{
+ sal_uInt16 nPos;
+ sal_uInt16 nTextRangeEnd;
+ std::unique_ptr<SvxFieldItem> xField1;
+ std::unique_ptr<SvxFieldItem> xField2;
+ std::optional<OUString> xString;
+
+ PPTFieldEntry()
+ : nPos(0)
+ , nTextRangeEnd(0)
+ {
+ }
+
+ ~PPTFieldEntry();
+
+ void SetDateTime( sal_uInt32 nType );
+
+ // converting PPT date time format:
+ static void GetDateTime(
+ const sal_uInt32 nVal,
+ SvxDateFormat& eDateFormat,
+ SvxTimeFormat& eTimeFormat
+ );
+};
+
+struct MSFILTER_DLLPUBLIC HeaderFooterEntry
+{
+ const PptSlidePersistEntry* pMasterPersist;
+ OUString pPlaceholder[ 4 ];
+ sal_uInt32 nAtom;
+
+ sal_uInt32 IsToDisplay( sal_uInt32 nInstance );
+ sal_uInt32 NeedToImportInstance(
+ const sal_uInt32 nInstance,
+ const PptSlidePersistEntry& rSlidePersist
+ );
+
+ explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = nullptr );
+};
+
+struct MSFILTER_DLLPUBLIC ProcessData final : public SvxMSDffClientData
+{
+ PptSlidePersistEntry& rPersistEntry;
+ SdPageCapsule pPage;
+ ::std::vector< SdrObject* > aBackgroundColoredObjects;
+ std::unique_ptr<sal_uInt32[]> pTableRowProperties;
+
+ ProcessData( PptSlidePersistEntry& rP, SdPageCapsule pP ) :
+ rPersistEntry ( rP ),
+ pPage ( pP ) {};
+
+ virtual void NotifyFreeObj(SdrObject* pObj) override;
+};
+
+
+class SdrTextObj;
+
+class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTExtParaProv;
+ friend struct PPTStyleSheet;
+ friend class PPTNumberFormatCreator;
+
+ bool m_bOk;
+ PptUserEditAtom m_aUserEditAtom;
+ PptColorSchemeAtom m_aPageColors;
+ ::std::vector< SdHyperlinkEntry > m_aHyperList;
+ std::unique_ptr<sal_uInt32[]>
+ m_pPersistPtr;
+ sal_uInt32 m_nPersistPtrCnt;
+
+ const PPTStyleSheet* m_pPPTStyleSheet; // this is the current stylesheet;
+ const PPTStyleSheet* m_pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
+ // never happen just preventing a crash
+ std::unique_ptr<PptSlidePersistList> m_pMasterPages;
+ std::unique_ptr<PptSlidePersistList> m_pSlidePages;
+ std::unique_ptr<PptSlidePersistList> m_pNotePages;
+ sal_uInt16 m_nCurrentPageNum;
+ sal_uLong m_nDocStreamPos;
+ sal_uInt16 m_nPageColorsNum;
+ PptPageKind m_ePageColorsKind;
+ PptPageKind m_eCurrentPageKind;
+
+protected:
+ using SdrEscherImport::ReadObjText;
+
+ bool SeekToCurrentPage(DffRecordHeader* pRecHd) const;
+ bool SeekToDocument(DffRecordHeader* pRecHd) const;
+ static bool SeekToContentOfProgTag(
+ sal_Int32 nVersion,
+ SvStream& rSt,
+ const DffRecordHeader& rProgTagBinaryDataHd,
+ DffRecordHeader& rContentHd
+ );
+ virtual SdrObject* ApplyTextObj(
+ PPTTextObj* pTextObj,
+ SdrTextObj* pText,
+ SdPageCapsule pPage,
+ SfxStyleSheet*,
+ SfxStyleSheet** )
+ const;
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const override;
+ // #i32596# - new parameter <_nCalledByGroup>, which
+ // indicates, if the OLE object is imported inside a group object.
+ virtual SdrObject* ImportOLE(
+ sal_uInt32 nOLEId,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ const int _nCalledByGroup
+ ) const override;
+ std::unique_ptr<SvMemoryStream> ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
+ rtl::Reference<SdrPage> MakeBlankPage(bool bMaster) const;
+ bool ReadFontCollection();
+ PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
+ sal_uInt32 GetCurrentPageId();
+ sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
+ sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const;
+ static SdrOutliner* GetDrawOutliner( SdrTextObj const * pSdrText );
+ void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
+
+ void ApplyTextAnchorAttributes( PPTTextObj const & rTextObj, SfxItemSet& rSet ) const;
+ bool IsVerticalText() const;
+
+public:
+ SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrPowerPointImport() override;
+ sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
+ void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
+ Size GetPageSize() const;
+ SdrObject* ImportPageBackgroundObject(
+ const SdrPage& rPage,
+ sal_uInt32& nBgFileOffset
+ );
+ bool IsNoteOrHandout( sal_uInt16 nPageNum ) const;
+ bool HasMasterPage(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+ sal_uInt16 GetMasterPageIndex(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+
+ void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist );
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const override;
+ virtual bool SeekToShape( SvStream& rSt, SvxMSDffClientData* pClientData, sal_uInt32 nId ) const override;
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const override;
+ SdrObject* CreateTable(
+ SdrObject* pGroupObject,
+ const sal_uInt32* pTableArry,
+ SvxMSDffSolverContainer* pSolverContainer,
+ std::vector<SdrObject*>& rBackgroundColoredObjects
+ );
+ virtual bool ReadFormControl( tools::SvRef<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const = 0;
+};
+
+struct PPTTextParagraphStyleAtomInterpreter
+{
+ bool bValid;
+ bool bForbiddenRules;
+ bool bHangingPunctuation;
+ bool bLatinTextWrap;
+
+ PPTTextParagraphStyleAtomInterpreter();
+
+ bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+};
+
+struct PPTTextSpecInfo
+{
+ sal_uInt32 nCharIdx;
+ LanguageType nLanguage[ 3 ];
+ sal_uInt16 nDontKnow;
+
+ explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
+};
+
+struct PPTTextSpecInfoAtomInterpreter
+{
+ bool bValid;
+ ::std::vector< PPTTextSpecInfo > aList;
+
+ PPTTextSpecInfoAtomInterpreter();
+ ~PPTTextSpecInfoAtomInterpreter();
+
+ bool Read(
+ SvStream& rIn,
+ const DffRecordHeader& rRecHd,
+ sal_uInt16 nRecordType,
+ const PPTTextSpecInfo* pTextSpecDefault = nullptr
+ );
+
+};
+
+#define PPT_STYLESHEETENTRIES 9
+
+struct PPTExtParaLevel
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mcfPP10Ext;
+ bool mbSet;
+
+ PPTExtParaLevel();
+ friend SvStream& ReadPPTExtParaLevel( SvStream& rIn, PPTExtParaLevel& rL );
+};
+
+struct PPTExtParaSheet
+{
+ PPTExtParaLevel aExtParaLevel[nMaxPPTLevels];
+};
+
+struct PPTBuGraEntry
+{
+ sal_uInt32 nInstance;
+ Graphic aBuGra;
+
+ PPTBuGraEntry( Graphic aGraphic, sal_uInt32 nInstance );
+};
+
+class PPTExtParaProv
+{
+ ::std::vector< std::unique_ptr<PPTBuGraEntry> > aBuGraList;
+
+public:
+ bool bStyles;
+ DffRecordManager aExtendedPresRules;
+
+ o3tl::enumarray<TSS_Type, PPTExtParaSheet> aExtParaSheet;
+
+ bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
+
+ PPTExtParaProv(
+ SdrPowerPointImport& rManager,
+ SvStream& rSt,
+ const DffRecordHeader* pMainMasterHd
+ );
+ ~PPTExtParaProv();
+};
+
+struct PPTCharLevel
+{
+ Color mnFontColorInStyleSheet;
+ sal_uInt32 mnFontColor;
+ sal_uInt16 mnFlags;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+};
+
+struct PPTCharSheet
+{
+ PPTCharLevel maCharLevel[nMaxPPTLevels];
+
+ explicit PPTCharSheet( TSS_Type nInstance );
+
+ void Read( SvStream& rIn, sal_uInt32 nLevel );
+};
+
+struct PPTParaLevel
+{
+ sal_uInt16 mnBuFlags;
+ sal_uInt16 mnBulletChar;
+ sal_uInt16 mnBulletFont;
+ sal_uInt16 mnBulletHeight;
+ sal_uInt32 mnBulletColor;
+
+ sal_uInt16 mnAdjust;
+ sal_uInt16 mnLineFeed;
+ sal_uInt16 mnUpperDist;
+ sal_uInt16 mnLowerDist;
+ sal_uInt16 mnTextOfs;
+ sal_uInt16 mnBulletOfs;
+ sal_uInt16 mnDefaultTab;
+ sal_uInt16 mnAsianLineBreak; // bit0: use asian rules for first and last character
+ // 1: do not wrap latin text in the middle of the word
+ // 2: allow hanging punctuation
+ sal_uInt16 mnBiDi;
+};
+
+struct PPTParaSheet
+{
+public:
+
+ PPTParaLevel maParaLevel[nMaxPPTLevels];
+
+ explicit PPTParaSheet( TSS_Type nInstance );
+
+ void Read(
+ SdrPowerPointImport const & rMan,
+ SvStream& rIn,
+ sal_uInt32 nLevel,
+ bool bFirst
+ );
+ void UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight );
+};
+
+class PPTParagraphObj;
+class PPTNumberFormatCreator
+{
+ sal_uInt32 nIsBullet;
+ sal_uInt32 nBulletChar;
+ sal_uInt32 nBulletFont;
+ sal_uInt32 nBulletHeight;
+ sal_uInt32 nBulletColor;
+ sal_uInt32 nTextOfs;
+ sal_uInt32 nBulletOfs;
+
+ void ImplGetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat
+ );
+ bool ImplGetExtNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ TSS_Type nInstance,
+ TSS_Type nInstanceInSheet,
+ std::optional< sal_Int16 >& rStartNumbering,
+ sal_uInt32 nFontHeight,
+ PPTParagraphObj const * pPara
+ );
+
+protected:
+
+ PPTNumberFormatCreator( std::unique_ptr<PPTExtParaProv> );
+ ~PPTNumberFormatCreator();
+
+public:
+
+ std::unique_ptr<PPTExtParaProv> pExtParaProv;
+
+ void GetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ const PPTParaLevel& rParaLevel,
+ const PPTCharLevel& rCharLevel,
+ TSS_Type nInstance
+ );
+
+ bool GetNumberFormat(
+ SdrPowerPointImport const & rMan,
+ SvxNumberFormat& rNumberFormat,
+ PPTParagraphObj* pPara,
+ TSS_Type nInstanceInSheet,
+ std::optional< sal_Int16 >& rStartNumbering
+ );
+};
+
+class SvxNumBulletItem;
+struct PPTStyleSheet : public PPTNumberFormatCreator
+{
+ PPTTextSpecInfo maTxSI;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<PPTCharSheet>> mpCharSheet;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<PPTParaSheet>> mpParaSheet;
+ o3tl::enumarray<TSS_Type, std::unique_ptr<SvxNumBulletItem>> mpNumBulletItem;
+
+ PPTStyleSheet(
+ const DffRecordHeader& rSlideHd,
+ SvStream& rSt, SdrPowerPointImport&,
+ const PPTTextParagraphStyleAtomInterpreter&,
+ const PPTTextSpecInfo&
+ );
+ ~PPTStyleSheet();
+};
+
+struct ImplPPTParaPropSet final : public salhelper::SimpleReferenceObject
+{
+ sal_uInt16 mnDepth;
+ sal_uInt32 mnAttrSet;
+ sal_uInt32 mnBulletColor;
+ sal_uInt16 mpArry[ 22 ];
+
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt16 mnHasAnm;
+ sal_uInt16 mnBuBlip;
+
+ sal_uInt32 nDontKnow1;
+ sal_uInt32 nDontKnow2;
+ sal_uInt16 nDontKnow2bit06;
+
+ ImplPPTParaPropSet()
+ : mnDepth( 0 )
+ , mnAttrSet( 0 )
+ , mnBulletColor( 0 )
+ , mnExtParagraphMask( 0 )
+ , mnAnmScheme( 0 )
+ , mnHasAnm( 0 )
+ , mnBuBlip( 0 )
+ , nDontKnow1( 0 )
+ , nDontKnow2( 0 )
+ , nDontKnow2bit06( 0 )
+ { }
+};
+
+struct PPTParaPropSet
+{
+ sal_uInt32 mnOriginalTextPos;
+ rtl::Reference<ImplPPTParaPropSet> mxParaSet;
+
+ PPTParaPropSet();
+ PPTParaPropSet( PPTParaPropSet const & rParaPropSet );
+ ~PPTParaPropSet();
+
+ PPTParaPropSet& operator=( const PPTParaPropSet& rParaPropSet );
+};
+
+struct ImplPPTCharPropSet
+{
+ sal_uInt32 mnAttrSet;
+ sal_uInt16 mnFlags;
+ sal_uInt32 mnColor;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnANSITypeface;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+ sal_uInt16 mnSymbolFont;
+
+ ImplPPTCharPropSet()
+ : mnAttrSet( 0 )
+ , mnFlags( 0 )
+ , mnColor( 0 )
+ , mnFont( 0 )
+ , mnAsianOrComplexFont( 0 )
+ , mnANSITypeface( 0 )
+ , mnFontHeight( 0 )
+ , mnEscapement( 0 )
+ , mnSymbolFont( 0)
+ { }
+};
+
+struct PPTCharPropSet
+{
+ //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
+ //now,the bullet color should be set original hyperlink text's color
+ //so "mbHardHylinkOrigColor" hold the original hyperlink text's color.
+ sal_uInt32 mnHylinkOrigColor;
+ //the bullet text whether has a hyperlink.
+ bool mbIsHyperlink;
+ //the hyperlink text whether has a custom color.
+ bool mbHardHylinkOrigColor;
+
+ sal_uInt32 mnOriginalTextPos;
+ sal_uInt32 mnParagraph;
+ OUString maString;
+ std::unique_ptr<SvxFieldItem>
+ mpFieldItem;
+ LanguageType mnLanguage[ 3 ];
+
+ void SetFont( sal_uInt16 nFont );
+ void SetColor( sal_uInt32 nColor );
+
+ explicit PPTCharPropSet( sal_uInt32 nParagraph );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
+ ~PPTCharPropSet();
+
+ PPTCharPropSet& operator=( const PPTCharPropSet& rCharPropSet );
+
+ friend class PPTTextObj;
+ friend class PPTParagraphObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+
+private:
+ o3tl::cow_wrapper< ImplPPTCharPropSet > mpImplPPTCharPropSet;
+};
+
+struct PPTTabEntry
+{
+ sal_uInt16 nOffset;
+ sal_uInt16 nStyle;
+};
+
+struct PPTRuler final : public salhelper::SimpleReferenceObject
+{
+ sal_Int32 nFlags;
+ sal_uInt16 nDefaultTab;
+ sal_uInt16 nTextOfs[nMaxPPTLevels] = {};
+ sal_uInt16 nBulletOfs[nMaxPPTLevels] = {};
+ std::unique_ptr<PPTTabEntry[]>
+ pTab;
+ sal_uInt16 nTabCount;
+
+ PPTRuler();
+ virtual ~PPTRuler() override;
+};
+
+struct PPTTextRulerInterpreter
+{
+ rtl::Reference<PPTRuler> mxImplRuler;
+
+ PPTTextRulerInterpreter();
+ PPTTextRulerInterpreter( PPTTextRulerInterpreter const & rRuler );
+ PPTTextRulerInterpreter(
+ sal_uInt32 nFileOfs,
+ DffRecordHeader const & rHd,
+ SvStream& rIn
+ );
+ ~PPTTextRulerInterpreter();
+
+ sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const
+ { return mxImplRuler->pTab[ nIndex ].nOffset; };
+
+ sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const
+ { return mxImplRuler->pTab[ nIndex ].nStyle; };
+
+ sal_uInt16 GetTabCount() const { return mxImplRuler->nTabCount; };
+ bool GetDefaultTab( sal_uInt16& nValue ) const;
+ bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+
+ PPTTextRulerInterpreter& operator=( const PPTTextRulerInterpreter& rRuler );
+};
+
+#define PPT_SPEC_NEWLINE 0x10000
+#define PPT_SPEC_SYMBOL 0x20000
+
+struct StyleTextProp9
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mncfPP10Ext;
+ sal_uInt32 mnSpecialInfoMask;
+ sal_uInt32 mnPP10Ext;
+ sal_uInt16 mfBidi;
+
+ StyleTextProp9()
+ : mnExtParagraphMask( 0 )
+ , mnBuBlip( 0 )
+ , mnHasAnm( 0 )
+ , mnAnmScheme( 0 )
+ , mpfPP10Ext( 0 )
+ , mnExtCharacterMask( 0 )
+ , mncfPP10Ext( 0 )
+ , mnSpecialInfoMask( 0 )
+ , mnPP10Ext( 0 )
+ , mfBidi( 0 )
+ {
+ }
+ void Read( SvStream& rSt );
+};
+
+struct PPTStyleTextPropReader
+{
+ std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
+ std::vector<std::unique_ptr<PPTParaPropSet>> aParaPropList;
+ std::vector<std::unique_ptr<PPTCharPropSet>> aCharPropList;
+
+ PPTStyleTextPropReader(
+ SvStream& rIn,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter const & rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ TSS_Type nTextInstance
+ );
+ ~PPTStyleTextPropReader();
+
+ void Init(
+ SvStream& rIn,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter const & rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ TSS_Type nTextInstance
+ );
+ void ReadParaProps(
+ SvStream& rIn,
+ const DffRecordHeader& rTextHeader,
+ const OUString& aString,
+ PPTTextRulerInterpreter const & rRuler,
+ sal_uInt32& nCharCount,
+ bool& bTextPropAtom
+ );
+ static void ReadCharProps(
+ SvStream& rIn,
+ PPTCharPropSet& aCharPropSet,
+ const OUString& aString,
+ sal_uInt32& nCharCount,
+ sal_uInt32 nCharReadCnt,
+ bool& bTextPropAtom,
+ sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags,
+ sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm,
+ sal_uInt32& nAnmScheme
+ );
+};
+
+class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
+{
+
+ friend class PPTParagraphObj;
+
+ const PPTStyleSheet& mrStyleSheet;
+ TSS_Type mnInstance;
+ sal_uInt32 mnDepth;
+
+public:
+
+ bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet ) const;
+ SvxFieldItem* GetTextField();
+
+ PPTPortionObj( const PPTStyleSheet&, TSS_Type nInstance, sal_uInt32 nDepth );
+ PPTPortionObj(
+ const PPTCharPropSet&,
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ sal_uInt32 nDepth
+ );
+ PPTPortionObj( const PPTPortionObj& );
+ ~PPTPortionObj();
+
+ // the following function should be removed during next full update
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ TSS_Type nInstanceInSheet
+ );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ TSS_Type nInstanceInSheet,
+ const PPTTextObj* pTextObj
+ );
+ sal_uInt32 Count() const { return mpFieldItem ? 1 : maString.getLength(); };
+};
+
+class MSFILTER_DLLPUBLIC PPTParagraphObj
+ : public PPTParaPropSet,
+ public PPTNumberFormatCreator,
+ public PPTTextRulerInterpreter
+{
+ friend class PPTTextObj;
+ friend class PPTNumberFormatCreator;
+
+ const PPTStyleSheet& mrStyleSheet;
+ TSS_Type mnInstance;
+
+ PPTParagraphObj(PPTParagraphObj const&) = delete;
+ void operator=(PPTParagraphObj const&) = delete;
+
+public:
+ sal_uInt32 mnCurrentObject;
+ ::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList;
+
+ void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
+ bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet );
+
+ PPTParagraphObj(
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ sal_uInt16 nDepth
+ );
+ PPTParagraphObj(
+ PPTStyleTextPropReader&,
+ size_t nCurParaPos,
+ size_t& rnCurCharPos,
+ const PPTStyleSheet&,
+ TSS_Type nInstance,
+ PPTTextRulerInterpreter const & rRuler
+ );
+ ~PPTParagraphObj();
+
+ sal_uInt32 GetTextSize();
+ PPTPortionObj* First();
+ PPTPortionObj* Next();
+
+ void AppendPortion( PPTPortionObj& rPortion );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ std::optional< sal_Int16 >& rStartNumbering,
+ SdrPowerPointImport const & rManager,
+ TSS_Type nInstanceInSheet
+ );
+};
+
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT 1
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER 2
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT 4
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK 8
+#define PPT_TEXTOBJ_FLAGS_VERTICAL 16
+
+struct ImplPPTTextObj final : public salhelper::SimpleReferenceObject
+{
+ sal_uInt32 mnShapeId;
+ sal_uInt32 mnShapeMaster;
+ std::unique_ptr<PptOEPlaceholderAtom> mpPlaceHolderAtom;
+ TSS_Type mnInstance;
+ TSS_Type mnDestinationInstance;
+ MSO_SPT meShapeType;
+
+ sal_uInt32 mnCurrentObject;
+ sal_uInt32 mnParagraphCount;
+ std::vector<std::unique_ptr<PPTParagraphObj>>
+ maParagraphList;
+ PptSlidePersistEntry& mrPersistEntry;
+
+ sal_uInt32 mnTextFlags;
+
+ explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry )
+ : mnShapeId(0)
+ , mnShapeMaster(0)
+ , mnInstance(TSS_Type::PageTitle)
+ , mnDestinationInstance(TSS_Type::PageTitle)
+ , meShapeType(mso_sptMin)
+ , mnCurrentObject(0)
+ , mnParagraphCount(0)
+ , mrPersistEntry ( rPersistEntry )
+ , mnTextFlags(0) {};
+};
+
+class MSFILTER_DLLPUBLIC PPTTextObj
+{
+ rtl::Reference<ImplPPTTextObj> mxImplTextObj;
+
+public:
+ PPTTextObj(
+ SvStream& rSt,
+ SdrPowerPointImport&,
+ PptSlidePersistEntry&,
+ DffObjData const *
+ );
+ PPTTextObj( PPTTextObj const & rTextObj );
+ ~PPTTextObj();
+
+ sal_uInt32 GetCurrentIndex() const { return mxImplTextObj->mnCurrentObject; };
+ sal_uInt32 Count() const { return mxImplTextObj->mnParagraphCount; };
+ PPTParagraphObj* First();
+ PPTParagraphObj* Next();
+ MSO_SPT GetShapeType() const { return mxImplTextObj->meShapeType; };
+ TSS_Type GetInstance() const { return mxImplTextObj->mnInstance; };
+ void SetInstance( TSS_Type nInstance )
+ { mxImplTextObj->mnInstance = nInstance; }
+
+ TSS_Type GetDestinationInstance() const
+ { return mxImplTextObj->mnDestinationInstance; }
+
+ void SetDestinationInstance( TSS_Type nInstance )
+ { mxImplTextObj->mnDestinationInstance = nInstance; }
+
+ PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mxImplTextObj->mpPlaceHolderAtom.get(); }
+ sal_uInt32 GetTextFlags() const { return mxImplTextObj->mnTextFlags; }
+ void SetVertical( bool bVertical )
+ {
+ if ( bVertical )
+ mxImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
+ else
+ mxImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
+ }
+ bool GetVertical() const
+ { return ( mxImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; }
+
+ const SfxItemSet* GetBackground() const;
+
+ PPTTextObj& operator=( const PPTTextObj& rTextObj );
+};
+
+class PPTConvertOCXControls final : public SvxMSConvertOCXControls
+{
+ virtual void GetDrawPage() override;
+ PptPageKind ePageKind;
+ const SdrPowerPointImport* mpPPTImporter;
+public:
+
+ PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, const css::uno::Reference< css::frame::XModel >& rxModel, PptPageKind ePKind ) :
+ SvxMSConvertOCXControls ( rxModel ),
+ ePageKind ( ePKind ),
+ mpPPTImporter ( pPPTImporter )
+ {};
+ bool ReadOCXStream( tools::SvRef<SotStorage>& rSrc1,
+ css::uno::Reference<css::drawing::XShape > *pShapeRef );
+ virtual bool InsertControl(
+ const css::uno::Reference< css::form::XFormComponent > &rFComp,
+ const css::awt::Size& rSize,
+ css::uno::Reference< css::drawing::XShape > *pShape,
+ bool bFloatingCtrl
+ ) override;
+};
+
+// PowerPoint record types
+#define PPT_PST_Document 1000
+#define PPT_PST_DocumentAtom 1001
+#define PPT_PST_SlideAtom 1007
+#define PPT_PST_NotesAtom 1009
+#define PPT_PST_Environment 1010
+#define PPT_PST_SlidePersistAtom 1011
+#define PPT_PST_SSSlideInfoAtom 1017
+#define PPT_PST_VBAInfo 1023
+#define PPT_PST_VBAInfoAtom 1024
+#define PPT_PST_SSDocInfoAtom 1025
+#define PPT_PST_ExObjList 1033
+#define PPT_PST_PPDrawingGroup 1035
+#define PPT_PST_PPDrawing 1036
+#define PPT_PST_GridSpacing10Atom 1037
+#define PPT_PST_NamedShows 1040
+#define PPT_PST_NamedShow 1041
+#define PPT_PST_NamedShowSlides 1042
+#define PPT_PST_List 2000
+#define PPT_PST_FontCollection 2005
+#define PPT_PST_SoundCollection 2020
+#define PPT_PST_Sound 2022
+#define PPT_PST_SoundData 2023
+#define PPT_PST_ColorSchemeAtom 2032
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedBuGraContainer 2040 // consist of 4041
+#define PPT_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
+
+#define PPT_PST_ExObjRefAtom 3009
+#define PPT_PST_OEPlaceholderAtom 3011
+#define PPT_PST_OutlineTextRefAtom 3998
+#define PPT_PST_TextHeaderAtom 3999
+#define PPT_PST_TextCharsAtom 4000
+#define PPT_PST_StyleTextPropAtom 4001
+#define PPT_PST_TxMasterStyleAtom 4003
+#define PPT_PST_TxPFStyleAtom 4005
+#define PPT_PST_TextRulerAtom 4006
+#define PPT_PST_TextBytesAtom 4008
+#define PPT_PST_TxSIStyleAtom 4009
+#define PPT_PST_TextSpecInfoAtom 4010
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedParagraphAtom 4012
+#define PPT_PST_ExtendedParagraphMasterAtom 4013
+#define PPT_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
+#define PPT_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
+ // the first sal_uInt32 in this atom indices the current slideId
+#define PPT_PST_TextDefaults9Atom 4016
+
+#define PPT_PST_FontEntityAtom 4023
+#define PPT_PST_CString 4026
+#define PPT_PST_ExOleObjAtom 4035
+#define PPT_PST_SrKinsoku 4040
+#define PPT_PST_ExEmbed 4044
+#define PPT_PST_ExHyperlinkAtom 4051
+#define PPT_PST_ExHyperlink 4055
+#define PPT_PST_SlideNumberMCAtom 4056
+#define PPT_PST_HeadersFooters 4057
+#define PPT_PST_HeadersFootersAtom 4058
+#define PPT_PST_TxInteractiveInfoAtom 4063
+#define PPT_PST_MasterText 4068
+#define PPT_PST_RecolorInfoAtom 4071
+#define PPT_PST_ExControl 4078
+#define PPT_PST_SlideListWithText 4080
+#define PPT_PST_AnimationInfoAtom 4081
+#define PPT_PST_InteractiveInfo 4082
+#define PPT_PST_InteractiveInfoAtom 4083
+#define PPT_PST_UserEditAtom 4085
+#define PPT_PST_CurrentUserAtom 4086
+#define PPT_PST_DateTimeMCAtom 4087
+#define PPT_PST_GenericDateMCAtom 4088
+#define PPT_PST_HeaderMCAtom 4089
+#define PPT_PST_FooterMCAtom 4090
+#define PPT_PST_ExMediaAtom 4100
+#define PPT_PST_ExVideo 4101
+#define PPT_PST_ExAviMovie 4102
+#define PPT_PST_ExMCIMovie 4103
+#define PPT_PST_AnimationInfo 4116
+#define PPT_PST_RTFDateTimeMCAtom 4117
+#define PPT_PST_ProgTags 5000
+#define PPT_PST_ProgBinaryTag 5002
+#define PPT_PST_BinaryTagData 5003
+#define PPT_PST_PersistPtrIncrementalBlock 6002
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_PresentationAdvisorFlags9Atom 6010
+#define PPT_PST_HtmlDocInfo9Atom 6011
+
+
+#define PPT_PST_HashCodeAtom 11008
+#define PPT_PST_BuildList 11010
+#define PPT_PST_Comment10 12000
+#define PPT_PST_CommentAtom10 12001
+#define PPT_PST_CommentIndex10 12004
+#define PPT_PST_SlideFlags10Atom 12010
+#define PPT_PST_SlideTime10Atom 12011
+#define PPT_PST_DocToolbarStates10Atom 14001
+
+// attributes for PptTextStyleSheet
+#define PPT_ParaAttr_BulletOn 0 //00000001
+#define PPT_ParaAttr_BuHardFont 1 //00000002
+#define PPT_ParaAttr_BuHardColor 2 //00000004
+#define PPT_ParaAttr_BuHardHeight 3 //00000008
+#define PPT_ParaAttr_BulletFont 4 //00000010
+#define PPT_ParaAttr_BulletColor 5 //00000020
+#define PPT_ParaAttr_BulletHeight 6 //00000040
+#define PPT_ParaAttr_BulletChar 7 //00000080
+#define PPT_ParaAttr_Adjust 11 //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
+#define PPT_ParaAttr_LineFeed 12 //00001000
+#define PPT_ParaAttr_UpperDist 13 //00002000 is set to 0032 for TextFrames by default
+#define PPT_ParaAttr_LowerDist 14 //00004000
+#define PPT_ParaAttr_TextOfs 15 //00008000
+#define PPT_ParaAttr_BulletOfs 16 //00010000
+#define PPT_ParaAttr_DefaultTab 17 //00020000
+#define PPT_ParaAttr_AsianLB_1 18
+#define PPT_ParaAttr_AsianLB_2 19
+#define PPT_ParaAttr_AsianLB_3 20
+#define PPT_ParaAttr_BiDi 21 //00200000
+
+#define PPT_CharAttr_Bold 0 //00000001
+#define PPT_CharAttr_Italic 1 //00000002
+#define PPT_CharAttr_Underline 2 //00000004
+#define PPT_CharAttr_Shadow 4 //00000010
+#define PPT_CharAttr_Strikeout 8 //00000100
+#define PPT_CharAttr_Embossed 9 //00000200
+#define PPT_CharAttr_Font 16 //00010000
+#define PPT_CharAttr_AsianOrComplexFont 21 //00200000
+#define PPT_CharAttr_ANSITypeface 22 //00400000
+#define PPT_CharAttr_Symbol 23 //00800000
+#define PPT_CharAttr_FontHeight 17 //00020000
+#define PPT_CharAttr_FontColor 18 //00040000
+#define PPT_CharAttr_Escapement 19 //00080000
+
+// values for PptSlideLayoutAtom.eLayout
+enum class PptSlideLayout
+{
+ TITLESLIDE = 0, // The slide is a title slide
+ TITLEANDBODYSLIDE = 1, // Title and body slide
+ TITLEMASTERSLIDE = 2, // Title master slide
+ MASTERSLIDE = 3, // Master slide layout
+ MASTERNOTES = 4, // Master notes layout
+ NOTESTITLEBODY = 5, // Notes title/body layout
+ HANDOUTLAYOUT = 6, // Handout layout, therefore it doesn't have placeholders except header, footer, and date
+ ONLYTITLE = 7, // Only title placeholder
+ TWOCOLUMNSANDTITLE = 8, // Body of the slide has 2 columns and a title
+ TWOROWSANDTITLE = 9, // Slide's body has 2 rows and a title
+ RIGHTCOLUMN2ROWS = 10, // Body contains 2 columns, right column has 2 rows
+ LEFTCOLUMN2ROWS = 11, // Body contains 2 columns, left column has 2 rows
+ BOTTOMROW2COLUMNS = 12, // Body contains 2 rows, bottom row has 2 columns
+ TOPROW2COLUMN = 13, // Body contains 2 rows, top row has 2 columns
+ FOUROBJECTS = 14, // 4 objects
+ BIGOBJECT = 15, // Big object
+ BLANKSLIDE = 16, // Blank slide
+ TITLERIGHTBODYLEFT = 17, // Vertical title on the right, body on the left
+ TITLERIGHT2BODIESLEFT = 18 // Vertical title on the right, body on the left split into 2 rows
+};
+
+// the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
+enum class PptPlaceholder : sal_uInt8
+{
+ NONE = 0, // 0 None
+ MASTERTITLE = 1, // 1 Master title
+ MASTERBODY = 2, // 2 Master body
+ MASTERCENTEREDTITLE = 3, // 3 Master centered title
+ MASTERSUBTITLE = 4, // 10 Master subtitle
+ MASTERNOTESSLIDEIMAGE = 5, // 4 Master notes slide image
+ MASTERNOTESBODYIMAGE = 6, // 5 Master notes body image
+ MASTERDATE = 7, // 6 Master date
+ MASTERSLIDENUMBER = 8, // 7 Master slide number
+ MASTERFOOTER = 9, // 8 Master footer
+ MASTERHEADER = 10, // 9 Master header
+ // 11 Generic text object
+ TITLE = 13, // 12 Title
+ BODY = 14, // 13 Body
+ NOTESBODY = 12, // 14 Notes body
+ CENTEREDTITLE = 15, // 15 Centered title
+ SUBTITLE = 16, // 16 Subtitle
+ VERTICALTEXTTITLE = 17, // 17 Vertical text title
+ VERTICALTEXTBODY = 18, // 18 Vertical text body
+ NOTESSLIDEIMAGE = 11, // 19 Notes slide image
+ OBJECT = 19, // 20 Object (no matter the size)
+ GRAPH = 20, // 21 Graph
+ TABLE = 21, // 22 Table
+ CLIPART = 22, // 23 Clip Art
+ ORGANISZATIONCHART = 23, // 24 Organization Chart
+ MEDIACLIP = 24 // 25 Media Clip
+};
+
+#endif // INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx
new file mode 100644
index 000000000..190e289c4
--- /dev/null
+++ b/include/filter/msfilter/svxmsbas.hxx
@@ -0,0 +1,73 @@
+/* -*- 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_MSFILTER_SVXMSBAS_HXX
+#define INCLUDED_FILTER_MSFILTER_SVXMSBAS_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <rtl/ustring.hxx>
+#include <sot/storage.hxx>
+#include <vcl/errcode.hxx>
+#include <tools/ref.hxx>
+
+class SfxObjectShell;
+
+/* Construct with the root storage of the MS document, with bImportCode
+ * set the visual basic code will be imported into the stardocument when Import
+ * is called, with bCopyStorage set, the visual basic storage tree will be
+ * copied completely into staroffice, so that any future export to a msoffice
+ * format will retain the vba code, allowing a lossless roundtrip from
+ * msoffice to staroffice and back.
+ *
+ * Setting bAsComment to true in Import will import the visual basic as a
+ * starbasic comment. Which is currently necessary, as vb is not valid sb.
+ *
+ * Setting bStripped will remove the "Attribute" lines from the vb, msoffice
+ * does this itself when it shows the vb code in the vbeditor, so this is
+ * probably what the user expects to see when viewing the code
+ */
+
+class MSFILTER_DLLPUBLIC SvxImportMSVBasic
+{
+public:
+ SvxImportMSVBasic(SfxObjectShell& rDocS, SotStorage& rRoot)
+ : xRoot(&rRoot)
+ , rDocSh(rDocS)
+ {
+ }
+ // only for the export - copy or delete the saved VBA-macro-storage
+ // form the ObjectShell
+ // - returns a warning code if a modified basic exist, in all other
+ // cases return ERRCODE_NONE.
+ ErrCode SaveOrDelMSVBAStorage(bool bSaveInto, const OUString& rStorageName);
+
+ // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
+ // If it exist, then return the WarningId for losing the information.
+ static ErrCode GetSaveWarningOfMSVBAStorage(SfxObjectShell& rDocS);
+
+ static OUString GetMSBasicStorageName();
+
+private:
+ tools::SvRef<SotStorage> xRoot;
+ SfxObjectShell& rDocSh;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
new file mode 100644
index 000000000..3dd7c8884
--- /dev/null
+++ b/include/filter/msfilter/util.hxx
@@ -0,0 +1,145 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_FILTER_MSFILTER_UTIL_HXX
+#define INCLUDED_FILTER_MSFILTER_UTIL_HXX
+
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <tools/datetime.hxx>
+#include <tools/long.hxx>
+
+class Color;
+
+namespace com::sun::star {
+ namespace awt { struct Size; }
+ namespace lang { struct Locale; }
+}
+
+namespace msfilter::util {
+
+/// Returns the best-fit default 8bit encoding for a given locale
+/// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
+/// what the encoding is, but you know or can guess the language
+MSFILTER_DLLPUBLIC rtl_TextEncoding getBestTextEncodingFromLocale(const css::lang::Locale &rLocale);
+
+/// Convert a color in BGR format to RGB.
+MSFILTER_DLLPUBLIC ::Color BGRToRGB(sal_uInt32 nColour);
+
+/** Convert from DTTM to Writer's DateTime
+ */
+MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( tools::Long lDTTM );
+
+/** Convert DateTime to xsd::dateTime string.
+
+I guess there must be an implementation of this somewhere in LO, but I failed
+to find it, unfortunately :-(
+*/
+
+/// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
+/// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
+/// best-fit replacement in terms of default available MSOffice symbol
+/// fonts.
+///
+/// Used to map from [Open|Star]Symbol to some Windows font or other.
+MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
+ rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName);
+
+
+/**
+ * Converts tools Color to HTML color (without leading hashmark).
+ *
+ * @param rColor color to convert
+ */
+MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
+MSFILTER_DLLPUBLIC OUString ConvertColorOU( const Color &rColor );
+
+
+/** Paper size in 1/100 millimeters. */
+struct MSFILTER_DLLPUBLIC ApiPaperSize
+{
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+};
+
+class MSFILTER_DLLPUBLIC PaperSizeConv
+{
+public:
+ static sal_Int32 getMSPaperSizeIndex( const css::awt::Size& rSize );
+ static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
+};
+
+/**
+ * Finds the quoted text in a field instruction text.
+ *
+ * Example: SEQ "Figure" \someoption -> "Figure"
+ */
+MSFILTER_DLLPUBLIC std::u16string_view findQuotedText( std::u16string_view rCommand, const char* cStartQuote, const sal_Unicode uEndQuote );
+
+class MSFILTER_DLLPUBLIC WW8ReadFieldParams
+{
+private:
+ const OUString aData;
+ sal_Int32 nFnd;
+ sal_Int32 nNext;
+ sal_Int32 nSavPtr;
+public:
+ WW8ReadFieldParams( OUString aData );
+
+ bool GoToTokenParam();
+ sal_Int32 SkipToNextToken();
+ sal_Int32 GetTokenSttPtr() const { return nFnd; }
+
+ sal_Int32 FindNextStringPiece( sal_Int32 _nStart = -1 );
+ bool GetTokenSttFromTo(sal_Int32* _pFrom, sal_Int32* _pTo, sal_Int32 _nMax);
+
+ OUString GetResult() const;
+};
+
+struct MSFILTER_DLLPUBLIC EquationResult
+{
+ OUString sResult;
+ OUString sType;
+};
+
+MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
+
+/// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawingML string.
+MSFILTER_DLLPUBLIC OString GetOOXMLPresetGeometry( std::u16string_view rShapeType );
+
+/// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
+MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(std::u16string_view aType);
+
+/**
+ * The following function checks if a MSO shapetype is allowed to have textboxcontent.
+ *
+ * @param nShapeType shape to check
+ */
+MSFILTER_DLLPUBLIC bool HasTextBoxContent(sal_uInt32 nShapeType);
+
+/**
+ * Convert the input color value to an ico value (0..16)
+ *
+ * @param[in] rCol input color for conversion
+ *
+ * @return ico value [0..16]
+**/
+MSFILTER_DLLPUBLIC sal_uInt8 TransColToIco( const Color& rCol );
+
+}
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/ww8fields.hxx b/include/filter/msfilter/ww8fields.hxx
new file mode 100644
index 000000000..8399fe22e
--- /dev/null
+++ b/include/filter/msfilter/ww8fields.hxx
@@ -0,0 +1,130 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+namespace ww
+{
+enum eField
+{
+ eNONE = 0,
+ eUNKNOWN = 1,
+ ePOSSIBLEBOOKMARK = 2,
+ eREF = 3,
+ eXE = 4,
+ eFOOTREF = 5,
+ eSET = 6,
+ eIF = 7,
+ eINDEX = 8,
+ eTC = 9,
+ eSTYLEREF = 10,
+ eRD = 11,
+ eSEQ = 12,
+ eTOC = 13,
+ eINFO = 14,
+ eTITLE = 15,
+ eSUBJECT = 16,
+ eAUTHOR = 17,
+ eKEYWORDS = 18,
+ eCOMMENTS = 19,
+ eLASTSAVEDBY = 20,
+ eCREATEDATE = 21,
+ eSAVEDATE = 22,
+ ePRINTDATE = 23,
+ eREVNUM = 24,
+ eEDITTIME = 25,
+ eNUMPAGES = 26,
+ eNUMWORDS = 27,
+ eNUMCHARS = 28,
+ eFILENAME = 29,
+ eTEMPLATE = 30,
+ eDATE = 31,
+ eTIME = 32,
+ ePAGE = 33,
+ eEquals = 34,
+ eQUOTE = 35,
+ eMERGEINC = 36,
+ ePAGEREF = 37,
+ eASK = 38,
+ eFILLIN = 39,
+ eMERGEDATA = 40,
+ eNEXT = 41,
+ eNEXTIF = 42,
+ eSKIPIF = 43,
+ eMERGEREC = 44,
+ eDDEREF = 45,
+ eDDEAUTOREF = 46,
+ eGLOSSREF = 47,
+ ePRINT = 48,
+ eEQ = 49,
+ eGOTOBUTTON = 50,
+ eMACROBUTTON = 51,
+ eAUTONUMOUT = 52,
+ eAUTONUMLGL = 53,
+ eAUTONUM = 54,
+ eINCLUDETIFF = 55,
+ eLINK = 56,
+ eSYMBOL = 57,
+ eEMBED = 58,
+ eMERGEFIELD = 59,
+ eUSERNAME = 60,
+ eUSERINITIALS = 61,
+ eUSERADDRESS = 62,
+ eBARCODE = 63,
+ eDOCVARIABLE = 64,
+ eSECTION = 65,
+ eSECTIONPAGES = 66,
+ eINCLUDEPICTURE = 67,
+ eINCLUDETEXT = 68,
+ eFILESIZE = 69,
+ eFORMTEXT = 70,
+ eFORMCHECKBOX = 71,
+ eNOTEREF = 72,
+ eTOA = 73,
+ eTA = 74,
+ eMERGESEQ = 75,
+ eMACRO = 76,
+ ePRIVATE = 77,
+ eDATABASE = 78,
+ eAUTOTEXT = 79,
+ eCOMPARE = 80,
+ ePLUGIN = 81,
+ eSUBSCRIBER = 82,
+ eFORMDROPDOWN = 83,
+ eADVANCE = 84,
+ eDOCPROPERTY = 85,
+ eUNKNOWN2 = 86,
+ eCONTROL = 87,
+ eHYPERLINK = 88,
+ eAUTOTEXTLIST = 89,
+ eLISTNUM = 90,
+ eHTMLCONTROL = 91,
+ eBIDIOUTLINE = 92,
+ eADDRESSBLOCK = 93,
+ eGREETINGLINE = 94,
+ eSHAPE = 95,
+ // NOTE: values > 95 / 0x5F do not correspond to documented WW8 fields
+ // and thus need special handling in WW8Export::OutputField()!
+ eBIBLIOGRAPHY = 96,
+ eCITATION = 97,
+ eFORMDATE = 98,
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */