xref: /trunk/main/oox/source/ole/olehelper.cxx (revision d3e5b9da5ecd3a21afd95e21a5fd36807d0753aa)
1ca5ec200SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ca5ec200SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ca5ec200SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ca5ec200SAndrew Rist  * distributed with this work for additional information
6ca5ec200SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ca5ec200SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ca5ec200SAndrew Rist  * "License"); you may not use this file except in compliance
9ca5ec200SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11ca5ec200SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13ca5ec200SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ca5ec200SAndrew Rist  * software distributed under the License is distributed on an
15ca5ec200SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ca5ec200SAndrew Rist  * KIND, either express or implied.  See the License for the
17ca5ec200SAndrew Rist  * specific language governing permissions and limitations
18ca5ec200SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20ca5ec200SAndrew Rist  *************************************************************/
21ca5ec200SAndrew Rist 
22cdf0e10cSrcweir #include "oox/ole/olehelper.hxx"
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
25cdf0e10cSrcweir #include "oox/helper/binaryinputstream.hxx"
26cdf0e10cSrcweir #include "oox/helper/graphichelper.hxx"
27cdf0e10cSrcweir #include "oox/token/tokens.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace oox {
30cdf0e10cSrcweir namespace ole {
31cdf0e10cSrcweir 
32cdf0e10cSrcweir using ::rtl::OUString;
33cdf0e10cSrcweir using ::rtl::OUStringBuffer;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir const sal_uInt32 OLE_COLORTYPE_MASK         = 0xFF000000;
38cdf0e10cSrcweir const sal_uInt32 OLE_COLORTYPE_CLIENT       = 0x00000000;
39cdf0e10cSrcweir const sal_uInt32 OLE_COLORTYPE_PALETTE      = 0x01000000;
40cdf0e10cSrcweir const sal_uInt32 OLE_COLORTYPE_BGR          = 0x02000000;
41cdf0e10cSrcweir const sal_uInt32 OLE_COLORTYPE_SYSCOLOR     = 0x80000000;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir const sal_uInt32 OLE_PALETTECOLOR_MASK      = 0x0000FFFF;
44cdf0e10cSrcweir const sal_uInt32 OLE_BGRCOLOR_MASK          = 0x00FFFFFF;
45cdf0e10cSrcweir const sal_uInt32 OLE_SYSTEMCOLOR_MASK       = 0x0000FFFF;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir /** Swaps the red and blue component of the passed color. */
lclSwapRedBlue(sal_uInt32 nColor)48cdf0e10cSrcweir inline sal_uInt32 lclSwapRedBlue( sal_uInt32 nColor )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     return static_cast< sal_uInt32 >( (nColor & 0xFF00FF00) | ((nColor & 0x0000FF) << 16) | ((nColor & 0xFF0000) >> 16) );
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /** Returns the UNO RGB color from the passed encoded OLE BGR color. */
lclDecodeBgrColor(sal_uInt32 nOleColor)54cdf0e10cSrcweir inline sal_Int32 lclDecodeBgrColor( sal_uInt32 nOleColor )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     return static_cast< sal_Int32 >( lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir // ----------------------------------------------------------------------------
60cdf0e10cSrcweir 
61cdf0e10cSrcweir const sal_Char* const OLE_GUID_URLMONIKER   = "{79EAC9E0-BAF9-11CE-8C82-00AA004BA90B}";
62cdf0e10cSrcweir const sal_Char* const OLE_GUID_FILEMONIKER  = "{00000303-0000-0000-C000-000000000046}";
63cdf0e10cSrcweir 
64cdf0e10cSrcweir const sal_uInt32 OLE_STDPIC_ID              = 0x0000746C;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir const sal_uInt32 OLE_STDHLINK_VERSION       = 2;
67*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASTARGET     = 0x00000001; // Has hyperlink moniker.
68*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_ABSOLUTE      = 0x00000002; // Absolute path.
69*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASLOCATION   = 0x00000008; // Has target location.
70*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASDISPLAY    = 0x00000010; // Has display string.
71*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASGUID       = 0x00000020; // Has identification GUID.
72*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASTIME       = 0x00000040; // Has creation time.
73*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_HASFRAME      = 0x00000080; // Has frame.
74*d3e5b9daSmseidel const sal_uInt32 OLE_STDHLINK_ASSTRING      = 0x00000100; // Hyperlink as simple string.
75cdf0e10cSrcweir 
76cdf0e10cSrcweir // ----------------------------------------------------------------------------
77cdf0e10cSrcweir 
78cdf0e10cSrcweir template< typename Type >
lclAppendHex(OUStringBuffer & orBuffer,Type nValue)79cdf0e10cSrcweir void lclAppendHex( OUStringBuffer& orBuffer, Type nValue )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     const sal_Int32 nWidth = 2 * sizeof( Type );
82cdf0e10cSrcweir     static const sal_Unicode spcHexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
83cdf0e10cSrcweir     orBuffer.setLength( orBuffer.getLength() + nWidth );
84cdf0e10cSrcweir     for( sal_Int32 nCharIdx = orBuffer.getLength() - 1, nCharEnd = nCharIdx - nWidth; nCharIdx > nCharEnd; --nCharIdx, nValue >>= 4 )
85cdf0e10cSrcweir         orBuffer.setCharAt( nCharIdx, spcHexChars[ nValue & 0xF ] );
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
lclReadStdHlinkString(BinaryInputStream & rInStrm,bool bUnicode)88cdf0e10cSrcweir OUString lclReadStdHlinkString( BinaryInputStream& rInStrm, bool bUnicode )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     OUString aRet;
91cdf0e10cSrcweir     sal_Int32 nChars = rInStrm.readInt32();
92cdf0e10cSrcweir     if( nChars > 0 )
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         sal_Int32 nReadChars = getLimitedValue< sal_Int32, sal_Int32 >( nChars, 0, SAL_MAX_UINT16 );
95cdf0e10cSrcweir         // byte strings are always in ANSI (Windows 1252) encoding
96cdf0e10cSrcweir         aRet = bUnicode ? rInStrm.readUnicodeArray( nReadChars, true ) : rInStrm.readCharArrayUC( nReadChars, RTL_TEXTENCODING_MS_1252, true );
97cdf0e10cSrcweir         // strings are NUL terminated, remove trailing NUL and possible other garbage
98cdf0e10cSrcweir         sal_Int32 nNulPos = aRet.indexOf( '\0' );
99cdf0e10cSrcweir         if( nNulPos >= 0 )
100cdf0e10cSrcweir             aRet = aRet.copy( 0, nNulPos );
101cdf0e10cSrcweir         // skip remaining chars
102cdf0e10cSrcweir         rInStrm.skip( (bUnicode ? 2 : 1) * (nChars - nReadChars) );
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir     return aRet;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir } // namespace
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // ============================================================================
110cdf0e10cSrcweir 
StdFontInfo()111cdf0e10cSrcweir StdFontInfo::StdFontInfo() :
112cdf0e10cSrcweir     mnHeight( 0 ),
113cdf0e10cSrcweir     mnWeight( OLE_STDFONT_NORMAL ),
114cdf0e10cSrcweir     mnCharSet( WINDOWS_CHARSET_ANSI ),
115cdf0e10cSrcweir     mnFlags( 0 )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
StdFontInfo(const::rtl::OUString & rName,sal_uInt32 nHeight,sal_uInt16 nWeight,sal_uInt16 nCharSet,sal_uInt8 nFlags)119cdf0e10cSrcweir StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight,
120cdf0e10cSrcweir         sal_uInt16 nWeight, sal_uInt16 nCharSet, sal_uInt8 nFlags ) :
121cdf0e10cSrcweir     maName( rName ),
122cdf0e10cSrcweir     mnHeight( nHeight ),
123cdf0e10cSrcweir     mnWeight( nWeight ),
124cdf0e10cSrcweir     mnCharSet( nCharSet ),
125cdf0e10cSrcweir     mnFlags( nFlags )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir // ============================================================================
130cdf0e10cSrcweir 
decodeOleColor(const GraphicHelper & rGraphicHelper,sal_uInt32 nOleColor,bool bDefaultColorBgr)131cdf0e10cSrcweir /*static*/ sal_Int32 OleHelper::decodeOleColor(
132cdf0e10cSrcweir         const GraphicHelper& rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir     static const sal_Int32 spnSystemColors[] =
135cdf0e10cSrcweir     {
136cdf0e10cSrcweir         XML_scrollBar,      XML_background,     XML_activeCaption,  XML_inactiveCaption,
137cdf0e10cSrcweir         XML_menu,           XML_window,         XML_windowFrame,    XML_menuText,
138cdf0e10cSrcweir         XML_windowText,     XML_captionText,    XML_activeBorder,   XML_inactiveBorder,
139cdf0e10cSrcweir         XML_appWorkspace,   XML_highlight,      XML_highlightText,  XML_btnFace,
140cdf0e10cSrcweir         XML_btnShadow,      XML_grayText,       XML_btnText,        XML_inactiveCaptionText,
141cdf0e10cSrcweir         XML_btnHighlight,   XML_3dDkShadow,     XML_3dLight,        XML_infoText,
142cdf0e10cSrcweir         XML_infoBk
143cdf0e10cSrcweir     };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     switch( nOleColor & OLE_COLORTYPE_MASK )
146cdf0e10cSrcweir     {
147cdf0e10cSrcweir         case OLE_COLORTYPE_CLIENT:
148cdf0e10cSrcweir             return bDefaultColorBgr ? lclDecodeBgrColor( nOleColor ) : rGraphicHelper.getPaletteColor( nOleColor & OLE_PALETTECOLOR_MASK );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         case OLE_COLORTYPE_PALETTE:
151cdf0e10cSrcweir             return rGraphicHelper.getPaletteColor( nOleColor & OLE_PALETTECOLOR_MASK );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir         case OLE_COLORTYPE_BGR:
154cdf0e10cSrcweir             return lclDecodeBgrColor( nOleColor );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir         case OLE_COLORTYPE_SYSCOLOR:
157cdf0e10cSrcweir             return rGraphicHelper.getSystemColor( STATIC_ARRAY_SELECT( spnSystemColors, nOleColor & OLE_SYSTEMCOLOR_MASK, XML_TOKEN_INVALID ), API_RGB_WHITE );
158cdf0e10cSrcweir     }
159cdf0e10cSrcweir     OSL_ENSURE( false, "OleHelper::decodeOleColor - unknown color type" );
160cdf0e10cSrcweir     return API_RGB_BLACK;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir 
encodeOleColor(sal_Int32 nRgbColor)163cdf0e10cSrcweir /*static*/ sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor )
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     return OLE_COLORTYPE_BGR | lclSwapRedBlue( static_cast< sal_uInt32 >( nRgbColor & 0xFFFFFF ) );
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
importGuid(BinaryInputStream & rInStrm)168cdf0e10cSrcweir /*static*/ OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir     OUStringBuffer aBuffer;
171cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '{' ) );
172cdf0e10cSrcweir     lclAppendHex( aBuffer, rInStrm.readuInt32() );
173cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '-' ) );
174cdf0e10cSrcweir     lclAppendHex( aBuffer, rInStrm.readuInt16() );
175cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '-' ) );
176cdf0e10cSrcweir     lclAppendHex( aBuffer, rInStrm.readuInt16() );
177cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '-' ) );
178cdf0e10cSrcweir     lclAppendHex( aBuffer, rInStrm.readuInt8() );
179cdf0e10cSrcweir     lclAppendHex( aBuffer, rInStrm.readuInt8() );
180cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '-' ) );
181cdf0e10cSrcweir     for( int nIndex = 0; nIndex < 6; ++nIndex )
182cdf0e10cSrcweir         lclAppendHex( aBuffer, rInStrm.readuInt8() );
183cdf0e10cSrcweir     aBuffer.append( sal_Unicode( '}' ) );
184cdf0e10cSrcweir     return aBuffer.makeStringAndClear();
185cdf0e10cSrcweir }
186cdf0e10cSrcweir 
importStdFont(StdFontInfo & orFontInfo,BinaryInputStream & rInStrm,bool bWithGuid)187cdf0e10cSrcweir /*static*/ bool OleHelper::importStdFont( StdFontInfo& orFontInfo, BinaryInputStream& rInStrm, bool bWithGuid )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir     if( bWithGuid )
190cdf0e10cSrcweir     {
191cdf0e10cSrcweir         bool bIsStdFont = importGuid( rInStrm ).equalsAscii( OLE_GUID_STDFONT );
192cdf0e10cSrcweir         OSL_ENSURE( bIsStdFont, "OleHelper::importStdFont - unexpected header GUID, expected StdFont" );
193cdf0e10cSrcweir         if( !bIsStdFont )
194cdf0e10cSrcweir             return false;
195cdf0e10cSrcweir     }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     sal_uInt8 nVersion, nNameLen;
198cdf0e10cSrcweir     rInStrm >> nVersion >> orFontInfo.mnCharSet >> orFontInfo.mnFlags >> orFontInfo.mnWeight >> orFontInfo.mnHeight >> nNameLen;
199cdf0e10cSrcweir     // according to spec the name is ASCII
200cdf0e10cSrcweir     orFontInfo.maName = rInStrm.readCharArrayUC( nNameLen, RTL_TEXTENCODING_ASCII_US );
201cdf0e10cSrcweir     OSL_ENSURE( nVersion <= 1, "OleHelper::importStdFont - wrong version" );
202cdf0e10cSrcweir     return !rInStrm.isEof() && (nVersion <= 1);
203cdf0e10cSrcweir }
204cdf0e10cSrcweir 
importStdPic(StreamDataSequence & orGraphicData,BinaryInputStream & rInStrm,bool bWithGuid)205cdf0e10cSrcweir /*static*/ bool OleHelper::importStdPic( StreamDataSequence& orGraphicData, BinaryInputStream& rInStrm, bool bWithGuid )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir     if( bWithGuid )
208cdf0e10cSrcweir     {
209cdf0e10cSrcweir         bool bIsStdPic = importGuid( rInStrm ).equalsAscii( OLE_GUID_STDPIC );
210cdf0e10cSrcweir         OSL_ENSURE( bIsStdPic, "OleHelper::importStdPic - unexpected header GUID, expected StdPic" );
211cdf0e10cSrcweir         if( !bIsStdPic )
212cdf0e10cSrcweir             return false;
213cdf0e10cSrcweir     }
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     sal_uInt32 nStdPicId;
216cdf0e10cSrcweir     sal_Int32 nBytes;
217cdf0e10cSrcweir     rInStrm >> nStdPicId >> nBytes;
218cdf0e10cSrcweir     OSL_ENSURE( nStdPicId == OLE_STDPIC_ID, "OleHelper::importStdPic - unexpected header version" );
219cdf0e10cSrcweir     return !rInStrm.isEof() && (nStdPicId == OLE_STDPIC_ID) && (nBytes > 0) && (rInStrm.readData( orGraphicData, nBytes ) == nBytes);
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
importStdHlink(StdHlinkInfo & orHlinkInfo,BinaryInputStream & rInStrm,bool bWithGuid)222cdf0e10cSrcweir /*static*/ bool OleHelper::importStdHlink( StdHlinkInfo& orHlinkInfo, BinaryInputStream& rInStrm, bool bWithGuid )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     if( bWithGuid )
225cdf0e10cSrcweir     {
226cdf0e10cSrcweir         bool bIsStdHlink = importGuid( rInStrm ).equalsAscii( OLE_GUID_STDHLINK );
227cdf0e10cSrcweir         OSL_ENSURE( bIsStdHlink, "OleHelper::importStdHlink - unexpected header GUID, expected StdHlink" );
228cdf0e10cSrcweir         if( !bIsStdHlink )
229cdf0e10cSrcweir             return false;
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     sal_uInt32 nVersion, nFlags;
233cdf0e10cSrcweir     rInStrm >> nVersion >> nFlags;
234cdf0e10cSrcweir     OSL_ENSURE( nVersion == OLE_STDHLINK_VERSION, "OleHelper::importStdHlink - unexpected header version" );
235cdf0e10cSrcweir     if( rInStrm.isEof() || (nVersion != OLE_STDHLINK_VERSION) )
236cdf0e10cSrcweir         return false;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     // display string
239cdf0e10cSrcweir     if( getFlag( nFlags, OLE_STDHLINK_HASDISPLAY ) )
240cdf0e10cSrcweir         orHlinkInfo.maDisplay = lclReadStdHlinkString( rInStrm, true );
241cdf0e10cSrcweir     // frame string
242cdf0e10cSrcweir     if( getFlag( nFlags, OLE_STDHLINK_HASFRAME ) )
243cdf0e10cSrcweir         orHlinkInfo.maFrame = lclReadStdHlinkString( rInStrm, true );
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     // target
246cdf0e10cSrcweir     if( getFlag( nFlags, OLE_STDHLINK_HASTARGET ) )
247cdf0e10cSrcweir     {
248cdf0e10cSrcweir         if( getFlag( nFlags, OLE_STDHLINK_ASSTRING ) )
249cdf0e10cSrcweir         {
250cdf0e10cSrcweir             OSL_ENSURE( getFlag( nFlags, OLE_STDHLINK_ABSOLUTE ), "OleHelper::importStdHlink - link not absolute" );
251cdf0e10cSrcweir             orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, true );
252cdf0e10cSrcweir         }
253cdf0e10cSrcweir         else // hyperlink moniker
254cdf0e10cSrcweir         {
255cdf0e10cSrcweir             OUString aGuid = importGuid( rInStrm );
256cdf0e10cSrcweir             if( aGuid.equalsAscii( OLE_GUID_FILEMONIKER ) )
257cdf0e10cSrcweir             {
258cdf0e10cSrcweir                 // file name, maybe relative and with directory up-count
259cdf0e10cSrcweir                 sal_Int16 nUpLevels;
260cdf0e10cSrcweir                 rInStrm >> nUpLevels;
261cdf0e10cSrcweir                 OSL_ENSURE( (nUpLevels == 0) || !getFlag( nFlags, OLE_STDHLINK_ABSOLUTE ), "OleHelper::importStdHlink - absolute filename with upcount" );
262cdf0e10cSrcweir                 orHlinkInfo.maTarget = lclReadStdHlinkString( rInStrm, false );
263cdf0e10cSrcweir                 rInStrm.skip( 24 );
264cdf0e10cSrcweir                 sal_Int32 nBytes = rInStrm.readInt32();
265cdf0e10cSrcweir                 if( nBytes > 0 )
266cdf0e10cSrcweir                 {
267cdf0e10cSrcweir                     sal_Int64 nEndPos = rInStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
268cdf0e10cSrcweir                     sal_uInt16 nChars = getLimitedValue< sal_uInt16, sal_Int32 >( rInStrm.readInt32() / 2, 0, SAL_MAX_UINT16 );
269cdf0e10cSrcweir                     rInStrm.skip( 2 ); // key value
270cdf0e10cSrcweir                     orHlinkInfo.maTarget = rInStrm.readUnicodeArray( nChars ); // NOT null terminated
271cdf0e10cSrcweir                     rInStrm.seek( nEndPos );
272cdf0e10cSrcweir                 }
273cdf0e10cSrcweir                 if( !getFlag( nFlags, OLE_STDHLINK_ABSOLUTE ) )
274cdf0e10cSrcweir                     for( sal_Int16 nLevel = 0; nLevel < nUpLevels; ++nLevel )
275cdf0e10cSrcweir                         orHlinkInfo.maTarget = CREATE_OUSTRING( "../" ) + orHlinkInfo.maTarget;
276cdf0e10cSrcweir             }
277cdf0e10cSrcweir             else if( aGuid.equalsAscii( OLE_GUID_URLMONIKER ) )
278cdf0e10cSrcweir             {
279cdf0e10cSrcweir                 // URL, maybe relative and with leading '../'
280cdf0e10cSrcweir                 sal_Int32 nBytes = rInStrm.readInt32();
281cdf0e10cSrcweir                 sal_Int64 nEndPos = rInStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
282cdf0e10cSrcweir                 orHlinkInfo.maTarget = rInStrm.readNulUnicodeArray();
283cdf0e10cSrcweir                 rInStrm.seek( nEndPos );
284cdf0e10cSrcweir             }
285cdf0e10cSrcweir             else
286cdf0e10cSrcweir             {
287cdf0e10cSrcweir                 OSL_ENSURE( false, "OleHelper::importStdHlink - unsupported hyperlink moniker" );
288cdf0e10cSrcweir                 return false;
289cdf0e10cSrcweir             }
290cdf0e10cSrcweir         }
291cdf0e10cSrcweir     }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir     // target location
294cdf0e10cSrcweir     if( getFlag( nFlags, OLE_STDHLINK_HASLOCATION ) )
295cdf0e10cSrcweir         orHlinkInfo.maLocation = lclReadStdHlinkString( rInStrm, true );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir     return !rInStrm.isEof();
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir } // namespace ole
301cdf0e10cSrcweir } // namespace oox
302*d3e5b9daSmseidel 
303*d3e5b9daSmseidel /* vim: set noet sw=4 ts=4: */
304