1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_features.h>
22 #include <sal/config.h>
26 #include <osl/file.hxx>
27 #include <osl/thread.hxx>
28 #include <tools/urlobj.hxx>
29 #include <tools/vcompat.hxx>
30 #include <tools/datetime.hxx>
31 #include <sot/storage.hxx>
32 #include <sot/formats.hxx>
33 #include <sot/filelist.hxx>
34 #include <vcl/virdev.hxx>
35 #include <vcl/weld.hxx>
36 #include <avmedia/mediawindow.hxx>
37 #include <svx/svdograf.hxx>
38 #include <svx/fmmodel.hxx>
39 #include <svx/fmview.hxx>
40 #include <svx/galmisc.hxx>
41 #include <svx/galtheme.hxx>
42 #include <svx/svdpage.hxx>
43 #include <svx/galleryobjectcollection.hxx>
44 #include <galleryfilestorage.hxx>
46 #include <svx/gallery1.hxx>
47 #include "gallerydrawmodel.hxx"
50 using namespace ::com::sun::star
;
52 GalleryTheme::GalleryTheme( Gallery
* pGallery
, GalleryThemeEntry
* pThemeEntry
)
56 , mnBroadcasterLockCount(0)
59 , bAbortActualize(false)
61 mpGalleryStorageEngine
= pThm
->createGalleryStorageEngine(maGalleryObjectCollection
);
64 GalleryTheme::~GalleryTheme()
66 if(pThm
->IsModified())
67 if(!mpGalleryStorageEngine
->implWrite(*this, pThm
))
68 ImplSetModified(false);
70 for (auto & pEntry
: maGalleryObjectCollection
.getObjectList())
72 Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT
, GetName(), pEntry
.get() ) );
75 maGalleryObjectCollection
.clear();
76 mpGalleryStorageEngine
->clearSotStorage();
79 void GalleryTheme::SetDestDir(const OUString
& rDestDir
, bool bRelative
)
81 mpGalleryStorageEngine
->setDestDir(rDestDir
, bRelative
);
84 void GalleryTheme::ImplBroadcast(sal_uInt32 nUpdatePos
)
86 if( !IsBroadcasterLocked() )
88 if( GetObjectCount() && ( nUpdatePos
>= GetObjectCount() ) )
89 nUpdatePos
= GetObjectCount() - 1;
91 Broadcast( GalleryHint( GalleryHintType::THEME_UPDATEVIEW
, GetName(), reinterpret_cast<void*>(static_cast<sal_uIntPtr
>(nUpdatePos
)) ) );
95 bool GalleryTheme::UnlockTheme()
97 DBG_ASSERT( mnThemeLockCount
, "Theme is not locked" );
101 if( mnThemeLockCount
)
110 void GalleryTheme::UnlockBroadcaster()
112 DBG_ASSERT( mnBroadcasterLockCount
, "Broadcaster is not locked" );
114 if( mnBroadcasterLockCount
&& !--mnBroadcasterLockCount
)
118 bool GalleryTheme::InsertObject(const SgaObject
& rObj
, sal_uInt32 nInsertPos
)
123 GalleryObject
* pFoundEntry
= nullptr;
124 sal_uInt32 iFoundPos
= 0;
125 for (sal_uInt32 n
= maGalleryObjectCollection
.size(); iFoundPos
< n
; ++iFoundPos
)
127 if (*maGalleryObjectCollection
.get(iFoundPos
)->m_oStorageUrl
== rObj
.GetURL())
129 pFoundEntry
= maGalleryObjectCollection
.get(iFoundPos
).get();
134 mpGalleryStorageEngine
->insertObject(rObj
, pFoundEntry
, nInsertPos
);
136 ImplSetModified(true);
137 ImplBroadcast(pFoundEntry
? iFoundPos
: nInsertPos
);
142 std::unique_ptr
<SgaObject
> GalleryTheme::AcquireObject(sal_uInt32 nPos
)
144 return mpGalleryStorageEngine
->implReadSgaObject(maGalleryObjectCollection
.getForPosition(nPos
));
147 void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uInt32 nPos
, BitmapEx
& rBitmapEx
, Size
& rSize
, OUString
& rTitle
, OUString
& rPath
)
149 const GalleryObject
* pGalleryObject
= maGalleryObjectCollection
.get(nPos
).get();
151 rBitmapEx
= pGalleryObject
->maPreviewBitmapEx
;
152 rSize
= pGalleryObject
->maPreparedSize
;
153 rTitle
= pGalleryObject
->maTitle
;
154 rPath
= pGalleryObject
->maPath
;
157 void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uInt32 nPos
, const BitmapEx
& rBitmapEx
, const Size
& rSize
, const OUString
& rTitle
, const OUString
& rPath
)
159 GalleryObject
* pGalleryObject
= maGalleryObjectCollection
.get(nPos
).get();
161 pGalleryObject
->maPreviewBitmapEx
= rBitmapEx
;
162 pGalleryObject
->maPreparedSize
= rSize
;
163 pGalleryObject
->maTitle
= rTitle
;
164 pGalleryObject
->maPath
= rPath
;
167 void GalleryTheme::RemoveObject(sal_uInt32 nPos
)
169 auto it
= maGalleryObjectCollection
.getObjectList().begin() + nPos
;
170 std::unique_ptr
<GalleryObject
> pEntry
= std::move(*it
);
171 maGalleryObjectCollection
.getObjectList().erase( it
);
173 mpGalleryStorageEngine
->removeObject(pEntry
);
175 Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT
, GetName(), pEntry
.get() ) );
178 ImplSetModified( true );
179 ImplBroadcast( nPos
);
182 bool GalleryTheme::ChangeObjectPos(sal_uInt32 nOldPos
, sal_uInt32 nNewPos
)
184 if (nOldPos
== nNewPos
|| nOldPos
>= maGalleryObjectCollection
.size())
187 std::unique_ptr
<GalleryObject
> pEntry
= std::move(maGalleryObjectCollection
.get(nOldPos
));
189 maGalleryObjectCollection
.getObjectList().insert(maGalleryObjectCollection
.getObjectList().begin() + nNewPos
, std::move(pEntry
));
191 if (nNewPos
< nOldPos
)
194 auto it
= maGalleryObjectCollection
.getObjectList().begin() + nOldPos
;
195 maGalleryObjectCollection
.getObjectList().erase(it
);
197 ImplSetModified(true);
198 ImplBroadcast((nNewPos
< nOldPos
)? nNewPos
: (nNewPos
- 1));
203 void GalleryTheme::Actualize( const Link
<const INetURLObject
&, void>& rActualizeLink
, GalleryProgress
* pProgress
)
210 const sal_uInt32 nCount
= maGalleryObjectCollection
.size();
213 bAbortActualize
= false;
216 for (sal_uInt32 i
= 0; i
< nCount
; i
++)
217 maGalleryObjectCollection
.get(i
)->mbDelete
= false;
219 for (sal_uInt32 i
= 0; ( i
< nCount
) && !bAbortActualize
; i
++)
222 pProgress
->Update( i
, nCount
- 1 );
224 GalleryObject
* pEntry
= maGalleryObjectCollection
.get(i
).get();
226 const INetURLObject
aURL( *pEntry
->m_oStorageUrl
);
228 rActualizeLink
.Call( aURL
);
230 // SvDraw objects will be updated later
231 if( pEntry
->eObjKind
!= SgaObjKind::SvDraw
)
233 // Still a function should be implemented,
234 // which assigns files to the relevant entry.
235 // insert graphics as graphic objects into the gallery
236 if( pEntry
->eObjKind
== SgaObjKind::Sound
)
238 SgaObjectSound
aObjSound( aURL
);
239 if( !InsertObject( aObjSound
) )
240 pEntry
->mbDelete
= true;
246 if ( GalleryGraphicImport( aURL
, aGraphic
, aFormat
) != GalleryGraphicImportRet::IMPORT_NONE
)
248 std::unique_ptr
<SgaObject
> pNewObj
;
250 if ( SgaObjKind::Inet
== pEntry
->eObjKind
)
251 pNewObj
.reset(new SgaObjectINet( aGraphic
, aURL
));
252 else if ( aGraphic
.IsAnimated() )
253 pNewObj
.reset(new SgaObjectAnim( aGraphic
, aURL
));
255 pNewObj
.reset(new SgaObjectBmp( aGraphic
, aURL
));
257 if( !InsertObject( *pNewObj
) )
258 pEntry
->mbDelete
= true;
261 pEntry
->mbDelete
= true; // set delete flag
266 //update SvDraw object
267 if ( mpGalleryStorageEngine
->GetSvDrawStorage().is() )
269 SgaObjectSvDraw aNewObj
= mpGalleryStorageEngine
->updateSvDrawObject(pEntry
);
270 if (aNewObj
.IsValid() && !InsertObject(aNewObj
))
271 pEntry
->mbDelete
= true;
276 // remove all entries with set flag
277 for ( auto it
= maGalleryObjectCollection
.getObjectList().begin(); it
!= maGalleryObjectCollection
.getObjectList().end(); /* increment is in the body of loop */)
279 if( (*it
)->mbDelete
)
281 Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT
, GetName(), it
->get() ) );
282 it
= maGalleryObjectCollection
.getObjectList().erase( it
);
289 mpGalleryStorageEngine
->updateTheme();
290 ImplSetModified( true );
291 if (pThm
->IsModified())
292 if (!mpGalleryStorageEngine
->implWrite(*this, pThm
))
293 ImplSetModified(false);
297 bool GalleryTheme::GetThumb(sal_uInt32 nPos
, BitmapEx
& rBmp
)
299 std::unique_ptr
<SgaObject
> pObj
= AcquireObject( nPos
);
304 rBmp
= pObj
->GetThumbBmp();
311 bool GalleryTheme::GetGraphic(sal_uInt32 nPos
, Graphic
& rGraphic
)
313 const GalleryObject
* pObject
= maGalleryObjectCollection
.getForPosition( nPos
);
318 const INetURLObject
aURL( ImplGetURL( pObject
) );
320 switch( pObject
->eObjKind
)
322 case SgaObjKind::Bitmap
:
323 case SgaObjKind::Animation
:
324 case SgaObjKind::Inet
:
326 OUString aFilterDummy
;
327 bRet
= ( GalleryGraphicImport( aURL
, rGraphic
, aFilterDummy
) != GalleryGraphicImportRet::IMPORT_NONE
);
331 case SgaObjKind::SvDraw
:
333 SvxGalleryDrawModel aModel
;
335 if( aModel
.GetModel() )
337 if( GetModel( nPos
, *aModel
.GetModel() ) )
341 if( CreateIMapGraphic( *aModel
.GetModel(), rGraphic
, aIMap
) )
345 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
346 pVDev
->SetMapMode( MapMode( MapUnit::Map100thMM
) );
347 FmFormView
aView(*aModel
.GetModel(), pVDev
);
349 aView
.hideMarkHandles();
350 aView
.ShowSdrPage(aView
.GetModel().GetPage(0));
352 rGraphic
= aView
.GetAllMarkedGraphic();
360 case SgaObjKind::Sound
:
362 std::unique_ptr
<SgaObject
> pObj
= AcquireObject( nPos
);
366 rGraphic
= pObj
->GetThumbBmp();
367 //Bitmap aBmp( pObj->GetThumbBmp() );
368 //aBmp.Replace( COL_LIGHTMAGENTA, COL_WHITE );
383 bool GalleryTheme::InsertGraphic(const Graphic
& rGraphic
, sal_uInt32 nInsertPos
)
387 if( rGraphic
.GetType() != GraphicType::NONE
)
389 ConvertDataFormat nExportFormat
= ConvertDataFormat::Unknown
;
390 const GfxLink
aGfxLink( rGraphic
.GetGfxLink() );
392 if( aGfxLink
.GetDataSize() )
394 switch( aGfxLink
.GetType() )
396 case GfxLinkType::EpsBuffer
: nExportFormat
= ConvertDataFormat::SVM
; break;
397 case GfxLinkType::NativeGif
: nExportFormat
= ConvertDataFormat::GIF
; break;
399 // #i15508# added BMP type
400 // could not find/trigger a call to this, but should do no harm
401 case GfxLinkType::NativeBmp
: nExportFormat
= ConvertDataFormat::BMP
; break;
403 case GfxLinkType::NativeJpg
: nExportFormat
= ConvertDataFormat::JPG
; break;
404 case GfxLinkType::NativePng
: nExportFormat
= ConvertDataFormat::PNG
; break;
405 case GfxLinkType::NativeTif
: nExportFormat
= ConvertDataFormat::TIF
; break;
406 case GfxLinkType::NativeWmf
: nExportFormat
= ConvertDataFormat::WMF
; break;
407 case GfxLinkType::NativeMet
: nExportFormat
= ConvertDataFormat::MET
; break;
408 case GfxLinkType::NativePct
: nExportFormat
= ConvertDataFormat::PCT
; break;
409 case GfxLinkType::NativeSvg
: nExportFormat
= ConvertDataFormat::SVG
; break;
410 case GfxLinkType::NativeWebp
: nExportFormat
= ConvertDataFormat::WEBP
; break;
417 if( rGraphic
.GetType() == GraphicType::Bitmap
)
419 if( rGraphic
.IsAnimated() )
420 nExportFormat
= ConvertDataFormat::GIF
;
422 nExportFormat
= ConvertDataFormat::PNG
;
425 nExportFormat
= ConvertDataFormat::SVM
;
428 const SgaObjectBmp aObjBmp
= mpGalleryStorageEngine
->insertGraphic(rGraphic
, aGfxLink
, nExportFormat
, GetParent()->GetUserURL());
430 if (aObjBmp
.IsValid())
431 bRet
= InsertObject(aObjBmp
, nInsertPos
);
437 bool GalleryTheme::GetModel(sal_uInt32 nPos
, SdrModel
& rModel
)
439 const GalleryObject
* pObject
= maGalleryObjectCollection
.getForPosition( nPos
);
442 if( pObject
&& ( SgaObjKind::SvDraw
== pObject
->eObjKind
) )
444 bRet
= mpGalleryStorageEngine
->readModel(pObject
, rModel
);
450 bool GalleryTheme::InsertModel(const FmFormModel
& rModel
, sal_uInt32 nInsertPos
)
453 SgaObjectSvDraw aObjSvDraw
= mpGalleryStorageEngine
->insertModel(rModel
, GetParent()->GetUserURL());
454 if(aObjSvDraw
.IsValid())
455 bRet
= InsertObject( aObjSvDraw
, nInsertPos
);
459 bool GalleryTheme::GetModelStream(sal_uInt32 nPos
, tools::SvRef
<SotTempStream
> const & rxModelStream
)
461 const GalleryObject
* pObject
= maGalleryObjectCollection
.getForPosition( nPos
);
464 if( pObject
&& ( SgaObjKind::SvDraw
== pObject
->eObjKind
) )
466 bRet
= mpGalleryStorageEngine
->readModelStream(pObject
, rxModelStream
);
472 bool GalleryTheme::InsertModelStream(const tools::SvRef
<SotTempStream
>& rxModelStream
, sal_uInt32 nInsertPos
)
476 const SgaObjectSvDraw aObjSvDraw
= mpGalleryStorageEngine
->insertModelStream(rxModelStream
, GetParent()->GetUserURL());
477 if(aObjSvDraw
.IsValid())
478 bRet
= InsertObject( aObjSvDraw
, nInsertPos
);
483 bool GalleryTheme::GetURL(sal_uInt32 nPos
, INetURLObject
& rURL
)
485 const GalleryObject
* pObject
= maGalleryObjectCollection
.getForPosition( nPos
);
490 rURL
= ImplGetURL( pObject
);
497 bool GalleryTheme::InsertURL(const INetURLObject
& rURL
, sal_uInt32 nInsertPos
)
501 std::unique_ptr
<SgaObject
> pNewObj
;
502 const GalleryGraphicImportRet nImportRet
= GalleryGraphicImport( rURL
, aGraphic
, aFormat
);
505 if( nImportRet
!= GalleryGraphicImportRet::IMPORT_NONE
)
507 if ( aGraphic
.IsAnimated() )
508 pNewObj
.reset(new SgaObjectAnim( aGraphic
, rURL
));
510 pNewObj
.reset(new SgaObjectBmp( aGraphic
, rURL
));
512 #if HAVE_FEATURE_AVMEDIA
513 else if( ::avmedia::MediaWindow::isMediaURL( rURL
.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous
), ""/*TODO?*/ ) )
514 pNewObj
.reset(new SgaObjectSound( rURL
));
516 if( pNewObj
&& InsertObject( *pNewObj
, nInsertPos
) )
522 bool GalleryTheme::InsertFileOrDirURL(const INetURLObject
& rFileOrDirURL
, sal_uInt32 nInsertPos
)
525 std::vector
< INetURLObject
> aURLVector
;
526 GalleryFileStorage::insertFileOrDirURL(rFileOrDirURL
, aURLVector
);
528 for( const auto& rURL
: aURLVector
)
529 bRet
= bRet
|| InsertURL( rURL
, nInsertPos
);
534 bool GalleryTheme::InsertTransferable(const uno::Reference
< datatransfer::XTransferable
>& rxTransferable
, sal_uInt32 nInsertPos
)
538 if( rxTransferable
.is() )
540 TransferableDataHelper
aDataHelper( rxTransferable
);
541 std::optional
<Graphic
> oGraphic
;
543 if( aDataHelper
.HasFormat( SotClipboardFormatId::DRAWING
) )
545 tools::SvRef
<SotTempStream
> xModelStm
;
547 if( aDataHelper
.GetSotStorageStream( SotClipboardFormatId::DRAWING
, xModelStm
) )
548 bRet
= InsertModelStream( xModelStm
, nInsertPos
);
550 else if( aDataHelper
.HasFormat( SotClipboardFormatId::FILE_LIST
) ||
551 aDataHelper
.HasFormat( SotClipboardFormatId::SIMPLE_FILE
) )
555 if( aDataHelper
.HasFormat( SotClipboardFormatId::FILE_LIST
) )
556 aDataHelper
.GetFileList( SotClipboardFormatId::FILE_LIST
, aFileList
);
560 if (aDataHelper
.GetString(SotClipboardFormatId::SIMPLE_FILE
, aFile
) && !aFile
.isEmpty())
561 aFileList
.AppendFile( aFile
);
564 for( sal_uInt32 i
= 0, nCount
= aFileList
.Count(); i
< nCount
; ++i
)
566 const OUString
aFile( aFileList
.GetFile( i
) );
567 INetURLObject
aURL( aFile
);
569 if( aURL
.GetProtocol() == INetProtocol::NotValid
)
573 if( osl::FileBase::getFileURLFromSystemPath( aFile
, aLocalURL
) == osl::FileBase::E_None
)
574 aURL
= INetURLObject( aLocalURL
);
577 if( aURL
.GetProtocol() != INetProtocol::NotValid
)
578 bRet
= InsertFileOrDirURL( aURL
, nInsertPos
);
584 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
586 if( aDataHelper
.HasFormat( SotClipboardFormatId::SVXB
) )
587 nFormat
= SotClipboardFormatId::SVXB
;
588 else if( aDataHelper
.HasFormat( SotClipboardFormatId::GDIMETAFILE
) )
589 nFormat
= SotClipboardFormatId::GDIMETAFILE
;
590 else if( aDataHelper
.HasFormat( SotClipboardFormatId::BITMAP
) )
591 nFormat
= SotClipboardFormatId::BITMAP
;
593 if( nFormat
!= SotClipboardFormatId::NONE
&& aDataHelper
.GetGraphic( nFormat
, aGraphic
) )
594 oGraphic
.emplace( aGraphic
);
601 if( aDataHelper
.HasFormat( SotClipboardFormatId::SVIM
) )
606 // according to KA we don't need a BaseURL here
607 if( aDataHelper
.GetImageMap( SotClipboardFormatId::SVIM
, aImageMap
) )
609 SvxGalleryDrawModel aModel
;
611 if( aModel
.GetModel() )
613 SdrPage
* pPage
= aModel
.GetModel()->GetPage(0);
614 rtl::Reference
<SdrGrafObj
> pGrafObj
= new SdrGrafObj(*aModel
.GetModel(), *oGraphic
);
616 pGrafObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new SgaIMapInfo( aImageMap
)) );
617 pPage
->InsertObject( pGrafObj
.get() );
618 bRet
= InsertModel( *aModel
.GetModel(), nInsertPos
);
624 bRet
= InsertGraphic( *oGraphic
, nInsertPos
);
631 void GalleryTheme::CopyToClipboard(const weld::Widget
& rWidget
, sal_uInt32 nPos
)
633 rtl::Reference
<GalleryTransferable
> pTransferable
= new GalleryTransferable( this, nPos
, false );
634 pTransferable
->CopyToClipboard(rWidget
.get_clipboard());
637 DateTime
GalleryTheme::getModificationDate() const
639 return mpGalleryStorageEngine
->getModificationDate();
642 SvStream
& GalleryTheme::ReadData( SvStream
& rIStm
)
647 rIStm
.ReadUInt16( nVersion
);
648 read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm
);
649 rIStm
.ReadUInt32( nCount
);
651 if( nVersion
>= 0x0004 )
654 rIStm
.ReadUInt16( nTmp16
);
657 if( nCount
<= ( 1 << 14 ) )
659 INetURLObject
aRelURL1( GetParent()->GetRelativeURL() );
660 INetURLObject
aRelURL2( GetParent()->GetUserURL() );
661 sal_uInt32 nId1
, nId2
;
664 for(auto & i
: maGalleryObjectCollection
.getObjectList())
666 GalleryObject
* pObj
= i
.get();
667 Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT
, GetName(), pObj
) );
670 maGalleryObjectCollection
.clear();
672 for( sal_uInt32 i
= 0; i
< nCount
; i
++ )
674 std::unique_ptr
<GalleryObject
> pObj(new GalleryObject
);
679 rIStm
.ReadCharAsBool( bRel
);
680 OString aTempFileName
= read_uInt16_lenPrefixed_uInt8s_ToOString(rIStm
);
681 rIStm
.ReadUInt32( pObj
->nOffset
);
682 rIStm
.ReadUInt16( nTemp
); pObj
->eObjKind
= static_cast<SgaObjKind
>(nTemp
);
684 aFileName
= OStringToOUString(aTempFileName
, osl_getThreadTextEncoding());
686 pObj
->m_oStorageUrl
.emplace();
690 aFileName
= aFileName
.replaceAll( "\\", "/" );
691 OUString aPath
= aRelURL1
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
693 if( aFileName
[ 0 ] != '/' )
698 pObj
->m_oStorageUrl
= INetURLObject(aPath
);
700 if (!FileExists(*pObj
->m_oStorageUrl
))
702 aPath
= aRelURL2
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
704 if( aFileName
[0] != '/' )
709 // assign this URL, even in the case it is not valid (#94482)
710 pObj
->m_oStorageUrl
= INetURLObject(aPath
);
715 if( SgaObjKind::SvDraw
== pObj
->eObjKind
)
717 OUString aDummyURL
= "gallery/svdraw/" + aFileName
;
718 pObj
->m_oStorageUrl
= INetURLObject(aDummyURL
, INetProtocol::PrivSoffice
);
724 pObj
->m_oStorageUrl
= INetURLObject(aFileName
);
726 if( ( pObj
->m_oStorageUrl
->GetProtocol() == INetProtocol::NotValid
) &&
727 osl::FileBase::getFileURLFromSystemPath( aFileName
, aLocalURL
) == osl::FileBase::E_None
)
729 pObj
->m_oStorageUrl
= INetURLObject(aLocalURL
);
733 maGalleryObjectCollection
.getObjectList().push_back( std::move(pObj
) );
736 rIStm
.ReadUInt32( nId1
).ReadUInt32( nId2
);
738 // In newer versions a 512 byte reserve buffer is located at the end,
739 // the data is located at the beginning of this buffer and are clamped
740 // by a VersionCompatRead.
742 nId1
== COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
743 nId2
== COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
745 VersionCompatRead
aCompat(rIStm
);
747 bool bThemeNameFromResource
= false;
749 rIStm
.ReadUInt32( nTemp32
);
751 if( aCompat
.GetVersion() >= 2 )
753 rIStm
.ReadCharAsBool( bThemeNameFromResource
);
756 SetId( nTemp32
, bThemeNameFromResource
);
760 rIStm
.SetError( SVSTREAM_READ_ERROR
);
762 ImplSetModified( false );
767 void GalleryTheme::ImplSetModified( bool bModified
)
769 pThm
->SetModified(bModified
);
772 sal_uInt32
GalleryTheme::GetId() const { return pThm
->GetId(); }
773 void GalleryTheme::SetId( sal_uInt32 nNewId
, bool bResetThemeName
) { pThm
->SetId( nNewId
, bResetThemeName
); }
774 bool GalleryTheme::IsReadOnly() const { return pThm
->IsReadOnly(); }
775 bool GalleryTheme::IsDefault() const { return pThm
->IsDefault(); }
777 const OUString
& GalleryTheme::GetName() const { return pThm
->GetThemeName(); }
778 const INetURLObject
& GalleryTheme::getThemeURL() const { return mpGalleryStorageEngine
->getThemeURL(); }
780 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */