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: galtheme.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #define ENABLE_BYTESTRING_STREAM_OPERATORS
36 #include <tools/urlobj.hxx>
37 #include <tools/vcompat.hxx>
38 #include <unotools/streamwrap.hxx>
39 #include <unotools/ucbstreamhelper.hxx>
40 #include <unotools/tempfile.hxx>
41 #include <unotools/localfilehelper.hxx>
42 #include <ucbhelper/content.hxx>
43 #include <sot/storage.hxx>
44 #include <sot/formats.hxx>
45 #include <sot/filelist.hxx>
46 #include <vcl/virdev.hxx>
47 #include <vcl/cvtgrf.hxx>
48 #include <svtools/itempool.hxx>
49 #include <sfx2/docfile.hxx>
50 #include <avmedia/mediawindow.hxx>
51 #include <svx/svdograf.hxx>
52 #include <svx/fmpage.hxx>
54 #include <svx/unomodel.hxx>
55 #include <svx/fmmodel.hxx>
56 #include <svx/fmview.hxx>
57 #include "galmisc.hxx"
58 #include "galtheme.hxx"
59 #include <com/sun/star/sdbc/XResultSet.hpp>
60 #include <com/sun/star/ucb/XContentAccess.hpp>
61 #include <com/sun/star/io/XInputStream.hpp>
63 #include "gallerydrawmodel.hxx"
69 using namespace ::rtl
;
70 using namespace ::com::sun::star
;
76 GalleryTheme::GalleryTheme( Gallery
* pGallery
, GalleryThemeEntry
* pThemeEntry
) :
79 mnThemeLockCount ( 0 ),
80 mnBroadcasterLockCount( 0 ),
84 ImplCreateSvDrawStorage();
86 if( pThm
->IsImported() )
87 aImportName
= pThm
->GetThemeName();
90 // ------------------------------------------------------------------------
92 GalleryTheme::~GalleryTheme()
96 for( GalleryObject
* pEntry
= aObjectList
.First(); pEntry
; pEntry
= aObjectList
.Next() )
98 Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
100 Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
104 // ------------------------------------------------------------------------
106 void GalleryTheme::ImplCreateSvDrawStorage()
108 if( !pThm
->IsImported() )
110 aSvDrawStorageRef
= new SvStorage( FALSE
, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE
), pThm
->IsReadOnly() ? STREAM_READ
: STREAM_STD_READWRITE
);
111 // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons)
112 if ( ( aSvDrawStorageRef
->GetError() != ERRCODE_NONE
) && !pThm
->IsReadOnly() )
113 aSvDrawStorageRef
= new SvStorage( FALSE
, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
116 aSvDrawStorageRef
.Clear();
119 // ------------------------------------------------------------------------
121 BOOL
GalleryTheme::ImplWriteSgaObject( const SgaObject
& rObj
, ULONG nPos
, GalleryObject
* pExistentEntry
)
123 SvStream
* pOStm
= ::utl::UcbStreamHelper::CreateStream( GetSdgURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
);
128 const sal_uInt32 nOffset
= pOStm
->Seek( STREAM_SEEK_TO_END
);
130 rObj
.WriteData( *pOStm
, m_aDestDir
);
132 if( !pOStm
->GetError() )
134 GalleryObject
* pEntry
;
136 if( !pExistentEntry
)
138 pEntry
= new GalleryObject
;
139 aObjectList
.Insert( pEntry
, nPos
);
142 pEntry
= pExistentEntry
;
144 pEntry
->aURL
= rObj
.GetURL();
145 pEntry
->nOffset
= nOffset
;
146 pEntry
->eObjKind
= rObj
.GetObjKind();
156 // ------------------------------------------------------------------------
158 SgaObject
* GalleryTheme::ImplReadSgaObject( GalleryObject
* pEntry
)
160 SgaObject
* pSgaObj
= NULL
;
164 SvStream
* pIStm
= ::utl::UcbStreamHelper::CreateStream( GetSdgURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
168 sal_uInt32 nInventor
;
170 // Ueberpruefen, ob das File ein gueltiges SGA-File ist
171 pIStm
->Seek( pEntry
->nOffset
);
174 if( nInventor
== COMPAT_FORMAT( 'S', 'G', 'A', '3' ) )
176 pIStm
->Seek( pEntry
->nOffset
);
178 switch( pEntry
->eObjKind
)
180 case( SGA_OBJ_BMP
): pSgaObj
= new SgaObjectBmp(); break;
181 case( SGA_OBJ_ANIM
): pSgaObj
= new SgaObjectAnim(); break;
182 case( SGA_OBJ_INET
): pSgaObj
= new SgaObjectINet(); break;
183 case( SGA_OBJ_SVDRAW
): pSgaObj
= new SgaObjectSvDraw(); break;
184 case( SGA_OBJ_SOUND
): pSgaObj
= new SgaObjectSound(); break;
193 pSgaObj
->ImplUpdateURL( pEntry
->aURL
);
204 // ------------------------------------------------------------------------
206 void GalleryTheme::ImplRead()
208 SvStream
* pIStm
= ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
217 // ------------------------------------------------------------------------
219 void GalleryTheme::ImplWrite()
223 INetURLObject
aPathURL( GetThmURL() );
225 aPathURL
.removeSegment();
226 aPathURL
.removeFinalSlash();
228 DBG_ASSERT( aPathURL
.GetProtocol() != INET_PROT_NOT_VALID
, "invalid URL" );
230 if( FileExists( aPathURL
) || CreateDir( aPathURL
) )
233 SvStream
* pOStm
= ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
| STREAM_COPY_ON_SYMLINK
| STREAM_TRUNC
);
235 SvStream
* pOStm
= ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
| STREAM_TRUNC
);
244 ImplSetModified( FALSE
);
249 // ------------------------------------------------------------------------
251 const GalleryObject
* GalleryTheme::ImplGetGalleryObject( const INetURLObject
& rURL
)
253 GalleryObject
* pEntry
= aObjectList
.First();
254 GalleryObject
* pFoundEntry
= NULL
;
256 for( ; pEntry
&& !pFoundEntry
; pEntry
= aObjectList
.Next() )
257 if( pEntry
->aURL
== rURL
)
258 pFoundEntry
= pEntry
;
263 // ------------------------------------------------------------------------
265 INetURLObject
GalleryTheme::ImplGetURL( const GalleryObject
* pObject
) const
273 INetURLObject
aPathURL( GetParent()->GetImportURL( GetName() ) );
275 aPathURL
.removeSegment();
276 aPathURL
.removeFinalSlash();
277 aPathURL
.Append( pObject
->aURL
.GetName() );
281 aURL
= pObject
->aURL
;
287 // ------------------------------------------------------------------------
289 INetURLObject
GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind
, ULONG nFormat
)
291 INetURLObject
aDir( GetParent()->GetUserURL() );
292 INetURLObject
aInfoFileURL( GetParent()->GetUserURL() );
293 INetURLObject aNewURL
;
294 sal_uInt32 nNextNumber
= 1999;
295 sal_Char
const* pExt
= NULL
;
298 aDir
.Append( String( RTL_CONSTASCII_USTRINGPARAM( "dragdrop" ) ) );
301 aInfoFileURL
.Append( String( RTL_CONSTASCII_USTRINGPARAM( "sdddndx1" ) ) );
303 // read next possible number
304 if( FileExists( aInfoFileURL
) )
306 SvStream
* pIStm
= ::utl::UcbStreamHelper::CreateStream( aInfoFileURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
310 *pIStm
>> nNextNumber
;
320 case( CVT_BMP
): pExt
= ".bmp"; break;
321 case( CVT_GIF
): pExt
= ".gif"; break;
322 case( CVT_JPG
): pExt
= ".jpg"; break;
323 case( CVT_MET
): pExt
= ".met"; break;
324 case( CVT_PCT
): pExt
= ".pct"; break;
325 case( CVT_PNG
): pExt
= ".png"; break;
326 case( CVT_SVM
): pExt
= ".svm"; break;
327 case( CVT_TIF
): pExt
= ".tif"; break;
328 case( CVT_WMF
): pExt
= ".wmf"; break;
329 case( CVT_EMF
): pExt
= ".emf"; break;
340 if( SGA_OBJ_SVDRAW
== eObjKind
)
342 String
aFileName( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/dd" ) );
343 aNewURL
= INetURLObject( aFileName
+= String::CreateFromInt32( ++nNextNumber
% 99999999 ), INET_PROT_PRIV_SOFFICE
);
347 for( GalleryObject
* pEntry
= aObjectList
.First(); pEntry
&& !bExists
; pEntry
= aObjectList
.Next() )
348 if( pEntry
->aURL
== aNewURL
)
353 String
aFileName( RTL_CONSTASCII_USTRINGPARAM( "dd" ) );
355 aFileName
+= String::CreateFromInt32( ++nNextNumber
% 999999 );
356 aFileName
+= String( pExt
, RTL_TEXTENCODING_ASCII_US
);
359 aNewURL
.Append( aFileName
);
361 bExists
= FileExists( aNewURL
);
366 // write updated number
367 SvStream
* pOStm
= ::utl::UcbStreamHelper::CreateStream( aInfoFileURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
);
371 *pOStm
<< nNextNumber
;
378 // ------------------------------------------------------------------------
380 void GalleryTheme::ImplBroadcast( ULONG nUpdatePos
)
382 if( !IsBroadcasterLocked() )
384 if( GetObjectCount() && ( nUpdatePos
>= GetObjectCount() ) )
385 nUpdatePos
= GetObjectCount() - 1;
387 Broadcast( GalleryHint( GALLERY_HINT_THEME_UPDATEVIEW
, GetName(), nUpdatePos
) );
391 // ------------------------------------------------------------------------
393 BOOL
GalleryTheme::UnlockTheme()
395 DBG_ASSERT( mnThemeLockCount
, "Theme is not locked" );
399 if( mnThemeLockCount
)
408 // ------------------------------------------------------------------------
410 void GalleryTheme::UnlockBroadcaster( ULONG nUpdatePos
)
412 DBG_ASSERT( mnBroadcasterLockCount
, "Broadcaster is not locked" );
414 if( mnBroadcasterLockCount
&& !--mnBroadcasterLockCount
)
415 ImplBroadcast( nUpdatePos
);
418 // ------------------------------------------------------------------------
420 BOOL
GalleryTheme::InsertObject( const SgaObject
& rObj
, ULONG nInsertPos
)
426 GalleryObject
* pEntry
= aObjectList
.First();
427 GalleryObject
* pFoundEntry
= NULL
;
429 for( ; pEntry
&& !pFoundEntry
; pEntry
= aObjectList
.Next() )
430 if( pEntry
->aURL
== rObj
.GetURL() )
431 pFoundEntry
= pEntry
;
435 GalleryObject aNewEntry
;
437 // update title of new object if neccessary
438 if( !rObj
.GetTitle().Len() )
440 SgaObject
* pOldObj
= ImplReadSgaObject( pFoundEntry
);
444 ( (SgaObject
&) rObj
).SetTitle( pOldObj
->GetTitle() );
448 else if( rObj
.GetTitle() == String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) ) )
449 ( (SgaObject
&) rObj
).SetTitle( String() );
451 ImplWriteSgaObject( rObj
, nInsertPos
, &aNewEntry
);
452 pFoundEntry
->nOffset
= aNewEntry
.nOffset
;
455 ImplWriteSgaObject( rObj
, nInsertPos
, NULL
);
457 ImplSetModified( bRet
= TRUE
);
458 ImplBroadcast( pFoundEntry
? aObjectList
.GetPos( pFoundEntry
) : nInsertPos
);
464 // ------------------------------------------------------------------------
466 SgaObject
* GalleryTheme::AcquireObject( ULONG nPos
)
468 return ImplReadSgaObject( aObjectList
.GetObject( nPos
) );
471 // ------------------------------------------------------------------------
473 void GalleryTheme::ReleaseObject( SgaObject
* pObject
)
478 // ------------------------------------------------------------------------
480 BOOL
GalleryTheme::RemoveObject( ULONG nPos
)
482 GalleryObject
* pEntry
= aObjectList
.Remove( nPos
);
484 if( !aObjectList
.Count() )
485 KillFile( GetSdgURL() );
489 if( SGA_OBJ_SVDRAW
== pEntry
->eObjKind
)
490 aSvDrawStorageRef
->Remove( pEntry
->aURL
.GetMainURL( INetURLObject::NO_DECODE
) );
492 Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
494 Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
496 ImplSetModified( TRUE
);
497 ImplBroadcast( nPos
);
500 return( pEntry
!= NULL
);
503 // ------------------------------------------------------------------------
505 BOOL
GalleryTheme::ChangeObjectPos( ULONG nOldPos
, ULONG nNewPos
)
509 if( nOldPos
!= nNewPos
)
511 GalleryObject
* pEntry
= aObjectList
.GetObject( nOldPos
);
515 aObjectList
.Insert( pEntry
, nNewPos
);
517 if( nNewPos
< nOldPos
)
520 aObjectList
.Remove( nOldPos
);
521 ImplSetModified( bRet
= TRUE
);
522 ImplBroadcast( ( nNewPos
< nOldPos
) ? nNewPos
: ( nNewPos
- 1 ) );
529 // ------------------------------------------------------------------------
531 void GalleryTheme::Actualize( const Link
& rActualizeLink
, GalleryProgress
* pProgress
)
533 if( !IsReadOnly() && !IsImported() )
537 GalleryObject
* pEntry
;
538 const ULONG nCount
= aObjectList
.Count();
542 bAbortActualize
= FALSE
;
544 // LoeschFlag zuruecksetzen
545 for ( i
= 0; i
< nCount
; i
++ )
546 aObjectList
.GetObject( i
)->bDummy
= FALSE
;
548 for( i
= 0; ( i
< nCount
) && !bAbortActualize
; i
++ )
551 pProgress
->Update( i
, nCount
- 1 );
553 pEntry
= aObjectList
.GetObject( i
);
555 const INetURLObject
aURL( pEntry
->aURL
);
557 rActualizeLink
.Call( (void*) &aURL
);
559 // SvDraw-Objekte werden spaeter aktualisiert
560 if( pEntry
->eObjKind
!= SGA_OBJ_SVDRAW
)
562 // Hier muss noch etwas eingebaut werden,
563 // das Files auf den ensprechenden Eintrag matched
564 // Grafiken als Grafik-Objekte in die Gallery aufnehmen
565 if( pEntry
->eObjKind
== SGA_OBJ_SOUND
)
567 SgaObjectSound
aObjSound( aURL
);
568 if( !InsertObject( aObjSound
) )
569 pEntry
->bDummy
= TRUE
;
575 if ( GalleryGraphicImport( aURL
, aGraphic
, aFormat
) )
579 if ( SGA_OBJ_INET
== pEntry
->eObjKind
)
580 pNewObj
= (SgaObject
*) new SgaObjectINet( aGraphic
, aURL
, aFormat
);
581 else if ( aGraphic
.IsAnimated() )
582 pNewObj
= (SgaObject
*) new SgaObjectAnim( aGraphic
, aURL
, aFormat
);
584 pNewObj
= (SgaObject
*) new SgaObjectBmp( aGraphic
, aURL
, aFormat
);
586 if( !InsertObject( *pNewObj
) )
587 pEntry
->bDummy
= TRUE
;
592 pEntry
->bDummy
= TRUE
; // Loesch-Flag setzen
597 if ( aSvDrawStorageRef
.Is() )
599 const String
aStmName( GetSvDrawStreamNameFromURL( pEntry
->aURL
) );
600 SvStorageStreamRef pIStm
= aSvDrawStorageRef
->OpenSotStream( aStmName
, STREAM_READ
);
602 if( pIStm
&& !pIStm
->GetError() )
604 pIStm
->SetBufferSize( 16384 );
606 SgaObjectSvDraw
aNewObj( *pIStm
, pEntry
->aURL
);
608 if( !InsertObject( aNewObj
) )
609 pEntry
->bDummy
= TRUE
;
611 pIStm
->SetBufferSize( 0L );
617 // remove all entries with set flag
618 pEntry
= aObjectList
.First();
623 Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
624 delete aObjectList
.Remove( pEntry
);
625 Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED
, GetName(), reinterpret_cast< ULONG
>( pEntry
) ) );
627 pEntry
= aObjectList
.GetCurObject();
630 pEntry
= aObjectList
.Next();
634 ::utl::TempFile aTmp
;
635 INetURLObject
aInURL( GetSdgURL() );
636 INetURLObject
aTmpURL( aTmp
.GetURL() );
638 DBG_ASSERT( aInURL
.GetProtocol() != INET_PROT_NOT_VALID
, "invalid URL" );
639 DBG_ASSERT( aTmpURL
.GetProtocol() != INET_PROT_NOT_VALID
, "invalid URL" );
641 SvStream
* pIStm
= ::utl::UcbStreamHelper::CreateStream( aInURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
642 SvStream
* pTmpStm
= ::utl::UcbStreamHelper::CreateStream( aTmpURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
| STREAM_TRUNC
);
644 if( pIStm
&& pTmpStm
)
646 pEntry
= aObjectList
.First();
652 switch( pEntry
->eObjKind
)
654 case( SGA_OBJ_BMP
): pObj
= new SgaObjectBmp(); break;
655 case( SGA_OBJ_ANIM
): pObj
= new SgaObjectAnim(); break;
656 case( SGA_OBJ_INET
): pObj
= new SgaObjectINet(); break;
657 case( SGA_OBJ_SVDRAW
): pObj
= new SgaObjectSvDraw(); break;
658 case (SGA_OBJ_SOUND
): pObj
= new SgaObjectSound(); break;
667 pIStm
->Seek( pEntry
->nOffset
);
669 pEntry
->nOffset
= pTmpStm
->Tell();
674 pEntry
= aObjectList
.Next();
679 DBG_ERROR( "File(s) could not be opened" );
685 CopyFile( aTmpURL
, aInURL
);
691 SvStorageRef
aTempStorageRef( new SvStorage( FALSE
, aTmpURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_STD_READWRITE
) );
692 aSvDrawStorageRef
->CopyTo( aTempStorageRef
);
693 nStorErr
= aSvDrawStorageRef
->GetError();
698 aSvDrawStorageRef
.Clear();
699 CopyFile( aTmpURL
, GetSdvURL() );
700 ImplCreateSvDrawStorage();
704 ImplSetModified( TRUE
);
710 // ------------------------------------------------------------------------
712 GalleryThemeEntry
* GalleryTheme::CreateThemeEntry( const INetURLObject
& rURL
, BOOL bReadOnly
)
714 DBG_ASSERT( rURL
.GetProtocol() != INET_PROT_NOT_VALID
, "invalid URL" );
716 GalleryThemeEntry
* pRet
= NULL
;
718 if( FileExists( rURL
) )
720 SvStream
* pIStm
= ::utl::UcbStreamHelper::CreateStream( rURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_READ
);
725 sal_uInt32 nThemeId
= 0;
727 BOOL bThemeNameFromResource
= FALSE
;
731 if( nVersion
<= 0x00ff )
735 *pIStm
>> aTmpStr
; aThemeName
= String( aTmpStr
.GetBuffer(), RTL_TEXTENCODING_UTF8
);
737 // Charakterkonvertierung durchfuehren
738 if( nVersion
>= 0x0004 )
743 *pIStm
>> nCount
>> nTemp16
;
744 pIStm
->Seek( STREAM_SEEK_TO_END
);
746 // pruefen, ob es sich um eine neuere Version handelt;
747 // daher um 520Bytes (8Bytes Kennung + 512Bytes Reserverpuffer ) zurueckspringen,
748 // falls dies ueberhaupt moeglich ist
749 if( pIStm
->Tell() >= 520 )
751 sal_uInt32 nId1
, nId2
;
753 pIStm
->SeekRel( -520 );
754 *pIStm
>> nId1
>> nId2
;
756 if( nId1
== COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
757 nId2
== COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
759 VersionCompat
* pCompat
= new VersionCompat( *pIStm
, STREAM_READ
);
763 if( pCompat
->GetVersion() >= 2 )
765 *pIStm
>> bThemeNameFromResource
;
773 INetURLObject
aPathURL( rURL
);
775 aPathURL
.removeSegment();
776 aPathURL
.removeFinalSlash();
777 pRet
= new GalleryThemeEntry( aPathURL
, aThemeName
,
778 String(rURL
.GetBase()).Copy( 2, 6 ).ToInt32(),
779 bReadOnly
, FALSE
, FALSE
, nThemeId
,
780 bThemeNameFromResource
);
790 // -----------------------------------------------------------------------------
792 BOOL
GalleryTheme::GetThumb( ULONG nPos
, Bitmap
& rBmp
, BOOL
)
794 SgaObject
* pObj
= AcquireObject( nPos
);
799 rBmp
= pObj
->GetThumbBmp();
800 ReleaseObject( pObj
);
807 // -----------------------------------------------------------------------------
809 BOOL
GalleryTheme::GetGraphic( ULONG nPos
, Graphic
& rGraphic
, BOOL bProgress
)
811 const GalleryObject
* pObject
= ImplGetGalleryObject( nPos
);
816 const INetURLObject
aURL( ImplGetURL( pObject
) );
818 switch( pObject
->eObjKind
)
821 case( SGA_OBJ_ANIM
):
822 case( SGA_OBJ_INET
):
825 bRet
= ( GalleryGraphicImport( aURL
, rGraphic
, aFilterDummy
, bProgress
) != SGA_IMPORT_NONE
);
829 case( SGA_OBJ_SVDRAW
):
831 SvxGalleryDrawModel aModel
;
833 if( aModel
.GetModel() )
835 if( GetModel( nPos
, *aModel
.GetModel(), bProgress
) )
839 if( CreateIMapGraphic( *aModel
.GetModel(), rGraphic
, aIMap
) )
844 aVDev
.SetMapMode( MapMode( MAP_100TH_MM
) );
845 FmFormView
aView( aModel
.GetModel(), &aVDev
);
847 aView
.hideMarkHandles();
848 aView
.ShowSdrPage(aView
.GetModel()->GetPage(0));
850 rGraphic
= aView
.GetAllMarkedGraphic();
858 case( SGA_OBJ_SOUND
):
860 SgaObject
* pObj
= AcquireObject( nPos
);
864 Bitmap
aBmp( pObj
->GetThumbBmp() );
865 aBmp
.Replace( COL_LIGHTMAGENTA
, COL_WHITE
);
867 ReleaseObject( pObj
);
881 // -----------------------------------------------------------------------------
883 BOOL
GalleryTheme::InsertGraphic( const Graphic
& rGraphic
, ULONG nInsertPos
)
887 if( rGraphic
.GetType() != GRAPHIC_NONE
)
889 ULONG nExportFormat
= CVT_UNKNOWN
;
890 const GfxLink
aGfxLink( ( (Graphic
&) rGraphic
).GetLink() );
892 if( aGfxLink
.GetDataSize() )
894 switch( aGfxLink
.GetType() )
896 case( GFX_LINK_TYPE_EPS_BUFFER
): nExportFormat
= CVT_SVM
; break;
897 case( GFX_LINK_TYPE_NATIVE_GIF
): nExportFormat
= CVT_GIF
; break;
898 case( GFX_LINK_TYPE_NATIVE_JPG
): nExportFormat
= CVT_JPG
; break;
899 case( GFX_LINK_TYPE_NATIVE_PNG
): nExportFormat
= CVT_PNG
; break;
900 case( GFX_LINK_TYPE_NATIVE_TIF
): nExportFormat
= CVT_TIF
; break;
901 case( GFX_LINK_TYPE_NATIVE_WMF
): nExportFormat
= CVT_WMF
; break;
902 case( GFX_LINK_TYPE_NATIVE_MET
): nExportFormat
= CVT_MET
; break;
903 case( GFX_LINK_TYPE_NATIVE_PCT
): nExportFormat
= CVT_PCT
; break;
910 if( rGraphic
.GetType() == GRAPHIC_BITMAP
)
912 if( rGraphic
.IsAnimated() )
913 nExportFormat
= CVT_GIF
;
915 nExportFormat
= CVT_PNG
;
918 nExportFormat
= CVT_SVM
;
921 const INetURLObject
aURL( ImplCreateUniqueURL( SGA_OBJ_BMP
, nExportFormat
) );
922 SvStream
* pOStm
= ::utl::UcbStreamHelper::CreateStream( aURL
.GetMainURL( INetURLObject::NO_DECODE
), STREAM_WRITE
| STREAM_TRUNC
);
926 pOStm
->SetVersion( SOFFICE_FILEFORMAT_50
);
928 if( CVT_SVM
== nExportFormat
)
930 GDIMetaFile
aMtf( rGraphic
.GetGDIMetaFile() );
932 aMtf
.Write( *pOStm
);
933 bRet
= ( pOStm
->GetError() == ERRCODE_NONE
);
937 if( aGfxLink
.GetDataSize() && aGfxLink
.GetData() )
939 pOStm
->Write( aGfxLink
.GetData(), aGfxLink
.GetDataSize() );
940 bRet
= ( pOStm
->GetError() == ERRCODE_NONE
);
943 bRet
= ( GraphicConverter::Export( *pOStm
, rGraphic
, nExportFormat
) == ERRCODE_NONE
);
951 const SgaObjectBmp
aObjBmp( aURL
.GetMainURL( INetURLObject::NO_DECODE
) );
952 InsertObject( aObjBmp
, nInsertPos
);
959 // -----------------------------------------------------------------------------
961 BOOL
GalleryTheme::GetModel( ULONG nPos
, SdrModel
& rModel
, BOOL
)
963 const GalleryObject
* pObject
= ImplGetGalleryObject( nPos
);
966 if( pObject
&& ( SGA_OBJ_SVDRAW
== pObject
->eObjKind
) )
968 const INetURLObject
aURL( ImplGetURL( pObject
) );
969 SvStorageRef
xStor( GetSvDrawStorage() );
973 const String
aStmName( GetSvDrawStreamNameFromURL( aURL
) );
974 SvStorageStreamRef
xIStm( xStor
->OpenSotStream( aStmName
, STREAM_READ
) );
976 if( xIStm
.Is() && !xIStm
->GetError() )
978 xIStm
->SetBufferSize( STREAMBUF_SIZE
);
979 bRet
= GallerySvDrawImport( *xIStm
, rModel
);
980 xIStm
->SetBufferSize( 0L );
988 // -----------------------------------------------------------------------------
990 BOOL
GalleryTheme::InsertModel( const FmFormModel
& rModel
, ULONG nInsertPos
)
992 INetURLObject
aURL( ImplCreateUniqueURL( SGA_OBJ_SVDRAW
) );
993 SvStorageRef
xStor( GetSvDrawStorage() );
998 const String
aStmName( GetSvDrawStreamNameFromURL( aURL
) );
999 SvStorageStreamRef
xOStm( xStor
->OpenSotStream( aStmName
, STREAM_WRITE
| STREAM_TRUNC
) );
1001 if( xOStm
.Is() && !xOStm
->GetError() )
1003 SvMemoryStream
aMemStm( 65535, 65535 );
1004 FmFormModel
* pFormModel
= (FmFormModel
*) &rModel
;
1006 pFormModel
->BurnInStyleSheetAttributes();
1009 uno::Reference
< io::XOutputStream
> xDocOut( new utl::OOutputStreamWrapper( aMemStm
) );
1012 SvxDrawingLayerExport( pFormModel
, xDocOut
);
1017 xOStm
->SetBufferSize( 16348 );
1018 GalleryCodec
aCodec( *xOStm
);
1019 aCodec
.Write( aMemStm
);
1021 if( !xOStm
->GetError() )
1023 SgaObjectSvDraw
aObjSvDraw( rModel
, aURL
);
1024 bRet
= InsertObject( aObjSvDraw
, nInsertPos
);
1027 xOStm
->SetBufferSize( 0L );
1035 // -----------------------------------------------------------------------------
1037 BOOL
GalleryTheme::GetModelStream( ULONG nPos
, SotStorageStreamRef
& rxModelStream
, BOOL
)
1039 const GalleryObject
* pObject
= ImplGetGalleryObject( nPos
);
1042 if( pObject
&& ( SGA_OBJ_SVDRAW
== pObject
->eObjKind
) )
1044 const INetURLObject
aURL( ImplGetURL( pObject
) );
1045 SvStorageRef
xStor( GetSvDrawStorage() );
1049 const String
aStmName( GetSvDrawStreamNameFromURL( aURL
) );
1050 SvStorageStreamRef
xIStm( xStor
->OpenSotStream( aStmName
, STREAM_READ
) );
1052 if( xIStm
.Is() && !xIStm
->GetError() )
1054 UINT32 nVersion
= 0;
1056 xIStm
->SetBufferSize( 16348 );
1058 if( GalleryCodec::IsCoded( *xIStm
, nVersion
) )
1060 SvxGalleryDrawModel aModel
;
1062 if( aModel
.GetModel() )
1064 if( GallerySvDrawImport( *xIStm
, *aModel
.GetModel() ) )
1066 aModel
.GetModel()->BurnInStyleSheetAttributes();
1069 uno::Reference
< io::XOutputStream
> xDocOut( new utl::OOutputStreamWrapper( *rxModelStream
) );
1071 if( SvxDrawingLayerExport( aModel
.GetModel(), xDocOut
) )
1072 rxModelStream
->Commit();
1076 bRet
= ( rxModelStream
->GetError() == ERRCODE_NONE
);
1080 xIStm
->SetBufferSize( 0 );
1088 // -----------------------------------------------------------------------------
1090 BOOL
GalleryTheme::InsertModelStream( const SotStorageStreamRef
& rxModelStream
, ULONG nInsertPos
)
1092 INetURLObject
aURL( ImplCreateUniqueURL( SGA_OBJ_SVDRAW
) );
1093 SvStorageRef
xStor( GetSvDrawStorage() );
1098 const String
aStmName( GetSvDrawStreamNameFromURL( aURL
) );
1099 SvStorageStreamRef
xOStm( xStor
->OpenSotStream( aStmName
, STREAM_WRITE
| STREAM_TRUNC
) );
1101 if( xOStm
.Is() && !xOStm
->GetError() )
1103 GalleryCodec
aCodec( *xOStm
);
1104 SvMemoryStream
aMemStm( 65535, 65535 );
1106 xOStm
->SetBufferSize( 16348 );
1107 aCodec
.Write( *rxModelStream
);
1109 if( !xOStm
->GetError() )
1112 SgaObjectSvDraw
aObjSvDraw( *xOStm
, aURL
);
1113 bRet
= InsertObject( aObjSvDraw
, nInsertPos
);
1116 xOStm
->SetBufferSize( 0L );
1124 // -----------------------------------------------------------------------------
1126 BOOL
GalleryTheme::GetURL( ULONG nPos
, INetURLObject
& rURL
, BOOL
)
1128 const GalleryObject
* pObject
= ImplGetGalleryObject( nPos
);
1133 rURL
= INetURLObject( ImplGetURL( pObject
) );
1140 // -----------------------------------------------------------------------------
1142 BOOL
GalleryTheme::InsertURL( const INetURLObject
& rURL
, ULONG nInsertPos
)
1146 SgaObject
* pNewObj
= NULL
;
1147 const USHORT nImportRet
= GalleryGraphicImport( rURL
, aGraphic
, aFormat
);
1150 if( nImportRet
!= SGA_IMPORT_NONE
)
1152 if ( SGA_IMPORT_INET
== nImportRet
)
1153 pNewObj
= (SgaObject
*) new SgaObjectINet( aGraphic
, rURL
, aFormat
);
1154 else if ( aGraphic
.IsAnimated() )
1155 pNewObj
= (SgaObject
*) new SgaObjectAnim( aGraphic
, rURL
, aFormat
);
1157 pNewObj
= (SgaObject
*) new SgaObjectBmp( aGraphic
, rURL
, aFormat
);
1159 else if( ::avmedia::MediaWindow::isMediaURL( rURL
.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS
) ) )
1160 pNewObj
= (SgaObject
*) new SgaObjectSound( rURL
);
1162 if( pNewObj
&& InsertObject( *pNewObj
, nInsertPos
) )
1170 // -----------------------------------------------------------------------------
1172 BOOL
GalleryTheme::InsertFileOrDirURL( const INetURLObject
& rFileOrDirURL
, ULONG nInsertPos
)
1175 ::std::vector
< INetURLObject
> aURLVector
;
1180 ::ucbhelper::Content
aCnt( rFileOrDirURL
.GetMainURL( INetURLObject::NO_DECODE
), uno::Reference
< ucb::XCommandEnvironment
>() );
1181 sal_Bool bFolder
= false;
1183 aCnt
.getPropertyValue( OUString::createFromAscii( "IsFolder" ) ) >>= bFolder
;
1187 uno::Sequence
< OUString
> aProps( 1 );
1188 aProps
.getArray()[ 0 ] = OUString::createFromAscii( "Url" );
1189 uno::Reference
< sdbc::XResultSet
> xResultSet( aCnt
.createCursor( aProps
, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY
) );
1191 if( xResultSet
.is() )
1193 uno::Reference
< ucb::XContentAccess
> xContentAccess( xResultSet
, uno::UNO_QUERY
);
1195 if( xContentAccess
.is() )
1197 while( xResultSet
->next() )
1199 aURL
.SetSmartURL( xContentAccess
->queryContentIdentifierString() );
1200 aURLVector
.push_back( aURL
);
1206 aURLVector
.push_back( rFileOrDirURL
);
1208 catch( const ucb::ContentCreationException
& )
1211 catch( const uno::RuntimeException
& )
1214 catch( const uno::Exception
& )
1218 ::std::vector
< INetURLObject
>::const_iterator
aIter( aURLVector
.begin() ), aEnd( aURLVector
.end() );
1220 while( aIter
!= aEnd
)
1221 bRet
= bRet
|| InsertURL( *aIter
++, nInsertPos
);
1226 // -----------------------------------------------------------------------------
1228 BOOL
GalleryTheme::InsertTransferable( const uno::Reference
< datatransfer::XTransferable
>& rxTransferable
, ULONG nInsertPos
)
1232 if( rxTransferable
.is() )
1234 TransferableDataHelper
aDataHelper( rxTransferable
);
1235 Graphic
* pGraphic
= NULL
;
1237 if( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_DRAWING
) )
1239 SotStorageStreamRef xModelStm
;
1241 if( aDataHelper
.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING
, xModelStm
) )
1242 bRet
= InsertModelStream( xModelStm
, nInsertPos
);
1244 else if( aDataHelper
.HasFormat( SOT_FORMAT_FILE_LIST
) ||
1245 aDataHelper
.HasFormat( FORMAT_FILE
) )
1249 if( aDataHelper
.HasFormat( SOT_FORMAT_FILE_LIST
) )
1250 aDataHelper
.GetFileList( SOT_FORMAT_FILE_LIST
, aFileList
);
1255 aDataHelper
.GetString( FORMAT_FILE
, aFile
);
1258 aFileList
.AppendFile( aFile
);
1261 for( sal_uInt32 i
= 0, nCount
= aFileList
.Count(); i
< nCount
; ++i
)
1263 const String
aFile( aFileList
.GetFile( i
) );
1264 INetURLObject
aURL( aFile
);
1266 if( aURL
.GetProtocol() == INET_PROT_NOT_VALID
)
1270 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFile
, aLocalURL
) )
1271 aURL
= INetURLObject( aLocalURL
);
1274 if( aURL
.GetProtocol() != INET_PROT_NOT_VALID
)
1275 bRet
= InsertFileOrDirURL( aURL
, nInsertPos
);
1283 if( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_SVXB
) )
1284 nFormat
= SOT_FORMATSTR_ID_SVXB
;
1285 else if( aDataHelper
.HasFormat( FORMAT_GDIMETAFILE
) )
1286 nFormat
= FORMAT_GDIMETAFILE
;
1287 else if( aDataHelper
.HasFormat( FORMAT_BITMAP
) )
1288 nFormat
= FORMAT_BITMAP
;
1290 if( nFormat
&& aDataHelper
.GetGraphic( nFormat
, aGraphic
) )
1291 pGraphic
= new Graphic( aGraphic
);
1298 if( aDataHelper
.HasFormat( SOT_FORMATSTR_ID_SVIM
) )
1303 // according to KA we don't need a BaseURL here
1304 if( aDataHelper
.GetImageMap( SOT_FORMATSTR_ID_SVIM
, aImageMap
) )
1306 SvxGalleryDrawModel aModel
;
1308 if( aModel
.GetModel() )
1310 SgaUserDataFactory aFactory
;
1312 SdrPage
* pPage
= aModel
.GetModel()->GetPage(0);
1313 SdrGrafObj
* pGrafObj
= new SdrGrafObj( *pGraphic
);
1315 pGrafObj
->InsertUserData( new SgaIMapInfo( aImageMap
) );
1316 pPage
->InsertObject( pGrafObj
);
1317 bRet
= InsertModel( *aModel
.GetModel(), nInsertPos
);
1323 bRet
= InsertGraphic( *pGraphic
, nInsertPos
);
1332 // -----------------------------------------------------------------------------
1334 void GalleryTheme::CopyToClipboard( Window
* pWindow
, ULONG nPos
)
1336 GalleryTransferable
* pTransferable
= new GalleryTransferable( this, nPos
, false );
1337 pTransferable
->CopyToClipboard( pWindow
);
1340 // -----------------------------------------------------------------------------
1342 void GalleryTheme::StartDrag( Window
* pWindow
, ULONG nPos
)
1344 GalleryTransferable
* pTransferable
= new GalleryTransferable( this, nPos
, true );
1345 pTransferable
->StartDrag( pWindow
, DND_ACTION_COPY
| DND_ACTION_LINK
);
1348 // -----------------------------------------------------------------------------
1350 SvStream
& GalleryTheme::WriteData( SvStream
& rOStm
) const
1352 const INetURLObject
aRelURL1( GetParent()->GetRelativeURL() );
1353 const INetURLObject
aRelURL2( GetParent()->GetUserURL() );
1354 INetURLObject aNewURL
, aTempURL
;
1355 sal_uInt32 nCount
= GetObjectCount();
1358 rOStm
<< (sal_uInt16
) 0x0004;
1359 rOStm
<< ByteString( GetRealName(), RTL_TEXTENCODING_UTF8
);
1360 rOStm
<< nCount
<< (sal_uInt16
) gsl_getSystemTextEncoding();
1362 for( sal_uInt32 i
= 0; i
< nCount
; i
++ )
1364 const GalleryObject
* pObj
= ImplGetGalleryObject( i
);
1367 if( SGA_OBJ_SVDRAW
== pObj
->eObjKind
)
1369 aPath
= GetSvDrawStreamNameFromURL( pObj
->aURL
);
1374 aPath
= pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
);
1375 bRel
= ( ( aPath
.Erase( sal::static_int_cast
< xub_StrLen
>( aRelURL1
.GetMainURL( INetURLObject::NO_DECODE
).getLength() ) ) ) == String(aRelURL1
.GetMainURL( INetURLObject::NO_DECODE
) ));
1377 if( bRel
&& ( pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
).getLength() > ( aRelURL1
.GetMainURL( INetURLObject::NO_DECODE
).getLength() + 1 ) ) )
1379 aPath
= pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
);
1380 aPath
= aPath
.Erase( 0, sal::static_int_cast
< xub_StrLen
>( aRelURL1
.GetMainURL( INetURLObject::NO_DECODE
).getLength() ) );
1384 aPath
= pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
);
1385 bRel
= ( ( aPath
.Erase( sal::static_int_cast
< xub_StrLen
>( aRelURL2
.GetMainURL( INetURLObject::NO_DECODE
).getLength() ) ) ) == String(aRelURL2
.GetMainURL( INetURLObject::NO_DECODE
) ));
1387 if( bRel
&& ( pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
).getLength() > ( aRelURL2
.GetMainURL( INetURLObject::NO_DECODE
).getLength() + 1 ) ) )
1389 aPath
= pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
);
1390 aPath
= aPath
.Erase( 0, sal::static_int_cast
< xub_StrLen
>( aRelURL2
.GetMainURL( INetURLObject::NO_DECODE
).getLength() ) );
1393 aPath
= pObj
->aURL
.GetMainURL( INetURLObject::NO_DECODE
);
1397 aPath
.SearchAndReplace(m_aDestDir
, String());
1398 rOStm
<< bRel
<< ByteString( aPath
, RTL_TEXTENCODING_UTF8
) << pObj
->nOffset
<< (sal_uInt16
) pObj
->eObjKind
;
1401 // neuerdings wird ein 512-Byte-Reservepuffer gechrieben;
1402 // um diesen zu erkennen werden zwei ULONG-Ids geschrieben
1403 rOStm
<< COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) << COMPAT_FORMAT( 'E', 'S', 'R', 'V' );
1405 const long nReservePos
= rOStm
.Tell();
1406 VersionCompat
* pCompat
= new VersionCompat( rOStm
, STREAM_WRITE
, 2 );
1408 rOStm
<< (sal_uInt32
) GetId() << IsThemeNameFromResource(); // ab Version 2
1412 // Rest des Puffers auffuellen
1413 const long nRest
= Max( 512L - ( (long) rOStm
.Tell() - nReservePos
), 0L );
1417 char* pReserve
= new char[ nRest
];
1418 memset( pReserve
, 0, nRest
);
1419 rOStm
.Write( pReserve
, nRest
);
1426 // ------------------------------------------------------------------------
1428 SvStream
& GalleryTheme::ReadData( SvStream
& rIStm
)
1431 sal_uInt16 nVersion
;
1434 rtl_TextEncoding nTextEncoding
;
1436 aImportName
= String();
1437 rIStm
>> nVersion
>> aTmpStr
>> nCount
;
1439 if( nVersion
>= 0x0004 )
1443 nTextEncoding
= (rtl_TextEncoding
) nTmp16
;
1446 nTextEncoding
= RTL_TEXTENCODING_UTF8
;
1448 aThemeName
= String( aTmpStr
.GetBuffer(), nTextEncoding
);
1450 if( nCount
<= ( 1L << 14 ) )
1452 GalleryObject
* pObj
;
1453 INetURLObject
aRelURL1( GetParent()->GetRelativeURL() );
1454 INetURLObject
aRelURL2( GetParent()->GetUserURL() );
1455 sal_uInt32 nId1
, nId2
;
1458 for( pObj
= aObjectList
.First(); pObj
; pObj
= aObjectList
.Next() )
1460 Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT
, GetName(), reinterpret_cast< ULONG
>( pObj
) ) );
1462 Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED
, GetName(), reinterpret_cast< ULONG
>( pObj
) ) );
1465 aObjectList
.Clear();
1467 for( sal_uInt32 i
= 0; i
< nCount
; i
++ )
1469 pObj
= new GalleryObject
;
1471 ByteString aTempFileName
;
1476 rIStm
>> bRel
>> aTempFileName
>> pObj
->nOffset
;
1477 rIStm
>> nTemp
; pObj
->eObjKind
= (SgaObjKind
) nTemp
;
1479 aFileName
= String( aTempFileName
.GetBuffer(), gsl_getSystemTextEncoding() );
1483 aFileName
.SearchAndReplaceAll( '\\', '/' );
1484 aPath
= aRelURL1
.GetMainURL( INetURLObject::NO_DECODE
);
1486 if( aFileName
.GetChar( 0 ) != '/' )
1491 pObj
->aURL
= INetURLObject( aPath
);
1493 if( !FileExists( pObj
->aURL
) )
1495 aPath
= aRelURL2
.GetMainURL( INetURLObject::NO_DECODE
);
1497 if( aFileName
.GetChar( 0 ) != '/' )
1502 // assign this URL, even in the case it is not valid (#94482)
1503 pObj
->aURL
= INetURLObject( aPath
);
1508 if( SGA_OBJ_SVDRAW
== pObj
->eObjKind
)
1510 const static String
aBaseURLStr( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/" ) );
1512 String
aDummyURL( aBaseURLStr
);
1513 pObj
->aURL
= INetURLObject( aDummyURL
+= aFileName
, INET_PROT_PRIV_SOFFICE
);
1519 pObj
->aURL
= INetURLObject( aFileName
);
1521 if( ( pObj
->aURL
.GetProtocol() == INET_PROT_NOT_VALID
) &&
1522 ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName
, aLocalURL
) )
1524 pObj
->aURL
= INetURLObject( aLocalURL
);
1529 aObjectList
.Insert( pObj
, LIST_APPEND
);
1532 rIStm
>> nId1
>> nId2
;
1534 // in neueren Versionen befindet sich am Ende ein 512-Byte-Reservepuffer;
1535 // die Daten befinden sich am Anfang dieses Puffers und
1536 // sind durch eine VersionCompat geklammert
1537 if( !rIStm
.IsEof() &&
1538 nId1
== COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
1539 nId2
== COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
1541 VersionCompat
* pCompat
= new VersionCompat( rIStm
, STREAM_READ
);
1543 BOOL bThemeNameFromResource
= FALSE
;
1547 if( pCompat
->GetVersion() >= 2 )
1549 rIStm
>> bThemeNameFromResource
;
1552 SetId( nTemp32
, bThemeNameFromResource
);
1557 rIStm
.SetError( SVSTREAM_READ_ERROR
);
1559 ImplSetModified( FALSE
);
1564 // ------------------------------------------------------------------------
1566 SvStream
& operator<<( SvStream
& rOut
, const GalleryTheme
& rTheme
)
1568 return rTheme
.WriteData( rOut
);
1571 // ------------------------------------------------------------------------
1573 SvStream
& operator>>( SvStream
& rIn
, GalleryTheme
& rTheme
)
1575 return rTheme
.ReadData( rIn
);