build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / vcl / source / image / ImplImageList.cxx
blobf1a0d94973c87062b78a24e300c0f8f6560fbe94
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <vcl/outdev.hxx>
21 #include <vcl/bitmapex.hxx>
22 #include <vcl/alpha.hxx>
23 #include <vcl/window.hxx>
24 #include <vcl/bitmapaccess.hxx>
25 #include <vcl/virdev.hxx>
26 #include <vcl/image.hxx>
27 #include <vcl/settings.hxx>
29 #include <image.h>
30 #include <memory>
32 ImplImageList::ImplImageList()
36 ImplImageList::ImplImageList( const ImplImageList &aSrc )
37 : maPrefix(aSrc.maPrefix)
38 , maImageSize(aSrc.maImageSize)
40 maImages.reserve( aSrc.maImages.size() );
41 for ( std::vector<ImageAryData *>::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt )
43 ImageAryData* pAryData = new ImageAryData( **aIt );
44 maImages.push_back( pAryData );
45 if( !pAryData->maName.isEmpty() )
46 maNameHash [ pAryData->maName ] = pAryData;
50 ImplImageList::~ImplImageList()
52 for ( std::vector<ImageAryData *>::iterator aIt = maImages.begin(), aEnd = maImages.end(); aIt != aEnd; ++aIt )
53 delete *aIt;
56 void ImplImageList::AddImage( const OUString &aName,
57 sal_uInt16 nId, const BitmapEx &aBitmapEx )
59 ImageAryData *pImg = new ImageAryData( aName, nId, aBitmapEx );
60 maImages.push_back( pImg );
61 if( !aName.isEmpty() )
62 maNameHash [ aName ] = pImg;
65 void ImplImageList::RemoveImage( sal_uInt16 nPos )
67 ImageAryData *pImg = maImages[ nPos ];
68 if( !pImg->maName.isEmpty() )
69 maNameHash.erase( pImg->maName );
70 maImages.erase( maImages.begin() + nPos );
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */