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