update dev300-m58
[ooovba.git] / oox / source / dump / dffdumper.cxx
blob4ce96bdd24a3c04aacce3a961576ab480e889828
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dffdumper.cxx,v $
10 * $Revision: 1.3.22.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/dump/dffdumper.hxx"
33 #if OOX_INCLUDE_DUMPER
35 using ::rtl::OUString;
37 namespace oox {
38 namespace dump {
40 // ============================================================================
42 void DffStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
44 SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, "DFF-RECORD-NAMES" );
45 constructDffObj();
48 void DffStreamObject::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
50 SequenceRecordObjectBase::construct( rParent, rxStrm, "DFF-RECORD-NAMES" );
51 constructDffObj();
54 bool DffStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
56 sal_uInt16 nRecId;
57 rBaseStrm >> mnInstVer >> nRecId >> mnRealSize;
58 ornRecId = nRecId;
59 ornRecSize = isContainer() ? 0 : mnRealSize;
60 return !rBaseStrm.isEof();
63 void DffStreamObject::implWriteExtHeader()
65 const sal_Char* pcListName = "DFF-RECORD-INST";
66 switch( getRecId() )
68 case 0xF001: pcListName = "DFFBSTORECONT-RECORD-INST"; break; // DFFBSTORECONTAINER contains BLIP count
69 case 0xF007: pcListName = "DFFBSE-RECORD-INST"; break; // DFFBSE contains BLIP type
70 case 0xF00A: pcListName = "DFFSP-RECORD-INST"; break; // DFFSP contains shape type
71 case 0xF00B: pcListName = "DFFOPT-RECORD-INST"; break; // DFFOPT contains property count
73 MultiItemsGuard aMultiGuard( out() );
74 writeHexItem( "instance", mnInstVer, pcListName );
75 if( isContainer() ) writeDecItem( "container-size", mnRealSize );
78 void DffStreamObject::implDumpRecordBody()
80 switch( getRecId() )
82 case 0xF007: // DFFBSE
83 dumpDec< sal_uInt8 >( "win-type", "DFFBSE-TYPE" );
84 dumpDec< sal_uInt8 >( "mac-type", "DFFBSE-TYPE" );
85 dumpGuid( "guid" );
86 dumpDec< sal_uInt16 >( "tag" );
87 dumpDec< sal_uInt32 >( "blip-size" );
88 dumpDec< sal_uInt32 >( "blip-refcount" );
89 dumpDec< sal_uInt32 >( "blip-streampos" );
90 dumpDec< sal_uInt8 >( "blip-usage", "DFFBSE-USAGE" );
91 dumpDec< sal_uInt8 >( "blip-name-len" );
92 dumpUnused( 2 );
93 break;
95 case 0xF00A: // DFFSP
96 dumpHex< sal_uInt32 >( "shape-id", "CONV-DEC" );
97 dumpHex< sal_uInt32 >( "shape-flags", "DFFSP-FLAGS" );
98 break;
100 case 0xF00B: // DFFOPT
102 sal_uInt16 nPropCount = getInst();
103 out().resetItemIndex();
104 for( sal_uInt16 nPropIdx = 0; !in().isEof() && (nPropIdx < nPropCount); ++nPropIdx )
106 sal_uInt16 nPropId = dumpDffOptPropHeader();
107 IndentGuard aIndent( out() );
108 dumpDffOptPropValue( nPropId, in().readuInt32() );
111 break;
113 case 0xF010: // DFFCLIENTANCHOR
114 implDumpClientAnchor();
115 break;
119 void DffStreamObject::implDumpClientAnchor()
123 void DffStreamObject::constructDffObj()
125 mnInstVer = 0;
126 mnRealSize = 0;
129 sal_uInt16 DffStreamObject::dumpDffOptPropHeader()
131 MultiItemsGuard aMultiGuard( out() );
132 TableGuard aTabGuard( out(), 11 );
133 writeEmptyItem( "#prop" );
134 return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" );
137 void DffStreamObject::dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue )
139 switch( nPropId & 0x3FFF )
141 case 127: writeHexItem( "flags", nValue, "DFFOPT-LOCK-FLAGS" ); break;
142 case 191: writeHexItem( "flags", nValue, "DFFOPT-TEXT-FLAGS" ); break;
143 case 255: writeHexItem( "flags", nValue, "DFFOPT-TEXTGEO-FLAGS" ); break;
144 case 319: writeHexItem( "flags", nValue, "DFFOPT-PICTURE-FLAGS" ); break;
145 case 383: writeHexItem( "flags", nValue, "DFFOPT-GEO-FLAGS" ); break;
146 case 447: writeHexItem( "flags", nValue, "DFFOPT-FILL-FLAGS" ); break;
147 case 511: writeHexItem( "flags", nValue, "DFFOPT-LINE-FLAGS" ); break;
148 case 575: writeHexItem( "flags", nValue, "DFFOPT-SHADOW-FLAGS" ); break;
149 case 639: writeHexItem( "flags", nValue, "DFFOPT-PERSP-FLAGS" ); break;
150 case 703: writeHexItem( "flags", nValue, "DFFOPT-3DOBJ-FLAGS" ); break;
151 case 767: writeHexItem( "flags", nValue, "DFFOPT-3DSTYLE-FLAGS" ); break;
152 case 831: writeHexItem( "flags", nValue, "DFFOPT-SHAPE1-FLAGS" ); break;
153 case 895: writeHexItem( "flags", nValue, "DFFOPT-CALLOUT-FLAGS" ); break;
154 case 959: writeHexItem( "flags", nValue, "DFFOPT-SHAPE2-FLAGS" ); break;
155 default: writeHexItem( "value", nValue );
159 // ============================================================================
161 } // namespace dump
162 } // namespace oox
164 #endif