bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / unodraw / unobtabl.cxx
blob398ebc9cc621542af18ec9a107ff5bb34d98efb8
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 <svl/itempool.hxx>
21 #include <vcl/cvtgrf.hxx>
22 #include <svl/itemset.hxx>
23 #include <svx/xit.hxx>
24 #include "UnoNameItemTable.hxx"
26 #include <svx/xbtmpit.hxx>
27 #include <svx/svdmodel.hxx>
28 #include <svx/xflhtit.hxx>
29 #include "svx/unoapi.hxx"
30 #include <svx/unomid.hxx>
31 #include <editeng/unoprnms.hxx>
32 #include "svx/unofill.hxx"
33 #include <editeng/memberids.hrc>
35 using namespace ::com::sun::star;
36 using namespace ::rtl;
37 using namespace ::cppu;
39 class SvxUnoBitmapTable : public SvxUnoNameItemTable
41 public:
42 SvxUnoBitmapTable( SdrModel* pModel ) throw();
43 virtual ~SvxUnoBitmapTable() throw();
45 virtual NameOrIndex* createItem() const throw();
46 virtual bool isValid( const NameOrIndex* pItem ) const;
48 // XServiceInfo
49 virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
50 virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
52 // XElementAccess
53 virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
56 SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw()
57 : SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_GRAFURL )
61 SvxUnoBitmapTable::~SvxUnoBitmapTable() throw()
65 bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
67 if( SvxUnoNameItemTable::isValid( pItem ) )
69 const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
70 if( pBitmapItem )
72 const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic();
74 return rGraphic.GetSizeBytes() > 0;
78 return false;
81 OUString SAL_CALL SvxUnoBitmapTable::getImplementationName() throw( uno::RuntimeException )
83 return OUString("SvxUnoBitmapTable");
86 uno::Sequence< OUString > SAL_CALL SvxUnoBitmapTable::getSupportedServiceNames( )
87 throw( uno::RuntimeException )
89 uno::Sequence< OUString > aSNS( 1 );
90 aSNS.getArray()[0] = OUString("com.sun.star.drawing.BitmapTable" );
91 return aSNS;
94 NameOrIndex* SvxUnoBitmapTable::createItem() const throw()
96 return new XFillBitmapItem();
99 // XElementAccess
100 uno::Type SAL_CALL SvxUnoBitmapTable::getElementType( )
101 throw( uno::RuntimeException )
103 return ::getCppuType( (const OUString*)0 );
107 * Create a bitmaptable
109 uno::Reference< uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel )
111 return *new SvxUnoBitmapTable(pModel);
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */