1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10f6e50924SAndrew Rist * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f6e50924SAndrew Rist * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19f6e50924SAndrew Rist * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 28cdf0e10cSrcweir #include "svx/XPropertyTable.hxx" 29cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx> 3070d3707aSArmin Le Grand #include <xmlxtexp.hxx> 3170d3707aSArmin Le Grand #include <xmlxtimp.hxx> 32cdf0e10cSrcweir #include <tools/urlobj.hxx> 33cdf0e10cSrcweir #include <vcl/virdev.hxx> 34cdf0e10cSrcweir #include <svl/itemset.hxx> 35cdf0e10cSrcweir #include <sfx2/docfile.hxx> 36cdf0e10cSrcweir #include <svx/dialogs.hrc> 37cdf0e10cSrcweir #include <svx/dialmgr.hxx> 38cdf0e10cSrcweir #include <svx/xtable.hxx> 39cdf0e10cSrcweir #include <svx/xpool.hxx> 4070d3707aSArmin Le Grand #include <svx/xbtmpit.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #define GLOBALOVERFLOW 43cdf0e10cSrcweir 44cdf0e10cSrcweir using namespace com::sun::star; 45cdf0e10cSrcweir using namespace rtl; 46cdf0e10cSrcweir 47cdf0e10cSrcweir sal_Unicode const pszExtBitmap[] = {'s','o','b'}; 48cdf0e10cSrcweir 49cdf0e10cSrcweir static char const aChckBitmap[] = { 0x04, 0x00, 'S','O','B','L'}; // very old 50cdf0e10cSrcweir static char const aChckBitmap0[] = { 0x04, 0x00, 'S','O','B','0'}; // old 51cdf0e10cSrcweir static char const aChckBitmap1[] = { 0x04, 0x00, 'S','O','B','1'}; // = 5.2 52cdf0e10cSrcweir static char const aChckXML[] = { 'P', 'K', 0x03, 0x04 }; // = 6.0 53cdf0e10cSrcweir 54cdf0e10cSrcweir // ------------------ 55cdf0e10cSrcweir // class XBitmapList 56cdf0e10cSrcweir // ------------------ 57cdf0e10cSrcweir 58*97e8a929SArmin Le Grand XBitmapList::XBitmapList( const String& rPath, XOutdevItemPool* pInPool ) : 59*97e8a929SArmin Le Grand XPropertyList( rPath, pInPool ) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir /************************************************************************/ 64cdf0e10cSrcweir 65cdf0e10cSrcweir XBitmapList::~XBitmapList() 66cdf0e10cSrcweir { 67cdf0e10cSrcweir } 68cdf0e10cSrcweir 69cdf0e10cSrcweir /************************************************************************/ 70cdf0e10cSrcweir 71cdf0e10cSrcweir XBitmapEntry* XBitmapList::Replace(XBitmapEntry* pEntry, long nIndex ) 72cdf0e10cSrcweir { 73cdf0e10cSrcweir return (XBitmapEntry*) XPropertyList::Replace(pEntry, nIndex); 74cdf0e10cSrcweir } 75cdf0e10cSrcweir 76cdf0e10cSrcweir /************************************************************************/ 77cdf0e10cSrcweir 78cdf0e10cSrcweir XBitmapEntry* XBitmapList::Remove(long nIndex) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir return (XBitmapEntry*) XPropertyList::Remove(nIndex, 0); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir /************************************************************************/ 84cdf0e10cSrcweir 85cdf0e10cSrcweir XBitmapEntry* XBitmapList::GetBitmap(long nIndex) const 86cdf0e10cSrcweir { 87cdf0e10cSrcweir return (XBitmapEntry*) XPropertyList::Get(nIndex, 0); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir /************************************************************************/ 91cdf0e10cSrcweir 92cdf0e10cSrcweir sal_Bool XBitmapList::Load() 93cdf0e10cSrcweir { 94*97e8a929SArmin Le Grand if( mbListDirty ) 95cdf0e10cSrcweir { 96*97e8a929SArmin Le Grand mbListDirty = false; 97cdf0e10cSrcweir 98*97e8a929SArmin Le Grand INetURLObject aURL( maPath ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) 101cdf0e10cSrcweir { 102*97e8a929SArmin Le Grand DBG_ASSERT( !maPath.Len(), "invalid URL" ); 103cdf0e10cSrcweir return sal_False; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106*97e8a929SArmin Le Grand aURL.Append( maName ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir if( !aURL.getExtension().getLength() ) 109cdf0e10cSrcweir aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); 112cdf0e10cSrcweir return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir return( sal_False ); 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir /************************************************************************/ 118cdf0e10cSrcweir 119cdf0e10cSrcweir sal_Bool XBitmapList::Save() 120cdf0e10cSrcweir { 121*97e8a929SArmin Le Grand INetURLObject aURL( maPath ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) 124cdf0e10cSrcweir { 125*97e8a929SArmin Le Grand DBG_ASSERT( !maPath.Len(), "invalid URL" ); 126cdf0e10cSrcweir return sal_False; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129*97e8a929SArmin Le Grand aURL.Append( maName ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir if( !aURL.getExtension().getLength() ) 132cdf0e10cSrcweir aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); 135cdf0e10cSrcweir return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir /************************************************************************/ 139cdf0e10cSrcweir // Umgestellt am 27.07.95 auf XBitmap 140cdf0e10cSrcweir 141cdf0e10cSrcweir sal_Bool XBitmapList::Create() 142cdf0e10cSrcweir { 143cdf0e10cSrcweir //----------------------- 144cdf0e10cSrcweir // 00 01 02 03 04 05 06 07 145cdf0e10cSrcweir // 08 09 10 11 12 13 14 15 146cdf0e10cSrcweir // 16 17 18 19 20 21 22 23 147cdf0e10cSrcweir // 24 25 26 27 28 29 30 31 148cdf0e10cSrcweir // 32 33 34 35 36 37 38 39 149cdf0e10cSrcweir // 40 41 42 43 44 45 46 47 150cdf0e10cSrcweir // 48 49 50 51 52 53 54 55 151cdf0e10cSrcweir // 56 57 58 59 60 61 62 63 15270d3707aSArmin Le Grand String aStr(SVX_RES(RID_SVXSTR_BITMAP)); 15370d3707aSArmin Le Grand sal_uInt16 aArray[64]; 15470d3707aSArmin Le Grand Bitmap aBitmap; 15570d3707aSArmin Le Grand const xub_StrLen nLen(aStr.Len() - 1); 156cdf0e10cSrcweir 15770d3707aSArmin Le Grand memset(aArray, 0, sizeof(aArray)); 158cdf0e10cSrcweir 15970d3707aSArmin Le Grand // white/white bitmap 160cdf0e10cSrcweir aStr.AppendAscii(" 1"); 16170d3707aSArmin Le Grand aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE)); 16270d3707aSArmin Le Grand Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); 163cdf0e10cSrcweir 16470d3707aSArmin Le Grand // black/white bitmap 165cdf0e10cSrcweir aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1; 166cdf0e10cSrcweir aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1; 167cdf0e10cSrcweir aStr.SetChar(nLen, sal_Unicode('2')); 16870d3707aSArmin Le Grand aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE)); 16970d3707aSArmin Le Grand Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); 170cdf0e10cSrcweir 17170d3707aSArmin Le Grand // lightred/white bitmap 172cdf0e10cSrcweir aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1; 173cdf0e10cSrcweir aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1; 174cdf0e10cSrcweir aStr.SetChar(nLen, sal_Unicode('3')); 17570d3707aSArmin Le Grand aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE)); 17670d3707aSArmin Le Grand Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); 177cdf0e10cSrcweir 17870d3707aSArmin Le Grand // lightblue/white bitmap 179cdf0e10cSrcweir aArray[24] = 1; aArray[25] = 1; aArray[26] = 1; 180cdf0e10cSrcweir aArray[29] = 1; aArray[30] = 1; aArray[31] = 1; 181cdf0e10cSrcweir aStr.SetChar(nLen, sal_Unicode('4')); 18270d3707aSArmin Le Grand aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE)); 18370d3707aSArmin Le Grand Insert(new XBitmapEntry(Graphic(aBitmap), aStr)); 184cdf0e10cSrcweir 185cdf0e10cSrcweir return( sal_True ); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir 188cdf0e10cSrcweir /************************************************************************/ 189cdf0e10cSrcweir 190*97e8a929SArmin Le Grand Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ ) 191cdf0e10cSrcweir { 192*97e8a929SArmin Le Grand return Bitmap(); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir // eof 196