diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-09-01 20:30:52 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-09-01 20:51:09 +0100 |
commit | 8e7560f441d2b1c3aa0df67eaa9c008565e14524 (patch) | |
tree | efbef6d1a117e6b8e026e0ccda68f8dbb0b9bcab /svx/source/xoutdev/xtabdash.cxx | |
parent | e5068742511651a2c1bfacbe7c9450f769ef3658 (diff) |
re-factor and cleanup load and save code for lists, killing copy & paste
'return' is not a function, GLOBALOVERFLOW is superstition, bin unused &
obsolete static character arrays, prune unused includes, remove bogus
comments.
Diffstat (limited to 'svx/source/xoutdev/xtabdash.cxx')
-rw-r--r-- | svx/source/xoutdev/xtabdash.cxx | 78 |
1 files changed, 8 insertions, 70 deletions
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index d4b9b78886cf..8287dd837164 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -31,16 +31,10 @@ // include --------------------------------------------------------------- -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> - -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" #include <vcl/svapp.hxx> -#include <tools/urlobj.hxx> #include <vcl/virdev.hxx> #include <vcl/window.hxx> #include <svl/itemset.hxx> @@ -64,16 +58,6 @@ using namespace com::sun::star; -using ::rtl::OUString; - -#define GLOBALOVERFLOW - -sal_Unicode const pszExtDash[] = {'s','o','d'}; - -// ---------------- -// class XDashList -// ---------------- - class impXDashList { private: @@ -150,17 +134,14 @@ void XDashList::impCreate() void XDashList::impDestroy() { - if(mpData) - { - delete mpData; - mpData = 0; - } + delete mpData; + mpData = 0; } XDashList::XDashList( const String& rPath, XOutdevItemPool* pInPool -) : XPropertyList( rPath, pInPool ), + ) : XPropertyList( "sod", rPath, pInPool ), mpData(0) { pBmpList = new BitmapList_impl(); @@ -186,48 +167,10 @@ XDashEntry* XDashList::GetDash(long nIndex) const return (XDashEntry*) XPropertyList::Get(nIndex, 0); } -sal_Bool XDashList::Load() -{ - if( bListDirty ) - { - bListDirty = sal_False; - - INetURLObject aURL( aPath ); - - if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) - { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); - return sal_False; - } - - aURL.Append( aName ); - - if( !aURL.getExtension().getLength() ) - aURL.setExtension( rtl::OUString( pszExtDash, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - } - return( sal_False ); -} - -sal_Bool XDashList::Save() +uno::Reference< container::XNameContainer > XDashList::createInstance() { - INetURLObject aURL( aPath ); - - if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) - { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); - return sal_False; - } - - aURL.Append( aName ); - - if( !aURL.getExtension().getLength() ) - aURL.setExtension( rtl::OUString( pszExtDash, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY ); } sal_Bool XDashList::Create() @@ -243,7 +186,7 @@ sal_Bool XDashList::Create() aStr.SetChar(nLen, sal_Unicode('3')); Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aStr)); - return( sal_True ); + return sal_True; } sal_Bool XDashList::CreateBitmapsForUI() @@ -267,7 +210,7 @@ sal_Bool XDashList::CreateBitmapsForUI() impDestroy(); - return( sal_True ); + return sal_True; } Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) @@ -291,14 +234,9 @@ Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); if(bDelete) - { impDestroy(); - } return pBitmap; } -////////////////////////////////////////////////////////////////////////////// -// eof - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |