diff options
Diffstat (limited to 'filter/inc/filter')
-rw-r--r-- | filter/inc/filter/msfilter/countryid.hxx | 318 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/escherex.hxx | 1613 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/mscodec.hxx | 340 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msdffimp.hxx | 861 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msfilterdllapi.h | 41 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msfiltertracer.hxx | 96 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msocximex.hxx | 1420 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msoleexp.hxx | 60 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msvbahelper.hxx | 56 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/svdfppt.hxx | 1440 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/svxmsbas.hxx | 98 |
11 files changed, 6343 insertions, 0 deletions
diff --git a/filter/inc/filter/msfilter/countryid.hxx b/filter/inc/filter/msfilter/countryid.hxx new file mode 100644 index 000000000000..f33b2fe6b5ac --- /dev/null +++ b/filter/inc/filter/msfilter/countryid.hxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// ============================================================================ + +#ifndef INCLUDED_SVX_COUNTRYID_HXX +#define INCLUDED_SVX_COUNTRYID_HXX + +#include <sal/types.h> +#include <i18npool/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 + diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx new file mode 100644 index 000000000000..51058e2eabd8 --- /dev/null +++ b/filter/inc/filter/msfilter/escherex.hxx @@ -0,0 +1,1613 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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/list.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/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 der Mickysoft-Doku heissen die msofbt... statt 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 occured 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_BlipFlagDontSave = 4, // A "dont" is the depression in the metal + // body work of an automobile caused when a + // cyclist violently thrusts his or her nose + // at it, thus a DontSave is another name for + // a cycle lane. + ESCHER_BlipFlagDoNotSave = 4, // For those who prefer English + 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 /* BOOL No rotation */ +#define ESCHER_Prop_LockAspectRatio 120 /* BOOL Don't allow changes in aspect ratio */ +#define ESCHER_Prop_LockPosition 121 /* BOOL Don't allow the shape to be moved */ +#define ESCHER_Prop_LockAgainstSelect 122 /* BOOL Shape may not be selected */ +#define ESCHER_Prop_LockCropping 123 /* BOOL No cropping this shape */ +#define ESCHER_Prop_LockVertices 124 /* BOOL Edit Points not allowed */ +#define ESCHER_Prop_LockText 125 /* BOOL Do not edit text */ +#define ESCHER_Prop_LockAdjustHandles 126 /* BOOL Do not adjust */ +#define ESCHER_Prop_LockAgainstGrouping 127 /* BOOL Do not group this shape */ +// Text +#define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */ +#define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */ +#define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */ +#define ESCHER_Prop_dxTextRight 131 /* LONG */ +#define ESCHER_Prop_dyTextBottom 132 /* LONG */ +#define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */ +#define ESCHER_Prop_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 /* BOOL TRUE if single click selects text, FALSE if two clicks */ +#define ESCHER_Prop_AutoTextMargin 188 /* BOOL use host's margin calculations */ +#define ESCHER_Prop_RotateText 189 /* BOOL Rotate text with shape */ +#define ESCHER_Prop_FitShapeToText 190 /* BOOL Size shape to fit text size */ +#define ESCHER_Prop_FitTextToShape 191 /* BOOL Size text to fit shape size */ +// GeoText +#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */ +#define ESCHER_Prop_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 /* BOOL Reverse row order */ +#define ESCHER_Prop_fGtext 241 /* BOOL Has text effect */ +#define ESCHER_Prop_gtextFVertical 242 /* BOOL Rotate characters */ +#define ESCHER_Prop_gtextFKern 243 /* BOOL Kern characters */ +#define ESCHER_Prop_gtextFTight 244 /* BOOL Tightening or tracking */ +#define ESCHER_Prop_gtextFStretch 245 /* BOOL Stretch to fit shape */ +#define ESCHER_Prop_gtextFShrinkFit 246 /* BOOL Char bounding box */ +#define ESCHER_Prop_gtextFBestFit 247 /* BOOL Scale text-on-path */ +#define ESCHER_Prop_gtextFNormalize 248 /* BOOL Stretch char height */ +#define ESCHER_Prop_gtextFDxMeasure 249 /* BOOL Do not measure along path */ +#define ESCHER_Prop_gtextFBold 250 /* BOOL Bold font */ +#define ESCHER_Prop_gtextFItalic 251 /* BOOL Italic font */ +#define ESCHER_Prop_gtextFUnderline 252 /* BOOL Underline font */ +#define ESCHER_Prop_gtextFShadow 253 /* BOOL Shadow font */ +#define ESCHER_Prop_gtextFSmallcaps 254 /* BOOL Small caps font */ +#define ESCHER_Prop_gtextFStrikethrough 255 /* 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 /* BOOL Do not hit test the picture */ +#define ESCHER_Prop_pictureGray 317 /* BOOL grayscale display */ +#define ESCHER_Prop_pictureBiLevel 318 /* BOOL bi-level display */ +#define ESCHER_Prop_pictureActive 319 /* BOOL Server is active (OLE objects only) */ +// Geometry +#define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */ +#define ESCHER_Prop_geoTop 321 /* LONG */ +#define ESCHER_Prop_geoRight 322 /* LONG */ +#define ESCHER_Prop_geoBottom 323 /* LONG */ +#define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */ +#define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */ +#define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */ +#define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */ +#define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */ +#define ESCHER_Prop_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 /* BOOL Shadow may be set */ +#define ESCHER_Prop_f3DOK 379 /* BOOL 3D may be set */ +#define ESCHER_Prop_fLineOK 380 /* BOOL Line style may be set */ +#define ESCHER_Prop_fGtextOK 381 /* BOOL Text effect (FontWork) supported */ +#define ESCHER_Prop_fFillShadeShapeOK 382 /* BOOL */ +#define ESCHER_Prop_fFillOK 383 /* BOOL OK to fill the shape through the UI or VBA? */ +// FillStyle +#define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */ +#define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */ +#define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */ +#define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */ +#define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */ +#define ESCHER_Prop_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 /* BOOL Is shape filled? */ +#define ESCHER_Prop_fHitTestFill 444 /* BOOL Should we hit test fill? */ +#define ESCHER_Prop_fillShape 445 /* BOOL Register pattern on shape */ +#define ESCHER_Prop_fillUseRect 446 /* BOOL Use the large rect? */ +#define ESCHER_Prop_fNoFillHitTest 447 /* BOOL Hit test a shape as though filled */ +// LineStyle +#define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */ +#define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */ +#define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */ +#define ESCHER_Prop_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 /* BOOL Allow arrowheads if prop. is set */ +#define ESCHER_Prop_fLine 508 /* BOOL Any line? */ +#define ESCHER_Prop_fHitTestLine 509 /* BOOL Should we hit test lines? */ +#define ESCHER_Prop_lineFillShape 510 /* BOOL Register pattern on shape */ +#define ESCHER_Prop_fNoLineDrawDash 511 /* 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 /* BOOL Any shadow? */ +#define ESCHER_Prop_fshadowObscured 575 /* 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 /* 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 /* BOOL Does this shape have a 3D effect? */ +#define ESCHER_Prop_fc3DMetallic 701 /* BOOL Use metallic specularity? */ +#define ESCHER_Prop_fc3DUseExtrusionColor 702 /* BOOL */ +#define ESCHER_Prop_fc3DLightFace 703 /* 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 /* BOOL */ +#define ESCHER_Prop_fc3DRotationCenterAuto 764 /* BOOL */ +#define ESCHER_Prop_fc3DParallel 765 /* BOOL Parallel projection? */ +#define ESCHER_Prop_fc3DKeyHarsh 766 /* BOOL Is key lighting harsh? */ +#define ESCHER_Prop_fc3DFillHarsh 767 /* 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 /* BOOL For OLE objects, whether the object is in icon form */ +#define ESCHER_Prop_fPreferRelativeResize 827 /* BOOL For UI only. Prefer relative resizing. */ +#define ESCHER_Prop_fLockShapeType 828 /* BOOL Lock the shape type (don't allow Change Shape) */ +#define ESCHER_Prop_fDeleteAttachedObject 830 /* BOOL */ +#define ESCHER_Prop_fBackground 831 /* BOOL If 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 /* BOOL Is the shape a callout? */ +#define ESCHER_Prop_fCalloutAccentBar 890 /* BOOL does callout have accent bar */ +#define ESCHER_Prop_fCalloutTextBorder 891 /* BOOL does callout have a text border */ +#define ESCHER_Prop_fCalloutMinusX 892 /* BOOL */ +#define ESCHER_Prop_fCalloutMinusY 893 /* BOOL */ +#define ESCHER_Prop_fCalloutDropAuto 894 /* BOOL If true, then we occasionally invert the drop distance */ +#define ESCHER_Prop_fCalloutLengthSpecified 895 /* 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 /* BOOL Has the wrap polygon been edited? */ +#define ESCHER_Prop_fBehindDocument 954 /* BOOL Word-only (shape is behind text) */ +#define ESCHER_Prop_fOnDblClickNotify 955 /* BOOL Notify client on a double click */ +#define ESCHER_Prop_fIsButton 956 /* BOOL A button shape (i.e., clicking performs an action). Set for shapes with attached hyperlinks or macros. */ +#define ESCHER_Prop_fOneD 957 /* BOOL 1D adjustment */ +#define ESCHER_Prop_fHidden 958 /* BOOL Do not display */ +#define ESCHER_Prop_fPrint 959 /* 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 String& 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 String& rPropertyName ); +}; + +// --------------------------------------------------------------------------------------------- + +struct EscherPersistEntry +{ + UINT32 mnID; + UINT32 mnOffset; + EscherPersistEntry( UINT32 nId, UINT32 nOffset ) { mnID = nId; mnOffset = nOffset; }; + +}; + +// --------------------------------------------------------------------------------------------- + +class EscherBlibEntry +{ + + friend class EscherGraphicProvider; + friend class EscherEx; + + protected: + + UINT32 mnIdentifier[ 4 ]; + UINT32 mnPictureOffset; // offset auf die grafik im PictureStreams + UINT32 mnSize; // size of real graphic + + UINT32 mnRefCount; // !! reference count + 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 ByteString& rId, const GraphicAttr* pAttr = NULL ); + + ~EscherBlibEntry(); + + void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 ); + sal_Bool IsEmpty() const { return mbIsEmpty; }; + + 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; + + protected : + + 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 ByteString& 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 ); + + EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); + ~EscherGraphicProvider(); + +}; + +class MSFILTER_DLLPUBLIC EscherSolverContainer +{ + List maShapeList; + List 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 ByteString& 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 cirumstances the ShapeBoundRect is adjusted + // this will happen when rotated GraphicObjects + // are saved to PowerPoint + ~EscherPropertyContainer(); + + void AddOpt( sal_uInt16 nPropertyID, const rtl::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 ::rtl::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 String& 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, rtl::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 ); +}; + +// --------------------------------------------------------------------------------------------- + +class MSFILTER_DLLPUBLIC EscherPersistTable +{ + + public: + List maPersistTable; + + BOOL PtIsID( UINT32 nID ); + void PtInsert( UINT32 nID, UINT32 nOfs ); + UINT32 PtDelete( UINT32 nID ); + UINT32 PtGetOffsetByID( UINT32 nID ); + UINT32 PtReplace( UINT32 nID, UINT32 nOfs ); + UINT32 PtReplaceOrInsert( UINT32 nID, UINT32 nOfs ); + UINT32 PtGetCount() const { return maPersistTable.Count(); }; + + 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 EscherExHostAppData +{ +private: + EscherExClientAnchor_Base* pClientAnchor; + EscherExClientRecord_Base* pClientData; + EscherExClientRecord_Base* pClientTextbox; + // ignore single shape if entire pages are written + BOOL bDontWriteShape; + +public: + EscherExHostAppData() : pClientAnchor(0), pClientData(0), + pClientTextbox(0), bDontWriteShape(FALSE) + {} + + void SetClientAnchor( EscherExClientAnchor_Base* p ) + { pClientAnchor = p; } + void SetClientData( EscherExClientRecord_Base* p ) + { pClientData = p; } + void SetClientTextbox( EscherExClientRecord_Base* p ) + { pClientTextbox = p; } + void SetDontWriteShape( BOOL b ) + { bDontWriteShape = b; } + 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 ); } + + 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; + UINT32 mnStrmStartOfs; + std::vector< sal_uInt32 > mOffsets; + std::vector< sal_uInt16 > mRecTypes; + + UINT32 mnCurrentDg; + UINT32 mnCountOfs; + + UINT32 mnGroupLevel; + UINT16 mnHellLayerId; + + BOOL mbEscherSpgr; + BOOL mbEscherDg; + BOOL mbOleEmf; // OLE is EMF instead of WMF + + + virtual BOOL DoSeek( UINT32 nKey ); + +public: + explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream& rOutStrm ); + 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(); } + + /// Fuegt in den EscherStream interne Daten ein, dieser Vorgang + /// darf und muss nur einmal ausgefuehrt werden. + /// Wenn pPicStreamMergeBSE angegeben ist, werden die BLIPs + /// aus diesem Stream in die MsofbtBSE Records des EscherStream + /// gemerged, wie es fuer Excel (und Word?) benoetigt wird. + 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( UINT32 nKey, UINT32 nOffset ); // Es wird nicht geprueft, ob sich jener schluessel schon in der PersistantTable befindet + void ReplacePersistOffset( UINT32 nKey, UINT32 nOffset ); + UINT32 GetPersistOffset( UINT32 nKey ); + BOOL SeekToPersistOffset( UINT32 nKey ); + virtual BOOL InsertAtPersistOffset( UINT32 nKey, UINT32 nValue );// nValue wird im Stream an entrsprechender Stelle eingefuegt(overwrite modus), ohne dass sich die + // aktuelle StreamPosition aendert + + SvStream& GetStream() const { return *mpOutStrm; } + ULONG GetStreamPos() const { return mpOutStrm->Tell(); } + + virtual BOOL SeekBehindRecHeader( UINT16 nRecType ); // der stream muss vor einem gueltigen Record Header oder Atom stehen + + // features beim erzeugen folgender Container: + // + // ESCHER_DggContainer: ein EscherDgg Atom wird automatisch erzeugt und verwaltet + // ESCHER_DgContainer: ein EscherDg Atom wird automatisch erzeugt und verwaltet + // ESCHER_SpgrContainer: + // ESCHER_SpContainer: + + virtual void OpenContainer( UINT16 nEscherContainer, int nRecInstance = 0 ); + virtual void CloseContainer(); + + virtual void BeginAtom(); + virtual void EndAtom( UINT16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddAtom( UINT32 nAtomSitze, UINT16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddChildAnchor( const Rectangle& rRectangle ); + virtual void AddClientAnchor( const Rectangle& rRectangle ); + + virtual UINT32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); + UINT32 EnterGroup( const Rectangle* pBoundRect = NULL ); + UINT32 GetGroupLevel() const { return mnGroupLevel; }; + virtual BOOL SetGroupSnapRect( UINT32 nGroupLevel, const Rectangle& rRect ); + virtual BOOL SetGroupLogicRect( UINT32 nGroupLevel, const Rectangle& rRect ); + virtual void LeaveGroup(); + + // ein ESCHER_Sp wird geschrieben ( Ein ESCHER_DgContainer muss dazu geoeffnet sein !!) + virtual void AddShape( UINT32 nShpInstance, UINT32 nFlagIds, UINT32 nShapeID = 0 ); + + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + + UINT32 GetColor( const UINT32 nColor, BOOL bSwap = TRUE ); + UINT32 GetColor( const Color& rColor, BOOL bSwap = 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 + 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( UINT16 nShapeType, 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 UINT32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, UINT32 nShapeId ); + // add an dummy rectangle shape into the escher stream + UINT32 AddDummyShape(); + + static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape ); + + void SetHellLayerId( UINT16 nId ) { mnHellLayerId = nId; } + 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 diff --git a/filter/inc/filter/msfilter/mscodec.hxx b/filter/inc/filter/msfilter/mscodec.hxx new file mode 100644 index 000000000000..7bad8af6b788 --- /dev/null +++ b/filter/inc/filter/msfilter/mscodec.hxx @@ -0,0 +1,340 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVX_MSCODEC_HXX +#define SVX_MSCODEC_HXX + +#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 ] ); + + /** 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 ); + + // static ----------------------------------------------------------------- + + /** Calculates the 16-bit hash value for the given password. + + The password data may be longer than 16 bytes. The array does not need + to be terminated with a NULL byte (but it can without invalidating the + result). + */ + static sal_uInt16 GetHash( const sal_uInt8* pnPassData, sal_Size nSize ); + +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 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 pUnique + Unique document identifier read from or written to the file. + */ + void InitKey( + const sal_uInt16 pPassData[ 16 ], + const sal_uInt8 pUnique[ 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 occured). + */ + 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 occured). + */ + 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]); + +private: + void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[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 ]; +}; + +// ============================================================================ + +} // namespace msfilter + +#endif + diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx new file mode 100644 index 000000000000..4f11a4c2fab9 --- /dev/null +++ b/filter/inc/filter/msfilter/msdffimp.hxx @@ -0,0 +1,861 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MSDFFIMP_HXX +#define _MSDFFIMP_HXX + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <tools/solar.h> // UINTXX +#include <svl/svarray.hxx> +#include <tools/color.hxx> +#include <tools/gen.hxx> +#include <tools/table.hxx> +#include <svx/msdffdef.hxx> +#include <filter/msfilter/msfiltertracer.hxx> +#include <vcl/graph.hxx> +#include <string.h> +#include <map> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <filter/msfilter/msfilterdllapi.h> +#include <sot/storage.hxx> + +class Graphic; +class SvStream; +class SdrObject; +class SdrOle2Obj; +class SotStorageRef; +class Polygon; +class PolyPolygon; +class FmFormModel; +class SdrModel; +class DffRecordHeader; + +class SwFlyFrmFmt; + +struct SvxMSDffBLIPInfo; +struct SvxMSDffShapeInfo; +struct SvxMSDffShapeOrder; + +class MSFILTER_DLLPUBLIC DffRecordHeader +{ + +public: + BYTE nRecVer; // may be DFF_PSFLAG_CONTAINER + UINT16 nRecInstance; + UINT16 nImpVerInst; + UINT16 nRecType; + UINT32 nRecLen; + ULONG nFilePos; +public: + DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0), nRecType(0), nRecLen(0), nFilePos(0) {} + FASTBOOL IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; } + ULONG GetRecBegFilePos() const { return nFilePos; } + ULONG GetRecEndFilePos() const { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; } + void SeekToEndOfRecord(SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen ); } + void SeekToContent( SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE ); } + void SeekToBegOfRecord(SvStream& rIn) const { rIn.Seek( nFilePos ); } + + MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec); + +}; + +struct DffPropFlags +{ + BYTE bSet : 1; + BYTE bComplex : 1; + BYTE bBlip : 1; + BYTE bSoftAttr : 1; +}; + +class SvxMSDffManager; + +class MSFILTER_DLLPUBLIC DffPropSet : public Table +{ + protected : + + UINT32 mpContents[ 1024 ]; + DffPropFlags mpFlags[ 1024 ]; + + public : + + DffPropSet( BOOL bInitialize = FALSE ){ if ( bInitialize ) + memset( mpFlags, 0, 0x400 * sizeof( DffPropFlags ) ); }; + + inline BOOL IsProperty( UINT32 nRecType ) const { return ( mpFlags[ nRecType & 0x3ff ].bSet ); }; + BOOL IsHardAttribute( UINT32 nId ) const; + UINT32 GetPropertyValue( UINT32 nId, UINT32 nDefault = 0 ) const; + /** Returns a boolean property by its real identifier. */ + bool GetPropertyBool( UINT32 nId, bool bDefault = false ) const; + /** Returns a string property. */ + ::rtl::OUString GetPropertyString( UINT32 nId, SvStream& rStrm ) const; + void SetPropertyValue( UINT32 nId, UINT32 nValue ) const; + BOOL SeekToContent( UINT32 nRecType, SvStream& rSt ) const; + void Merge( DffPropSet& rMasterPropSet ) const; + void InitializePropSet() const; + friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet ); +}; + +class SfxItemSet; +class SdrObject; +struct DffObjData; + +class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet +{ + const SvxMSDffManager& rManager; + DffPropSet* pDefaultPropSet; + + void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) 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: + + INT32 mnFix16Angle; + + DffPropertyReader( const SvxMSDffManager& rManager ); + ~DffPropertyReader(); + INT32 Fix16ToAngle( INT32 nAngle ) const; + +#ifdef DBG_CUSTOMSHAPE + void ReadPropSet( SvStream& rIn, void* pClientData, UINT32 nShapeType = 0 ) const; +#else + void ReadPropSet( SvStream& rIn, void* pClientData ) const; +#endif + + void SetDefaultPropSet( SvStream& rIn, UINT32 nOffDgg ) const; + void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const; + void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const; +}; + + +#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC ) + +typedef SvxMSDffBLIPInfo* SvxMSDffBLIPInfo_Ptr; + +typedef SvxMSDffShapeInfo* SvxMSDffShapeInfo_Ptr; + +typedef SvxMSDffShapeOrder* SvxMSDffShapeOrder_Ptr; + +typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer; + +#define SVEXT_PERSIST_STREAM "\002OlePres000" + +// nach der Reihenfolge des Auftretens sortiert werden: +// +SV_DECL_PTRARR_DEL(SvxMSDffBLIPInfos, SvxMSDffBLIPInfo_Ptr, 16,16) + +SV_DECL_PTRARR_DEL(SvxMSDffShapeOrders, SvxMSDffShapeOrder_Ptr, 16,16) + +// explizit sortiert werden: +// +SV_DECL_PTRARR_SORT_DEL_VISIBILITY(SvxMSDffShapeInfos, SvxMSDffShapeInfo_Ptr, 16,16, MSFILTER_DLLPUBLIC) + +SV_DECL_PTRARR_SORT_VISIBILITY(SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder_Ptr, 16,16, MSFILTER_DLLPUBLIC) + +#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 A + + SdrObject* pAObj; // pPtr of object ( corresponding to shape A ) + SdrObject* pBObj; // " + SdrObject* pCObj; // " of connector object + + SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ), pBObj( NULL ), pCObj( NULL ) {}; + + friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom ); +}; +struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer +{ + List aCList; + + SvxMSDffSolverContainer(); + ~SvxMSDffSolverContainer(); + + MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom ); +}; + +struct FIDCL +{ + UINT32 dgid; // DG owning the SPIDs in this cluster + UINT32 cspidCur; // number of SPIDs used so far +}; + +//--------------------------------------------------------------------------- +// von SvxMSDffManager fuer jedes in der Gruppe enthaltene Shape geliefert +//--------------------------------------------------------------------------- +struct MSDffTxId +{ + USHORT nTxBxS; + USHORT nSequence; + MSDffTxId(USHORT nTxBxS_, USHORT nSequence_ ) + : nTxBxS( nTxBxS_ ), + nSequence( nSequence_ ){} + MSDffTxId(const MSDffTxId& rCopy) + : nTxBxS( rCopy.nTxBxS ), + nSequence( rCopy.nSequence ){} +}; + +struct MSFILTER_DLLPUBLIC SvxMSDffImportRec +{ + SdrObject* pObj; + Polygon* pWrapPolygon; + char* pClientAnchorBuffer; + UINT32 nClientAnchorLen; + char* pClientDataBuffer; + UINT32 nClientDataLen; + UINT32 nXAlign; + UINT32 nXRelTo; + UINT32 nYAlign; + UINT32 nYRelTo; + UINT32 nLayoutInTableCell; + UINT32 nFlags; + long nTextRotationAngle; + long nDxTextLeft; // Abstand der Textbox vom umgebenden 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; // Kennungen fuer Textboxen + ULONG nNextShapeId; // fuer verlinkte Textboxen + ULONG nShapeId; + MSO_SPT eShapeType; + MSO_LineStyle eLineStyle; // Umrandungs-Arten + BOOL bDrawHell :1; + BOOL bHidden :1; + BOOL bReplaceByFly :1; + BOOL bLastBoxInChain :1; + BOOL bHasUDefProp :1; + BOOL bVFlip :1; + BOOL bHFlip :1; + BOOL bAutoWidth :1; + + 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; } +}; +typedef SvxMSDffImportRec* MSDffImportRec_Ptr; + +// Liste aller SvxMSDffImportRec fuer eine Gruppe +SV_DECL_PTRARR_SORT_DEL_VISIBILITY(MSDffImportRecords, MSDffImportRec_Ptr, 16,16, MSFILTER_DLLPUBLIC) + +//--------------------------------------------------------------------------- +// Import-/Export-Parameterblock fuer 1 x ImportObjAtCurrentStreamPos() +//--------------------------------------------------------------------------- +struct SvxMSDffImportData +{ + MSDffImportRecords aRecords; // Shape-Pointer, -Ids und private Daten + Rectangle aParentRect;// Rectangle der umgebenden Gruppe + // bzw. von aussen reingegebenes Rect + Rectangle aNewRect; // mit diesem Shape definiertes Rectangle + + SvxMSDffImportData() + {} + SvxMSDffImportData(const Rectangle& rParentRect) + :aParentRect( rParentRect ) + {} + void SetNewRect(INT32 l, INT32 o, + INT32 r, INT32 u ){ aNewRect = Rectangle(l,o, r,u); } + BOOL HasParRect() const { return aParentRect.IsEmpty(); } + BOOL HasNewRect() const { return aNewRect.IsEmpty() ; } + BOOL HasRecords() const { return 0 != aRecords.Count(); } + USHORT GetRecCount() const { return aRecords.Count(); } + SvxMSDffImportRec* GetRecord(USHORT iRecord) const + { return aRecords.GetObject( iRecord ); } +}; + +struct DffObjData +{ + const DffRecordHeader& rSpHd; + + Rectangle aBoundRect; + Rectangle aChildAnchor; + + UINT32 nShapeId; + UINT32 nSpFlags; + MSO_SPT eShapeType; + + BOOL bShapeType : 1; + BOOL bClientAnchor : 1; + BOOL bClientData : 1; + BOOL bChildAnchor : 1; + BOOL bOpt : 1; + BOOL bIsAutoText : 1; + + int nCalledByGroup; + + DffObjData( const DffRecordHeader& rObjHd, + const Rectangle& rBoundRect, + int nClByGroup ) : + rSpHd( rObjHd ), + aBoundRect( rBoundRect ), + nShapeId( 0 ), + nSpFlags( 0 ), + eShapeType( mso_sptNil ), + bShapeType( FALSE ), + bClientAnchor( FALSE ), + bClientData( FALSE ), + bChildAnchor( FALSE ), + bOpt( FALSE ), + bIsAutoText( FALSE ), + nCalledByGroup( nClByGroup ){} +}; + +#define DFF_RECORD_MANAGER_BUF_SIZE 64 + +struct DffRecordList +{ + UINT32 nCount; + UINT32 nCurrent; + DffRecordList* pPrev; + DffRecordList* pNext; + + DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ]; + + 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, BOOL bAppend = FALSE, UINT32 nStOfs = 0 ); + + BOOL SeekToContent( SvStream& rIn, UINT16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); + DffRecordHeader* GetRecordHeader( UINT16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); + + DffRecordManager(); + DffRecordManager( SvStream& rIn ); + ~DffRecordManager(); + + DffRecordHeader* Current(); + DffRecordHeader* First(); + DffRecordHeader* Next(); + DffRecordHeader* Prev(); + DffRecordHeader* Last(); +}; + +/* + SvxMSDffManager - abstrakte Basis-Klasse fuer Escher-Import + =============== + Zweck: Zugriff auf Objekte im Drawing File Format + Stand: Zugriff nur auf BLIPs (wird spaeter erweitert) + + Beachte: in der zwecks PowerPoint-, ODER Word- ODER Excel-Import + ======== abgeleiteten Klasse + MUSS jeweils die Methode ProcessUserDefinedRecord() + implementiert werden! +*/ +class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader +{ + FmFormModel* pFormModel; + SvxMSDffBLIPInfos* pBLIPInfos; + SvxMSDffShapeInfos* pShapeInfos; + SvxMSDffShapeOrders* pShapeOrders; + ULONG nDefaultFontHeight; + long nOffsDgg; + USHORT nBLIPCount; + USHORT nShapeCount; + sal_uInt32 nGroupShapeFlags; + + void CheckTxBxStoryChain(); + void GetFidclData( long nOffsDgg ); + +protected : + + String maBaseURL; + UINT32 mnCurMaxShapeId; // we need this information to + UINT32 mnDrawingsSaved; // access the right drawing + UINT32 mnIdClusters; // while only knowing the shapeid + FIDCL* mpFidcls; + Table 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; + FASTBOOL bNeedMap; + UINT32 nSvxMSDffSettings; + UINT32 nSvxMSDffOLEConvFlags; + + /** stores a reference to an imported SdrObject with its shape id if + it has one + */ + SvxMSDffShapeIdContainer maShapeIdContainer; + + void GetCtrlData( long nOffsDgg ); + void GetDrawingGroupContainerData( SvStream& rSt, + ULONG nLenDgg ); + // --> OD 2008-08-01 #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, + ULONG nLenDg, + const unsigned long nDrawingContainerId ); + BOOL GetShapeGroupContainerData( SvStream& rSt, + ULONG nLenShapeGroupCont, + BOOL bPatriarch, + const unsigned long nDrawingContainerId ); + BOOL GetShapeContainerData( SvStream& rSt, + ULONG nLenShapeCont, + ULONG nPosGroup, + const unsigned long nDrawingContainerId ); + // <-- + + FASTBOOL ReadGraphic( SvStream& rSt, ULONG nIndex, Graphic& rGraphic ) const; + SdrObject* ImportFontWork( SvStream&, SfxItemSet&, Rectangle& rBoundRect ) const; + SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& ) const; + // --> OD 2004-12-14 #i32596# - pass <nCalledByGroup> to method + // Needed in the Writer 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; + // <-- + SdrObject* GetAutoForm( MSO_SPT eTyp ) const; + static const GDIMetaFile* lcl_GetMetaFileFromGrf_Impl( const Graphic& rGrf, GDIMetaFile& rMtf ); +#ifndef SVX_LIGHT + static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj( + UINT32 nConvertFlags, SotStorage& rSrcStg, + const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg, + const Graphic& rGrf, + const Rectangle& rVisArea ); +#endif + +/* + folgende Methoden sind zum Excel-Import zu ueberschreiben: +*/ + virtual BOOL ProcessClientAnchor(SvStream& rStData, ULONG nDatLen, char*& rpBuff, UINT32& rBuffLen ) const; + virtual void ProcessClientAnchor2( SvStream& rStData, DffRecordHeader& rHd, void* pData, DffObjData& ); + virtual BOOL ProcessClientData( SvStream& rStData, ULONG nDatLen, char*& rpBuff, UINT32& rBuffLen ) const; + virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj = NULL); + virtual ULONG Calc_nBLIPPos( ULONG nOrgVal, ULONG nStreamPos ) const; + virtual FASTBOOL GetColorFromPalette(USHORT nNum, Color& rColor) const; + + // ----------------------------------------------------------------------- + + FASTBOOL ReadDffString(SvStream& rSt, String& rTxt) const; + FASTBOOL ReadObjText(SvStream& rSt, SdrObject* pObj) const; + + // SJ: New implementation of ReadObjText is used by Fontwork objects, because + // the old one does not properly import multiple paragraphs + void ReadObjText( const String& rText, SdrObject* pObj ) const; + // ----------------------------------------------------------------------- + + /* + folgende Methode ist von allen zu ueberschreiben, die OLE-Objecte + importieren moechten: + */ + virtual BOOL GetOLEStorageName( long nOLEId, String& rStorageName, + SotStorageRef& rSrcStorage, + com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg + ) const; + + /* + folgende Methode ist von allen zu ueberschreiben, die verhindern + moechten, dass (abgerundete) Rechtecke mit umgebrochenem Text + immer in SdrRectObj( OBJ_TEXT ) umgewandelt werden: + TRUE bedeutet umwandeln. + */ + virtual BOOL ShapeHasText(ULONG nShapeId, ULONG nFilePos) const; + +public: + + void* pSvxMSDffDummy1; + void* pSvxMSDffDummy2; + void* pSvxMSDffDummy3; + List* pEscherBlipCache; + + DffRecordManager maShapeRecords; + ColorData mnDefaultColor; + + MSFilterTracer* mpTracer; + 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 BOOL SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const; + FASTBOOL SeekToRec( SvStream& rSt, USHORT nRecId, ULONG nMaxFilePos, DffRecordHeader* pRecHd = NULL, ULONG nSkipCount = 0 ) const; + FASTBOOL SeekToRec2( USHORT nRecId1, USHORT nRecId2, ULONG nMaxFilePos, DffRecordHeader* pRecHd = NULL, ULONG nSkipCount = 0 ) const; + + // ----------------------------------------------------------------------- + static void MSDFFReadZString( SvStream& rIn, String& rStr, ULONG nMaxLen, FASTBOOL bUniCode = FALSE ); + + static BOOL ReadCommonRecordHeader( DffRecordHeader& rRec, SvStream& rIn ); + static BOOL ReadCommonRecordHeader( SvStream& rSt, + BYTE& rVer, + USHORT& rInst, + USHORT& rFbt, + UINT32& rLength ); +/* + Konstruktor + =========== + Input: rStCtrl - Verwaltungsstream mit Containern, + FBSE Objekten und Shapes + ( muss immer uebergeben werden; + Stream muss bereits offen sein ) + + nOffsDgg - Offset im rStCtrl: Beginn des Drawing Group Containers + + pStData - Datenstream, in dem die BLIPs gespeichert sind + ( falls Null, wird angenommen, dass die + BLIPs ebenfalls im rStCtrl gespeichert sind; + dieser Stream muss ebenfalls bereits offen sein ) + pSdrModel_ kann beim Ctor-Aufruf leer bleiben, muss dann aber + spaeter ueber SetModel() gesetzt werden! + + setzt nBLIPCount +*/ + SvxMSDffManager( SvStream& rStCtrl, + const String& rBaseURL, + long nOffsDgg, + SvStream* pStData, + SdrModel* pSdrModel_ = 0, + long nApplicationScale = 0, + ColorData mnDefaultColor_ = COL_DEFAULT, + ULONG nDefaultFontHeight_ = 24, + SvStream* pStData2_ = 0, + MSFilterTracer* pTracer = NULL ); + + // in PPT werden die Parameter DGGContainerOffset und PicStream + // mit Hilfe einer Init Routine Uebergeben. + SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL, MSFilterTracer* pTracer ); + void InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags ); + void SetDgContainer( SvStream& rSt ); + + virtual ~SvxMSDffManager(); + + UINT32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; }; + void SetSvxMSDffSettings( UINT32 nSettings ) { nSvxMSDffSettings = nSettings; }; + + static BOOL MakeContentStream( SotStorage * pStor, const GDIMetaFile & ); + static BOOL ConvertToOle2( SvStream& rStm, 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 Scale(Rectangle& rRect) const; + void Scale(Polygon& rPoly) const; + void Scale(PolyPolygon& rPoly) const; + void ScaleEmu(sal_Int32& rVal) const; + UINT32 ScalePt( UINT32 nPt ) const; + INT32 ScalePoint( INT32 nVal ) const; + +/* + GetBLIP() - Anforderung eines bestimmten BLIP + ========= + Input: nIdx - Nummer des angeforderten BLIP + ( muss immer uebergeben werden ) + + Output: rData - bereits fertig konvertierte Daten + ( direkt als Grafik in unsere Dokumente einzusetzen ) + + Rueckgabewert: TRUE, im Erfolgsfalls, FALSE bei Fehler +*/ + BOOL GetBLIP( ULONG nIdx, Graphic& rData, Rectangle* pVisArea = NULL ) const; + +/* + GetBLIPDirect() -Einlesen eines BLIP aus schon positioniertem Stream + =============== + Input: rBLIPStream -bereits korrekt positionierter Stream + ( muss immer uebergeben werden ) + + Output: rData -bereits fertig konvertierte Daten + ( direkt als Grafik in unsere Dokumente einzusetzen ) + + Rueckgabewert: TRUE, im Erfolgsfalls, FALSE bei Fehler +*/ + BOOL GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const; + + BOOL GetShape(ULONG nId, + SdrObject*& rpData, SvxMSDffImportData& rData); + +/* + GetBLIPCount() - Abfrage der verwalteten BLIP Anzahl + ============== + Input: ./. + Output: ./. + Rueckgabewert: nBLIPCount - Anzahl der im pStData (bzw. rStCtrl) enthaltenen BLIPs + ( sprich: Anzahl der FBSEs im Drawing Group Container ) + + Werte: 0 - Struktur Ok, jedoch keine BLIPs vorhanden + 1.. - Anzahl der BLIPs + USHRT_MAX - Fehler: kein korrektes Drawing File Format +*/ + USHORT GetBLIPCount() const{ return nBLIPCount; } + +/* + ZCodecDecompressed() - Dekomprimierung eines komp. WMF oder Enhanced WMF + ==================== + Input: rIn -bereits korrekt positionierter Stream, + der das komprimierte Bild enthaelt + rOut -bereits korrekt positionierter Ausgabe-Stream, + + bLookForEnd -Flag, ob das komp. Bild bis zum Stream-Ende reicht. + Falls TRUE, wird jeweils geprueft, ob das gelesene noch + zum Bild gehoert. + Falls FALSE, wird bis zum Stream-Ende gelesen. + + Output: rIn -Der Stream steht hinter dem Ende des komp. Bildes. + (es kann aber noch eine Ende-Kennung und CRC-Sum folgen) + rOut -Der Stream enthaelt das dekomprimierte Bild. + Der Stream wird auf den Anfang des Bildes positioniert. + (also dorthin, wo der Stream vor der Verarbeitung stand) + + Rueckgabewert: TRUE, im Erfolgsfall + FALSE bei Fehler oder Null Bytes geschrieben +*/ +// static BOOL ZCodecDecompressed( SvStream& rIn, +// SvStream& rOut, +// BOOL bLookForEnd ); +// + 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* GetShapeInfos( void ) const + { + return pShapeInfos; + } + + inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const + { + return pShapeOrders; + } + + void StoreShapeOrder(ULONG nId, + ULONG nTxBx, + SdrObject* pObject, + SwFlyFrmFmt* pFly = 0, + short nHdFtSection = 0) const; + + void ExchangeInShapeOrder(SdrObject* pOldObject, + ULONG nTxBx, + SwFlyFrmFmt* pFly, + SdrObject* pObject) const; + + void RemoveFromShapeOrder( SdrObject* pObject ) const; + + UINT32 GetConvertFlags() const { return nSvxMSDffOLEConvFlags; } + + static SdrOle2Obj* CreateSdrOLEFromStorage( const String& 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, + UINT32 nConvertFlags, + sal_Int64 nAspect ); + + /* the method SolveSolver will create connections between shapes, it should be called after a page is imported. + The SvxMSDffSolverContainer is containing necessary data 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 String& rPropertyName, + sal_Bool bTestPropertyAvailability = sal_False ); + + void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ); + void removeShapeId( SdrObject* pShape ); + SdrObject* getShapeForId( sal_Int32 nShapeId ); +}; + +struct SvxMSDffBLIPInfo +{ + USHORT nBLIPType; // Art des BLIP: z.B. 6 fuer PNG + ULONG nFilePos; // Offset des BLIP im Daten-Stream + ULONG nBLIPSize; // Anzahl Bytes, die der BLIP im Stream einnimmt + SvxMSDffBLIPInfo(USHORT nBType, ULONG nFPos, ULONG nBSize): + nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){} +}; + +struct SvxMSDffShapeInfo +{ + sal_uInt32 nShapeId; // Shape Id, verwendet im PLCF SPA und im mso_fbtSp (FSP) + ULONG nFilePos; // Offset des Shape im Kontroll-Stream fuer eventuelle + // erneute Zugriffe auf dieses Shape + sal_uInt32 nTxBxComp; + + BOOL bReplaceByFly :1; // Shape darf im Writer durch Rahmen ersetzt werden. + BOOL bSortByShapeId :1; + BOOL bLastBoxInChain:1; + + SvxMSDffShapeInfo(ULONG nFPos, sal_uInt32 nId=0, // ULONG nBIdx=0, + USHORT nSeqId=0, USHORT nBoxId=0): + nShapeId( nId ), + nFilePos( nFPos ), + nTxBxComp( (nSeqId << 16) + nBoxId ) + { + bReplaceByFly = FALSE; + bSortByShapeId = FALSE; + bLastBoxInChain = TRUE; + } + SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo): + nShapeId( rInfo.nShapeId ), + nFilePos( rInfo.nFilePos ), + nTxBxComp( rInfo.nTxBxComp ) + { + bReplaceByFly = rInfo.bReplaceByFly; + bSortByShapeId = rInfo.bSortByShapeId; + bLastBoxInChain = rInfo.bLastBoxInChain; + } + BOOL operator==( const SvxMSDffShapeInfo& rEntry ) const + { + return bSortByShapeId ? (nShapeId == rEntry.nShapeId) + : (nTxBxComp == rEntry.nTxBxComp && this == &rEntry); + } + BOOL operator<( const SvxMSDffShapeInfo& rEntry ) const + { + return bSortByShapeId ? (nShapeId < rEntry.nShapeId) + : (nTxBxComp < rEntry.nTxBxComp); + } +}; + +struct SvxMSDffShapeOrder +{ + ULONG nShapeId; // Shape Id, verwendet im PLCF SPA und im mso_fbtSp (FSP) + + ULONG nTxBxComp; // Ketten- und Boxnummer in der Text-Box-Story (bzw. Null) + + SwFlyFrmFmt* pFly; // Frame-Format eines statt des Sdr-Text-Objektes im + // Writer eingefuegten Rahmens: zur Verkettung benoetigt! + + short nHdFtSection; // used by Writer to find out if linked frames are in the + // same header or footer of the same section + + SdrObject* pObj; // Zeiger auf das Draw-Objekt (bzw. Null, falls nicht verwendet) + + // Vorgehensweise: im Ctor des SvxMSDffManager werden im der Shape-Order-Array + // nur die Shape-Ids vermerkt, + // Text-Box-Nummer und der Objekt-Pointer werden nur dann + // gespeichert, wenn das Shape tatsaechlich importiert wird! + SvxMSDffShapeOrder( 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); + } +}; + +#endif + diff --git a/filter/inc/filter/msfilter/msfilterdllapi.h b/filter/inc/filter/msfilter/msfilterdllapi.h new file mode 100644 index 000000000000..28985f0c500f --- /dev/null +++ b/filter/inc/filter/msfilter/msfilterdllapi.h @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 diff --git a/filter/inc/filter/msfilter/msfiltertracer.hxx b/filter/inc/filter/msfilter/msfiltertracer.hxx new file mode 100644 index 000000000000..3b103e5be422 --- /dev/null +++ b/filter/inc/filter/msfilter/msfiltertracer.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MS_FILTERTRACER_HXX +#define _MS_FILTERTRACER_HXX + +#include <rtl/ustring.hxx> +#include <tools/stream.hxx> +#include <xmloff/attrlist.hxx> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/util/XTextSearch.hpp> +#include <com/sun/star/util/SearchResult.hpp> +#include <com/sun/star/util/logging/XLogger.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include "filter/msfilter/msfilterdllapi.h" + +class FilterConfigItem; +class MSFILTER_DLLPUBLIC MSFilterTracer +{ + FilterConfigItem* mpCfgItem; + SvXMLAttributeList* mpAttributeList; + SvStream* mpStream; + sal_Bool mbEnabled; + + ::com::sun::star::util::SearchOptions maSearchOptions; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxFilterTracer; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > mxTextSearch; + + ::com::sun::star::uno::Reference< ::com::sun::star::util::logging::XLogger > mxLogger; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler; + + public : + + /* The first parameter is expecting the path of the configuration file. + The second parameter can be used to override properties of the configuration + file. A "DocumentURL" property can be set in the property + sequence to provide the current url of the document. + If the "Path" property is not set in the configuration file, then the path + of the "DocumentURL" property is used instead. If both are not set, the + application path is used instead. + If the "Name" property is not set in the configuration file, then the name + of the "DocumentURL" property is used instead. If both are not set, the + name "tracer* is used. + The file extension will always be "log" */ + + MSFilterTracer( const ::rtl::OUString& rConfigurationPath, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pConfigData = NULL ); + ~MSFilterTracer(); + + void StartTracing(); + void EndTracing(); + + inline sal_Bool IsEnabled() const { return mbEnabled; } + + void StartElement( const ::rtl::OUString& rName, ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttribs ); + void EndElement( const ::rtl::OUString& rName ); + + void Trace( const ::rtl::OUString& rElementID, const ::rtl::OUString& rMessage ); + void AddAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sValue ); + void RemoveAttribute( const ::rtl::OUString& sName ); + void ClearAttributes(); + + /* initially all properties of the configuration file and the + properties which are given to the c'tor can be retrieved */ + ::com::sun::star::uno::Any GetProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any* pDefault = NULL ) const; + void SetProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rProperty ); +}; + +#endif diff --git a/filter/inc/filter/msfilter/msocximex.hxx b/filter/inc/filter/msfilter/msocximex.hxx new file mode 100644 index 000000000000..173835495b12 --- /dev/null +++ b/filter/inc/filter/msfilter/msocximex.hxx @@ -0,0 +1,1420 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _MSOCXIMEX_HXX +#define _MSOCXIMEX_HXX + +#include <sot/storage.hxx> +#include <tools/debug.hxx> + +//!! no such defines in global namespaces - it will break other existing code that uses the same define!! +//#ifndef C2U +//#define C2U(cChar) rtl::OUString::createFromAscii(cChar) +//#endif +#include "filter/msfilter/msfilterdllapi.h" +#include <vector> +#include <hash_map> + +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; + } + +}}} + +class OCX_Control; +class SfxObjectShell; +class SwPaM; + +class TypeName +{ +public: + String msName; + sal_uInt16 mnType; + sal_Int32 mnLeft; + sal_Int32 mnTop; + sal_Int32 mnStoreId; + TypeName(sal_Char *pName, sal_uInt32 nStoreId, sal_uInt32 nLen, sal_uInt16 nType, + sal_Int32 nLeft, sal_Int32 nTop); +}; + + +class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls +{ +public: + SvxMSConvertOCXControls( SfxObjectShell *pDSh,SwPaM *pP ); + virtual ~SvxMSConvertOCXControls(); + + //Reads a control from the given storage, constructed shape in pShapeRef + sal_Bool ReadOCXStream( SotStorageRef& rSrc1, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape > *pShapeRef=0, + BOOL bFloatingCtrl=FALSE ); + + + //Excel has a nasty kludged mechanism for this, read + //the comments in the source to follow it + sal_Bool ReadOCXExcelKludgeStream(SotStorageStreamRef& rSrc1, + com::sun::star::uno::Reference < + com::sun::star::drawing::XShape > *pShapeRef,BOOL bFloatingCtrl); + + + //Writes the given Uno Control into the given storage + + static sal_Bool WriteOCXStream(SotStorageRef &rSrc1, + const com::sun::star::uno::Reference< + com::sun::star::awt::XControlModel > &rControlModel, + const com::sun::star::awt::Size& rSize,String &rName); + + //Excel has a nasty kludged mechanism for this, read + //the comments in the source to follow it + static sal_Bool WriteOCXExcelKludgeStream(SotStorageStreamRef& rContents, + const com::sun::star::uno::Reference< + com::sun::star::awt::XControlModel > &rControlModel, + const com::sun::star::awt::Size &rSize, String &rName); + + //Generate an OCX converter based on the OLE2 name + static OCX_Control *OCX_Factory(const String &rId); + + //Generate an OCX converter based on the StarOffice UNO id + static OCX_Control *OCX_Factory( const com::sun::star::uno::Reference< + com::sun::star::awt::XControlModel > &rControlModel, + String &rId,String &rName); + + 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*/, + 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(); + + sal_uInt16 GetEditNum() { return ++nEdit; } + sal_uInt16 GetCheckboxNum() { return ++nCheckbox; } + /*end: Backwards compatability*/ +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(); + + SfxObjectShell *pDocSh; + SwPaM *pPaM; + + // 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; + + sal_uInt16 nEdit; + sal_uInt16 nCheckbox; + + virtual const com::sun::star::uno::Reference< + com::sun::star::drawing::XDrawPage > & GetDrawPage(); +}; + +class OCX_FontData +{ +public: + OCX_FontData() : nFontNameLen(0), fBold(0), fItalic(0), fUnderline(0), + fStrike(0), nFontSize(12), nJustification(1), pFontName(0), + bHasAlign(FALSE), bHasFont(TRUE) {} + ~OCX_FontData() { + if (pFontName) + delete [] pFontName; + } + sal_Bool Read(SotStorageStream *pS); + void Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet > &rPropSet); + + sal_Bool Export(SotStorageStreamRef &rContent, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 nFontNameLen; + + sal_uInt8 fBold:1; + sal_uInt8 fItalic:1; + sal_uInt8 fUnderline:1; + sal_uInt8 fStrike:1; + sal_uInt8 fUnknown1:4; + + sal_uInt8 nUnknown2; + sal_uInt8 nUnknown3; + sal_uInt8 nUnknown4; + + sal_uInt32 nFontSize; + sal_uInt16 nLanguageID; + sal_uInt8 nJustification; + sal_uInt16 nFontWeight; + + char *pFontName; + void SetHasAlign(sal_Bool bIn) {bHasAlign=bIn;} + void SetHasFont(sal_Bool bIn) {bHasFont=bIn;} +protected: + static sal_uInt16 nStandardId; + sal_uInt8 ExportAlign(sal_Int16 nAlign) const; + sal_Int16 ImportAlign(sal_uInt8 nJustification) const; +private: + sal_Bool bHasAlign; + sal_Bool bHasFont; +}; + +class MSFILTER_DLLPUBLIC OCX_Control +{ +public: + OCX_Control(UniString sN, OCX_Control* parent = NULL ) : nWidth( 0 ), nHeight( 0 ), mnLeft(0), mnTop(0), + mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), mbVisible(true), sName(sN), pDocSh(0), + bSetInDialog(FALSE), mpParent( parent ) {} + sal_Bool FullRead(SotStorageStream *pS) + { + return Read(pS) && ReadFontData(pS); + }; + virtual sal_Bool Read(SotStorageStream *pS); + virtual sal_Bool ReadFontData(SotStorageStream *pS); + virtual sal_Bool Import(const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > &rServiceFactory, + com::sun::star::uno::Reference< + com::sun::star::form::XFormComponent > &rFComp, + com::sun::star::awt::Size &rSz); + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer> + &rDialog); + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& /*rPropSet*/) + {return sal_False;} + //Export exports a control as an OLE style storage stream tree + virtual sal_Bool Export(SotStorageRef& /*rObj*/, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& /*rPropSet*/, + const com::sun::star::awt::Size& /*rSize*/) {return sal_False;} + + //WriteContents writes the contents of a contents stream, for + //the Excel export you cannot use Export, only WriteContents instead + virtual sal_Bool WriteContents(SotStorageStreamRef& /*rObj*/, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& /*rPropSet*/, + const com::sun::star::awt::Size& /*rSize*/) {return sal_False;} + void SetInDialog(bool bState) { bSetInDialog = bState; } + bool GetInDialog() { return bSetInDialog; } + + sal_Bool ReadAndImport(SotStorageStream *pS, + com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > &rSF, + com::sun::star::uno::Reference< + com::sun::star::form::XFormComponent > &rFComp, + com::sun::star::awt::Size &rSz) + { + if (Read(pS)) + return Import(rSF,rFComp,rSz); + return sal_False; + } + virtual ~OCX_Control() {} + + static void FillSystemColors(); + + sal_uInt32 nWidth; + sal_uInt32 nHeight; + sal_Int32 mnLeft; + sal_Int32 mnTop; + sal_Int32 mnStep; + sal_Int32 mnBackColor; + sal_Int32 mnForeColor; + sal_uInt16 mnTabPos; + bool mbVisible; + UniString sName; + UniString msToolTip; + OCX_FontData aFontData; + SfxObjectShell *pDocSh; +protected: + + sal_uInt32 ImportColor(sal_uInt32 nColorCode) const; + sal_uInt32 ExportColor(sal_uInt32 nColorCode) const; + sal_uInt32 SwapColor(sal_uInt32 nColorCode) const; + sal_Int16 ImportBorder(sal_uInt16 nSpecialEffect,sal_uInt16 nBorderStyle) + const; + sal_uInt8 ExportBorder(sal_uInt16 nBorder,sal_uInt8 &rBorderStyle) const; + bool bSetInDialog; + sal_Int16 ImportSpecEffect( sal_uInt8 nSpecialEffect ) const; + sal_uInt8 ExportSpecEffect( sal_Int16 nApiEffect ) const; + static sal_uInt16 nStandardId; + static sal_uInt8 __READONLY_DATA aObjInfo[4]; + rtl::OUString msFormType; + rtl::OUString msDialogType; + OCX_Control* mpParent; +private: + static sal_uInt32 pColor[25]; +}; + +class OCX_ModernControl : public OCX_Control +{ +public: + OCX_ModernControl(UniString sN) : OCX_Control(sN), + fEnabled(1), fLocked(0), fBackStyle(1), fColumnHeads(0), fIntegralHeight(1), + fMatchRequired(0), fAlignment(1), fDragBehaviour(0), fEnterKeyBehaviour(0), + fEnterFieldBehaviour(0), fTabKeyBehaviour(0), fWordWrap(1), + fSelectionMargin(1), fAutoWordSelect(1), fAutoSize(0), fHideSelection(1), + fAutoTab(0), fMultiLine(1), nMaxLength(0), nBorderStyle(0), nScrollBars(0), + nStyle(0), nMousePointer(0), nPasswordChar(0), nListWidth(0), + nBoundColumn(1), nTextColumn(-1), nColumnCount(1), nListRows(8), + nMatchEntry(2), nListStyle(0), nShowDropButtonWhen(0), nDropButtonStyle(1), + nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7), + nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0), + pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0), + nPictureLen(0), pPicture(0) {} + + ~OCX_ModernControl() { + if (pValue) delete[] pValue; + if (pCaption) delete[] pCaption; + if (pGroupName) delete[] pGroupName; + if (pIcon) delete[] pIcon; + if (pPicture) delete[] pPicture; + } + sal_Bool Read(SotStorageStream *pS); + + + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[8]; + + sal_uInt8 fUnknown1:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown2:4; + + sal_uInt8 fUnknown3:2; + sal_uInt8 fColumnHeads:1; + sal_uInt8 fIntegralHeight:1; + sal_uInt8 fMatchRequired:1; + sal_uInt8 fAlignment:1; + sal_uInt8 fUnknown4:2; + + sal_uInt8 fUnknown5:3; + sal_uInt8 fDragBehaviour:1; + sal_uInt8 fEnterKeyBehaviour:1; + sal_uInt8 fEnterFieldBehaviour:1; + sal_uInt8 fTabKeyBehaviour:1; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown6:2; + sal_uInt8 fSelectionMargin:1; + sal_uInt8 fAutoWordSelect:1; + sal_uInt8 fAutoSize:1; + sal_uInt8 fHideSelection:1; + sal_uInt8 fAutoTab:1; + sal_uInt8 fMultiLine:1; + + sal_uInt32 nMaxLength; + sal_uInt8 nBorderStyle; + sal_uInt8 nScrollBars; + sal_uInt8 nStyle; + sal_uInt8 nMousePointer; + sal_uInt8 nUnknown7; + sal_uInt8 nPasswordChar; + sal_uInt32 nListWidth; + sal_uInt16 nBoundColumn; + sal_Int16 nTextColumn; + sal_uInt16 nColumnCount; + sal_uInt16 nListRows; + sal_uInt16 nUnknown8; + sal_uInt8 nMatchEntry; + sal_uInt8 nListStyle; + sal_uInt8 nShowDropButtonWhen; + sal_uInt8 nDropButtonStyle; + sal_uInt8 nMultiState; + sal_uInt32 nValueLen; + sal_uInt32 nCaptionLen; + + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + + sal_uInt32 nBorderColor; + sal_uInt8 nSpecialEffect; + sal_uInt16 nIcon; + sal_uInt16 nPicture; + sal_uInt8 nAccelerator; + sal_uInt8 nUnknown9; + sal_uInt32 nGroupNameLen; + sal_uInt32 nUnknown10; + + char *pValue; + char *pCaption; + char *pGroupName; + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; + +}; + +class OCX_TabStrip : public OCX_Control +{ +public: + OCX_TabStrip() : OCX_Control( rtl::OUString::createFromAscii("TabStrip")) {} + virtual sal_Bool ReadFontData(SotStorageStream *pS); + virtual sal_Bool Read(SotStorageStream *pS); + + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + sal_uInt16 nNumTabs; +}; + +class OCX_Image : public OCX_Control +{ +public: + OCX_Image() : OCX_Control(rtl::OUString::createFromAscii("Image")), fEnabled(1), fBackStyle(0), bPictureTiling(false), bAutoSize(false) { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseImageControl"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlImageControlModel"); + } + + ~OCX_Image() { } + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 nBorderColor; + sal_uInt8 nBorderStyle; + sal_uInt8 nMousePointer; + sal_uInt8 nPictureSizeMode; + + + sal_uInt8 fUnknown1:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fUnknown2:2; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown3:3; + + sal_uInt8 nPictureAlignment; + bool bPictureTiling; + sal_uInt8 nSpecialEffect; + + bool bAutoSize; + ::rtl::OUString sImageUrl; + sal_Bool Read(SotStorageStream *pS); + + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + // No Font record + virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } + + static OCX_Control *Create() { return new OCX_Image;} +}; +struct ContainerRecord +{ + ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0), bVisible( true ) {} + + ::rtl::OUString cName; + ::rtl::OUString controlTip; + + sal_uInt32 nTop; + sal_uInt32 nLeft; + sal_uInt32 nSubStorageId; + sal_uInt32 nSubStreamLen; + sal_uInt16 nTabPos; + sal_uInt16 nTypeIdent; + bool bVisible; +}; + +typedef std::vector<OCX_Control*>::iterator CtrlIterator; +typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst; +typedef std::vector<OCX_Control*> CtrlList; + + + +class RBGroup +{ + public: + RBGroup():mRBGroupPos(0){} + RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){} + sal_Int16 tabPos() const { return mRBGroupPos; } + std::vector<OCX_Control*>::size_type numControls() + { return mpControls.size(); } + std::vector<OCX_Control*>& controls() { return mpControls; } + + void add(OCX_Control* pRB); + private: + sal_uInt16 mRBGroupPos; + std::vector<OCX_Control*> mpControls; +}; + +typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > RBGroupHash; +typedef std::vector<RBGroup*>::iterator GroupIterator; + +class OCX_OptionButton; + +class RBGroupManager +{ +public: + RBGroupManager( String& defaultName ); + ~RBGroupManager(); + + CtrlList insertGroupsIntoControlList( const CtrlList& sourceList ); + void addRadioButton( OCX_OptionButton* pRButton ); +private: + + void addSeperator( std::vector< OCX_Control* >& dest ); + void copyList( std::vector< OCX_Control* >& src, + std::vector< OCX_Control* >& dest, + bool addGroupSeperator ); + + RBGroupHash rbGroups; + String mSDefaultName; + std::vector< RBGroup* > groupList; + sal_uInt16 numRadioButtons; +}; + + + + +class OCX_ContainerControl : public OCX_Control +{ +public: + virtual ~OCX_ContainerControl(); + // sub class will process the control specific information + // e.g frame or userform ( maybe tab, mulipage in the future ) + // Base (this) class will process the container specific information + // e.g. the controls contained by this container + // will + // a) create the controls + // b) read the controls + // c) store these controls in a list for post processing + // e.g. import + // + virtual sal_Bool Read(SvStorageStream *pS); + // No Font record + virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } + + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + SotStorageStreamRef getContainerStream() { return mContainerStream; } + + virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec ); + bool createFromContainerRecord( const ContainerRecord& record, + OCX_Control*& ); +protected: + // This class not meant to be instantiated + // needs to be subclassed + OCX_ContainerControl( SotStorageRef& parent, + const ::rtl::OUString& storageName, + const ::rtl::OUString& sN, + const com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > &rParent, + OCX_Control* pParent = NULL ); + rtl::OUString createSubStreamName( const sal_uInt32& subStorageID ); + + RBGroupManager rbGroupMgr; + com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > mxParent; + std::vector<OCX_Control*> mpControls; + SotStorageRef mContainerStorage; + SotStorageStreamRef mContainerStream; + SotStorageStreamRef mContainedControlsStream; + sal_uInt32 nNoRecords; + sal_uInt32 nTotalLen; + sal_uInt32 containerType; + +private: + OCX_ContainerControl(); // not implemented + OCX_ContainerControl(const OCX_ContainerControl&); // not implemented +}; + + +class OCX_MultiPage : public OCX_ContainerControl +{ +public: + OCX_MultiPage( SotStorageRef& parent, + const ::rtl::OUString& storageName, + const ::rtl::OUString& sN, + const com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > &rDialog, OCX_Control* pParent = NULL); + virtual ~OCX_MultiPage() + { + delete[] pCaption; + delete[] pIcon; + delete[] pPicture; + } + virtual sal_Bool Read(SvStorageStream *pS); + + using OCX_ContainerControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer> + &rDialog); + virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec ); + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 fUnknown1; + + sal_uInt8 fUnknown2:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown3:4; + + sal_uInt8 fUnknown4:8; + + sal_uInt8 fUnknown5:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown6:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown7:3; + + sal_uInt32 nCaptionLen; + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + sal_uInt8 nMousePointer; + sal_uInt32 nBorderColor; + sal_uInt32 fUnknown8; + sal_uInt32 fUnknown9; + sal_uInt8 nKeepScrollBarsVisible; + sal_uInt8 nCycle; + sal_uInt16 nBorderStyle; + sal_uInt16 nSpecialEffect; + sal_uInt16 nPicture; + sal_uInt8 nPictureAlignment; + sal_uInt8 nPictureSizeMode; + bool bPictureTiling; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + + char *pCaption; + + sal_uInt32 nScrollWidth; + sal_uInt32 nScrollHeight; + + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; +private: + sal_Int32 mnCurrentPageStep; +}; + + + +class OCX_Page : public OCX_ContainerControl +{ +public: + OCX_Page( SotStorageRef& parentStorage, + const ::rtl::OUString& storageName, + const ::rtl::OUString& sN, + const com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > &rDialog, OCX_Control* parent = NULL); + virtual ~OCX_Page() + { + delete[] pCaption; + delete[] pIcon; + delete[] pPicture; + } + virtual sal_Bool Read(SvStorageStream *pS); + + using OCX_ContainerControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer> + &rDialog); +/* virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); +*/ + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 fUnknown1; + + sal_uInt8 fUnknown2:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown3:4; + + sal_uInt8 fUnknown4:8; + + sal_uInt8 fUnknown5:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown6:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown7:3; + + sal_uInt32 nCaptionLen; + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + sal_uInt8 nMousePointer; + sal_uInt32 nBorderColor; + sal_uInt32 fUnknown8; + sal_uInt32 fUnknown9; + sal_uInt8 nKeepScrollBarsVisible; + sal_uInt8 nCycle; + sal_uInt16 nBorderStyle; + sal_uInt16 nSpecialEffect; + sal_uInt16 nPicture; + sal_uInt8 nPictureAlignment; + sal_uInt8 nPictureSizeMode; + bool bPictureTiling; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + + char *pCaption; + + sal_uInt32 nScrollWidth; + sal_uInt32 nScrollHeight; + + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; +private: +}; + + +class OCX_Frame : public OCX_ContainerControl +{ +public: + OCX_Frame( SotStorageRef& parent, + const ::rtl::OUString& storageName, + const ::rtl::OUString& sN, + const com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > &rDialog, OCX_Control* pParent = NULL); + virtual ~OCX_Frame() + { + delete[] pCaption; + delete[] pIcon; + delete[] pPicture; + } + virtual sal_Bool Read(SvStorageStream *pS); + + using OCX_ContainerControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 fUnknown1; + + sal_uInt8 fUnknown2:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown3:4; + + sal_uInt8 fUnknown4:8; + + sal_uInt8 fUnknown5:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown6:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown7:3; + + sal_uInt32 nCaptionLen; + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + sal_uInt8 nMousePointer; + sal_uInt32 nBorderColor; + sal_uInt32 fUnknown8; + sal_uInt32 fUnknown9; + sal_uInt8 nKeepScrollBarsVisible; + sal_uInt8 nCycle; + sal_uInt16 nBorderStyle; + sal_uInt16 nSpecialEffect; + sal_uInt16 nPicture; + sal_uInt8 nPictureAlignment; + sal_uInt8 nPictureSizeMode; + bool bPictureTiling; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + + char *pCaption; + + sal_uInt32 nScrollWidth; + sal_uInt32 nScrollHeight; + sal_uInt32 nScrollLeft; + sal_uInt32 nScrollTop; + + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; +private: +}; + +class OCX_UserForm : public OCX_ContainerControl +{ +public: + OCX_UserForm( SotStorageRef& parent, + const ::rtl::OUString& storageName, + const ::rtl::OUString& sN, + const com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer > &rDialog, + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory >& rMsf); + ~OCX_UserForm() + { + delete[] pCaption; + delete[] pIcon; + delete[] pPicture; + } + + virtual sal_Bool Read(SvStorageStream *pS); + + using OCX_ContainerControl::Import; // to not hide the other two import methods + virtual sal_Bool Import( com::sun::star::uno::Reference< + com::sun::star::container::XNameContainer> + &rDialog); + + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + sal_uInt32 nChildrenA; + + sal_uInt8 fUnknown1:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown2:4; + + sal_uInt8 fUnknown3:8; + + sal_uInt8 fUnknown4:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown5:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown6:3; + + sal_uInt32 nCaptionLen; + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + sal_uInt8 nMousePointer; + sal_uInt32 nBorderColor; + sal_uInt32 nDrawBuffer; + sal_uInt32 nChildrenB; + sal_uInt8 nKeepScrollBarsVisible; + sal_uInt8 nCycle; + sal_uInt16 nBorderStyle; + sal_uInt8 nSpecialEffect; + sal_uInt16 nPicture; + sal_uInt8 nPictureAlignment; + sal_uInt8 nPictureSizeMode; + bool bPictureTiling; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + sal_uInt16 fUnknown7; + + char *pCaption; + + sal_uInt32 nScrollWidth; + sal_uInt32 nScrollHeight; + sal_uInt32 nScrollLeft; + sal_uInt32 nScrollTop; + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; +private: + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext> mxCtx; +}; + + + +class OCX_CheckBox : public OCX_ModernControl +{ +public: + OCX_CheckBox() : OCX_ModernControl(rtl::OUString::createFromAscii("CheckBox")){ + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CheckBox"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlCheckBoxModel"); + mnBackColor = 0x80000005L; + mnForeColor = 0x80000008L; + aFontData.SetHasAlign(TRUE); + } + + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + static OCX_Control *Create() { return new OCX_CheckBox;} +}; + +class OCX_OptionButton : public OCX_ModernControl +{ +public: + OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton")) + { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel"); + mnBackColor = 0x80000005L; + mnForeColor = 0x80000008L; + aFontData.SetHasAlign(TRUE); + } + + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + + + static OCX_Control *Create() { return new OCX_OptionButton;} +}; + +class OCX_TextBox : public OCX_ModernControl +{ +public: + OCX_TextBox() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.TextField"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlEditModel"); + mnBackColor = 0x80000005L; + mnForeColor = 0x80000008L; + nBorderColor = 0x80000006L; + aFontData.SetHasAlign(TRUE); + } + + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + static OCX_Control *Create() { return new OCX_TextBox;} +}; + +class OCX_FieldControl: public OCX_ModernControl +{ +public: + OCX_FieldControl() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) { + mnBackColor = 0x80000005L; + mnForeColor = 0x80000008L; + nBorderColor = 0x80000006L; + } + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + static OCX_Control *Create() { return new OCX_FieldControl;} +}; + + +class OCX_ToggleButton : public OCX_ModernControl +{ +public: + OCX_ToggleButton() : OCX_ModernControl(rtl::OUString::createFromAscii("ToggleButton")) { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); + + mnBackColor = 0x8000000F; + mnForeColor = 0x80000012; + aFontData.SetHasAlign(TRUE); + aFontData.nJustification = 3; // centered by default + } + static OCX_Control *Create() { return new OCX_ToggleButton;} + + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SvStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SvStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); +}; + +class OCX_ComboBox : public OCX_ModernControl +{ +public: + OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){ + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel"); + mnBackColor = 0x80000005; + mnForeColor = 0x80000008; + nBorderColor = 0x80000006; + aFontData.SetHasAlign(TRUE); + } + static OCX_Control *Create() { return new OCX_ComboBox;} + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); +}; + +class OCX_ListBox : public OCX_ModernControl +{ +public: + OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){ + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel"); + mnBackColor = 0x80000005; + mnForeColor = 0x80000008; + nBorderColor = 0x80000006; + aFontData.SetHasAlign(TRUE); + } + static OCX_Control *Create() { return new OCX_ListBox;} + using OCX_ModernControl::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + +}; + +class OCX_CommandButton : public OCX_Control +{ +public: + OCX_CommandButton() : OCX_Control(String::CreateFromAscii("CommandButton")), + fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0), + nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0), + nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0), + pPicture(0), mbTakeFocus( true ) + { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); + mnForeColor = 0x80000012L; + mnBackColor = 0x8000000FL; + } + + ~OCX_CommandButton() { + if (pCaption) delete[] pCaption; + if (pIcon) delete[] pIcon; + if (pPicture) delete[] pPicture; + } + sal_Bool Read(SotStorageStream *pS); + + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + + sal_uInt8 fUnknown1:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown2:4; + + sal_uInt8 fUnknown3:8; + + sal_uInt8 fUnknown4:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown5:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown6:3; + + sal_uInt32 nCaptionLen; + + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + + sal_uInt16 nMousePointer; + sal_uInt16 nPicture; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + + char *pCaption; + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; + + bool mbTakeFocus; + + static OCX_Control *Create() { return new OCX_CommandButton;} + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + +}; + +class OCX_ImageButton: public OCX_CommandButton +{ +public: + OCX_ImageButton() { + aFontData.SetHasAlign(FALSE); + aFontData.SetHasFont(FALSE); + } + static OCX_Control *Create() { return new OCX_ImageButton;} + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + +}; + +class OCX_GroupBox: public OCX_Control +{ +public: + OCX_GroupBox() : OCX_Control(String::CreateFromAscii("GroupBox")) {} + static OCX_Control *Create() { return new OCX_GroupBox;} + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + +}; + +class OCX_Label : public OCX_Control +{ +public: + OCX_Label(OCX_Control* pParent = NULL ) : OCX_Control(rtl::OUString::createFromAscii("Label"), pParent ), fEnabled(1), + fLocked(0),fBackStyle(1),fWordWrap(1), + fAutoSize(0),nCaptionLen(0),nVertPos(1),nHorzPos(7),nMousePointer(0), + nBorderColor(0x80000006),nBorderStyle(0),nSpecialEffect(0), + nPicture(0),nAccelerator(0),nIcon(0),pCaption(0),nIconLen(0),pIcon(0), + nPictureLen(0),pPicture(0) + { + msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.FixedText"); + msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlFixedTextModel"); + mnForeColor = 0x80000008; + mnBackColor = 0x80000005; + aFontData.SetHasAlign(TRUE); + } + + ~OCX_Label() { + if (pCaption) delete[] pCaption; + if (pIcon) delete[] pIcon; + if (pPicture) delete[] pPicture; + } + sal_Bool Read(SotStorageStream *pS); + + /*sal_uInt8 for sal_uInt8 Word Struct*/ + sal_uInt16 nIdentifier; + sal_uInt16 nFixedAreaLen; + sal_uInt8 pBlockFlags[4]; + + + sal_uInt8 fUnknown1:1; + sal_uInt8 fEnabled:1; + sal_uInt8 fLocked:1; + sal_uInt8 fBackStyle:1; + sal_uInt8 fUnknown2:4; + + sal_uInt8 fUnknown3:8; + + sal_uInt8 fUnknown4:7; + sal_uInt8 fWordWrap:1; + + sal_uInt8 fUnknown5:4; + sal_uInt8 fAutoSize:1; + sal_uInt8 fUnknown6:3; + + sal_uInt32 nCaptionLen; + sal_uInt16 nVertPos; + sal_uInt16 nHorzPos; + sal_uInt8 nMousePointer; + sal_uInt32 nBorderColor; + sal_uInt16 nBorderStyle; + sal_uInt16 nSpecialEffect; + sal_uInt16 nPicture; + sal_uInt16 nAccelerator; + sal_uInt16 nIcon; + + char *pCaption; + + sal_uInt8 pIconHeader[20]; + sal_uInt32 nIconLen; + sal_uInt8 *pIcon; + + sal_uInt8 pPictureHeader[20]; + sal_uInt32 nPictureLen; + sal_uInt8 *pPicture; + + static OCX_Control *Create() { return new OCX_Label;} + + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + sal_Bool Export(SotStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + sal_Bool WriteContents(SotStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize); + +}; + + +class OCX_ProgressBar : public OCX_Control +{ +public: + explicit OCX_ProgressBar(); + + static OCX_Control* Create(); + + virtual sal_Bool Read( SvStorageStream *pS ); + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + // No Font record + virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } +private: + sal_Int32 nMin; + sal_Int32 nMax; + bool bFixedSingle; + bool bEnabled; + bool b3d; +}; + +class OCX_SpinButton : public OCX_Control +{ +public: + explicit OCX_SpinButton(); + + static OCX_Control* Create(); + + virtual sal_Bool Read( SvStorageStream *pS ); + + virtual sal_Bool ReadFontData( SvStorageStream *pS ); + + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + //Export exports a control as an OLE style storage stream tree + virtual sal_Bool Export( SvStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize ); + + //WriteContents writes the contents of a contents stream, for + //the Excel export you cannot use Export, only WriteContents instead + virtual sal_Bool WriteContents( SvStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize ); + +protected: + void UpdateInt32Property( + sal_Int32& rnCoreValue, sal_Int32 nNewValue, + sal_Int32 nBlockFlag ); + + void GetInt32Property( + sal_Int32& rnCoreValue, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet >& rxPropSet, + const rtl::OUString& rPropName, + sal_Int32 nBlockFlag ); + + void UpdateBoolProperty( + bool& rbCoreValue, bool bNewValue, + sal_Int32 nBlockFlag ); + + void GetBoolProperty( + bool& rbCoreValue, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet >& rxPropSet, + const rtl::OUString& rPropName, + sal_Int32 nBlockFlag ); + + /** Writes the data from own members to stream. */ + sal_Bool WriteData( SvStream& rStrm ) const; + + sal_Int32 mnBlockFlags; + sal_Int32 mnValue; + sal_Int32 mnMin; + sal_Int32 mnMax; + sal_Int32 mnSmallStep; + sal_Int32 mnPageStep; + sal_Int32 mnOrient; + sal_Int32 mnDelay; + bool mbEnabled; + bool mbLocked; + bool mbPropThumb; +}; + +class OCX_ScrollBar : public OCX_SpinButton +{ +public: + explicit OCX_ScrollBar(); + + static OCX_Control* Create(); + + using OCX_Control::Import; // to not hide the other two import methods + virtual sal_Bool Import(com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet); + + //Export exports a control as an OLE style storage stream tree + virtual sal_Bool Export( SvStorageRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize ); + + //WriteContents writes the contents of a contents stream, for + //the Excel export you cannot use Export, only WriteContents instead + virtual sal_Bool WriteContents( SvStorageStreamRef &rObj, + const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> &rPropSet, + const com::sun::star::awt::Size& rSize ); +}; + +#endif diff --git a/filter/inc/filter/msfilter/msoleexp.hxx b/filter/inc/filter/msfilter/msoleexp.hxx new file mode 100644 index 000000000000..3cdbab6a9235 --- /dev/null +++ b/filter/inc/filter/msfilter/msoleexp.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 +{ + UINT32 nConvertFlags; +public: + SvxMSExportOLEObjects( UINT32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {} + + void SetFlags( UINT32 n ) { nConvertFlags = n; } + 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 + diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx new file mode 100644 index 000000000000..81607c9b296c --- /dev/null +++ b/filter/inc/filter/msfilter/msvbahelper.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _MSVBAHELPER_HXX +#define _MSVBAHELPER_HXX + +#include <sfx2/objsh.hxx> +#include "filter/msfilter/msfilterdllapi.h" + +namespace ooo { namespace vba +{ + class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo + { + SfxObjectShell* mpDocContext; + bool mbFound; + String msResolvedMacro; + public: + VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){} + void SetResolved( bool bRes ) { mbFound = bRes; } + bool IsResolved() { return mbFound; } + void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; } + SfxObjectShell* MacroDocContext() { return mpDocContext; } + String ResolvedMacro() { return msResolvedMacro; } + void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; } + }; + + MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName ); + MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl ); + MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); + MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& 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 ); +} } + +#endif diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx new file mode 100644 index 000000000000..796ecc18cd3a --- /dev/null +++ b/filter/inc/filter/msfilter/svdfppt.hxx @@ -0,0 +1,1440 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVDFPPT_HXX +#define _SVDFPPT_HXX + +#ifndef SVX_LIGHT + +#include <tools/solar.h> +#include <svl/svarray.hxx> +#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> // Escher-Grafikimport +#include <filter/msfilter/msocximex.hxx> +#include <filter/msfilter/msfiltertracer.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> +//////////////////////////////////////////////////////////////////////////////////////////////////// + +class SdrModel; +class SdPage; +class SdrPage; +class SdrObject; +class SvStream; +class Polygon; +class PolyPolygon; +class SfxItemSet; +class Outliner; +class Graphic; +class SvxMSDffManager; +class PptTextMetaCharList; +class PPTTextObj; +class DffRecordHeader; +struct PptCharAttrSet; +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; + String 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; + MSFilterTracer* pTracer; + PptCurrentUserAtom aCurrentUserAtom; + + PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags, MSFilterTracer* pTracer ); +}; + +struct SdHyperlinkEntry +{ + sal_uInt32 nIndex; + sal_Int32 nPrivate1; + sal_Int32 nPrivate2; + sal_Int32 nPrivate3; + sal_Int32 nInfo; + String aTarget; + String aSubAdress; + + sal_Int32 nStartPos; + sal_Int32 nEndPos; + + String aConvSubString; + ESelection aESelection; + sal_Bool bSelection; +}; + +// Hilfsklasse zum Einlesen der PPT InteractiveInfoAtom +struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom +{ + UINT32 nSoundRef; + UINT32 nExHyperlinkId; + UINT8 nAction; + UINT8 nOleVerb; + UINT8 nJump; + UINT8 nFlags; + UINT8 nHyperlinkType; + + // unknown, da Gesamtgroesse 16 ist + UINT8 nUnknown1; + UINT8 nUnknown2; + 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 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 UINT32 PPTInventor =UINT32('P')*0x00000001+ + UINT32('P')*0x00000100+ + UINT32('T')*0x00010000+ + UINT32('0')*0x01000000; + +// Object-Ids fuer StarDraw UserData +#define PPT_OBJECTINFO_ID (1) + +struct MSFILTER_DLLPUBLIC PptDocumentAtom +{ + Size aSlidesPageSize; // Seitengroesse der Slides in 576DPI + Size aNotesPageSize; // Seitengroesse der Notes in 576DPI + // RatioAtom erstmal weggelassen + UINT32 nNotesMasterPersist; // 0=nicht vorhanden + UINT32 nHandoutMasterPersist; // 0=nicht vorhanden + UINT16 n1stPageNumber; // Seitennummer des ersten Slides + PptPageFormat eSlidesPageFormat; // Seitenformat der Slides + sal_Bool bEmbeddedTrueType : 1; // TrueType direkt im 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 +{ + INT32 eLayout; // 0..18 + BYTE aPlaceholderId[ 8 ]; + 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; + UINT32 nMasterId; + UINT32 nNotesId; + UINT16 nFlags; + +public: + + PptSlideAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>(SvStream& rIn, PptSlideAtom& rAtom); +}; + +struct PptSlidePersistAtom +{ + UINT32 nPsrReference; + UINT32 nFlags; + UINT32 nNumberTexts; + UINT32 nSlideId; + 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 +{ + UINT32 nSlideId; + UINT16 nFlags; + +public: + + PptNotesAtom() { Clear(); } + void Clear(); + + friend SvStream& operator>>(SvStream& rIn, PptNotesAtom& rAtom); +}; + +struct PptColorSchemeAtom +{ + BYTE aData[32]; + +public: + PptColorSchemeAtom () { Clear(); } + void Clear(); + Color GetColor( USHORT nNum ) const; + + friend SvStream& operator>>(SvStream& rIn, PptColorSchemeAtom& rAtom); +}; + +struct PptFontEntityAtom +{ + String 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; + INT32 nLastSlideID; // ID of last visible slide + UINT32 nVersion; // This is major/minor/build which did the edit + UINT32 nOffsetLastEdit; // File offset of prev PptUserEditAtom + UINT32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version. + UINT32 nDocumentRef; + UINT32 nMaxPersistWritten; // Gesamtanzahl der Persisteintraege bis hierher. + INT16 eLastViewType; // enum view type + +public: + + PptUserEditAtom() : nOffsetPersistDirectory( 0 ) {} + + friend SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom ); +}; + +struct PptOEPlaceholderAtom +{ + UINT32 nPlacementId; + BYTE nPlaceholderId; + BYTE 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; + + void* pDummy2; + PptPageKind ePageKind; // + + sal_Bool bNotesMaster : 1; // fuer NotesMaster + sal_Bool bHandoutMaster : 1; // fuer HandoutMaster + sal_Bool bStarDrawFiller : 1; // speziell fuer StarDraw +public: + PptSlidePersistEntry(); + ~PptSlidePersistEntry(); + UINT32 GetSlideId() const { return aPersistAtom.nSlideId; } +}; + +SV_DECL_PTRARR_DEL(_PptSlidePersistList,PptSlidePersistEntry*,16,16) + +#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF + +class MSFILTER_DLLPUBLIC PptSlidePersistList: public _PptSlidePersistList +{ + + public: + + USHORT FindPage( 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 +{ + UINT32 nAspect; + UINT32 nDummy1; + UINT32 nId; + UINT32 nDummy2; + UINT32 nPersistPtr; + UINT32 nDummy4; + +public: + + friend SvStream& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom ); +}; + +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 + + List aHFMasterList; + List 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( String& rStr ) const; + // nur fuer PowerPoint-Filter: + virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const; + void CheckWingdings() const; + void CheckMonotypeSorts() const; + void CheckTimesNewRoman() const; + +public: + + PowerPointImportParam& rImportParam; + + void* pSdrEscherDummy1; + void* pSdrEscherDummy2; + void* pSdrEscherDummy3; + void* pSdrEscherDummy4; + + SdrEscherImport( PowerPointImportParam&, const String& rBaseURL ); + virtual ~SdrEscherImport(); + virtual FASTBOOL GetColorFromPalette( USHORT nNum, Color& rColor ) const; + virtual BOOL SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const; + PptFontEntityAtom* GetFontEnityAtom( UINT32 nNum ) const; + CharSet GetCharSet( UINT32 nNum ) const; + BOOL IsFontAvailable( UINT32 nNum ) const; + void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph ); + using SvxMSDffManager::ReadObjText; + 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 +{ + UINT16 nPos; + UINT16 nTextRangeEnd; + SvxFieldItem* pField1; + SvxFieldItem* pField2; + String* pString; + + PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {}; + ~PPTFieldEntry(); + + void SetDateTime( 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; + String pPlaceholder[ 4 ]; + sal_uInt32 nAtom; + + sal_uInt32 GetMaskForInstance( UINT32 nInstance ); + sal_uInt32 IsToDisplay( UINT32 nInstance ); + sal_uInt32 NeedToImportInstance( const sal_uInt32 nInstance, const PptSlidePersistEntry& rSlidePersist ); + + HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL ); + ~HeaderFooterEntry(); +}; + +struct ProcessData +{ + PptSlidePersistEntry& rPersistEntry; + SdPage* pPage; + List* pBackgroundColoredObjects; + sal_uInt32* pTableRowProperties; + + ProcessData( PptSlidePersistEntry& rP, SdPage* pP ) : + rPersistEntry ( rP ), + pPage ( pP ), + pBackgroundColoredObjects ( NULL ), + pTableRowProperties ( NULL ) {}; + ~ProcessData() { delete pBackgroundColoredObjects; delete[] pTableRowProperties; }; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +class SdrTextObj; +class SfxObjectShell; +class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport +{ + +protected: + + friend class PPTTextObj; + friend class PPTExtParaProv; + friend struct PPTStyleSheet; + friend class PPTNumberFormatCreator; + + BOOL bOk; + PptUserEditAtom aUserEditAtom; + PptColorSchemeAtom aPageColors; + List aHyperList; + UINT32* pPersistPtr; + 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; + USHORT nAktPageNum; + ULONG nDocStreamPos; + USHORT nPageColorsNum; + PptPageKind ePageColorsKind; + PptPageKind eAktPageKind; + +protected: + + 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; + using SdrEscherImport::ReadObjText; + virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const; + // --> OD 2004-12-14 #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( UINT32 nPersistPtr, UINT32& nOleId ) const; + SdrPage* MakeBlancPage(sal_Bool bMaster) const; + sal_Bool ReadFontCollection(); + sal_Bool ForceFontCollection() const { return pFonts!=NULL?TRUE:((SdrPowerPointImport*)this)->ReadFontCollection(); } + PptSlidePersistList* GetPageList(PptPageKind ePageKind) const; + UINT32 GetAktPageId(); + UINT32 GetMasterPageId(USHORT nPageNum, PptPageKind ePageKind) const; + UINT32 GetNotesPageId(USHORT nPageNum ) const; + SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const; + void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions ); + +public: + SdrPowerPointImport( PowerPointImportParam&, const String& rBaseURL ); + virtual ~SdrPowerPointImport(); + USHORT GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const; + void SetPageNum( USHORT nPageNum, PptPageKind = PPT_SLIDEPAGE ); + USHORT 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( USHORT nPageNum, PptPageKind ePageKind ) const; + sal_Bool HasMasterPage( USHORT nPageNum, PptPageKind ePageKind = PPT_SLIDEPAGE ) const; + USHORT GetMasterPageIndex( USHORT nPageNum, PptPageKind ePageKind = PPT_SLIDEPAGE ) const; + + void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist = NULL ); + virtual FASTBOOL GetColorFromPalette(USHORT nNum, Color& rColor) const; + virtual BOOL SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const; + sal_Unicode PPTSubstitute( UINT16 nFont, sal_Unicode nChar, + 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* ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +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; + + PPTTextSpecInfo( sal_uInt32 nCharIdx ); + ~PPTTextSpecInfo(); +}; + +struct PPTTextSpecInfoAtomInterpreter +{ + sal_Bool bValid; + List 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 +{ + UINT32 nInstance; + Graphic aBuGra; + + PPTBuGraEntry( Graphic& rGraphic, UINT32 nInstance ); +}; + +class PPTExtParaProv +{ + List aBuGraList; + + public : + BOOL bStyles; + BOOL bGraphics; + DffRecordManager aExtendedPresRules; + + PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ]; + + BOOL GetGraphic( 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 ]; + + 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 ]; + + PPTParaSheet( sal_uInt32 nInstance ); + PPTParaSheet( const PPTParaSheet& rParaSheet ); + + void Read( SdrPowerPointImport& rMan, SvStream& rIn, sal_Bool bMasterStyle, + sal_uInt32 nLevel, sal_Bool bFirst ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +class PPTParagraphObj; +class PPTNumberFormatCreator +{ + UINT32 nIsBullet; + UINT32 nBulletChar; + UINT32 nBulletFont; + UINT32 nBulletHeight; + UINT32 nBulletColor; + UINT32 nTextOfs; + UINT32 nBulletOfs; + + void ImplGetNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, UINT32 nLevel ); + BOOL ImplGetExtNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, UINT32 nLevel, + UINT32 nInstance, UINT32 nInstanceInSheet, boost::optional< sal_Int16 >& rStartNumbering, + UINT32 nFontHeight, PPTParagraphObj* pPara ); + + protected : + + PPTNumberFormatCreator( PPTExtParaProv* ); + ~PPTNumberFormatCreator(); + + public : + + PPTExtParaProv* pExtParaProv; + + void GetNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, UINT32 nLevel, + const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, UINT32 nInstance ); + + BOOL GetNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, + PPTParagraphObj* pPara, 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 ]; + void* mpDummy; + + 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 +{ + + sal_uInt32 mnOriginalTextPos; + sal_uInt32 mnParagraph; + String maString; + SvxFieldItem* mpFieldItem; + sal_uInt16 mnLanguage[ 3 ]; + + ImplPPTCharPropSet* pCharSet; + + void SetFont( UINT16 nFont ); + void SetColor( sal_uInt32 nColor ); + + PPTCharPropSet( sal_uInt32 nParagraph ); + PPTCharPropSet( PPTCharPropSet& rCharPropSet ); + PPTCharPropSet( PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph ); + ~PPTCharPropSet(); + + PPTCharPropSet& operator=( PPTCharPropSet& rCharPropSet ); + + private : + + void ImplMakeUnique(); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +struct PPTTabEntry +{ + sal_uInt16 nOffset; + sal_uInt16 nStyle; +}; + +struct PPTRuler +{ + UINT32 nRefCount; + + INT32 nFlags; + UINT16 nDefaultTab; + UINT16 nTextOfs[ 5 ]; + UINT16 nBulletOfs[ 5 ]; + PPTTabEntry* pTab; + UINT16 nTabCount; + + PPTRuler(); + ~PPTRuler(); +}; + +struct PPTTextRulerInterpreter +{ + PPTRuler *mpImplRuler; + + PPTTextRulerInterpreter(); + PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler ); + PPTTextRulerInterpreter( 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; }; + UINT16 GetTabCount() const { return mpImplRuler->nTabCount; }; + BOOL GetDefaultTab( UINT32 nLevel, UINT16& nValue ) const; + BOOL GetTextOfs( UINT32 nLevel, UINT16& nValue ) const; + BOOL GetBulletOfs( UINT32 nLevel, 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 ); +}; + +struct PPTStyleTextPropReader +{ + List aSpecMarkerList; // hiword -> Flags, loword -> Position + List aParaPropList; + List aCharPropList; + + PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd, + PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance ); + + 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 String& aString, PPTTextRulerInterpreter& rRuler, + sal_uInt32& nCharCount, sal_Bool& bTextPropAtom ); + void ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& 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 ); + + ~PPTStyleTextPropReader(); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +class SvxFieldItem; +class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet +{ + + friend class PPTParagraphObj; + + const PPTStyleSheet& mrStyleSheet; + UINT32 mnInstance; + UINT32 mnDepth; + + public : + + BOOL GetAttrib( UINT32 nAttr, UINT32& nVal, UINT32 nInstanceInSheet ); + SvxFieldItem* GetTextField(); + + PPTPortionObj( const PPTStyleSheet&, UINT32 nInstance, UINT32 nDepth ); + PPTPortionObj( PPTCharPropSet&, const PPTStyleSheet&, UINT32 nInstance, UINT32 nDepth ); + PPTPortionObj( PPTPortionObj& ); + ~PPTPortionObj(); + + // the following function should be removed during next full update + void ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, UINT32 nInstanceInSheet ); + void ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, UINT32 nInstanceInSheet, const PPTTextObj* pTextObj ); + UINT32 Count() const { return ( mpFieldItem ) ? 1 : maString.Len(); }; + BOOL HasTabulator(); +}; + +class MSFILTER_DLLPUBLIC PPTParagraphObj : public PPTParaPropSet, public PPTNumberFormatCreator, public PPTTextRulerInterpreter +{ + friend class PPTTextObj; + friend class PPTNumberFormatCreator; + + const PPTStyleSheet& mrStyleSheet; + UINT32 mnInstance; + + protected : + + void ImplClear(); + + public : + + BOOL mbTab; // if true, this paragraph has tabulators in text + + UINT32 mnCurrentObject; + UINT32 mnPortionCount; + PPTPortionObj** mpPortionList; + + void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const; + BOOL GetAttrib( UINT32 nAttr, UINT32& nVal, UINT32 nInstanceInSheet ); + + PPTParagraphObj( const PPTStyleSheet&, UINT32 nInstance, UINT16 nDepth ); + PPTParagraphObj( PPTStyleTextPropReader&, const PPTStyleSheet&, UINT32 nInstance, PPTTextRulerInterpreter& rRuler ); + ~PPTParagraphObj(); + + UINT32 GetTextSize(); + PPTPortionObj* First(); + PPTPortionObj* Next(); + + void AppendPortion( PPTPortionObj& rPortion ); + void ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, 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 +{ + UINT32 mnRefCount; + UINT32 mnShapeId; + UINT32 mnShapeMaster; + PptOEPlaceholderAtom* mpPlaceHolderAtom; + UINT16 mnInstance; + UINT16 mnDestinationInstance; + MSO_SPT meShapeType; + + UINT32 mnCurrentObject; + UINT32 mnParagraphCount; + PPTParagraphObj** mpParagraphList; + PptSlidePersistEntry& mrPersistEntry; + + sal_uInt32 mnTextFlags; + + ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {}; +}; + +class PPTTextObj +{ + ImplPPTTextObj* mpImplTextObj; + void ImplClear(); + + PPTTextObj(){}; + public : + PPTTextObj( SvStream& rSt, SdrPowerPointImport&, PptSlidePersistEntry&, DffObjData* ); + PPTTextObj( PPTTextObj& rTextObj ); + ~PPTTextObj(); + + UINT32 GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; }; + UINT32 Count() const { return mpImplTextObj->mnParagraphCount; }; + PPTParagraphObj* First(); + PPTParagraphObj* Next(); + MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; }; + UINT32 GetInstance() const { return mpImplTextObj->mnInstance; }; + void SetInstance( UINT16 nInstance ) { mpImplTextObj->mnInstance = nInstance; }; + UINT32 GetDestinationInstance() const { return mpImplTextObj->mnDestinationInstance; }; + void SetDestinationInstance( 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; + public : + + PPTConvertOCXControls( SfxObjectShell* pDSh, PptPageKind ePKind ) : + SvxMSConvertOCXControls ( pDSh, NULL ), + ePageKind ( ePKind ){}; + + 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, + 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 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 // SVX_LIGHT + +#endif //_SVDFPPT_HXX + diff --git a/filter/inc/filter/msfilter/svxmsbas.hxx b/filter/inc/filter/msfilter/svxmsbas.hxx new file mode 100644 index 000000000000..716c6788989c --- /dev/null +++ b/filter/inc/filter/msfilter/svxmsbas.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVXMSBAS_HXX +#define _SVXMSBAS_HXX + +#include <tools/solar.h> +#include "filter/msfilter/msfilterdllapi.h" + +#include <sot/storage.hxx> + +class SfxObjectShell; + +/* Construct with the root storage of the MS document, with bImportCode + * set the visual basic code will be imported into the stardocument when Import + * is called, with bCopyStorage set, the visual basic storage tree will be + * copied completely into staroffice, so that any future export to a msoffice + * format will retain the vba code, allowing a lossless roundtrip from + * msoffice to staroffice and back. + * + * Setting bAsComment to true in Import will import the visual basic as a + * starbasic comment. Which is currently necessary, as vb is not valid sb. + * + * Setting bStripped will remove the "Attribute" lines from the vb, msoffice + * does this itself when it shows the vb code in the vbeditor, so this is + * probably what the user expects to see when viewing the code + */ + +class MSFILTER_DLLPUBLIC SvxImportMSVBasic +{ +public: + SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot, + BOOL bImportCode = TRUE, BOOL bCopyStorage = TRUE ) + : xRoot(&rRoot), rDocSh(rDocS), + bImport(bImportCode), bCopy(bCopyStorage) + {} + // returns the status of import: + // 0 - nothing has done + // bit 0 = 1 -> any code is imported to the SO-Basic + // bit 1 = 1 -> the VBA - storage is copy to the ObjectShell storage + int Import( const String& rStorageName, const String &rSubStorageName, + BOOL bAsComment=TRUE, BOOL bStripped=TRUE ); + int Import( const String& rStorageName, const String &rSubStorageName, + const std::vector< String >& codeNames, + BOOL bAsComment=TRUE, BOOL bStripped=TRUE ); + + // 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. + ULONG SaveOrDelMSVBAStorage( BOOL bSaveInto, const String& 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 ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); + + static String GetMSBasicStorageName(); +private: + SotStorageRef xRoot; + SfxObjectShell &rDocSh; + BOOL bImport; + BOOL bCopy; + + MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName, + const String &rSubStorageName, + const std::vector< String >& codeNames, + BOOL bAsComment, BOOL bStripped); + MSFILTER_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName, + const String &rSubStorageName); + MSFILTER_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName, + const String &rSubStorageName); +}; + +#endif |