diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/filter/msfilter | |
parent | move global headers script (diff) | |
download | core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.tar.gz core-b9337e22ce1dbf2eba0e8c8db294ae99f4111f91.zip |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/filter/msfilter')
-rw-r--r-- | include/filter/msfilter/countryid.hxx | 311 | ||||
-rw-r--r-- | include/filter/msfilter/dffpropset.hxx | 70 | ||||
-rw-r--r-- | include/filter/msfilter/dffrecordheader.hxx | 63 | ||||
-rw-r--r-- | include/filter/msfilter/escherex.hxx | 1721 | ||||
-rw-r--r-- | include/filter/msfilter/mscodec.hxx | 370 | ||||
-rw-r--r-- | include/filter/msfilter/msdffimp.hxx | 809 | ||||
-rw-r--r-- | include/filter/msfilter/msfilterdllapi.h | 35 | ||||
-rw-r--r-- | include/filter/msfilter/msocximex.hxx | 106 | ||||
-rw-r--r-- | include/filter/msfilter/msoleexp.hxx | 53 | ||||
-rw-r--r-- | include/filter/msfilter/mstoolbar.hxx | 359 | ||||
-rw-r--r-- | include/filter/msfilter/msvbahelper.hxx | 106 | ||||
-rw-r--r-- | include/filter/msfilter/rtfutil.hxx | 52 | ||||
-rw-r--r-- | include/filter/msfilter/svdfppt.hxx | 1564 | ||||
-rw-r--r-- | include/filter/msfilter/svxmsbas.hxx | 75 | ||||
-rw-r--r-- | include/filter/msfilter/util.hxx | 81 |
15 files changed, 5775 insertions, 0 deletions
diff --git a/include/filter/msfilter/countryid.hxx b/include/filter/msfilter/countryid.hxx new file mode 100644 index 000000000000..b70f649b05c3 --- /dev/null +++ b/include/filter/msfilter/countryid.hxx @@ -0,0 +1,311 @@ +/* -*- 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_SVX_COUNTRYID_HXX +#define INCLUDED_SVX_COUNTRYID_HXX + +#include <sal/types.h> +#include <i18nlangtag/lang.h> +#include "filter/msfilter/msfilterdllapi.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_ARGENTINIA = 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_MADAGASKAR = 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 ); + +// ============================================================================ + +} // namespace svx + +// ============================================================================ + +#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 000000000000..e4e9e90a5a6e --- /dev/null +++ b/include/filter/msfilter/dffpropset.hxx @@ -0,0 +1,70 @@ +/* -*- 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 _DFFPROPSET_HXX +#define _DFFPROPSET_HXX + +#include <tools/solar.h> +#include <filter/msfilter/msfilterdllapi.h> +#include <filter/msfilter/dffrecordheader.hxx> +#include <tools/stream.hxx> +#include <vector> + +struct DffPropFlags +{ + sal_uInt8 bSet : 1; + sal_uInt8 bComplex : 1; + sal_uInt8 bBlip : 1; + sal_uInt8 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(); + + inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); }; + sal_Bool IsHardAttribute( sal_uInt32 nId ) const; + sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const; + /** Returns a boolean property by its real identifier. */ + bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const; + /** Returns a string property. */ + OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const; + sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const; + void InitializePropSet( sal_uInt16 nPropSetType ) const; + + friend SvStream& operator>>( 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 000000000000..ca2fcc368c46 --- /dev/null +++ b/include/filter/msfilter/dffrecordheader.hxx @@ -0,0 +1,63 @@ +/* -*- 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 _DFFRECORDHEADER_HXX +#define _DFFRECORDHEADER_HXX + +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <filter/msfilter/msfilterdllapi.h> +#include <svx/msdffdef.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_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; + return nPos == rIn.Seek(nPos); + } + bool SeekToContent(SvStream& rIn) const + { + sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE; + return nPos == rIn.Seek(nPos); + } + bool SeekToBegOfRecord(SvStream& rIn) const + { + return nFilePos == rIn.Seek(nFilePos); + } + + MSFILTER_DLLPUBLIC friend SvStream& operator>>(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 000000000000..b57d269d30b0 --- /dev/null +++ b/include/filter/msfilter/escherex.hxx @@ -0,0 +1,1721 @@ +/* -*- 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 _SVX_ESCHEREX_HXX +#define _SVX_ESCHEREX_HXX + +#include <memory> +#include <vector> +#include <boost/shared_ptr.hpp> +#include <tools/solar.h> +#include <tools/gen.hxx> +#include <tools/stream.hxx> +#include <com/sun/star/uno/Reference.h> +#include <svtools/grfmgr.hxx> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/drawing/Hatch.hpp> +#include <svx/msdffdef.hxx> +#include "filter/msfilter/msfilterdllapi.h" + + /*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 0xF000 /* per-document data X X X */ +#define ESCHER_Dgg 0xF006 /* an FDGG and several FIDCLs X X X 0 */ +#define ESCHER_CLSID 0xF016 /* the CLSID of the application that put the data on the clipboard C C C 0 */ +#define ESCHER_OPT 0xF00B /* count of properties the document-wide default shape properties X X X 3 */ +#define ESCHER_ColorMRU 0xF11A /* count of colors the colors in the MRU swatch X X X 0 */ +#define ESCHER_SplitMenuColors 0xF11E /* count of colors the colors in the top-level split menus X X X 0 */ +#define ESCHER_BstoreContainer 0xF001 /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */ +#define ESCHER_BSE 0xF007 /* BLIP type an FBSE (one per BLIP) X X X 2 */ +#define ESCHER_BlipFirst 0xF018 /* range of fbts reserved for various kinds of BLIPs X X X */ +#define ESCHER_BlipLast 0xF117 /* range of fbts reserved for various kinds of BLIPs X X X */ + +#define ESCHER_DgContainer 0xF002 /* per-sheet/page/slide data X X X */ +#define ESCHER_Dg 0xF008 /* drawing ID an FDG X X X 0 */ +#define ESCHER_RegroupItems 0xF118 /* count of regroup entries several FRITs X X X 0 */ +#define ESCHER_ColorScheme 0xF120 /* count of colors the colors of the source host's color scheme C C 0 */ +#define ESCHER_SpgrContainer 0xF003 /* several SpContainers, the first of which is the group shape itself X X X */ +#define ESCHER_SpContainer 0xF004 /* a shape X X X */ +#define ESCHER_Spgr 0xF009 /* an FSPGR; only present if the shape is a group shape X X X 1 */ +#define ESCHER_Sp 0xF00A /* shape type an FSP X X X 2 */ +//#define ESCHER_OPT 0xF00B /* count of properties a shape property table X X X 3 */ +#define ESCHER_Textbox 0xF00C /* RTF text C C C 0 */ +#define ESCHER_ClientTextbox 0xF00D /* host-defined the text in the textbox, in host-defined format X X X */ +#define ESCHER_Anchor 0xF00E /* a RECT, in 100000ths of an inch C C C 0 */ +#define ESCHER_ChildAnchor 0xF00F /* a RECT, in units relative to the parent group X X X 0 */ +#define ESCHER_ClientAnchor 0xF010 /* host-defined the location of the shape, in a host-defined format X X X */ +#define ESCHER_ClientData 0xF011 /* host-defined host-specific data X X X */ +#define ESCHER_OleObject 0xF11F /* a serialized IStorage for an OLE object C C C 0 */ +#define ESCHER_DeletedPspl 0xF11D /* an FPSPL; only present in top-level deleted shapes X 0 */ +#define ESCHER_SolverContainer 0xF005 /* count of rules the rules governing shapes X X X */ +#define ESCHER_ConnectorRule 0xF012 /* an FConnectorRule X X 1 */ +#define ESCHER_AlignRule 0xF013 /* an FAlignRule X X X 0 */ +#define ESCHER_ArcRule 0xF014 /* an FARCRU X X X 0 */ +#define ESCHER_ClientRule 0xF015 /* host-defined host-defined */ +#define ESCHER_CalloutRule 0xF017 /* an FCORU X X X 0 */ +#define ESCHER_Selection 0xF119 /* an FDGSL followed by the SPIDs of the shapes in the selection X 0 */ +#define ESCHER_UDefProp 0xF122 + +#define SHAPEFLAG_GROUP 0x001 /* This shape is a group shape */ +#define SHAPEFLAG_CHILD 0x002 /* Not a top-level shape */ +#define SHAPEFLAG_PATRIARCH 0x004 /* This is the topmost group shape. Exactly one of these per drawing. */ +#define SHAPEFLAG_DELETED 0x008 /* The shape has been deleted */ +#define SHAPEFLAG_OLESHAPE 0x010 /* The shape is an OLE object */ +#define SHAPEFLAG_HAVEMASTER 0x020 /* Shape has a hspMaster property */ +#define SHAPEFLAG_FLIPH 0x040 /* Shape is flipped horizontally */ +#define SHAPEFLAG_FLIPV 0x080 /* Shape is flipped vertically */ +#define SHAPEFLAG_CONNECTOR 0x100 /* Connector type of shape */ +#define SHAPEFLAG_HAVEANCHOR 0x200 /* Shape has an anchor of some kind */ +#define SHAPEFLAG_BACKGROUND 0x400 /* Background shape */ +#define SHAPEFLAG_HAVESPT 0x800 /* Shape has a shape type property */ + +#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_Diamond 4 +#define ESCHER_ShpInst_IsocelesTriangle 5 +#define ESCHER_ShpInst_RightTriangle 6 +#define ESCHER_ShpInst_Parallelogram 7 +#define ESCHER_ShpInst_Trapezoid 8 +#define ESCHER_ShpInst_Hexagon 9 +#define ESCHER_ShpInst_Octagon 10 +#define ESCHER_ShpInst_Plus 11 +#define ESCHER_ShpInst_Star 12 +#define ESCHER_ShpInst_Arrow 13 +#define ESCHER_ShpInst_ThickArrow 14 +#define ESCHER_ShpInst_HomePlate 15 +#define ESCHER_ShpInst_Cube 16 +#define ESCHER_ShpInst_Balloon 17 +#define ESCHER_ShpInst_Seal 18 +#define ESCHER_ShpInst_Arc 19 +#define ESCHER_ShpInst_Line 20 +#define ESCHER_ShpInst_Plaque 21 +#define ESCHER_ShpInst_Can 22 +#define ESCHER_ShpInst_Donut 23 +#define ESCHER_ShpInst_TextSimple 24 +#define ESCHER_ShpInst_TextOctagon 25 +#define ESCHER_ShpInst_TextHexagon 26 +#define ESCHER_ShpInst_TextCurve 27 +#define ESCHER_ShpInst_TextWave 28 +#define ESCHER_ShpInst_TextRing 29 +#define ESCHER_ShpInst_TextOnCurve 30 +#define ESCHER_ShpInst_TextOnRing 31 +#define ESCHER_ShpInst_StraightConnector1 32 +#define ESCHER_ShpInst_BentConnector2 33 +#define ESCHER_ShpInst_BentConnector3 34 +#define ESCHER_ShpInst_BentConnector4 35 +#define ESCHER_ShpInst_BentConnector5 36 +#define ESCHER_ShpInst_CurvedConnector2 37 +#define ESCHER_ShpInst_CurvedConnector3 38 +#define ESCHER_ShpInst_CurvedConnector4 39 +#define ESCHER_ShpInst_CurvedConnector5 40 +#define ESCHER_ShpInst_Callout1 41 +#define ESCHER_ShpInst_Callout2 42 +#define ESCHER_ShpInst_Callout3 43 +#define ESCHER_ShpInst_AccentCallout1 44 +#define ESCHER_ShpInst_AccentCallout2 45 +#define ESCHER_ShpInst_AccentCallout3 46 +#define ESCHER_ShpInst_BorderCallout1 47 +#define ESCHER_ShpInst_BorderCallout2 48 +#define ESCHER_ShpInst_BorderCallout3 49 +#define ESCHER_ShpInst_AccentBorderCallout1 50 +#define ESCHER_ShpInst_AccentBorderCallout2 51 +#define ESCHER_ShpInst_AccentBorderCallout3 52 +#define ESCHER_ShpInst_Ribbon 53 +#define ESCHER_ShpInst_Ribbon2 54 +#define ESCHER_ShpInst_Chevron 55 +#define ESCHER_ShpInst_Pentagon 56 +#define ESCHER_ShpInst_NoSmoking 57 +#define ESCHER_ShpInst_Seal8 58 +#define ESCHER_ShpInst_Seal16 59 +#define ESCHER_ShpInst_Seal32 60 +#define ESCHER_ShpInst_WedgeRectCallout 61 +#define ESCHER_ShpInst_WedgeRRectCallout 62 +#define ESCHER_ShpInst_WedgeEllipseCallout 63 +#define ESCHER_ShpInst_Wave 64 +#define ESCHER_ShpInst_FoldedCorner 65 +#define ESCHER_ShpInst_LeftArrow 66 +#define ESCHER_ShpInst_DownArrow 67 +#define ESCHER_ShpInst_UpArrow 68 +#define ESCHER_ShpInst_LeftRightArrow 69 +#define ESCHER_ShpInst_UpDownArrow 70 +#define ESCHER_ShpInst_IrregularSeal1 71 +#define ESCHER_ShpInst_IrregularSeal2 72 +#define ESCHER_ShpInst_LightningBolt 73 +#define ESCHER_ShpInst_Heart 74 +#define ESCHER_ShpInst_PictureFrame 75 +#define ESCHER_ShpInst_QuadArrow 76 +#define ESCHER_ShpInst_LeftArrowCallout 77 +#define ESCHER_ShpInst_RightArrowCallout 78 +#define ESCHER_ShpInst_UpArrowCallout 79 +#define ESCHER_ShpInst_DownArrowCallout 80 +#define ESCHER_ShpInst_LeftRightArrowCallout 81 +#define ESCHER_ShpInst_UpDownArrowCallout 82 +#define ESCHER_ShpInst_QuadArrowCallout 83 +#define ESCHER_ShpInst_Bevel 84 +#define ESCHER_ShpInst_LeftBracket 85 +#define ESCHER_ShpInst_RightBracket 86 +#define ESCHER_ShpInst_LeftBrace 87 +#define ESCHER_ShpInst_RightBrace 88 +#define ESCHER_ShpInst_LeftUpArrow 89 +#define ESCHER_ShpInst_BentUpArrow 90 +#define ESCHER_ShpInst_BentArrow 91 +#define ESCHER_ShpInst_Seal24 92 +#define ESCHER_ShpInst_StripedRightArrow 93 +#define ESCHER_ShpInst_NotchedRightArrow 94 +#define ESCHER_ShpInst_BlockArc 95 +#define ESCHER_ShpInst_SmileyFace 96 +#define ESCHER_ShpInst_VerticalScroll 97 +#define ESCHER_ShpInst_HorizontalScroll 98 +#define ESCHER_ShpInst_CircularArrow 99 +#define ESCHER_ShpInst_NotchedCircularArrow 100 +#define ESCHER_ShpInst_UturnArrow 101 +#define ESCHER_ShpInst_CurvedRightArrow 102 +#define ESCHER_ShpInst_CurvedLeftArrow 103 +#define ESCHER_ShpInst_CurvedUpArrow 104 +#define ESCHER_ShpInst_CurvedDownArrow 105 +#define ESCHER_ShpInst_CloudCallout 106 +#define ESCHER_ShpInst_EllipseRibbon 107 +#define ESCHER_ShpInst_EllipseRibbon2 108 +#define ESCHER_ShpInst_FlowChartProcess 109 +#define ESCHER_ShpInst_FlowChartDecision 110 +#define ESCHER_ShpInst_FlowChartInputOutput 111 +#define ESCHER_ShpInst_FlowChartPredefinedProcess 112 +#define ESCHER_ShpInst_FlowChartInternalStorage 113 +#define ESCHER_ShpInst_FlowChartDocument 114 +#define ESCHER_ShpInst_FlowChartMultidocument 115 +#define ESCHER_ShpInst_FlowChartTerminator 116 +#define ESCHER_ShpInst_FlowChartPreparation 117 +#define ESCHER_ShpInst_FlowChartManualInput 118 +#define ESCHER_ShpInst_FlowChartManualOperation 119 +#define ESCHER_ShpInst_FlowChartConnector 120 +#define ESCHER_ShpInst_FlowChartPunchedCard 121 +#define ESCHER_ShpInst_FlowChartPunchedTape 122 +#define ESCHER_ShpInst_FlowChartSummingJunction 123 +#define ESCHER_ShpInst_FlowChartOr 124 +#define ESCHER_ShpInst_FlowChartCollate 125 +#define ESCHER_ShpInst_FlowChartSort 126 +#define ESCHER_ShpInst_FlowChartExtract 127 +#define ESCHER_ShpInst_FlowChartMerge 128 +#define ESCHER_ShpInst_FlowChartOfflineStorage 129 +#define ESCHER_ShpInst_FlowChartOnlineStorage 130 +#define ESCHER_ShpInst_FlowChartMagneticTape 131 +#define ESCHER_ShpInst_FlowChartMagneticDisk 132 +#define ESCHER_ShpInst_FlowChartMagneticDrum 133 +#define ESCHER_ShpInst_FlowChartDisplay 134 +#define ESCHER_ShpInst_FlowChartDelay 135 +#define ESCHER_ShpInst_TextPlainText 136 +#define ESCHER_ShpInst_TextStop 137 +#define ESCHER_ShpInst_TextTriangle 138 +#define ESCHER_ShpInst_TextTriangleInverted 139 +#define ESCHER_ShpInst_TextChevron 140 +#define ESCHER_ShpInst_TextChevronInverted 141 +#define ESCHER_ShpInst_TextRingInside 142 +#define ESCHER_ShpInst_TextRingOutside 143 +#define ESCHER_ShpInst_TextArchUpCurve 144 +#define ESCHER_ShpInst_TextArchDownCurve 145 +#define ESCHER_ShpInst_TextCircleCurve 146 +#define ESCHER_ShpInst_TextButtonCurve 147 +#define ESCHER_ShpInst_TextArchUpPour 148 +#define ESCHER_ShpInst_TextArchDownPour 149 +#define ESCHER_ShpInst_TextCirclePour 150 +#define ESCHER_ShpInst_TextButtonPour 151 +#define ESCHER_ShpInst_TextCurveUp 152 +#define ESCHER_ShpInst_TextCurveDown 153 +#define ESCHER_ShpInst_TextCascadeUp 154 +#define ESCHER_ShpInst_TextCascadeDown 155 +#define ESCHER_ShpInst_TextWave1 156 +#define ESCHER_ShpInst_TextWave2 157 +#define ESCHER_ShpInst_TextWave3 158 +#define ESCHER_ShpInst_TextWave4 159 +#define ESCHER_ShpInst_TextInflate 160 +#define ESCHER_ShpInst_TextDeflate 161 +#define ESCHER_ShpInst_TextInflateBottom 162 +#define ESCHER_ShpInst_TextDeflateBottom 163 +#define ESCHER_ShpInst_TextInflateTop 164 +#define ESCHER_ShpInst_TextDeflateTop 165 +#define ESCHER_ShpInst_TextDeflateInflate 166 +#define ESCHER_ShpInst_TextDeflateInflateDeflate 167 +#define ESCHER_ShpInst_TextFadeRight 168 +#define ESCHER_ShpInst_TextFadeLeft 169 +#define ESCHER_ShpInst_TextFadeUp 170 +#define ESCHER_ShpInst_TextFadeDown 171 +#define ESCHER_ShpInst_TextSlantUp 172 +#define ESCHER_ShpInst_TextSlantDown 173 +#define ESCHER_ShpInst_TextCanUp 174 +#define ESCHER_ShpInst_TextCanDown 175 +#define ESCHER_ShpInst_FlowChartAlternateProcess 176 +#define ESCHER_ShpInst_FlowChartOffpageConnector 177 +#define ESCHER_ShpInst_Callout90 178 +#define ESCHER_ShpInst_AccentCallout90 179 +#define ESCHER_ShpInst_BorderCallout90 180 +#define ESCHER_ShpInst_AccentBorderCallout90 181 +#define ESCHER_ShpInst_LeftRightUpArrow 182 +#define ESCHER_ShpInst_Sun 183 +#define ESCHER_ShpInst_Moon 184 +#define ESCHER_ShpInst_BracketPair 185 +#define ESCHER_ShpInst_BracePair 186 +#define ESCHER_ShpInst_Seal4 187 +#define ESCHER_ShpInst_DoubleWave 188 +#define ESCHER_ShpInst_ActionButtonBlank 189 +#define ESCHER_ShpInst_ActionButtonHome 190 +#define ESCHER_ShpInst_ActionButtonHelp 191 +#define ESCHER_ShpInst_ActionButtonInformation 192 +#define ESCHER_ShpInst_ActionButtonForwardNext 193 +#define ESCHER_ShpInst_ActionButtonBackPrevious 194 +#define ESCHER_ShpInst_ActionButtonEnd 195 +#define ESCHER_ShpInst_ActionButtonBeginning 196 +#define ESCHER_ShpInst_ActionButtonReturn 197 +#define ESCHER_ShpInst_ActionButtonDocument 198 +#define ESCHER_ShpInst_ActionButtonSound 199 +#define ESCHER_ShpInst_ActionButtonMovie 200 +#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 +}; + +enum ESCHER_cDir +{ + ESCHER_cDir0, // Right + ESCHER_cDir90, // Down + ESCHER_cDir180, // Left + ESCHER_cDir270 // Up +}; + +// 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-@ +}; + +// text direction (needed for Bi-Di support) +enum ESCHER_txDir +{ + ESCHER_txdirLTR, // left-to-right text direction + ESCHER_txdirRTL, // right-to-left text direction + ESCHER_txdirContext // context text direction +}; + +// Callout Type +enum ESCHER_spcot +{ + ESCHER_spcotRightAngle = 1, + ESCHER_spcotOneSegment = 2, + ESCHER_spcotTwoSegment = 3, + ESCHER_spcotThreeSegment= 4 +}; + +// Callout Angle +enum ESCHER_spcoa +{ + ESCHER_spcoaAny, + ESCHER_spcoa30, + ESCHER_spcoa45, + ESCHER_spcoa60, + ESCHER_spcoa90, + ESCHER_spcoa0 +}; + +// Callout Drop +enum ESCHER_spcod +{ + ESCHER_spcodTop, + ESCHER_spcodCenter, + ESCHER_spcodBottom, + ESCHER_spcodSpecified +}; + +// FontWork alignment +enum ESCHER_GeoTextAlign +{ + ESCHER_AlignTextStretch, // Stretch each line of text to fit width. + ESCHER_AlignTextCenter, // Center text on width. + ESCHER_AlignTextLeft, // Left justify. + ESCHER_AlignTextRight, // Right justify. + ESCHER_AlignTextLetterJust, // Spread letters out to fit width. + ESCHER_AlignTextWordJust, // Spread words out to fit width. + ESCHER_AlignTextInvalid // Invalid +}; + +// 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 +}; + +// +enum ESCHER_3DRenderMode +{ + ESCHER_FullRender, // Generate a full rendering + ESCHER_Wireframe, // Generate a wireframe + ESCHER_BoundingCube // Generate a bounding cube +}; + +// +enum ESCHER_xFormType +{ + ESCHER_xFormAbsolute, // Apply transform in absolute space centered on shape + ESCHER_xFormShape, // Apply transform to shape geometry + ESCHER_xFormDrawing // Apply transform in drawing space +}; + +// +enum ESCHER_ShadowType +{ + ESCHER_ShadowOffset, // N pixel offset shadow + ESCHER_ShadowDouble, // Use second offset too + ESCHER_ShadowRich, // Rich perspective shadow (cast relative to shape) + ESCHER_ShadowShape, // Rich perspective shadow (cast in shape space) + ESCHER_ShadowDrawing, // Perspective shadow cast in drawing space + ESCHER_ShadowEmbossOrEngrave +}; + +// - the type of a (length) measurement +enum ESCHER_dzType + { + ESCHER_dzTypeMin = 0, + ESCHER_dzTypeDefault = 0, // Default size, ignore the values + ESCHER_dzTypeA = 1, // Values are in EMUs + ESCHER_dzTypeV = 2, // Values are in pixels + ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size + ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed + ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio + ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio + ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio + ESCHER_dzTypeFixedAspectEnlarge= 8, // Aspect ratio is fixed, favor larger size + ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio + ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio + ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio + ESCHER_dzTypeMax = 11 +}; + +// how to interpret the colors in a shaded fill. +enum ESCHER_ShadeType +{ + ESCHER_ShadeNone = 0, // Interpolate without correction between RGBs + ESCHER_ShadeGamma = 1, // Apply gamma correction to colors + ESCHER_ShadeSigma = 2, // Apply a sigma transfer function to position + ESCHER_ShadeBand = 4, // Add a flat band at the start of the shade + ESCHER_ShadeOneColor = 8, // This is a one color shade + + /* A parameter for the band or sigma function can be stored in the top + 16 bits of the value - this is a proportion of *each* band of the + shade to make flat (or the approximate equal value for a sigma + function). NOTE: the parameter is not used for the sigma function, + instead a built in value is used. This value should not be changed + from the default! */ + ESCHER_ShadeParameterShift = 16, + ESCHER_ShadeParameterMask = 0xffff0000, + + ESCHER_ShadeDefault = (ESCHER_ShadeGamma|ESCHER_ShadeSigma| + (16384<<ESCHER_ShadeParameterShift)) +}; + +// compound line style +enum ESCHER_LineStyle +{ + ESCHER_LineSimple, // Single line (of width lineWidth) + ESCHER_LineDouble, // Double lines of equal width + ESCHER_LineThickThin, // Double lines, one thick, one thin + ESCHER_LineThinThick, // Double lines, reverse order + ESCHER_LineTriple // Three lines, thin, thick, thin +}; + +// how to "fill" the line contour +enum ESCHER_LineType +{ + ESCHER_lineSolidType, // Fill with a solid color + ESCHER_linePattern, // Fill with a pattern (bitmap) + ESCHER_lineTexture, // A texture (pattern with its own color map) + ESCHER_linePicture // Center a picture in the shape +}; + +// 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_LineEndLenght +{ + 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 +}; + +// 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_LockRotation 119 /* sal_Bool No rotation */ +#define ESCHER_Prop_LockAspectRatio 120 /* sal_Bool Don't allow changes in aspect ratio */ +#define ESCHER_Prop_LockPosition 121 /* sal_Bool Don't allow the shape to be moved */ +#define ESCHER_Prop_LockAgainstSelect 122 /* sal_Bool Shape may not be selected */ +#define ESCHER_Prop_LockCropping 123 /* sal_Bool No cropping this shape */ +#define ESCHER_Prop_LockVertices 124 /* sal_Bool Edit Points not allowed */ +#define ESCHER_Prop_LockText 125 /* sal_Bool Do not edit text */ +#define ESCHER_Prop_LockAdjustHandles 126 /* sal_Bool Do not adjust */ +#define ESCHER_Prop_LockAgainstGrouping 127 /* sal_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_scaleText 134 /* LONG Text zoom/scale (used if fFitTextToShape) */ +#define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */ +#define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */ +#define ESCHER_Prop_cdirFont 137 /* MSOCDIR Font rotation */ +#define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */ +#define ESCHER_Prop_txdir 139 /* MSOTXDIR Bi-Di Text direction */ +#define ESCHER_Prop_SelectText 187 /* sal_Bool sal_True if single click selects text, sal_False if two clicks */ +#define ESCHER_Prop_AutoTextMargin 188 /* sal_Bool use host's margin calculations */ +#define ESCHER_Prop_RotateText 189 /* sal_Bool Rotate text with shape */ +#define ESCHER_Prop_FitShapeToText 190 /* sal_Bool Size shape to fit text size */ +#define ESCHER_Prop_FitTextToShape 191 /* sal_Bool Size text to fit shape size */ +// GeoText +#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */ +#define ESCHER_Prop_gtextRTF 193 /* char* RTF text string */ +#define ESCHER_Prop_gtextAlign 194 /* MSOGEOTEXTALIGN alignment on curve */ +#define ESCHER_Prop_gtextSize 195 /* LONG default point size */ +#define ESCHER_Prop_gtextSpacing 196 /* LONG fixed point 16.16 */ +#define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */ +#define ESCHER_Prop_gtextFReverseRows 240 /* sal_Bool Reverse row order */ +#define ESCHER_Prop_fGtext 241 /* sal_Bool Has text effect */ +#define ESCHER_Prop_gtextFVertical 242 /* sal_Bool Rotate characters */ +#define ESCHER_Prop_gtextFKern 243 /* sal_Bool Kern characters */ +#define ESCHER_Prop_gtextFTight 244 /* sal_Bool Tightening or tracking */ +#define ESCHER_Prop_gtextFStretch 245 /* sal_Bool Stretch to fit shape */ +#define ESCHER_Prop_gtextFShrinkFit 246 /* sal_Bool Char bounding box */ +#define ESCHER_Prop_gtextFBestFit 247 /* sal_Bool Scale text-on-path */ +#define ESCHER_Prop_gtextFNormalize 248 /* sal_Bool Stretch char height */ +#define ESCHER_Prop_gtextFDxMeasure 249 /* sal_Bool Do not measure along path */ +#define ESCHER_Prop_gtextFBold 250 /* sal_Bool Bold font */ +#define ESCHER_Prop_gtextFItalic 251 /* sal_Bool Italic font */ +#define ESCHER_Prop_gtextFUnderline 252 /* sal_Bool Underline font */ +#define ESCHER_Prop_gtextFShadow 253 /* sal_Bool Shadow font */ +#define ESCHER_Prop_gtextFSmallcaps 254 /* sal_Bool Small caps font */ +#define ESCHER_Prop_gtextFStrikethrough 255 /* sal_Bool Strike through font */ +// 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_pictureTransparent 263 /* LONG transparent color (none if ~0UL) */ +#define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */ +#define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */ +#define ESCHER_Prop_pictureGamma 266 /* LONG 16.16 gamma */ +#define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */ +#define ESCHER_Prop_pictureDblCrMod 268 /* MSOCLR Modification used if shape has double shadow */ +#define ESCHER_Prop_pictureFillCrMod 269 /* MSOCLR */ +#define ESCHER_Prop_pictureLineCrMod 270 /* MSOCLR */ +#define ESCHER_Prop_pibPrint 271 /* IMsoBlip* Blip to display when printing */ +#define ESCHER_Prop_pibPrintName 272 /* WCHAR* Blip file name */ +#define ESCHER_Prop_pibPrintFlags 273 /* MSOBLIPFLAGS Blip flags */ +#define ESCHER_Prop_fNoHitTestPicture 316 /* sal_Bool Do not hit test the picture */ +#define ESCHER_Prop_pictureGray 317 /* sal_Bool grayscale display */ +#define ESCHER_Prop_pictureBiLevel 318 /* sal_Bool bi-level display */ +#define ESCHER_Prop_pictureActive 319 /* sal_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_adjust3Value 329 /* LONG of the shape. The number of values */ +#define ESCHER_Prop_adjust4Value 330 /* LONG used and their allowable ranges vary */ +#define ESCHER_Prop_adjust5Value 331 /* LONG from shape type to shape type. */ +#define ESCHER_Prop_adjust6Value 332 /* LONG */ +#define ESCHER_Prop_adjust7Value 333 /* LONG */ +#define ESCHER_Prop_adjust8Value 334 /* LONG */ +#define ESCHER_Prop_adjust9Value 335 /* LONG */ +#define ESCHER_Prop_adjust10Value 336 /* LONG */ +#define ESCHER_Prop_fShadowOK 378 /* sal_Bool Shadow may be set */ +#define ESCHER_Prop_f3DOK 379 /* sal_Bool 3D may be set */ +#define ESCHER_Prop_fLineOK 380 /* sal_Bool Line style may be set */ +#define ESCHER_Prop_fGtextOK 381 /* sal_Bool Text effect (FontWork) supported */ +#define ESCHER_Prop_fFillShadeShapeOK 382 /* sal_Bool */ +#define ESCHER_Prop_fFillOK 383 /* sal_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_fillCrMod 389 /* MSOCLR Modification for BW views */ +#define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */ +#define ESCHER_Prop_fillBlipName 391 /* WCHAR* Blip file name */ +#define ESCHER_Prop_fillBlipFlags 392 /* MSOBLIPFLAGS Blip flags */ +#define ESCHER_Prop_fillWidth 393 /* LONG How big (A units) to make a metafile texture. */ +#define ESCHER_Prop_fillHeight 394 /* LONG */ +#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_fillRectLeft 401 /* LONG For shaded fills, use the specified rectangle */ +#define ESCHER_Prop_fillRectTop 402 /* LONG instead of the shape's bounding rect to */ +#define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */ +#define ESCHER_Prop_fillRectBottom 404 /* LONG */ +#define ESCHER_Prop_fillDztype 405 /* MSODZTYPE */ +#define ESCHER_Prop_fillShadePreset 406 /* LONG Special shades */ +#define ESCHER_Prop_fillShadeColors 407 /* IMsoArray a preset array of colors */ +#define ESCHER_Prop_fillOriginX 408 /* LONG */ +#define ESCHER_Prop_fillOriginY 409 /* LONG */ +#define ESCHER_Prop_fillShapeOriginX 410 /* LONG */ +#define ESCHER_Prop_fillShapeOriginY 411 /* LONG */ +#define ESCHER_Prop_fillShadeType 412 /* MSOSHADETYPE Type of shading, if a shaded (gradient) fill. */ +#define ESCHER_Prop_fFilled 443 /* sal_Bool Is shape filled? */ +#define ESCHER_Prop_fHitTestFill 444 /* sal_Bool Should we hit test fill? */ +#define ESCHER_Prop_fillShape 445 /* sal_Bool Register pattern on shape */ +#define ESCHER_Prop_fillUseRect 446 /* sal_Bool Use the large rect? */ +#define ESCHER_Prop_fNoFillHitTest 447 /* sal_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_lineCrMod 451 /* MSOCLR Modification for BW views */ +#define ESCHER_Prop_lineType 452 /* MSOLINETYPE Type of line */ +#define ESCHER_Prop_lineFillBlip 453 /* IMsoBlip* Pattern/texture */ +#define ESCHER_Prop_lineFillBlipName 454 /* WCHAR* Blip file name */ +#define ESCHER_Prop_lineFillBlipFlags 455 /* MSOBLIPFLAGS Blip flags */ +#define ESCHER_Prop_lineFillWidth 456 /* LONG How big (A units) to make */ +#define ESCHER_Prop_lineFillHeight 457 /* LONG a metafile texture. */ +#define ESCHER_Prop_lineFillDztype 458 /* MSODZTYPE How to interpret fillWidth/Height numbers. */ +#define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */ +#define ESCHER_Prop_lineMiterLimit 460 /* LONG ratio (16.16) of width */ +#define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */ +#define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */ +#define ESCHER_Prop_lineDashStyle 463 /* IMsoArray As Win32 ExtCreatePen */ +#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_fArrowheadsOK 507 /* sal_Bool Allow arrowheads if prop. is set */ +#define ESCHER_Prop_fLine 508 /* sal_Bool Any line? */ +#define ESCHER_Prop_fHitTestLine 509 /* sal_Bool Should we hit test lines? */ +#define ESCHER_Prop_lineFillShape 510 /* sal_Bool Register pattern on shape */ +#define ESCHER_Prop_fNoLineDrawDash 511 /* sal_Bool Draw a dashed line if no line */ +// ShadowStyle +#define ESCHER_Prop_shadowType 512 /* MSOSHADOWTYPE Type of effect */ +#define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */ +#define ESCHER_Prop_shadowHighlight 514 /* MSOCLR Embossed color */ +#define ESCHER_Prop_shadowCrMod 515 /* MSOCLR Modification for BW views */ +#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_shadowSecondOffsetX 519 /* LONG Double offset shadow */ +#define ESCHER_Prop_shadowSecondOffsetY 520 /* LONG Double offset shadow */ +#define ESCHER_Prop_shadowScaleXToX 521 /* LONG 16.16 */ +#define ESCHER_Prop_shadowScaleYToX 522 /* LONG 16.16 */ +#define ESCHER_Prop_shadowScaleXToY 523 /* LONG 16.16 */ +#define ESCHER_Prop_shadowScaleYToY 524 /* LONG 16.16 */ +#define ESCHER_Prop_shadowPerspectiveX 525 /* LONG 16.16 / weight */ +#define ESCHER_Prop_shadowPerspectiveY 526 /* LONG 16.16 / weight */ +#define ESCHER_Prop_shadowWeight 527 /* LONG scaling factor */ +#define ESCHER_Prop_shadowOriginX 528 /* LONG */ +#define ESCHER_Prop_shadowOriginY 529 /* LONG */ +#define ESCHER_Prop_fShadow 574 /* sal_Bool Any shadow? */ +#define ESCHER_Prop_fshadowObscured 575 /* sal_Bool Excel5-style shadow */ +// PerspectiveStyle +#define ESCHER_Prop_perspectiveType 576 /* MSOXFORMTYPE Where transform applies */ +#define ESCHER_Prop_perspectiveOffsetX 577 /* LONG The LONG values define a */ +#define ESCHER_Prop_perspectiveOffsetY 578 /* LONG transformation matrix, */ +#define ESCHER_Prop_perspectiveScaleXToX 579 /* LONG effectively, each value */ +#define ESCHER_Prop_perspectiveScaleYToX 580 /* LONG is scaled by the */ +#define ESCHER_Prop_perspectiveScaleXToY 581 /* LONG perspectiveWeight parameter. */ +#define ESCHER_Prop_perspectiveScaleYToY 582 /* LONG */ +#define ESCHER_Prop_perspectivePerspectiveX 583 /* LONG */ +#define ESCHER_Prop_perspectivePerspectiveY 584 /* LONG */ +#define ESCHER_Prop_perspectiveWeight 585 /* LONG Scaling factor */ +#define ESCHER_Prop_perspectiveOriginX 586 /* LONG */ +#define ESCHER_Prop_perspectiveOriginY 587 /* LONG */ +#define ESCHER_Prop_fPerspective 639 /* sal_Bool On/off */ +// 3D Object +#define ESCHER_Prop_c3DSpecularAmt 640 /* LONG Fixed-point 16.16 */ +#define ESCHER_Prop_c3DDiffuseAmt 641 /* LONG Fixed-point 16.16 */ +#define ESCHER_Prop_c3DShininess 642 /* LONG Default gives OK results */ +#define ESCHER_Prop_c3DEdgeThickness 643 /* LONG Specular edge thickness */ +#define ESCHER_Prop_c3DExtrudeForward 644 /* LONG Distance of extrusion in EMUs */ +#define ESCHER_Prop_c3DExtrudeBackward 645 /* LONG */ +#define ESCHER_Prop_c3DExtrudePlane 646 /* LONG Extrusion direction */ +#define ESCHER_Prop_c3DExtrusionColor 647 /* MSOCLR Basic color of extruded part of shape; the lighting model used will determine the exact shades used when rendering. */ +#define ESCHER_Prop_c3DCrMod 648 /* MSOCLR Modification for BW views */ +#define ESCHER_Prop_f3D 700 /* sal_Bool Does this shape have a 3D effect? */ +#define ESCHER_Prop_fc3DMetallic 701 /* sal_Bool Use metallic specularity? */ +#define ESCHER_Prop_fc3DUseExtrusionColor 702 /* sal_Bool */ +#define ESCHER_Prop_fc3DLightFace 703 /* sal_Bool */ +// 3D Style +#define ESCHER_Prop_c3DYRotationAngle 704 /* LONG degrees (16.16) about y axis */ +#define ESCHER_Prop_c3DXRotationAngle 705 /* LONG degrees (16.16) about x axis */ +#define ESCHER_Prop_c3DRotationAxisX 706 /* LONG These specify the rotation axis; */ +#define ESCHER_Prop_c3DRotationAxisY 707 /* LONG only their relative magnitudes */ +#define ESCHER_Prop_c3DRotationAxisZ 708 /* LONG matter. */ +#define ESCHER_Prop_c3DRotationAngle 709 /* LONG degrees (16.16) about axis */ +#define ESCHER_Prop_c3DRotationCenterX 710 /* LONG rotation center x (16.16 or g-units) */ +#define ESCHER_Prop_c3DRotationCenterY 711 /* LONG rotation center y (16.16 or g-units) */ +#define ESCHER_Prop_c3DRotationCenterZ 712 /* LONG rotation center z (absolute (emus)) */ +#define ESCHER_Prop_c3DRenderMode 713 /* MSO3DRENDERMODE Full,wireframe, or bcube */ +#define ESCHER_Prop_c3DTolerance 714 /* LONG pixels (16.16) */ +#define ESCHER_Prop_c3DXViewpoint 715 /* LONG X view point (emus) */ +#define ESCHER_Prop_c3DYViewpoint 716 /* LONG Y view point (emus) */ +#define ESCHER_Prop_c3DZViewpoint 717 /* LONG Z view distance (emus) */ +#define ESCHER_Prop_c3DOriginX 718 /* LONG */ +#define ESCHER_Prop_c3DOriginY 719 /* LONG */ +#define ESCHER_Prop_c3DSkewAngle 720 /* LONG degree (16.16) skew angle */ +#define ESCHER_Prop_c3DSkewAmount 721 /* LONG Percentage skew amount */ +#define ESCHER_Prop_c3DAmbientIntensity 722 /* LONG Fixed point intensity */ +#define ESCHER_Prop_c3DKeyX 723 /* LONG Key light source direc- */ +#define ESCHER_Prop_c3DKeyY 724 /* LONG tion; only their relative */ +#define ESCHER_Prop_c3DKeyZ 725 /* LONG magnitudes matter */ +#define ESCHER_Prop_c3DKeyIntensity 726 /* LONG Fixed point intensity */ +#define ESCHER_Prop_c3DFillX 727 /* LONG Fill light source direc- */ +#define ESCHER_Prop_c3DFillY 728 /* LONG tion; only their relative */ +#define ESCHER_Prop_c3DFillZ 729 /* LONG magnitudes matter */ +#define ESCHER_Prop_c3DFillIntensity 730 /* LONG Fixed point intensity */ +#define ESCHER_Prop_fc3DConstrainRotation 763 /* sal_Bool */ +#define ESCHER_Prop_fc3DRotationCenterAuto 764 /* sal_Bool */ +#define ESCHER_Prop_fc3DParallel 765 /* sal_Bool Parallel projection? */ +#define ESCHER_Prop_fc3DKeyHarsh 766 /* sal_Bool Is key lighting harsh? */ +#define ESCHER_Prop_fc3DFillHarsh 767 /* sal_Bool Is fill lighting harsh? */ +// 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_bWModePureBW 773 /* ESCHERwMode be made when in different */ +#define ESCHER_Prop_bWModeBW 774 /* ESCHERwMode forms of black-and-white mode. */ +#define ESCHER_Prop_fOleIcon 826 /* sal_Bool For OLE objects, whether the object is in icon form */ +#define ESCHER_Prop_fPreferRelativeResize 827 /* sal_Bool For UI only. Prefer relative resizing. */ +#define ESCHER_Prop_fLockShapeType 828 /* sal_Bool Lock the shape type (don't allow Change Shape) */ +#define ESCHER_Prop_fDeleteAttachedObject 830 /* sal_Bool */ +#define ESCHER_Prop_fBackground 831 /* sal_Bool If sal_True, this is the background shape. */ +// Callout +#define ESCHER_Prop_spcot 832 /* MSOSPCOT Callout type */ +#define ESCHER_Prop_dxyCalloutGap 833 /* LONG Distance from box to first point.(EMUs) */ +#define ESCHER_Prop_spcoa 834 /* MSOSPCOA Callout angle */ +#define ESCHER_Prop_spcod 835 /* MSOSPCOD Callout drop type */ +#define ESCHER_Prop_dxyCalloutDropSpecified 836 /* LONG if msospcodSpecified, the actual drop distance */ +#define ESCHER_Prop_dxyCalloutLengthSpecified 837 /* LONG if fCalloutLengthSpecified, the actual distance */ +#define ESCHER_Prop_fCallout 889 /* sal_Bool Is the shape a callout? */ +#define ESCHER_Prop_fCalloutAccentBar 890 /* sal_Bool does callout have accent bar */ +#define ESCHER_Prop_fCalloutTextBorder 891 /* sal_Bool does callout have a text border */ +#define ESCHER_Prop_fCalloutMinusX 892 /* sal_Bool */ +#define ESCHER_Prop_fCalloutMinusY 893 /* sal_Bool */ +#define ESCHER_Prop_fCalloutDropAuto 894 /* sal_Bool If true, then we occasionally invert the drop distance */ +#define ESCHER_Prop_fCalloutLengthSpecified 895 /* sal_Bool if true, we look at dxyCalloutLengthSpecified */ +// 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_pWrapPolygonVertices 899 /* IMsoArray The polygon that text will be wrapped around (Word) */ +#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_lidRegroup 904 /* LONG Regroup ID */ +#define ESCHER_Prop_tableProperties 927 +#define ESCHER_Prop_tableRowProperties 928 +#define ESCHER_Prop_fEditedWrap 953 /* sal_Bool Has the wrap polygon been edited? */ +#define ESCHER_Prop_fBehindDocument 954 /* sal_Bool Word-only (shape is behind text) */ +#define ESCHER_Prop_fOnDblClickNotify 955 /* sal_Bool Notify client on a double click */ +#define ESCHER_Prop_fIsButton 956 /* sal_Bool A button shape (i.e., clicking performs an action). Set for shapes with attached hyperlinks or macros. */ +#define ESCHER_Prop_fOneD 957 /* sal_Bool 1D adjustment */ +#define ESCHER_Prop_fHidden 958 /* sal_Bool Do not display */ +#define ESCHER_Prop_fPrint 959 /* sal_Bool Print this shape */ + +#define ESCHER_PERSISTENTRY_PREALLOCATE 64 + +#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 { namespace sun { namespace star { + namespace awt { + struct Gradient; + } + namespace drawing { + struct EnhancedCustomShapeAdjustmentValue; + class XShape; + class XShapes; + } +}}} + +struct MSFILTER_DLLPUBLIC EscherConnectorListEntry +{ + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnector; + ::com::sun::star::awt::Point maPointA; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToA; + ::com::sun::star::awt::Point maPointB; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToB; + + sal_uInt32 GetConnectorRule( sal_Bool bFirst ); + + EscherConnectorListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rC, + const ::com::sun::star::awt::Point& rPA, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSA , + const ::com::sun::star::awt::Point& rPB, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSB ) : + mXConnector ( rC ), + maPointA ( rPA ), + mXConnectToA( rSA ), + maPointB ( rPB ), + mXConnectToB( rSB ) {} + + sal_uInt32 GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::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 sal_Bool GetPropertyValue( + ::com::sun::star::uno::Any& rAny, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + const OUString& rPropertyName, + sal_Bool bTestPropertyAvailability = sal_False + ); + + static ::com::sun::star::beans::PropertyState GetPropertyState( + const ::com::sun::star::uno::Reference < ::com::sun::star::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; + +protected: + + sal_uInt32 mnIdentifier[ 4 ]; + sal_uInt32 mnPictureOffset; // offset to the graphic im PictureStreams + sal_uInt32 mnSize; // size of real graphic + + sal_uInt32 mnRefCount; // !! reference count + sal_uInt32 mnSizeExtra; // !! size of preceding header + + ESCHER_BlibType meBlibType; + + Size maPrefSize; + MapMode maPrefMapMode; + + sal_Bool mbIsEmpty; + sal_Bool mbIsNativeGraphicPossible; + +public: + + EscherBlibEntry( + sal_uInt32 nPictureOffset, + const GraphicObject& rObj, + const OString& rId, + const GraphicAttr* pAttr = NULL + ); + + ~EscherBlibEntry(); + + void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 ); + sal_Bool IsEmpty() const { return mbIsEmpty; }; + + sal_Bool operator==( const EscherBlibEntry& ) const; +}; + +// --------------------------------------------------------------------------------------------- + +#define _E_GRAPH_PROV_USE_INSTANCES 1 +#define _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES 2 + +class MSFILTER_DLLPUBLIC EscherGraphicProvider +{ + sal_uInt32 mnFlags; + + EscherBlibEntry** mpBlibEntrys; + sal_uInt32 mnBlibBufSize; + sal_uInt32 mnBlibEntrys; + + OUString maBaseURI; + +protected: + + sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry ); + +public: + + sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const; + void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL ); + sal_Bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, + sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0); + sal_uInt32 GetBlibID( + SvStream& rPicOutStream, + const OString& rGraphicId, + const Rectangle& rBoundRect, + const com::sun::star::awt::Rectangle* pVisArea = NULL, + const GraphicAttr* pGrafikAttr = NULL + ); + sal_Bool HasGraphics() const { return mnBlibEntrys != 0; }; + + void SetNewBlipStreamOffset( sal_Int32 nOffset ); + + sal_Bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode ); + + void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; }; + const OUString& GetBaseURI() { return maBaseURI; }; + + EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); + ~EscherGraphicProvider(); + +}; + +struct EscherShapeListEntry; +typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl; +typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl; + +class MSFILTER_DLLPUBLIC EscherSolverContainer +{ + EscherShapeList_impl maShapeList; + EscherConnectorList_impl maConnectorList; + +public: + + sal_uInt32 GetShapeId( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape + ) const; + + void AddShape( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + sal_uInt32 nId + ); + + void AddConnector( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + const ::com::sun::star::awt::Point& rA, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + const ::com::sun::star::awt::Point& rB, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB + ); + + void WriteSolver( SvStream& ); + + EscherSolverContainer(){}; + ~EscherSolverContainer(); +}; + +// --------------------------------------------------------------------------------------------- + +#define ESCHER_CREATEPOLYGON_LINE 1 +#define ESCHER_CREATEPOLYGON_POLYLINE 2 +#define ESCHER_CREATEPOLYGON_POLYPOLYGON 4 + +class GraphicAttr; +class SdrObjCustomShape; + +struct EscherPropSortStruct +{ + sal_uInt8* pBuf; + sal_uInt32 nPropSize; + sal_uInt32 nPropValue; + sal_uInt16 nPropId; +}; + +typedef std::vector< EscherPropSortStruct > EscherProperties; + +class MSFILTER_DLLPUBLIC EscherPropertyContainer +{ + EscherGraphicProvider* pGraphicProvider; + SvStream* pPicOutStrm; + Rectangle* pShapeBoundRect; + + EscherPropSortStruct* pSortStruct; + + sal_uInt32 nSortCount; + sal_uInt32 nSortBufSize; + sal_uInt32 nCountCount; + sal_uInt32 nCountSize; + + sal_Bool bHasComplexData; + sal_Bool bSuppressRotation; + + + sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True ); + void ImplCreateGraphicAttributes( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + sal_uInt32 nBlibId, + sal_Bool bCreateCroppingAttributes + ); + sal_Bool ImplCreateEmbeddedBmp( const OString& rUniqueId ); + void ImplInit(); + +public: + + EscherPropertyContainer(); + EscherPropertyContainer( + EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know + SvStream* pPicOutStrm, // the GraphicProvider to be able to write + 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 nPropertyID, const OUString& rString ); + + void AddOpt( + sal_uInt16 nPropertyID, + sal_uInt32 nPropValue, + sal_Bool bBlib = sal_False + ); + + void AddOpt( + sal_uInt16 nPropertyID, + sal_Bool bBlib, + sal_uInt32 nPropValue, + sal_uInt8* pProp, + sal_uInt32 nPropSize + ); + + sal_Bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const; + + sal_Bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const; + + EscherProperties GetOpts() const; + + void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT ); + + sal_Bool CreateShapeProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape + ); + sal_Bool CreateOLEGraphicProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject + ); + + /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */ + sal_Bool CreateEmbeddedBitmapProperties( + const OUString& rBitmapUrl, + ::com::sun::star::drawing::BitmapMode eBitmapMode + ); + /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */ + sal_Bool CreateEmbeddedHatchProperties( + const ::com::sun::star::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). + sal_Bool CreateGraphicProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + const OUString& rSource, + const sal_Bool bCreateFillBitmap, + const sal_Bool bCreateCroppingAttributes = sal_False, + const sal_Bool bFillBitmapModeAllowed = sal_True + ); + + sal_Bool CreatePolygonProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + sal_uInt32 nFlags, + sal_Bool bBezier, + ::com::sun::star::awt::Rectangle& rGeoRect, + Polygon* pPolygon = NULL + ); + + static sal_uInt32 GetGradientColor( + const ::com::sun::star::awt::Gradient* pGradient, + sal_uInt32 nStartColor + ); + + void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient ); + void CreateGradientProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & + ); + void CreateLineProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + sal_Bool bEdge + ); + void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ); + void CreateTextProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + sal_uInt32 nText, + const sal_Bool bIsCustomShape = sal_False, + const sal_Bool bIsTextFrame = sal_True + ); + + sal_Bool CreateConnectorProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + EscherSolverContainer& rSolver, + ::com::sun::star::awt::Rectangle& rGeoRect, + sal_uInt16& rShapeType, + sal_uInt16& rShapeFlags + ); + + // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last. + // It activ only when at least a FillStyle or LineStyle is set. + sal_Bool CreateShadowProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & + ); + + // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties + void CreateCustomShapeProperties( + const MSO_SPT eShapeType, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & + ); + sal_Bool IsFontWork() const; + + // helper functions which are also used by the escher import + static PolyPolygon GetPolyPolygon( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape + ); + static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource ); + static MSO_SPT GetCustomShapeType( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + sal_uInt32& nMirrorFlags + ); + static MSO_SPT GetCustomShapeType( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + sal_uInt32& nMirrorFlags, + OUString& rShapeType + ); + + // helper functions which are also used in ooxml export + static sal_Bool GetLineArrow( + const sal_Bool bLineStart, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + ESCHER_LineEnd& reLineEnd, + sal_Int32& rnArrowLength, + sal_Int32& rnArrowWidth + ); + static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape ); + static void LookForPolarHandles( + const MSO_SPT eShapeType, + sal_Int32& nAdjustmentsWhichNeedsToBeConverted + ); + static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue ); +}; + +// --------------------------------------------------------------------------------------------- + +typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl; + +class MSFILTER_DLLPUBLIC EscherPersistTable +{ + +public: + EscherPersistTable_impl maPersistTable; + + sal_Bool PtIsID( sal_uInt32 nID ); + void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtDelete( sal_uInt32 nID ); + sal_uInt32 PtGetOffsetByID( sal_uInt32 nID ); + sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtGetCount() const { return maPersistTable.size(); }; + + EscherPersistTable(); + virtual ~EscherPersistTable(); +}; + +// --------------------------------------------------------------------------------------------- + +class EscherEx; + +/// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData +class MSFILTER_DLLPUBLIC EscherExClientRecord_Base +{ +public: + EscherExClientRecord_Base() {} + 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: + EscherExClientAnchor_Base() {} + 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 Rectangle& rRect ) = 0; +}; + +class InteractionInfo +{ + bool mbHasInteraction; + SAL_WNODEPRECATED_DECLARATIONS_PUSH + std::auto_ptr<SvMemoryStream> mpHyperlinkRecord; + SAL_WNODEPRECATED_DECLARATIONS_POP + InteractionInfo(); + +public: + InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction ) + { + mpHyperlinkRecord.reset( pStream ); + } + bool hasInteraction() { return mbHasInteraction; } + SAL_WNODEPRECATED_DECLARATIONS_PUSH + const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; } + SAL_WNODEPRECATED_DECLARATIONS_POP +}; + +class EscherExHostAppData +{ +private: + EscherExClientAnchor_Base* pClientAnchor; + EscherExClientRecord_Base* pClientData; + EscherExClientRecord_Base* pClientTextbox; + InteractionInfo* pInteractionInfo; + // ignore single shape if entire pages are written + sal_Bool bDontWriteShape; + +public: + EscherExHostAppData() : pClientAnchor(0), pClientData(0), + pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(sal_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( sal_Bool b ) + { bDontWriteShape = b; } + InteractionInfo* GetInteractionInfo() const + { return pInteractionInfo; } + EscherExClientAnchor_Base* GetClientAnchor() const + { return pClientAnchor; } + EscherExClientRecord_Base* GetClientData() const + { return pClientData; } + EscherExClientRecord_Base* GetClientTextbox() const + { return pClientTextbox; } + + void WriteClientAnchor( EscherEx& rEx, const 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 ); } + + sal_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( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); + virtual ~EscherExGlobal(); + + /** 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 simultaniously. */ + 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. */ + inline void SetDggContainer() { mbHasDggCont = true; } + /** Sets the flag indicating that the DGGCONTAINER exists. */ + inline 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 ImplEscherExSdr. + + On first invokation, 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. */ + inline 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. + inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {} + }; + typedef ::std::vector< ClusterEntry > ClusterTable; + + 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. + inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {} + }; + typedef ::std::vector< DrawingInfo > DrawingInfoVector; + + ClusterTable 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. +}; + +typedef ::boost::shared_ptr< EscherExGlobal > EscherExGlobalRef; + +// --------------------------------------------------------------------------------------------- + +class SdrObject; +class SdrPage; +class ImplEscherExSdr; + +class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable +{ + protected: + typedef ::std::auto_ptr< ImplEscherExSdr > ImplEscherExSdrPtr; + + EscherExGlobalRef mxGlobal; + ImplEscherExSdrPtr mpImplEscherExSdr; + 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; + sal_uInt16 mnHellLayerId; + + sal_Bool mbEscherSpgr; + sal_Bool mbEscherDg; + sal_Bool mbOleEmf; // OLE is EMF instead of WMF + + + virtual sal_Bool DoSeek( sal_uInt32 nKey ); + +public: + explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm ); + virtual ~EscherEx(); + + /** Creates and returns a new shape identifier, updates the internal shape + counters and registers the identifier in the DGG cluster table. */ + inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); } + + /** Returns the graphic provider from the global object that has been + passed to the constructor. + */ + inline EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; } + + /** Called if a picture shall be written and no picture stream is set at + class ImplEscherExSdr. + */ + inline 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?) + virtual void Flush( SvStream* pPicStreamMergeBSE = NULL ); + + /** 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. + + @param bExpandEndOfAtom If set to true, an atom that currently ends + exactly at the current stream position will be expanded to include + the inserted data. If set to false, 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, bool bExpandEndOfAtom ); + + 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 ); + sal_Bool SeekToPersistOffset( sal_uInt32 nKey ); + virtual sal_Bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite modus), without that the + // current StreamPosition changes + + SvStream& GetStream() const { return *mpOutStrm; } + sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); } + + // features during the creation of the following Containers: + // + // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed + // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed + // ESCHER_SpgrContainer: + // ESCHER_SpContainer: + + virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ); + virtual void CloseContainer(); + + virtual void BeginAtom(); + virtual void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddChildAnchor( const Rectangle& rRectangle ); + virtual void AddClientAnchor( const Rectangle& rRectangle ); + + virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 ); + sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL ); + sal_uInt32 GetGroupLevel() const { return mnGroupLevel; }; + virtual sal_Bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect ); + virtual sal_Bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const 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, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 ); + + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + + sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True ); + sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True ); + + // ...Sdr... implemented in eschesdo.cxx + + void AddSdrPage( const SdrPage& rPage ); + void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); + + /// returns the ShapeID + sal_uInt32 AddSdrObject( const SdrObject& rObj ); + + /// 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 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape, + const 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 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, sal_uInt32 nShapeId ); + // add an dummy rectangle shape into the escher stream + sal_uInt32 AddDummyShape(); + + static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape ); + + void SetHellLayerId( sal_uInt16 nId ) { mnHellLayerId = nId; } + sal_uInt16 GetHellLayerId() const { return mnHellLayerId; } + +private: + EscherEx( const EscherEx& ); + EscherEx& operator=( const EscherEx& ); + + // prevent C-style cast to former base class EscherGraphicProvider + operator EscherGraphicProvider&(); + operator EscherGraphicProvider const&(); +}; + + +#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 000000000000..f321441e2941 --- /dev/null +++ b/include/filter/msfilter/mscodec.hxx @@ -0,0 +1,370 @@ +/* -*- 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 SVX_MSCODEC_HXX +#define SVX_MSCODEC_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + +#include <rtl/cipher.h> +#include <rtl/digest.h> +#include "filter/msfilter/msfilterdllapi.h" + +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. + */ + sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::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, sal_Size 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( sal_Size nBytes ); + +protected: + sal_uInt8 mpnKey[ 16 ]; /// Encryption key. + sal_Size mnOffset; /// Key offset. + +private: + MSFILTER_DLLPRIVATE MSCodec_Xor95( const MSCodec_Xor95& ); + MSFILTER_DLLPRIVATE MSCodec_Xor95& operator=( const MSCodec_Xor95& ); + + 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 : 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, sal_Size nBytes ); +}; + +/** Encodes and decodes data from protected MSO Word 95- documents. + */ +class MSFILTER_DLLPUBLIC MSCodec_XorWord95 : 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, sal_Size nBytes ); +}; + + +// ============================================================================ + +/** 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 +{ +public: + explicit MSCodec_Std97(); + ~MSCodec_Std97(); + + /** Initializes the algorithm with the encryption data. + + @param aData + The sequence contains the necessary data to initialize + the codec. + */ + sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::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. + */ + void InitKey( + const sal_uInt16 pPassData[ 16 ], + const sal_uInt8 pDocId[ 16 ] ); + + /** 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[ 16 ], + const sal_uInt8 pSaltDigest[ 16 ] ); + + /** 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. + */ + bool InitCipher( sal_uInt32 nCounter ); + + /** Creates an MD5 digest of salt digest. */ + bool CreateSaltDigest( + const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] ); + + /** 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, sal_Size nDatLen, + sal_uInt8* pBuffer, sal_Size 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, sal_Size nDatLen, + sal_uInt8* pBuffer, sal_Size 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( sal_Size nDatLen ); + + /** 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]); + + /* allows to get the unique document id from the codec + */ + void GetDocId( sal_uInt8 pDocId[16] ); + + void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] ); + +private: + void InitKeyImpl( + const sal_uInt8 pKeyData[64], + const sal_uInt8 pDocId[16] ); + + +private: + MSFILTER_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& ); + MSFILTER_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& ); + + rtlCipher m_hCipher; + rtlDigest m_hDigest; + sal_uInt8 m_pDigestValue[ RTL_DIGEST_LENGTH_MD5 ]; + sal_uInt8 m_pDocId[16]; +}; + +// ============================================================================ + +} // 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 000000000000..6359277f49f4 --- /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 FLT_MSDFFIMP_HXX +#define FLT_MSDFFIMP_HXX + +#include <string.h> + +#include <map> +#include <vector> +#include <set> + +#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/ptr_container/ptr_vector.hpp> +#include <boost/ptr_container/ptr_set.hpp> + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <tools/solar.h> +#include <tools/color.hxx> +#include <tools/gen.hxx> + +#include <sot/storage.hxx> + +#include <vcl/graph.hxx> + +#include <svx/msdffdef.hxx> +#include <filter/msfilter/dffpropset.hxx> +#include <filter/msfilter/dffrecordheader.hxx> + +#include <filter/msfilter/msfilterdllapi.h> + +class Graphic; +class SvStream; +class SdrObject; +class SdrOle2Obj; +class SotStorageRef; +class Polygon; +class PolyPolygon; +class FmFormModel; +class SdrModel; +class SwFlyFrmFmt; + +struct SvxMSDffBLIPInfo; +struct SvxMSDffShapeInfo; +struct SvxMSDffShapeOrder; + +class SvxMSDffManager; +class SfxItemSet; +class SdrObject; +class SdrTextObj; +struct DffObjData; + +class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet +{ + const SvxMSDffManager& rManager; + DffPropSet* pDefaultPropSet; + + void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const; + void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const; + void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) 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: + sal_Int32 mnFix16Angle; + explicit DffPropertyReader( const SvxMSDffManager& rManager ); + ~DffPropertyReader(); + sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const; + +#ifdef DBG_CUSTOMSHAPE + void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const; +#else + void ReadPropSet( SvStream& rIn, void* 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& rObjData ) const; +}; + +#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC ) + +typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer; + +#define SVEXT_PERSIST_STREAM "\002OlePres000" + +// the following two will be sorted by the order of their appearance: +typedef boost::ptr_vector<SvxMSDffBLIPInfo> SvxMSDffBLIPInfos; +class SvxMSDffShapeOrders : public std::vector<SvxMSDffShapeOrder*> +{ +public: + ~SvxMSDffShapeOrders(); +}; + +struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById +{ + bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs, + ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const; +}; +struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp +{ + bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs, + ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const; +}; + +// the following will be sorted explicitly: +typedef ::std::set< ::boost::shared_ptr<SvxMSDffShapeInfo>, + CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById; +typedef ::std::multiset< ::boost::shared_ptr<SvxMSDffShapeInfo>, + CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp; + +#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1 +#define SVXMSDFF_SETTINGS_IMPORT_PPT 2 +#define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4 + +#define SP_FGROUP 0x001 ///< This shape is a group shape +#define SP_FCHILD 0x002 ///< Not a top-level shape +#define SP_FPATRIARCH 0x004 ///< This is the topmost group shape. + ///< Exactly one of these per drawing. +#define SP_FDELETED 0x008 ///< The shape has been deleted +#define SP_FOLESHAPE 0x010 ///< The shape is an OLE object +#define SP_FHAVEMASTER 0x020 ///< Shape has a hspMaster property +#define SP_FFLIPH 0x040 ///< Shape is flipped horizontally +#define SP_FFLIPV 0x080 ///< Shape is flipped vertically +#define SP_FCONNECTOR 0x100 ///< Connector type of shape +#define SP_FHAVEANCHOR 0x200 ///< Shape has an anchor of some kind +#define SP_FBACKGROUND 0x400 ///< Background shape +#define SP_FHAVESPT 0x800 ///< Shape has a shape type property + +// for the CreateSdrOLEFromStorage we need the information, how we handle +// convert able OLE-Objects - this ist 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 nRuleId; + 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 + sal_uInt32 nSpFlagsA; ///< SpFlags of shape A (the original mirror flags + ///< must be known when solving the Solver Container) + sal_uInt32 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() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ), + pBObj( NULL ), pCObj( NULL ) {}; + + friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom ); +}; + +typedef ::std::vector< SvxMSDffConnectorRule* > SvxMSDffConnectorRuleList; + +struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer +{ + SvxMSDffConnectorRuleList aCList; + + SvxMSDffSolverContainer(); + ~SvxMSDffSolverContainer(); + + MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom ); +}; + +struct FIDCL +{ + sal_uInt32 dgid; ///< DG owning the SPIDs in this cluster + sal_uInt32 cspidCur; ///< number of SPIDs used so far +}; + +/// provided by SvxMSDffManager for each shape in a group +struct MSDffTxId +{ + sal_uInt16 nTxBxS; + sal_uInt16 nSequence; + MSDffTxId( sal_uInt16 nTxBxS_, sal_uInt16 nSequence_ ) + : nTxBxS( nTxBxS_ ), nSequence( nSequence_ ){} + MSDffTxId( const MSDffTxId& rCopy ) + : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ){} +}; + +struct MSFILTER_DLLPUBLIC SvxMSDffImportRec +{ + static const int RELTO_DEFAULT = 2; + + SdrObject* pObj; + Polygon* pWrapPolygon; + char* pClientAnchorBuffer; + sal_uInt32 nClientAnchorLen; + char* pClientDataBuffer; + sal_uInt32 nClientDataLen; + sal_uInt32 nXAlign; + sal_uInt32 *pXRelTo; + sal_uInt32 nYAlign; + sal_uInt32 *pYRelTo; + sal_uInt32 nLayoutInTableCell; + sal_uInt32 nFlags; + long nTextRotationAngle; + long nDxTextLeft; ///< distance of text box from surrounding shape + long nDyTextTop; + long nDxTextRight; + long nDyTextBottom; + long nDxWrapDistLeft; + long nDyWrapDistTop; + long nDxWrapDistRight; + long nDyWrapDistBottom; + long nCropFromTop; + long nCropFromBottom; + long nCropFromLeft; + long 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; + sal_Bool bDrawHell :1; + sal_Bool bHidden :1; + sal_Bool bReplaceByFly :1; + sal_Bool bLastBoxInChain :1; + sal_Bool bHasUDefProp :1; + sal_Bool bVFlip :1; + sal_Bool bHFlip :1; + sal_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; } + bool operator<( const SvxMSDffImportRec& rEntry ) const + { return nShapeId < rEntry.nShapeId; } + +private: + SvxMSDffImportRec &operator=(const SvxMSDffImportRec&); +}; + +/** list of all SvxMSDffImportRec instances of/for a group */ +class MSDffImportRecords + : public ::boost::ptr_set<SvxMSDffImportRec> +{}; + +/** block of parameters for import/export for a single call of + ImportObjAtCurrentStreamPos() */ +struct SvxMSDffImportData +{ + MSDffImportRecords aRecords; ///< Shape pointer, Shape ids and private data + Rectangle aParentRect;///< Rectangle of the surrounding groups, + ///< which might have been provided externally + Rectangle aNewRect; ///< Rectangle that is defined by this shape + + SvxMSDffImportData() + {} + explicit SvxMSDffImportData( const Rectangle& rParentRect ) : aParentRect( rParentRect ) {} + void SetNewRect(sal_Int32 left, sal_Int32 top, sal_Int32 right, sal_Int32 bottom ) + { aNewRect = Rectangle(left, top, right, bottom); } + sal_Bool HasParRect() const { return aParentRect.IsEmpty(); } + sal_Bool HasNewRect() const { return aNewRect.IsEmpty() ; } + bool empty() const { return aRecords.empty(); } + size_t size() const { return aRecords.size(); } + MSDffImportRecords::const_iterator begin() const { return aRecords.begin(); } + MSDffImportRecords::const_iterator end() const { return aRecords.end(); } +}; + +struct DffObjData +{ + const DffRecordHeader& rSpHd; + + Rectangle aBoundRect; + Rectangle aChildAnchor; + + sal_uInt32 nShapeId; + sal_uInt32 nSpFlags; + MSO_SPT eShapeType; + + sal_Bool bShapeType : 1; + sal_Bool bClientAnchor : 1; + sal_Bool bClientData : 1; + sal_Bool bChildAnchor : 1; + sal_Bool bOpt : 1; + sal_Bool bOpt2 : 1; + sal_Bool bIsAutoText : 1; + sal_Bool bRotateTextWithShape : 1; + bool bPageAnchor; + int nCalledByGroup; + + DffObjData( const DffRecordHeader& rObjHd, + const Rectangle& rBoundRect, + int nClByGroup ) : + rSpHd( rObjHd ), + aBoundRect( rBoundRect ), + nShapeId( 0 ), + nSpFlags( 0 ), + eShapeType( mso_sptNil ), + bShapeType( sal_False ), + bClientAnchor( sal_False ), + bClientData( sal_False ), + bChildAnchor( sal_False ), + bOpt( sal_False ), + bOpt2( sal_False ), + bIsAutoText( sal_False ), + bRotateTextWithShape( sal_True ), + bPageAnchor( true ), + nCalledByGroup( nClByGroup ){} +}; + +#define DFF_RECORD_MANAGER_BUF_SIZE 64 + +struct DffRecordList +{ + sal_uInt32 nCount; + sal_uInt32 nCurrent; + DffRecordList* pPrev; + 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_Bool bAppend = sal_False, + sal_uInt32 nStOfs = 0 ); + + sal_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 ); + ~DffRecordManager(); + + 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 +{ + FmFormModel* pFormModel; + SvxMSDffBLIPInfos* pBLIPInfos; + ::boost::scoped_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_pShapeInfosByTxBxComp; + ::boost::scoped_ptr<SvxMSDffShapeInfos_ById> m_pShapeInfosById; + SvxMSDffShapeOrders* pShapeOrders; + sal_uLong nDefaultFontHeight; + sal_uInt32 nOffsDgg; + sal_uInt16 nBLIPCount; + sal_uInt16 nShapeCount; + sal_uInt32 nGroupShapeFlags; + + void CheckTxBxStoryChain(); + void GetFidclData(sal_uInt32 nOffsDgg); + +protected : + typedef std::map<sal_uInt32, sal_uInt32> OffsetMap; + + OUString maBaseURL; + sal_uInt32 mnCurMaxShapeId; // we need this information to + sal_uInt32 mnDrawingsSaved; // access the right drawing + sal_uInt32 mnIdClusters; // while only knowing the shapeid + std::vector<FIDCL> maFidcls; + OffsetMap maDgOffsetTable; ///< array of fileoffsets + + friend class DffPropertyReader; + + SvStream& rStCtrl; + SvStream* pStData; + SvStream* pStData2; + SdrModel* pSdrModel; + + long nMapMul; + long nMapDiv; + long nMapXOfs; + long nMapYOfs; + long nEmuMul; + long nEmuDiv; + long nPntMul; + 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_uLong nLenDgg ); + // #156763# + // 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_uLong nLenDg, + const unsigned long nDrawingContainerId ); + sal_Bool GetShapeGroupContainerData( SvStream& rSt, + sal_uLong nLenShapeGroupCont, + sal_Bool bPatriarch, + const unsigned long nDrawingContainerId ); + sal_Bool GetShapeContainerData( SvStream& rSt, + sal_uLong nLenShapeCont, + sal_uLong nPosGroup, + const unsigned long nDrawingContainerId ); + + bool ReadGraphic( SvStream& rSt, sal_uLong nIndex, Graphic& rGraphic ) const; + 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( long nOLEId, + const Graphic& rGraf, + const Rectangle& rBoundRect, + const Rectangle& rVisArea, + const int _nCalledByGroup, + sal_Int64 nAspect ) const; + static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj( + sal_uInt32 nConvertFlags, SotStorage& rSrcStg, + const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg, + const Graphic& rGrf, + const Rectangle& rVisArea ); + +// the following methods need to be overriden for Excel imports + virtual sal_Bool ProcessClientAnchor( SvStream& rStData, + sal_uInt32 nDatLen, + char*& rpBuff, + sal_uInt32& rBuffLen ) const; + virtual void ProcessClientAnchor2( SvStream& rStData, + DffRecordHeader& rHd, + void* pData, DffObjData& ); + virtual sal_Bool ProcessClientData( SvStream& rStData, + sal_uInt32 nDatLen, + char*& rpBuff, + sal_uInt32& rBuffLen ) const; + virtual SdrObject* ProcessObj( SvStream& rSt, + DffObjData& rData, + void* pData, + Rectangle& rTextRect, + SdrObject* pObj = NULL); + virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal, + sal_uLong nStreamPos ) const; + 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 sal_Bool GetOLEStorageName( long nOLEId, + OUString& rStorageName, + SotStorageRef& rSrcStorage, + com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg + ) const; + + /** Prevent that (rounded) rectangles with wrapped text will always be + converted into SdrRectObj( OBJ_TEXT ). + + @return sal_True means "conversion". + */ + virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const; + +public: + DffPropertyReader* pSecPropSet; + std::map<sal_uInt32,OString> aEscherBlipCache; + + DffRecordManager maShapeRecords; + ColorData mnDefaultColor; + + sal_Bool mbTracing; + + Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const; + Color MSO_CLR_ToColor( sal_uInt32 nColorCode, + sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const; + virtual sal_Bool SeekToShape( SvStream& rSt, + void* pClientData, + sal_uInt32 nId ) const; + bool SeekToRec( SvStream& rSt, + sal_uInt16 nRecId, + sal_uLong nMaxFilePos, + DffRecordHeader* pRecHd = NULL, + sal_uLong nSkipCount = 0 ) const; + bool SeekToRec2( sal_uInt16 nRecId1, + sal_uInt16 nRecId2, + sal_uLong nMaxFilePos, + DffRecordHeader* pRecHd = NULL, + sal_uLong nSkipCount = 0 ) const; + + static OUString MSDFFReadZString( SvStream& rIn, + sal_uInt32 nMaxLen, + bool bUniCode = sal_False); + + static bool ReadCommonRecordHeader( SvStream& rSt, + sal_uInt8& rVer, + sal_uInt16& rInst, + sal_uInt16& rFbt, + sal_uInt32& rLength) SAL_WARN_UNUSED_RESULT; + +// 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_ ??? + */ + SvxMSDffManager( SvStream& rStCtrl, + const OUString& rBaseURL, + sal_uInt32 nOffsDgg, + SvStream* pStData, + SdrModel* pSdrModel_ = 0, + long nApplicationScale = 0, + ColorData mnDefaultColor_ = COL_DEFAULT, + sal_uLong nDefaultFontHeight_ = 24, + SvStream* pStData2_ = 0 ); + + // in PPT the parameters DGGContainerOffset and PicStream are provided by an + // init method + SvxMSDffManager( SvStream& rStCtrl, const OUString& rBaseURL ); + 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 sal_Bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & ); + static void ReadObjText( SvStream& rStream, SdrObject* pObj ); + static sal_Bool ConvertToOle2( SvStream& rStm, + sal_uInt32 nLen, + const GDIMetaFile*, + const SotStorageRef & rDest ); + + void SetModel(SdrModel* pModel, 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 sal_True if successful, sal_False otherwise + */ + sal_Bool GetBLIP( sal_uLong nIdx, Graphic& rData, Rectangle* pVisArea = NULL ); + +// TODO: provide proper documentation here + /** read a BLIP out of a already positioned stream + + @param[in] rBLIPStream alread positioned stream (mandatory) + @param[out] rData already converted data (insert directly as + graphics into our documents) + @param pVisArea ??? + + @return sal_True if successful, sal_False otherwise + */ + sal_Bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const; + + sal_Bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData); + + /** Get count of managed BLIPs + + @return Number of BLIPs in pStData (or rStCtrl), thus number of FBSEs in + the drawing group container. If 0 is returned this means that + the structure is ok but there are no BLIPs; if USHRT_MAX is + returned than there was an error: no correct Drawing File Format + */ + sal_uInt16 GetBLIPCount() const{ return nBLIPCount; } + + SdrObject* ImportObj( SvStream& rSt, + void* pData, + Rectangle& rClientRect, + const Rectangle& rGlobalChildRect, + int nCalledByGroup = 0, + sal_Int32* pShapeId = NULL); + SdrObject* ImportGroup( const DffRecordHeader& rHd, + SvStream& rSt, + void* pData, + Rectangle& rClientRect, + const Rectangle& rGlobalChildRect, + int nCalledByGroup = 0, + sal_Int32* pShapeId = NULL ); + SdrObject* ImportShape( const DffRecordHeader& rHd, + SvStream& rSt, + void* pData, + Rectangle& rClientRect, + const Rectangle& rGlobalChildRect, + int nCalledByGroup = 0, + sal_Int32* pShapeId = NULL); + + Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd, + SvStream& rSt, + Rectangle& aClientRect ); + void GetGroupAnchors( const DffRecordHeader& rHd, + SvStream& rSt, + Rectangle& rGroupClientAnchor, + Rectangle& rGroupChildAnchor, + const Rectangle& rClientRect, + const Rectangle& rGlobalChildRect ); + + inline const SvxMSDffShapeInfos_ById* GetShapeInfos( void ) const + { return m_pShapeInfosById.get(); } + + inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const + { return pShapeOrders; } + + void StoreShapeOrder(sal_uLong nId, + sal_uLong nTxBx, + SdrObject* pObject, + SwFlyFrmFmt* pFly = 0, + short nHdFtSection = 0) const; + + void ExchangeInShapeOrder(SdrObject* pOldObject, + sal_uLong nTxBx, + SwFlyFrmFmt* pFly, + SdrObject* pObject) const; + + void RemoveFromShapeOrder( SdrObject* pObject ) const; + + sal_uInt32 GetConvertFlags() const { return nSvxMSDffOLEConvFlags; } + + static SdrOle2Obj* CreateSdrOLEFromStorage( const OUString& rStorageName, + SotStorageRef& rSrcStorage, + const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg, + const Graphic& rGraf, + const Rectangle& rBoundRect, + const Rectangle& rVisArea, + SvStream* pDataStrrm, + ErrCode& rError, + sal_uInt32 nConvertFlags, + sal_Int64 nAspect ); + + /** 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 + */ + void SolveSolver( const SvxMSDffSolverContainer& rSolver ); + + static sal_Bool SetPropValue( + const ::com::sun::star::uno::Any& rAny, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + const OUString& rPropertyName, + sal_Bool bTestPropertyAvailability = sal_False + ); + + void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ); + void removeShapeId( SdrObject* pShape ); + SdrObject* getShapeForId( sal_Int32 nShapeId ); +}; + +struct SvxMSDffBLIPInfo +{ + sal_uInt16 nBLIPType; ///< type of BLIP: e.g. 6 for PNG + sal_uLong nFilePos; ///< offset of the BLIP in data strem + sal_uLong nBLIPSize; ///< number of bytes that the BLIP needs in stream + SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize): + nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){} +}; + +struct SvxMSDffShapeInfo +{ + sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP) + sal_uLong nFilePos; ///< offset of the shape in control stream for + ///< potential later access to it + sal_uInt32 nTxBxComp; + + sal_Bool bReplaceByFly :1; ///< shape can be replaced by a frame in Writer + sal_Bool bLastBoxInChain:1; + + explicit SvxMSDffShapeInfo(sal_uLong 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 = sal_False; + bLastBoxInChain = sal_True; + } + SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo): + nShapeId( rInfo.nShapeId ), + nFilePos( rInfo.nFilePos ), + nTxBxComp( rInfo.nTxBxComp ) + { + bReplaceByFly = rInfo.bReplaceByFly; + bLastBoxInChain = rInfo.bLastBoxInChain; + } +}; + + +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) + SwFlyFrmFmt* pFly; ///< format of frame that was inserted as a replacement + ///< for a Sdr-Text object in Writer - needed for + ///< chaining! + short nHdFtSection; ///< used by Writer to find out if linked frames are in + ///< the same header or footer of the same section + 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( 0 ), nHdFtSection( 0 ), pObj( 0 ){} + + bool operator==( const SvxMSDffShapeOrder& rEntry ) const + { return (nTxBxComp == rEntry.nTxBxComp); } + 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 000000000000..03816baa92fc --- /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_MSFILTER_DLLAPI_H +#define INCLUDED_MSFILTER_DLLAPI_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 000000000000..79815e49126e --- /dev/null +++ b/include/filter/msfilter/msocximex.hxx @@ -0,0 +1,106 @@ +/* -*- 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 _MSOCXIMEX_HXX +#define _MSOCXIMEX_HXX + +#include <sot/storage.hxx> + +#include "filter/msfilter/msfilterdllapi.h" + +namespace com{namespace sun{namespace star{ + namespace drawing{ + class XDrawPage; + class XShape; + class XShapes; + } + namespace form{ + class XFormComponent; + } + namespace lang{ + class XMultiServiceFactory; + } + namespace container{ + class XIndexContainer; + class XNameContainer; + } + namespace beans{ + class XPropertySet; + } + namespace text{ + class XText; + } + namespace awt{ + struct Size; + class XControlModel; + } + namespace uno{ + class XComponentContext; + } + namespace frame{ + class XModel; + } + +}}} + +class SfxObjectShell; + +class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls +{ +public: + SvxMSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); + virtual ~SvxMSConvertOCXControls(); + + virtual sal_Bool InsertControl( + const com::sun::star::uno::Reference< + com::sun::star::form::XFormComponent >& /*rFComp*/, + const com::sun::star::awt::Size& /*rSize*/, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape >* /*pShape*/, + sal_Bool /*bFloatingCtrl*/ ) {return sal_False;} + + /*begin: Backwards compatability with office 95 import, modify later*/ + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory(); +protected: + const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & + GetShapes(); + + const com::sun::star::uno::Reference< + com::sun::star::container::XIndexContainer > & GetFormComps(); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + + // gecachte Interfaces + com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > + xDrawPage; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > + xShapes; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceFactory; + + // das einzige Formular + com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > + xFormComps; + + virtual const com::sun::star::uno::Reference< + com::sun::star::drawing::XDrawPage > & 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 000000000000..468fa6284513 --- /dev/null +++ b/include/filter/msfilter/msoleexp.hxx @@ -0,0 +1,53 @@ +/* -*- 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 _MSOLEEXP_HXX +#define _MSOLEEXP_HXX + +#include <com/sun/star/uno/Reference.h> +#include "filter/msfilter/msfilterdllapi.h" + +// for the CreateSdrOLEFromStorage we need the information, how we handle +// convert able OLE-Objects - this ist 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 SotStorage; + +#include <svtools/embedhlp.hxx> + +class MSFILTER_DLLPUBLIC SvxMSExportOLEObjects +{ + sal_uInt32 nConvertFlags; +public: + SvxMSExportOLEObjects( sal_uInt32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {} + + void SetFlags( sal_uInt32 n ) { nConvertFlags = n; } + sal_uInt32 GetFlags() const { return nConvertFlags; } + + void ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotStorage& rDestStg ); + void ExportOLEObject( const com::sun::star::uno::Reference < com::sun::star::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 000000000000..fc80f3115177 --- /dev/null +++ b/include/filter/msfilter/mstoolbar.hxx @@ -0,0 +1,359 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Noel Power <noel.power@novell.com> + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Noel Power <noel.power@novell.com> + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _MSTOOLBAR_HXX +#define _MSTOOLBAR_HXX +#include "filter/msfilter/msfilterdllapi.h" +#include <sot/storage.hxx> +#include <ostream> +#include <memory> +#include <vector> +#include <boost/shared_ptr.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/ImageType.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <vcl/bitmap.hxx> +#include <cppuhelper/implbase1.hxx> + +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::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor; + css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp; + css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr; + SfxObjectShell& mrDocSh; + void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, 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(); + css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager(); + + + css::uno::Any createCommandFromMacro( const OUString& 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, bool bPersist ); +}; + +class MSFILTER_DLLPUBLIC TBBase +{ +friend class Indent; + static int nIndent; // num spaces to indent before printing +protected: + void indent_printf(FILE* fp, const char* format, ... ); + sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record +public: + TBBase() : nOffSet( 0 ) {} + virtual ~TBBase(){} + + virtual bool Read(SvStream &rS) = 0; + virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output + sal_uInt32 GetOffset() { return nOffSet; } +}; + +class Indent +{ +public: + Indent( bool binit = false ) + { + if ( binit ) + init(); + else + TBBase::nIndent = TBBase::nIndent + 2; + } + ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; } + void init() { TBBase::nIndent = 0; } +}; + + +class MSFILTER_DLLPUBLIC WString : public TBBase +{ + OUString sString; + +public: + WString(){}; + ~WString(){}; + bool Read(SvStream &rS); + OUString getString(){ return sString; } +}; + +class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase +{ + WString wstrHelpFile; + sal_Int32 idHelpContext; + WString wstrTag; + WString wstrOnAction; + WString wstrParam; + sal_Int8 tbcu; + sal_Int8 tbmg; + + TBCExtraInfo(const TBCExtraInfo&); + TBCExtraInfo& operator = ( const TBCExtraInfo&); +public: + TBCExtraInfo(); + ~TBCExtraInfo(){} + bool Read(SvStream &rS); + void Print( FILE* ); + OUString getOnAction(); +}; + +class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase +{ + sal_uInt8 bFlags; + WString customText; + WString descriptionText; + WString tooltip; + TBCExtraInfo extraInfo; + +public: + TBCGeneralInfo(); + ~TBCGeneralInfo() {} + bool Read(SvStream &rS); + void Print( FILE* ); + bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& ); + OUString CustomText() { return customText.getString(); } + OUString DescriptionText() { return descriptionText.getString(); } + OUString Tooltip() { return tooltip.getString(); } +}; + +class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase +{ +friend class TBCBSpecific; // #FIXME hacky access, need to fix + sal_Int32 cbDIB; + Bitmap mBitMap; +public: + TBCBitMap(); + ~TBCBitMap(); + bool Read(SvStream &rS); + void Print( FILE* ); + Bitmap& getBitMap(); +}; + +class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase +{ + sal_Int32 tbid; + boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001 +public: + TBCMenuSpecific(); + ~TBCMenuSpecific(){} + bool Read(SvStream &rS); + void Print( FILE* ); + OUString Name(); +}; + +class MSFILTER_DLLPUBLIC TBCCDData : 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(); + ~TBCCDData(); + bool Read(SvStream &rS); + void Print( FILE* ); +}; + +class TBCComboDropdownSpecific : public TBBase +{ + boost::shared_ptr< TBCCDData > data; +public: + TBCComboDropdownSpecific( const TBCHeader& header ); + TBCComboDropdownSpecific(){} + bool Read(SvStream &rS); + void Print( FILE* ); +}; + +class TBCBSpecific : public TBBase +{ + sal_uInt8 bFlags; + boost::shared_ptr< TBCBitMap > icon; // optional + boost::shared_ptr< TBCBitMap > iconMask; // optional + boost::shared_ptr< sal_uInt16 > iBtnFace; // optional + boost::shared_ptr< WString > wstrAcc; // optional + +public: + TBCBSpecific(); + ~TBCBSpecific(){} + bool Read(SvStream &rS); + void Print( FILE* ); + // #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 : public TBBase +{ + sal_Int8 bSignature; + sal_Int8 bVersion; + sal_uInt8 bFlagsTCR; + sal_uInt8 tct; + sal_uInt16 tcid; + sal_uInt32 tbct; + sal_uInt8 bPriority; + boost::shared_ptr< sal_uInt16 > width; //optional + boost::shared_ptr< sal_uInt16 > height; //optional + +public: + TBCHeader(); + ~TBCHeader(); + sal_uInt8 getTct() const { return tct; } + sal_uInt16 getTcID() const { return tcid; } + bool isVisible() { return !( bFlagsTCR & 0x1 ); } + bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); } + bool Read(SvStream &rS); + void Print( FILE* ); + sal_uInt32 getTbct() { return tbct; }; +}; + +class MSFILTER_DLLPUBLIC TBCData : public TBBase +{ + TBCHeader rHeader; + TBCGeneralInfo controlGeneralInfo; + boost::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&); + TBCData& operator = ( const TBCData&); +public: + TBCData( const TBCHeader& Header ); + ~TBCData(){} + bool Read(SvStream &rS); + void Print( FILE* ); + bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar ); + TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; } + TBCMenuSpecific* getMenuSpecific(); +}; + +class MSFILTER_DLLPUBLIC TB : 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(); + ~TB(){} + bool Read(SvStream &rS); + void Print( FILE* ); + sal_Int16 getcCL(){ return cCL; } + WString& getName(){ return name; } + bool IsEnabled(); + bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); } +}; + +class MSFILTER_DLLPUBLIC SRECT : 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 ) { rS >> left >> top >> right >> bottom; return true; } + void Print( FILE* fo ); +}; + +typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE; + +class MSFILTER_DLLPUBLIC TBVisualData : public TBBase +{ + sal_Int8 tbds; + sal_Int8 tbv; + sal_Int8 tbdsDock; + sal_Int8 iRow; + + SRECT rcDock; + SRECT rcFloat; + +public: + TBVisualData(); + ~TBVisualData(){} + bool Read(SvStream &rS); + void Print( FILE* ); +}; +#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 000000000000..bafcc461a598 --- /dev/null +++ b/include/filter/msfilter/msvbahelper.hxx @@ -0,0 +1,106 @@ +/* -*- 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 _MSVBAHELPER_HXX +#define _MSVBAHELPER_HXX + +#include <sfx2/objsh.hxx> +#include <cppuhelper/implbase3.hxx> +#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/awt/KeyEvent.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "filter/msfilter/msfilterdllapi.h" +namespace ooo { +namespace vba { + +// ============================================================================ + +struct MSFILTER_DLLPUBLIC MacroResolvedInfo +{ + SfxObjectShell* mpDocContext; + OUString msResolvedMacro; + bool mbFound; + + inline explicit MacroResolvedInfo( SfxObjectShell* pDocContext = 0 ) : mpDocContext( pDocContext ), mbFound( false ) {} +}; + +MSFILTER_DLLPUBLIC OUString makeMacroURL( const OUString& sMacroName ); +MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl ); +MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell* pShell ); +MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell* pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName ); +MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false ); +MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); +MSFILTER_DLLPUBLIC ::com::sun::star::awt::KeyEvent parseKeyEvent( const OUString& sKey ) throw (::com::sun::star::uno::RuntimeException); +MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const ::com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxDoc, const ::com::sun::star::awt::KeyEvent& rKeyEvent, const OUString& sMacro ) throw (::com::sun::star::uno::RuntimeException); +// ============================================================================ + +typedef ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::script::vba::XVBAMacroResolver > VBAMacroResolverBase; + +class VBAMacroResolver : public VBAMacroResolverBase +{ +public: + explicit VBAMacroResolver(); + virtual ~VBAMacroResolver(); + + // com.sun.star.lang.XServiceInfo interface ------------------------------- + + virtual OUString SAL_CALL + getImplementationName() throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + supportsService( const OUString& rService ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // com.sun.star.lang.XInitialization interface ---------------------------- + + virtual void SAL_CALL initialize( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // com.sun.star.script.vba.XVBAMacroResolver interface -------------------- + + virtual OUString SAL_CALL + resolveVBAMacroToScriptURL( const OUString& rVBAMacroName ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual OUString SAL_CALL + resolveScriptURLtoVBAMacro( const OUString& rScriptURL ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + SfxObjectShell* mpObjShell; + OUString maProjectName; +}; + +// ============================================================================ + +} // namespace vba +} // namespace ooo + +#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 000000000000..b8d3c2c6d8ca --- /dev/null +++ b/include/filter/msfilter/rtfutil.hxx @@ -0,0 +1,52 @@ +/* -*- 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_MSFILTER_RTFUTIL_HXX +#define INCLUDED_MSFILTER_RTFUTIL_HXX + +#include "filter/msfilter/msfilterdllapi.h" +#include <rtl/string.hxx> +#include <rtl/textenc.h> +#include <tools/string.hxx> + +namespace msfilter { +namespace 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 = 0, 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 String &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 sal_Char *pToken, const String &rStr, rtl_TextEncoding eDestEnc); + +} +} + +#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 000000000000..2fbf096aec58 --- /dev/null +++ b/include/filter/msfilter/svdfppt.hxx @@ -0,0 +1,1564 @@ +/* -*- 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 _SVDFPPT_HXX +#define _SVDFPPT_HXX + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <svx/svdobj.hxx> +#include <editeng/numitem.hxx> +#include <editeng/editdata.hxx> +#include <filter/msfilter/msdffimp.hxx> +#include <filter/msfilter/msocximex.hxx> +#include <editeng/eeitem.hxx> +#define ITEMID_FIELD EE_FEATURE_FIELD +#include <editeng/flditem.hxx> +#undef ITEMID_FIELD +#include "filter/msfilter/msfilterdllapi.h" +#include <vcl/font.hxx> +#include <vector> +#include <boost/optional.hpp> +#include <boost/ptr_container/ptr_vector.hpp> + +class SdrModel; +class SdPage; +class SdrPage; +class SdrObject; +class SvStream; +class Polygon; +class PolyPolygon; +class SfxItemSet; +class Outliner; +class Graphic; +class SvxMSDffManager; +class PPTTextObj; +class DffRecordHeader; +class SvxBulletItem; + +#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& operator>>( SvStream& rIn, PptCurrentUserAtom& rAtom ); +}; + +struct MSFILTER_DLLPUBLIC PowerPointImportParam +{ + SvStream& rDocStream; + sal_uInt32 nImportFlags; + PptCurrentUserAtom aCurrentUserAtom; + + PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags ); +}; + +struct SdHyperlinkEntry +{ + sal_uInt32 nIndex; + sal_Int32 nPrivate1; + sal_Int32 nPrivate2; + sal_Int32 nPrivate3; + sal_Int32 nInfo; + OUString aTarget; + OUString aSubAdress; + + sal_Int32 nStartPos; + sal_Int32 nEndPos; + + OUString aConvSubString; + ESelection aESelection; + sal_Bool bSelection; +}; + +// Hilfsklasse zum Einlesen der 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, da Gesamtgroesse 16 ist + sal_uInt8 nUnknown1; + sal_uInt8 nUnknown2; + sal_uInt8 nUnknown3; + +public: + + MSFILTER_DLLPUBLIC friend SvStream& operator>>( 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 +}; + +// Werte fuer den sal_uLong im PPT_PST_TextHeaderAtom +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 +}; + +#define TSS_TYPE_PAGETITLE (0) +#define TSS_TYPE_BODY (1) +#define TSS_TYPE_NOTES (2) +#define TSS_TYPE_UNUSED (3) +#define TSS_TYPE_TEXT_IN_SHAPE (4) +#define TSS_TYPE_SUBTITLE (5) +#define TSS_TYPE_TITLE (6) +#define TSS_TYPE_HALFBODY (7) +#define TSS_TYPE_QUARTERBODY (8) + +// Inventor-Id fuer PPT UserData +const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001 + + sal_uInt32('P') * 0x00000100 + + sal_uInt32('T') * 0x00010000 + + sal_uInt32('0') * 0x01000000; + +// Object-Ids fuer 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 + // RatioAtom erstmal weggelassen + 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 + sal_Bool bEmbeddedTrueType : 1; // TrueType direcly within the File? + sal_Bool bTitlePlaceholdersOmitted : 1; + sal_Bool bRightToLeft : 1; + sal_Bool bShowComments : 1; + +public: + + Size GetPageSize( const Size& rSiz ) const; + Size GetSlidesPageSize() const { return GetPageSize( aSlidesPageSize ); } + Size GetNotesPageSize() const { return GetPageSize( aNotesPageSize ); } + + friend SvStream& operator>>( SvStream& rIn, PptDocumentAtom& rAtom ); +}; + +struct PptSlideLayoutAtom +{ + sal_Int32 eLayout; // 0..18 + sal_uInt8 aPlaceholderId[ 8 ]; + sal_uLong aPlacementId[ 8 ]; + +public: + PptSlideLayoutAtom() { Clear(); } + void Clear(); + + // Das SlideLayoutAtom wird ohne Header eingelesen! + friend SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom ); +}; + +struct PptSlideAtom +{ + PptSlideLayoutAtom aLayout; + sal_uInt32 nMasterId; + sal_uInt32 nNotesId; + sal_uInt16 nFlags; + +public: + PptSlideAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>(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 temporarly to set the offset to SSSlideInfoAtom ( if possible ) + +public: + PptSlidePersistAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>(SvStream& rIn, PptSlidePersistAtom& rAtom); +}; + +struct PptNotesAtom +{ + sal_uInt32 nSlideId; + sal_uInt16 nFlags; + +public: + PptNotesAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>(SvStream& rIn, PptNotesAtom& rAtom); +}; + +struct PptColorSchemeAtom +{ + sal_uInt8 aData[32]; + +public: + PptColorSchemeAtom () { Clear(); } + void Clear(); + Color GetColor( sal_uInt16 nNum ) const; + + friend SvStream& operator>>(SvStream& rIn, PptColorSchemeAtom& rAtom); +}; + +struct PptFontEntityAtom +{ + OUString aName; + double fScaling; + sal_uInt8 lfClipPrecision; + sal_uInt8 lfQuality; + + sal_uInt32 nUniqueFontId; // not used anymore + CharSet eCharSet; + FontFamily eFamily; + FontPitch ePitch; + sal_Bool bAvailable; + + friend SvStream& operator>>(SvStream& rIn, PptFontEntityAtom& rAtom); +}; + +class PptFontCollection; +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 + sal_Int16 eLastViewType; // enum view type + +public: + PptUserEditAtom() : nOffsetPersistDirectory( 0 ) {} + + friend SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom ); +}; + +struct PptOEPlaceholderAtom +{ + sal_uInt32 nPlacementId; + sal_uInt8 nPlaceholderId; + sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide + +public: + PptOEPlaceholderAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>( SvStream& rIn, PptOEPlaceholderAtom& rAtom ); +}; + +struct ProcessData; +struct PPTStyleSheet; +struct HeaderFooterEntry; +struct PptSlidePersistEntry +{ + PptSlidePersistAtom aPersistAtom; + PptSlideAtom aSlideAtom; + PptNotesAtom aNotesAtom; + PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom + PPTStyleSheet* pStyleSheet; // 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) + HeaderFooterEntry* pHeaderFooterEntry; + SvxMSDffSolverContainer* pSolverContainer; + 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 + 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; + sal_Bool bBObjIsTemporary; + + PptPageKind ePageKind; // + + sal_Bool bNotesMaster : 1; // for NotesMaster + sal_Bool bHandoutMaster : 1; // for HandoutMaster + sal_Bool bStarDrawFiller : 1; // special for StarDraw +public: + PptSlidePersistEntry(); + ~PptSlidePersistEntry(); + sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; } +}; + +class _PptSlidePersistList : public std::vector<PptSlidePersistEntry*> +{ +public: + ~_PptSlidePersistList() + { + for( const_iterator it = begin(); it != end(); ++it ) + delete *it; + } +}; + +#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF + +class MSFILTER_DLLPUBLIC PptSlidePersistList: public _PptSlidePersistList +{ +public: + sal_uInt16 FindPage( sal_uInt32 nId ) const; +}; + +class SfxObjectShell; +struct PPTOleEntry +{ + sal_uInt32 nId; // OleId + sal_uInt32 nPersistPtr; // PersistPtr + 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& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom ); +}; + +typedef ::std::vector< PPTOleEntry* > PPTOleEntryList; +class PPTExtParaProv; +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 + + PPTOleEntryList aOleObjectList; // contains PPTOleEntrys + + PptFontCollection* pFonts; + + sal_uInt32 nStreamLen; + sal_uInt16 nTextStylesIndex; + + CharSet eCharSetSystem; + + sal_Bool bWingdingsChecked : 1; + sal_Bool bWingdingsAvailable : 1; + sal_Bool bMonotypeSortsChecked : 1; + sal_Bool bMonotypeSortsAvailable : 1; + sal_Bool bTimesNewRomanChecked : 1; + sal_Bool bTimesNewRomanAvailable : 1; + + sal_Bool ReadString( OUString& rStr ) const; + // nur fuer PowerPoint-Filter: + virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const; + +public: + using SvxMSDffManager::ReadObjText; + + PowerPointImportParam& rImportParam; + + SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL ); + virtual ~SdrEscherImport(); + virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const; + virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const; + PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const; + void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph ); + virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const; + virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj ); + virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj ); + void ImportHeaderFooterContainer( DffRecordHeader& rHeader, HeaderFooterEntry& rEntry ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#define SD_HEADERFOOTER_DATE 1 +#define SD_HEADERFOOTER_TODAYDATE 2 +#define SD_HEADERFOOTER_USERDATE 4 +#define SD_HEADERFOOTER_SLIDENUMBER 8 +#define SD_HEADERFOOTER_HEADER 16 +#define SD_HEADERFOOTER_FOOTER 32 + +class SvxFieldItem; +struct MSFILTER_DLLPUBLIC PPTFieldEntry +{ + sal_uInt16 nPos; + sal_uInt16 nTextRangeEnd; + SvxFieldItem* pField1; + SvxFieldItem* pField2; + OUString* pString; + + PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {}; + ~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 GetMaskForInstance( sal_uInt32 nInstance ); + sal_uInt32 IsToDisplay( sal_uInt32 nInstance ); + sal_uInt32 NeedToImportInstance( + const sal_uInt32 nInstance, + const PptSlidePersistEntry& rSlidePersist + ); + + explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL ); + ~HeaderFooterEntry(); +}; + +struct ProcessData +{ + PptSlidePersistEntry& rPersistEntry; + SdPage* pPage; + ::std::vector< SdrObject* > aBackgroundColoredObjects; + sal_uInt32* pTableRowProperties; + + ProcessData( PptSlidePersistEntry& rP, SdPage* pP ) : + rPersistEntry ( rP ), + pPage ( pP ), + pTableRowProperties ( NULL ) {}; + ~ProcessData() { delete[] pTableRowProperties; }; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef ::std::vector< SdHyperlinkEntry* > SdHyperlinkEntryList; +class SdrTextObj; +class SfxObjectShell; + +class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport +{ +protected: + + friend class PPTTextObj; + friend class PPTExtParaProv; + friend struct PPTStyleSheet; + friend class PPTNumberFormatCreator; + + sal_Bool bOk; + PptUserEditAtom aUserEditAtom; + PptColorSchemeAtom aPageColors; + SdHyperlinkEntryList aHyperList; + sal_uInt32* pPersistPtr; + sal_uLong nPersistPtrAnz; + + const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet; + const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should + // never happen just preventing a crash + PptSlidePersistList* pMasterPages; + PptSlidePersistList* pSlidePages; + PptSlidePersistList* pNotePages; + sal_uInt16 nAktPageNum; + sal_uLong nDocStreamPos; + sal_uInt16 nPageColorsNum; + PptPageKind ePageColorsKind; + PptPageKind eAktPageKind; + +protected: + using SdrEscherImport::ReadObjText; + + sal_Bool SeekToAktPage(DffRecordHeader* pRecHd=NULL) const; + sal_Bool SeekToDocument(DffRecordHeader* pRecHd=NULL) const; + sal_Bool SeekToContentOfProgTag( + sal_Int32 nVersion, + SvStream& rSt, + const DffRecordHeader& rProgTagBinaryDataHd, + DffRecordHeader& rContentHd + ); + virtual SdrObject* ApplyTextObj( + PPTTextObj* pTextObj, + SdrTextObj* pText, + SdPage* pPage, + SfxStyleSheet*, + SfxStyleSheet** ) + const; + virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const; + // #i32596# - new parameter <_nCalledByGroup>, which + // indicates, if the OLE object is imported inside a group object. + virtual SdrObject* ImportOLE( + long nOLEId, + const Graphic& rGraf, + const Rectangle& rBoundRect, + const Rectangle& rVisArea, + const int _nCalledByGroup, + sal_Int64 nAspect + ) const; + SvMemoryStream* ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const; + SdrPage* MakeBlancPage(sal_Bool bMaster) const; + sal_Bool ReadFontCollection(); + sal_Bool ForceFontCollection() const + { return pFonts!=NULL?sal_True:((SdrPowerPointImport*)this)->ReadFontCollection(); } + PptSlidePersistList* GetPageList(PptPageKind ePageKind) const; + sal_uInt32 GetAktPageId(); + sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const; + sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const; + SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const; + void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions ); + +public: + SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL ); + virtual ~SdrPowerPointImport(); + sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const; + void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE ); + sal_uInt16 GetPageNum() const { return nAktPageNum; } + PptPageKind GetPageKind() const { return eAktPageKind; } + Size GetPageSize() const; + SdrObject* ImportPageBackgroundObject( + const SdrPage& rPage, + sal_uInt32& nBgFileOffset, + sal_Bool bForce + ); + sal_Bool IsNoteOrHandout( sal_uInt16 nPageNum, PptPageKind ePageKind ) const; + sal_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 = NULL ); + virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const; + virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const; + sal_Unicode PPTSubstitute( + sal_uInt16 nFont, + sal_Unicode nChar, + sal_uInt32& nMappedFontId, + Font& rFont, + char nDefault + ) const; + const PptDocumentAtom& GetDocumentAtom() const { return aDocAtom; } + virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const; + SdrObject* CreateTable( + SdrObject* pGroupObject, + sal_uInt32* pTableArry, + SvxMSDffSolverContainer* + ); + virtual bool ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0; +}; + +struct PPTTextCharacterStyleAtomInterpreter +{ + sal_uInt16 nFlags1; + sal_uInt16 nFlags2; + sal_uInt16 nFlags3; + sal_Int32 n1; + sal_uInt16 nFontHeight; + sal_Int32 nFontColor; + + PPTTextCharacterStyleAtomInterpreter(); + ~PPTTextCharacterStyleAtomInterpreter(); + + sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd ); + + sal_uInt32 GetColor( sal_uInt32 nDefault ); +}; + +struct PPTTextParagraphStyleAtomInterpreter +{ + sal_Bool bValid; + sal_Bool bForbiddenRules; + sal_Bool bHangingPunctuation; + sal_Bool bLatinTextWrap; + + PPTTextParagraphStyleAtomInterpreter(); + ~PPTTextParagraphStyleAtomInterpreter(); + + sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd ); +}; + +struct PPTTextSpecInfo +{ + sal_uInt32 nCharIdx; + sal_uInt16 nLanguage[ 3 ]; + sal_uInt16 nDontKnow; + + explicit PPTTextSpecInfo( sal_uInt32 nCharIdx ); + ~PPTTextSpecInfo(); +}; + +typedef ::std::vector< PPTTextSpecInfo* > PPTTextSpecInfoList; +struct PPTTextSpecInfoAtomInterpreter +{ + sal_Bool bValid; + PPTTextSpecInfoList aList; + + PPTTextSpecInfoAtomInterpreter(); + ~PPTTextSpecInfoAtomInterpreter(); + + sal_Bool Read( + SvStream& rIn, + const DffRecordHeader& rRecHd, + sal_uInt16 nRecordType, + const PPTTextSpecInfo* pTextSpecDefault = NULL + ); + +}; + +#define PPT_STYLESHEETENTRYS 9 + +struct PPTExtParaLevel +{ + sal_uInt32 mnExtParagraphMask; + sal_uInt16 mnBuBlip; + sal_uInt16 mnHasAnm; + sal_uInt32 mnAnmScheme; + sal_uInt32 mpfPP10Ext; + sal_uInt32 mnExtCharacterMask; + sal_uInt32 mcfPP10Ext; + sal_Bool mbSet; + + PPTExtParaLevel(); + friend SvStream& operator>>( SvStream& rIn, PPTExtParaLevel& rL ); +}; + +struct PPTExtParaSheet +{ + PPTExtParaLevel aExtParaLevel[ 5 ]; +}; + +struct PPTBuGraEntry +{ + sal_uInt32 nInstance; + Graphic aBuGra; + + PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance ); +}; + +typedef ::std::vector< PPTBuGraEntry* > PPTBuGraEntryList; + +class PPTExtParaProv +{ + PPTBuGraEntryList aBuGraList; + +public : + sal_Bool bStyles; + sal_Bool bGraphics; + DffRecordManager aExtendedPresRules; + + PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ]; + + sal_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[ 5 ]; + + explicit PPTCharSheet( sal_uInt32 nInstance ); + PPTCharSheet( const PPTCharSheet& rCharSheet ); + + void Read( SvStream& rIn, sal_Bool bMasterStyle, sal_uInt32 nLevel, sal_Bool bFirst ); +}; + +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[ 5 ]; + + explicit PPTParaSheet( sal_uInt32 nInstance ); + PPTParaSheet( const PPTParaSheet& rParaSheet ); + + void Read( + SdrPowerPointImport& rMan, + SvStream& rIn, + sal_Bool bMasterStyle, + sal_uInt32 nLevel, + sal_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& rMan, + SvxNumberFormat& rNumberFormat, + sal_uInt32 nLevel + ); + sal_Bool ImplGetExtNumberFormat( + SdrPowerPointImport& rMan, + SvxNumberFormat& rNumberFormat, + sal_uInt32 nLevel, + sal_uInt32 nInstance, + sal_uInt32 nInstanceInSheet, + boost::optional< sal_Int16 >& rStartNumbering, + sal_uInt32 nFontHeight, + PPTParagraphObj* pPara + ); + +protected: + + PPTNumberFormatCreator( PPTExtParaProv* ); + ~PPTNumberFormatCreator(); + +public: + + PPTExtParaProv* pExtParaProv; + + void GetNumberFormat( + SdrPowerPointImport& rMan, + SvxNumberFormat& rNumberFormat, + sal_uInt32 nLevel, + const PPTParaLevel& rParaLevel, + const PPTCharLevel& rCharLevel, + sal_uInt32 nInstance + ); + + sal_Bool GetNumberFormat( + SdrPowerPointImport& rMan, + SvxNumberFormat& rNumberFormat, + PPTParagraphObj* pPara, + sal_uInt32 nInstanceInSheet, + boost::optional< sal_Int16 >& rStartNumbering + ); +}; + +class SvxNumBulletItem; +struct PPTStyleSheet : public PPTNumberFormatCreator +{ + PPTTextSpecInfo maTxSI; + PPTCharSheet* mpCharSheet[ PPT_STYLESHEETENTRYS ]; + PPTParaSheet* mpParaSheet[ PPT_STYLESHEETENTRYS ]; + SvxNumBulletItem* mpNumBulletItem[ PPT_STYLESHEETENTRYS ]; + + PPTStyleSheet( + const DffRecordHeader& rSlideHd, + SvStream& rSt, SdrPowerPointImport&, + const PPTTextCharacterStyleAtomInterpreter&, + const PPTTextParagraphStyleAtomInterpreter&, + const PPTTextSpecInfo& + ); + ~PPTStyleSheet(); +}; + +struct ImplPPTParaPropSet +{ + sal_uInt32 mnRefCount; + + 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() + { mnRefCount = 1; mnAttrSet = 0; mnExtParagraphMask = 0; mnDepth = 0; }; +}; + +struct PPTParaPropSet +{ + sal_uInt32 mnOriginalTextPos; + ImplPPTParaPropSet* pParaSet; + + PPTParaPropSet(); + PPTParaPropSet( PPTParaPropSet& rParaPropSet ); + ~PPTParaPropSet(); + + PPTParaPropSet& operator=( PPTParaPropSet& rParaPropSet ); +}; + +struct ImplPPTCharPropSet +{ + sal_uInt32 mnRefCount; + + 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(){ mnRefCount = 1; mnAttrSet = 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 weather has a hyperlink. + sal_Bool mbIsHyperlink; + //the hyperlink text weather has a custom color. + sal_Bool mbHardHylinkOrigColor; + + sal_uInt32 mnOriginalTextPos; + sal_uInt32 mnParagraph; + OUString maString; + SvxFieldItem* mpFieldItem; + sal_uInt16 mnLanguage[ 3 ]; + + ImplPPTCharPropSet* pCharSet; + + 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 ); + +private: + void ImplMakeUnique(); +}; + +struct PPTTabEntry +{ + sal_uInt16 nOffset; + sal_uInt16 nStyle; +}; + +struct PPTRuler +{ + sal_uInt32 nRefCount; + + sal_Int32 nFlags; + sal_uInt16 nDefaultTab; + sal_uInt16 nTextOfs[ 5 ]; + sal_uInt16 nBulletOfs[ 5 ]; + PPTTabEntry* pTab; + sal_uInt16 nTabCount; + + PPTRuler(); + ~PPTRuler(); +}; + +struct PPTTextRulerInterpreter +{ + PPTRuler *mpImplRuler; + + PPTTextRulerInterpreter(); + PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler ); + PPTTextRulerInterpreter( + sal_uInt32 nFileOfs, + SdrPowerPointImport&, + DffRecordHeader& rHd, + SvStream& rIn + ); + ~PPTTextRulerInterpreter(); + + sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const + { return mpImplRuler->pTab[ nIndex ].nOffset; }; + + sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const + { return mpImplRuler->pTab[ nIndex ].nStyle; }; + + sal_uInt16 GetTabCount() const { return mpImplRuler->nTabCount; }; + sal_Bool GetDefaultTab( sal_uInt32 nLevel, sal_uInt16& nValue ) const; + sal_Bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const; + sal_Bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const; + + PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler ); +}; + +#define PPT_SPEC_NEWLINE 0x10000 +#define PPT_SPEC_SYMBOL 0x20000 +#define PPT_SPEC_USE_STARBATS 0x40000 + +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 ); +}; + +typedef std::vector<PPTParaPropSet*> PPTParaPropSetList; +typedef std::vector<PPTCharPropSet*> PPTCharPropSetList; + +struct PPTStyleTextPropReader +{ + std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position + PPTParaPropSetList aParaPropList; + PPTCharPropSetList aCharPropList; + + PPTStyleTextPropReader( + SvStream& rIn, + SdrPowerPointImport&, + const DffRecordHeader& rClientTextBoxHd, + PPTTextRulerInterpreter& rInterpreter, + const DffRecordHeader& rExtParaHd, + sal_uInt32 nTextInstance + ); + ~PPTStyleTextPropReader(); + + void Init( + SvStream& rIn, + SdrPowerPointImport&, + const DffRecordHeader& rClientTextBoxHd, + PPTTextRulerInterpreter& rInterpreter, + const DffRecordHeader& rExtParaHd, + sal_uInt32 nTextInstance + ); + void ReadParaProps( + SvStream& rIn, + SdrPowerPointImport& rMan, + const DffRecordHeader& rTextHeader, + const OUString& aString, + PPTTextRulerInterpreter& rRuler, + sal_uInt32& nCharCount, + sal_Bool& bTextPropAtom + ); + void ReadCharProps( + SvStream& rIn, + PPTCharPropSet& aCharPropSet, + const OUString& aString, + sal_uInt32& nCharCount, + sal_uInt32 nCharAnzRead, + sal_Bool& bTextPropAtom, + sal_uInt32 nExtParaPos, + const std::vector< StyleTextProp9 >& aStyleTextProp9, + sal_uInt32& nExtParaFlags, + sal_uInt16& nBuBlip, + sal_uInt16& nHasAnm, + sal_uInt32& nAnmScheme + ); +}; + +class SvxFieldItem; +class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet +{ + + friend class PPTParagraphObj; + + const PPTStyleSheet& mrStyleSheet; + sal_uInt32 mnInstance; + sal_uInt32 mnDepth; + +public: + + sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const; + SvxFieldItem* GetTextField(); + + PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth ); + PPTPortionObj( + const PPTCharPropSet&, + const PPTStyleSheet&, + sal_uInt32 nInstance, + sal_uInt32 nDepth + ); + PPTPortionObj( const PPTPortionObj& ); + ~PPTPortionObj(); + + // the following function should be removed during next full update + void ApplyTo( + SfxItemSet& rSet, + SdrPowerPointImport& rManager, + sal_uInt32 nInstanceInSheet + ); + void ApplyTo( + SfxItemSet& rSet, + SdrPowerPointImport& rManager, + sal_uInt32 nInstanceInSheet, + const PPTTextObj* pTextObj + ); + sal_uInt32 Count() const { return ( mpFieldItem ) ? 1 : maString.getLength(); }; + sal_Bool HasTabulator(); +}; + +class MSFILTER_DLLPUBLIC PPTParagraphObj + : public PPTParaPropSet, + public PPTNumberFormatCreator, + public PPTTextRulerInterpreter +{ + friend class PPTTextObj; + friend class PPTNumberFormatCreator; + + const PPTStyleSheet& mrStyleSheet; + sal_uInt32 mnInstance; + +protected: + + void ImplClear(); + +public: + + sal_Bool mbTab; // if true, this paragraph has tabulators in text + + sal_uInt32 mnCurrentObject; + ::boost::ptr_vector<PPTPortionObj> m_PortionList; + + void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const; + sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ); + + PPTParagraphObj( + const PPTStyleSheet&, + sal_uInt32 nInstance, + sal_uInt16 nDepth + ); + PPTParagraphObj( + PPTStyleTextPropReader&, + size_t nCurParaPos, + size_t& rnCurCharPos, + const PPTStyleSheet&, + sal_uInt32 nInstance, + PPTTextRulerInterpreter& rRuler + ); + ~PPTParagraphObj(); + + sal_uInt32 GetTextSize(); + PPTPortionObj* First(); + PPTPortionObj* Next(); + + void AppendPortion( PPTPortionObj& rPortion ); + void ApplyTo( + SfxItemSet& rSet, + boost::optional< sal_Int16 >& rStartNumbering, + SdrPowerPointImport& rManager, + sal_uInt32 nInstanceInSheet, + const PPTParagraphObj* pPrev + ); +}; + +#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 +{ + sal_uInt32 mnRefCount; + sal_uInt32 mnShapeId; + sal_uInt32 mnShapeMaster; + PptOEPlaceholderAtom* mpPlaceHolderAtom; + sal_uInt16 mnInstance; + sal_uInt16 mnDestinationInstance; + MSO_SPT meShapeType; + + sal_uInt32 mnCurrentObject; + sal_uInt32 mnParagraphCount; + PPTParagraphObj** mpParagraphList; + PptSlidePersistEntry& mrPersistEntry; + + sal_uInt32 mnTextFlags; + + explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {}; +}; + +class PPTTextObj +{ + ImplPPTTextObj* mpImplTextObj; + void ImplClear(); + + PPTTextObj(){}; +public: + PPTTextObj( + SvStream& rSt, + SdrPowerPointImport&, + PptSlidePersistEntry&, + DffObjData* + ); + PPTTextObj( PPTTextObj& rTextObj ); + ~PPTTextObj(); + + sal_uInt32 GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; }; + sal_uInt32 Count() const { return mpImplTextObj->mnParagraphCount; }; + PPTParagraphObj* First(); + PPTParagraphObj* Next(); + MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; }; + sal_uInt32 GetInstance() const { return mpImplTextObj->mnInstance; }; + void SetInstance( sal_uInt16 nInstance ) + { mpImplTextObj->mnInstance = nInstance; } + + sal_uInt32 GetDestinationInstance() const + { return mpImplTextObj->mnDestinationInstance; } + + void SetDestinationInstance( sal_uInt16 nInstance ) + { mpImplTextObj->mnDestinationInstance = nInstance; } + + PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; } + sal_uInt32 GetTextFlags() const { return mpImplTextObj->mnTextFlags; } + void SetVertical( sal_Bool bVertical ) + { + if ( bVertical ) + mpImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL; + else + mpImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL; + } + sal_Bool GetVertical() const + { return ( mpImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; } + + const SfxItemSet* GetBackground() const; + + PPTTextObj& operator=( PPTTextObj& rTextObj ); +}; + +class PPTConvertOCXControls : public SvxMSConvertOCXControls +{ + virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage(); + PptPageKind ePageKind; + const SdrPowerPointImport* mpPPTImporter; + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm; +public : + + PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, PptPageKind ePKind ) : + SvxMSConvertOCXControls ( rxModel ), + ePageKind ( ePKind ), + mpPPTImporter ( pPPTImporter ), + mxInStrm ( rxInStrm ) + {}; + virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape > *pShapeRef=0, + sal_Bool bFloatingCtrl=sal_False ); + virtual sal_Bool InsertControl( + const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp, + const com::sun::star::awt::Size& rSize, + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShape, + sal_Bool bFloatingCtrl + ); +}; + +// Powerpoint Recordtypen +#define PPT_PST_Unknown 0 +#define PPT_PST_SubContainerCompleted 1 +#define PPT_PST_IRRAtom 2 +#define PPT_PST_PSS 3 +#define PPT_PST_SubContainerException 4 +#define PPT_PST_ClientSignal1 6 +#define PPT_PST_ClientSignal2 7 +#define PPT_PST_PowerPointStateInfoAtom 10 +#define PPT_PST_Document 1000 +#define PPT_PST_DocumentAtom 1001 +#define PPT_PST_EndDocument 1002 +#define PPT_PST_SlidePersist 1003 +#define PPT_PST_SlideBase 1004 +#define PPT_PST_SlideBaseAtom 1005 +#define PPT_PST_Slide 1006 +#define PPT_PST_SlideAtom 1007 +#define PPT_PST_Notes 1008 +#define PPT_PST_NotesAtom 1009 +#define PPT_PST_Environment 1010 +#define PPT_PST_SlidePersistAtom 1011 +#define PPT_PST_Scheme 1012 +#define PPT_PST_SchemeAtom 1013 +#define PPT_PST_DocViewInfo 1014 +#define PPT_PST_SslideLayoutAtom 1015 +#define PPT_PST_MainMaster 1016 +#define PPT_PST_SSSlideInfoAtom 1017 +#define PPT_PST_SlideViewInfo 1018 +#define PPT_PST_GuideAtom 1019 +#define PPT_PST_ViewInfo 1020 +#define PPT_PST_ViewInfoAtom 1021 +#define PPT_PST_SlideViewInfoAtom 1022 +#define PPT_PST_VBAInfo 1023 +#define PPT_PST_VBAInfoAtom 1024 +#define PPT_PST_SSDocInfoAtom 1025 +#define PPT_PST_Summary 1026 +#define PPT_PST_Texture 1027 +#define PPT_PST_VBASlideInfo 1028 +#define PPT_PST_VBASlideInfoAtom 1029 +#define PPT_PST_DocRoutingSlip 1030 +#define PPT_PST_OutlineViewInfo 1031 +#define PPT_PST_SorterViewInfo 1032 +#define PPT_PST_ExObjList 1033 +#define PPT_PST_ExObjListAtom 1034 +#define PPT_PST_PPDrawingGroup 1035 +#define PPT_PST_PPDrawing 1036 +#define PPT_PST_NewlyAddedAtomByXP1037 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_ListPlaceholder 2017 +#define PPT_PST_BookmarkCollection 2019 +#define PPT_PST_SoundCollection 2020 +#define PPT_PST_SoundCollAtom 2021 +#define PPT_PST_Sound 2022 +#define PPT_PST_SoundData 2023 +#define PPT_PST_BookmarkSeedAtom 2025 +#define PPT_PST_GuideList 2026 +#define PPT_PST_RunArray 2028 +#define PPT_PST_RunArrayAtom 2029 +#define PPT_PST_ArrayElementAtom 2030 +#define PPT_PST_Int4ArrayAtom 2031 +#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_OEShape 3008 +#define PPT_PST_ExObjRefAtom 3009 +#define PPT_PST_OEPlaceholderAtom 3011 +#define PPT_PST_GrColor 3020 +#define PPT_PST_GrectAtom 3025 +#define PPT_PST_GratioAtom 3031 +#define PPT_PST_Gscaling 3032 +#define PPT_PST_GpointAtom 3034 +#define PPT_PST_OEShapeAtom 3035 +#define PPT_PST_OutlineTextRefAtom 3998 +#define PPT_PST_TextHeaderAtom 3999 +#define PPT_PST_TextCharsAtom 4000 +#define PPT_PST_StyleTextPropAtom 4001 +#define PPT_PST_BaseTextPropAtom 4002 +#define PPT_PST_TxMasterStyleAtom 4003 +#define PPT_PST_TxCFStyleAtom 4004 +#define PPT_PST_TxPFStyleAtom 4005 +#define PPT_PST_TextRulerAtom 4006 +#define PPT_PST_TextBookmarkAtom 4007 +#define PPT_PST_TextBytesAtom 4008 +#define PPT_PST_TxSIStyleAtom 4009 +#define PPT_PST_TextSpecInfoAtom 4010 +#define PPT_PST_DefaultRulerAtom 4011 + +// 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_NewlyAddedAtom4016 4016 + +#define PPT_PST_FontEntityAtom 4023 +#define PPT_PST_FontEmbedData 4024 +#define PPT_PST_TypeFace 4025 +#define PPT_PST_CString 4026 +#define PPT_PST_ExternalObject 4027 +#define PPT_PST_MetaFile 4033 +#define PPT_PST_ExOleObj 4034 +#define PPT_PST_ExOleObjAtom 4035 +#define PPT_PST_ExPlainLinkAtom 4036 +#define PPT_PST_CorePict 4037 +#define PPT_PST_CorePictAtom 4038 +#define PPT_PST_ExPlainAtom 4039 +#define PPT_PST_SrKinsoku 4040 +#define PPT_PST_Handout 4041 +#define PPT_PST_ExEmbed 4044 +#define PPT_PST_ExEmbedAtom 4045 +#define PPT_PST_ExLink 4046 +#define PPT_PST_ExLinkAtom_old 4047 +#define PPT_PST_BookmarkEntityAtom 4048 +#define PPT_PST_ExLinkAtom 4049 +#define PPT_PST_SrKinsokuAtom 4050 +#define PPT_PST_ExHyperlinkAtom 4051 +#define PPT_PST_ExPlain 4053 +#define PPT_PST_ExPlainLink 4054 +#define PPT_PST_ExHyperlink 4055 +#define PPT_PST_SlideNumberMCAtom 4056 +#define PPT_PST_HeadersFooters 4057 +#define PPT_PST_HeadersFootersAtom 4058 +#define PPT_PST_RecolorEntryAtom 4062 +#define PPT_PST_TxInteractiveInfoAtom 4063 +#define PPT_PST_EmFormatAtom 4065 +#define PPT_PST_CharFormatAtom 4066 +#define PPT_PST_ParaFormatAtom 4067 +#define PPT_PST_MasterText 4068 +#define PPT_PST_RecolorInfoAtom 4071 +#define PPT_PST_ExQuickTime 4073 +#define PPT_PST_ExQuickTimeMovie 4074 +#define PPT_PST_ExQuickTimeMovieData 4075 +#define PPT_PST_ExSubscription 4076 +#define PPT_PST_ExSubscriptionSection 4077 +#define PPT_PST_ExControl 4078 +#define PPT_PST_ExControlAtom 4091 +#define PPT_PST_SlideListWithText 4080 +#define PPT_PST_AnimationInfoAtom 4081 +#define PPT_PST_InteractiveInfo 4082 +#define PPT_PST_InteractiveInfoAtom 4083 +#define PPT_PST_SlideList 4084 +#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_ExMIDIAudio 4109 +#define PPT_PST_ExCDAudio 4110 +#define PPT_PST_ExWAVAudioEmbedded 4111 +#define PPT_PST_ExWAVAudioLink 4112 +#define PPT_PST_ExOleObjStg 4113 +#define PPT_PST_ExCDAudioAtom 4114 +#define PPT_PST_ExWAVAudioEmbeddedAtom 4115 +#define PPT_PST_AnimationInfo 4116 +#define PPT_PST_RTFDateTimeMCAtom 4117 +#define PPT_PST_ProgTags 5000 +#define PPT_PST_ProgStringTag 5001 +#define PPT_PST_ProgBinaryTag 5002 +#define PPT_PST_BinaryTagData 5003 +#define PPT_PST_PrintOptions 6000 +#define PPT_PST_PersistPtrFullBlock 6001 +#define PPT_PST_PersistPtrIncrementalBlock 6002 + +// these atoms first was seen in ppt2000 in a private Tag atom +#define PPT_PST_NewlyAddedAtomByPPT2000_6010 6010 +#define PPT_PST_NewlyAddedAtomByPPT2000_6011 6011 + +#define PPT_PST_RulerIndentAtom 10000 +#define PPT_PST_GscalingAtom 10001 +#define PPT_PST_GrColorAtom 10002 +#define PPT_PST_GLPointAtom 10003 +#define PPT_PST_GlineAtom 10004 + +#define PPT_PST_NewlyAddedAtomByXP11008 11008 +#define PPT_PST_NewlyAddedAtomByXP11010 11010 +#define PPT_PST_Comment10 12000 +#define PPT_PST_CommentAtom10 12001 +#define PPT_PST_NewlyAddedAtomByXP12004 12004 +#define PPT_PST_NewlyAddedAtomByXP12010 12010 +#define PPT_PST_NewlyAddedAtomByXP12011 12011 +#define PPT_PST_NewlyAddedAtomByXP14001 14001 + +// Attribute fuer 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_DontKnow1 8 //00000100 +#define PPT_ParaAttr_DontKnow2 9 //00000200 +#define PPT_ParaAttr_DontKnow3 10 //00000400 +#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 ist bei Textframes default immer auf 0032 gesetzt +#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_ResetNumbering 10 //00000400 +#define PPT_CharAttr_EnableNumbering1 11 //00000800 +#define PPT_CharAttr_EnableNumbering2 12 //00001000 +#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 + +// Werte fuer PptSlideLayoutAtom.eLayout +#define PPT_LAYOUT_TITLESLIDE 0 // The slide is a title slide +#define PPT_LAYOUT_TITLEANDBODYSLIDE 1 // Title and body slide +#define PPT_LAYOUT_TITLEMASTERSLIDE 2 // Title master slide +#define PPT_LAYOUT_MASTERSLIDE 3 // Master slide layout +#define PPT_LAYOUT_MASTERNOTES 4 // Master notes layout +#define PPT_LAYOUT_NOTESTITLEBODY 5 // Notes title/body layout +#define PPT_LAYOUT_HANDOUTLAYOUT 6 // Handout layout, therefore it doesn't have placeholders except header, footer, and date +#define PPT_LAYOUT_ONLYTITLE 7 // Only title placeholder +#define PPT_LAYOUT_2COLUMNSANDTITLE 8 // Body of the slide has 2 columns and a title +#define PPT_LAYOUT_2ROWSANDTITLE 9 // Slide's body has 2 rows and a title +#define PPT_LAYOUT_RIGHTCOLUMN2ROWS 10 // Body contains 2 columns, right column has 2 rows +#define PPT_LAYOUT_LEFTCOLUMN2ROWS 11 // Body contains 2 columns, left column has 2 rows +#define PPT_LAYOUT_BOTTOMROW2COLUMNS 12 // Body contains 2 rows, bottom row has 2 columns +#define PPT_LAYOUT_TOPROW2COLUMN 13 // Body contains 2 rows, top row has 2 columns +#define PPT_LAYOUT_4OBJECTS 14 // 4 objects +#define PPT_LAYOUT_BIGOBJECT 15 // Big object +#define PPT_LAYOUT_BLANCSLIDE 16 // Blank slide +#define PPT_LAYOUT_TITLERIGHTBODYLEFT 17 // Vertical title on the right, body on the left +#define PPT_LAYOUT_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) +#define PPT_PLACEHOLDER_NONE 0 // 0 None +#define PPT_PLACEHOLDER_MASTERTITLE 1 // 1 Master title +#define PPT_PLACEHOLDER_MASTERBODY 2 // 2 Master body +#define PPT_PLACEHOLDER_MASTERCENTEREDTITLE 3 // 3 Master centered title +#define PPT_PLACEHOLDER_MASTERSUBTITLE 4 // 10 Master subtitle +#define PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE 5 // 4 Master notes slide image +#define PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE 6 // 5 Master notes body image +#define PPT_PLACEHOLDER_MASTERDATE 7 // 6 Master date +#define PPT_PLACEHOLDER_MASTERSLIDENUMBER 8 // 7 Master slide number +#define PPT_PLACEHOLDER_MASTERFOOTER 9 // 8 Master footer +#define PPT_PLACEHOLDER_MASTERHEADER 10 // 9 Master header +#define PPT_PLACEHOLDER_GENERICTEXTOBJECT // 11 Generic text object +#define PPT_PLACEHOLDER_TITLE 13 // 12 Title +#define PPT_PLACEHOLDER_BODY 14 // 13 Body +#define PPT_PLACEHOLDER_NOTESBODY 12 // 14 Notes body +#define PPT_PLACEHOLDER_CENTEREDTITLE 15 // 15 Centered title +#define PPT_PLACEHOLDER_SUBTITLE 16 // 16 Subtitle +#define PPT_PLACEHOLDER_VERTICALTEXTTITLE 17 // 17 Vertical text title +#define PPT_PLACEHOLDER_VERTICALTEXTBODY 18 // 18 Vertical text body +#define PPT_PLACEHOLDER_NOTESSLIDEIMAGE 11 // 19 Notes slide image +#define PPT_PLACEHOLDER_OBJECT 19 // 20 Object (no matter the size) +#define PPT_PLACEHOLDER_GRAPH 20 // 21 Graph +#define PPT_PLACEHOLDER_TABLE 21 // 22 Table +#define PPT_PLACEHOLDER_CLIPART 22 // 23 Clip Art +#define PPT_PLACEHOLDER_ORGANISZATIONCHART 23 // 24 Organization Chart +#define PPT_PLACEHOLDER_MEDIACLIP 24 // 25 Media Clip + +#endif //_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 000000000000..8f87401edee5 --- /dev/null +++ b/include/filter/msfilter/svxmsbas.hxx @@ -0,0 +1,75 @@ +/* -*- 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 _SVXMSBAS_HXX +#define _SVXMSBAS_HXX + +#include <tools/solar.h> +#include "filter/msfilter/msfilterdllapi.h" + +#include <sot/storage.hxx> +#include <map> +#include <boost/unordered_map.hpp> + +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 + */ + +typedef boost::unordered_map< sal_Int32, OUString > ObjIdToName; + +typedef std::map< OUString, ObjIdToName > ControlAttributeInfo; + +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. + sal_uLong SaveOrDelMSVBAStorage( sal_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 loosing the information. + static sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); + + static OUString GetMSBasicStorageName(); +private: + SotStorageRef 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 000000000000..f50e4d10ea83 --- /dev/null +++ b/include/filter/msfilter/util.hxx @@ -0,0 +1,81 @@ +/* -*- 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_MSFILTER_UTIL_HXX +#define INCLUDED_MSFILTER_UTIL_HXX + +#include <rtl/textenc.h> +#include <tools/datetime.hxx> +#include <tools/color.hxx> +#include <com/sun/star/lang/Locale.hpp> +#include "filter/msfilter/msfilterdllapi.h" + +namespace msfilter { +namespace 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 ::com::sun::star::lang::Locale &rLocale); + +/// Convert a color in BGR format to RGB. +MSFILTER_DLLPUBLIC sal_uInt32 BGRToRGB(sal_uInt32 nColour); + +/** Convert from DTTM to Writer's DateTime + + @author + <a href="mailto:mmaher@openoffice.org">Martin Maher</a + */ +MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( 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 :-( +*/ +MSFILTER_DLLPUBLIC OString DateTimeToOString( const DateTime& rDateTime ); + +/// 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. +/// +/// Set bDisableUnicodeSupport when exporting to 8bit encodings +/// +/// 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, bool bDisableUnicodeSupport = false); + + +enum TextCategory +{ + latin, //Latin + cs, //Complex Script + ea, //East Asian + sym //Symbol +}; + +/** Categorize codepoints according to how MS seems to do it. + + It's been bugging me for ages as to what codepoint MS considers in + what category. Tom Jebo has a post suggesting the criteria used here + and indicating its been submitting to the standards working group + as a proposed resolution. +*/ +MSFILTER_DLLPUBLIC TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47LanguageTag); + +/// Converts tools Color to HTML color (without leading hashmark). +MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor ); + +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |