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 | |
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')
-rw-r--r-- | svx/inc/svx/xtable.hxx | 27 | ||||
-rwxr-xr-x | svx/source/xoutdev/_xoutbmp.cxx | 4 | ||||
-rw-r--r-- | svx/source/xoutdev/_xpoly.cxx | 2 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 2 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr2.cxx | 2 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 2 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabbtmp.cxx | 99 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabcolr.cxx | 99 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabdash.cxx | 78 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabgrdt.cxx | 58 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabhtch.cxx | 83 | ||||
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 108 | ||||
-rw-r--r-- | svx/source/xoutdev/xtablend.cxx | 85 |
13 files changed, 108 insertions, 541 deletions
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index c856f47993a0..a7b313d33e9f 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -44,6 +44,7 @@ #include <tools/table.hxx> #include "svx/svxdllapi.h" #include <basegfx/polygon/b2dpolypolygon.hxx> +#include <com/sun/star/container/XNameContainer.hpp> class Color; class Bitmap; @@ -199,6 +200,7 @@ protected: String aName; // not persistent String aPath; XOutdevItemPool* pXPool; + const char * pDefaultExt; XPropertyEntryList_impl aList; BitmapList_impl* pBmpList; @@ -208,6 +210,7 @@ protected: sal_Bool bOwnPool; XPropertyList( + const char *_pDefaultExtension, const String& rPath, XOutdevItemPool* pXPool = NULL ); @@ -236,8 +239,10 @@ public: void SetDirty( sal_Bool bDirty = sal_True ) { bListDirty = bDirty; bBitmapsDirty = bDirty; } - virtual sal_Bool Load() = 0; - virtual sal_Bool Save() = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > + createInstance() = 0; + sal_Bool Load(); + sal_Bool Save(); virtual sal_Bool Create() = 0; virtual sal_Bool CreateBitmapsForUI() = 0; virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; @@ -264,8 +269,7 @@ public: XColorEntry* Remove(long nIndex); XColorEntry* GetColor(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); @@ -300,8 +304,7 @@ public: using XPropertyList::Get; XLineEndEntry* GetLineEnd(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); @@ -334,8 +337,7 @@ public: using XPropertyList::Get; XDashEntry* GetDash(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); @@ -368,8 +370,7 @@ public: using XPropertyList::Get; XHatchEntry* GetHatch(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); @@ -402,8 +403,7 @@ public: using XPropertyList::Get; XGradientEntry* GetGradient(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); @@ -428,8 +428,7 @@ public: using XPropertyList::Get; XBitmapEntry* GetBitmap(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); virtual sal_Bool CreateBitmapsForUI(); virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index c1251765c276..1c9244a6fad9 100755 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -30,10 +30,8 @@ #include "precompiled_svx.hxx" #include <sot/factory.hxx> -#include <tools/urlobj.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <vcl/bmpacc.hxx> #include <tools/poly.hxx> +#include <vcl/bmpacc.hxx> #include <vcl/virdev.hxx> #include <vcl/wrkwin.hxx> #include <svl/solar.hrc> diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx index 0c9d7a229535..58204b021295 100644 --- a/svx/source/xoutdev/_xpoly.cxx +++ b/svx/source/xoutdev/_xpoly.cxx @@ -43,8 +43,6 @@ #include <basegfx/range/b2drange.hxx> #include <basegfx/numeric/ftools.hxx> -#define GLOBALOVERFLOW - DBG_NAME(XPolygon); DBG_NAME(XPolyPolygon); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index abc3356d90fa..2fb5b79c419a 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -69,8 +69,6 @@ using namespace ::rtl; using namespace ::com::sun::star; -#define GLOBALOVERFLOW - #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index 521bf88d92d6..767bce969642 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -42,8 +42,6 @@ #include <editeng/itemtype.hxx> #include <svx/xdef.hxx> -#define GLOBALOVERFLOW - /************************************************************************/ //------------------------------ diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 80ff904ee3bf..5f3237d1b7b1 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -49,8 +49,6 @@ #include <svx/svdmodel.hxx> #include <com/sun/star/beans/PropertyValue.hpp> -#define GLOBALOVERFLOW - using namespace ::com::sun::star; // --------------- diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx index 5c9f4bad3904..ffcd72d8534f 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -29,14 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" - -#include <tools/urlobj.hxx> #include <vcl/virdev.hxx> #include <svl/itemset.hxx> #include <sfx2/docfile.hxx> @@ -45,108 +39,35 @@ #include <svx/xtable.hxx> #include <svx/xpool.hxx> -#define GLOBALOVERFLOW - using namespace com::sun::star; -using ::rtl::OUString; - -sal_Unicode const pszExtBitmap[] = {'s','o','b'}; - -static char const aChckBitmap[] = { 0x04, 0x00, 'S','O','B','L'}; // very old -static char const aChckBitmap0[] = { 0x04, 0x00, 'S','O','B','0'}; // old -static char const aChckBitmap1[] = { 0x04, 0x00, 'S','O','B','1'}; // = 5.2 -static char const aChckXML[] = { 'P', 'K', 0x03, 0x04 }; // = 6.0 - -// ------------------ -// class XBitmapList -// ------------------ - -/************************************************************************* -|* -|* XBitmapList::XBitmapList() -|* -*************************************************************************/ - XBitmapList::XBitmapList( const String& rPath, XOutdevItemPool* pInPool -) : XPropertyList( rPath, pInPool ) + ) : XPropertyList( "sob", rPath, pInPool ) { - // pBmpList = new List( nInitSize, nReSize ); } -/************************************************************************/ - XBitmapList::~XBitmapList() { } -/************************************************************************/ - XBitmapEntry* XBitmapList::Remove(long nIndex) { return (XBitmapEntry*) XPropertyList::Remove(nIndex); } -/************************************************************************/ - XBitmapEntry* XBitmapList::GetBitmap(long nIndex) const { return (XBitmapEntry*) XPropertyList::Get(nIndex, 0); } -/************************************************************************/ - -sal_Bool XBitmapList::Load() +uno::Reference< container::XNameContainer > XBitmapList::createInstance() { - 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( pszExtBitmap, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - } - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XBitmapList::Save() -{ - 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( pszExtBitmap, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); } -/************************************************************************/ -// Umgestellt am 27.07.95 auf XBitmap - sal_Bool XBitmapList::Create() { // Array der Bitmap @@ -185,23 +106,17 @@ sal_Bool XBitmapList::Create() aStr.SetChar(nLen, sal_Unicode('4')); Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_LIGHTBLUE ), aColWhite ), aStr ) ); - return( sal_True ); + return sal_True; } -/************************************************************************/ - sal_Bool XBitmapList::CreateBitmapsForUI() { - return( sal_False ); + return sal_False; } -/************************************************************************/ - Bitmap* XBitmapList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) { - return( NULL ); + return NULL; } -// eof - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx index 599c14319624..502bb0c3d2ad 100644 --- a/svx/source/xoutdev/xtabcolr.cxx +++ b/svx/source/xoutdev/xtabcolr.cxx @@ -29,52 +29,25 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> - #include <unotools/pathoptions.hxx> -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" - #include <sfx2/docfile.hxx> -#include <tools/urlobj.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <svx/xtable.hxx> #include <svx/xpool.hxx> -#define GLOBALOVERFLOW - using namespace com::sun::star; -using ::rtl::OUString; - -sal_Unicode const pszExtColor[] = {'s','o','c'}; - -static char const aChckColor[] = { 0x04, 0x00, 'S','O','C','L'}; // < 5.2 -static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'}; // = 5.2 -static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 - -/************************************************************************* -|* -|* XColorList::XColorList() -|* -*************************************************************************/ - XColorList::XColorList( const String& rPath, XOutdevItemPool* pInPool ) : - XPropertyList( rPath, pInPool ) + XPropertyList( "soc", rPath, pInPool ) { - // ColorTable braucht keine eigene BmpTable - // pBmpTable = new Table( nInitSize, nReSize ); } -/************************************************************************/ - XColorList::~XColorList() { } @@ -85,80 +58,28 @@ XColorList& XColorList::GetStdColorTable() return aTable; } -/************************************************************************/ - XColorEntry* XColorList::Replace(long nIndex, XColorEntry* pEntry ) { return (XColorEntry*)XPropertyList::Replace( pEntry, nIndex ); } -/************************************************************************/ - XColorEntry* XColorList::Remove(long nIndex) { return (XColorEntry*) XPropertyList::Remove(nIndex); } -/************************************************************************/ - XColorEntry* XColorList::GetColor(long nIndex) const { return (XColorEntry*) XPropertyList::Get(nIndex, 0); } -/************************************************************************/ - -sal_Bool XColorList::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( pszExtColor, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( - SvxUnoXColorTable_createInstance( this ), - uno::UNO_QUERY - ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - } - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XColorList::Save() +uno::Reference< container::XNameContainer > XColorList::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( pszExtColor, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXColorTable_createInstance( this ), + uno::UNO_QUERY ); } -/************************************************************************/ - sal_Bool XColorList::Create() { XubString aStr; @@ -446,21 +367,17 @@ sal_Bool XColorList::Create() aStr.SetChar(nLen, sal_Unicode('2')); Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ), 103 ); - return( Count() == 104 ); + return Count() == 104; } -/************************************************************************/ - sal_Bool XColorList::CreateBitmapsForUI() { - return( sal_False ); + return sal_False; } -/************************************************************************/ - Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) { - return( NULL ); + return NULL; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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: */ diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 715a5ab5aa9c..73e9f98a8b18 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -31,14 +31,8 @@ // include --------------------------------------------------------------- -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" - -#include <tools/urlobj.hxx> #include <vcl/virdev.hxx> #include <svl/itemset.hxx> #include <sfx2/docfile.hxx> @@ -57,14 +51,10 @@ #include <svx/xlnclit.hxx> #include <svx/xgrscit.hxx> -#define GLOBALOVERFLOW - using namespace com::sun::star; using ::rtl::OUString; -sal_Unicode const pszExtGradient[] = {'s','o','g'}; - char const aChckGradient[] = { 0x04, 0x00, 'S','O','G','L'}; // < 5.2 char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'}; // = 5.2 char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 @@ -145,7 +135,7 @@ void XGradientList::impDestroy() XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool -) : XPropertyList( rPath, pInPool ), + ) : XPropertyList( "sog", rPath, pInPool ), mpData(0) { pBmpList = new BitmapList_impl(); @@ -175,49 +165,11 @@ XGradientEntry* XGradientList::GetGradient(long nIndex) const return( (XGradientEntry*) XPropertyList::Get( nIndex, 0 ) ); } -sal_Bool XGradientList::Load() +uno::Reference< container::XNameContainer > XGradientList::createInstance() { - 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( pszExtGradient, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXGradientTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - - } - return( sal_False ); -} - -sal_Bool XGradientList::Save() -{ - 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( pszExtGradient, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXGradientTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXGradientTable_createInstance( this ), + uno::UNO_QUERY ); } sal_Bool XGradientList::Create() diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index b48a6476e7a7..f61ed6e9afec 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -31,15 +31,9 @@ // include --------------------------------------------------------------- -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> #include <vcl/svapp.hxx> -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" - -#include <tools/urlobj.hxx> #include <vcl/virdev.hxx> #include <svl/itemset.hxx> #include <sfx2/docfile.hxx> @@ -61,16 +55,6 @@ using namespace ::com::sun::star; using namespace ::rtl; -sal_Unicode const pszExtHatch[] = {'s','o','h'}; - -char const aChckHatch[] = { 0x04, 0x00, 'S','O','H','L'}; // < 5.2 -char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'}; // = 5.2 -char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 - -// ----------------- -// class XHatchList -// ----------------- - class impXHatchList { private: @@ -143,29 +127,23 @@ void XHatchList::impCreate() void XHatchList::impDestroy() { - if(mpData) - { - delete mpData; - mpData = 0; - } + delete mpData; + mpData = NULL; } XHatchList::XHatchList( const String& rPath, XOutdevItemPool* pInPool -) : XPropertyList( rPath, pInPool ) - , mpData(0) + ) : XPropertyList( "soh", rPath, pInPool ) + , mpData(NULL) { pBmpList = new BitmapList_impl(); } XHatchList::~XHatchList() { - if(mpData) - { - delete mpData; - mpData = 0; - } + delete mpData; + mpData = NULL; } XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex ) @@ -183,48 +161,10 @@ XHatchEntry* XHatchList::GetHatch(long nIndex) const return (XHatchEntry*) XPropertyList::Get(nIndex, 0); } -sal_Bool XHatchList::Load() +uno::Reference< container::XNameContainer > XHatchList::createInstance() { - 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( pszExtHatch, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - } - return( sal_False ); -} - -sal_Bool XHatchList::Save() -{ - 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( pszExtHatch, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY ); } sal_Bool XHatchList::Create() @@ -288,14 +228,9 @@ Bitmap* XHatchList::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: */ diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index a5630433b050..66eb7505e2ce 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -29,10 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include <svx/XPropertyTable.hxx> +#include "xmlxtexp.hxx" +#include "xmlxtimp.hxx" +#include <tools/urlobj.hxx> #include <svx/xtable.hxx> #include <svx/xpool.hxx> -#define GLOBALOVERFLOW +using namespace com::sun::star; // Vergleichsstrings sal_Unicode pszStandard[] = { 's', 't', 'a', 'n', 'd', 'a', 'r', 'd', 0 }; @@ -50,19 +54,14 @@ Color RGB_Color( ColorData nColorName ) // class XPropertyList // -------------------- - -/************************************************************************* -|* -|* XPropertyList::XPropertyList() -|* -*************************************************************************/ - XPropertyList::XPropertyList( + const char *pDefaultExtension, const String& rPath, XOutdevItemPool* pInPool ) : aName ( pszStandard, 8 ), aPath ( rPath ), pXPool ( pInPool ), + pDefaultExt ( pDefaultExtension ), pBmpList ( NULL ), bListDirty ( sal_True ), bBitmapsDirty ( sal_True ), @@ -76,12 +75,6 @@ XPropertyList::XPropertyList( } } -/************************************************************************* -|* -|* XPropertyList::~XPropertyList() -|* -*************************************************************************/ - XPropertyList::~XPropertyList() { for( size_t i = 0, n = aList.size(); i < n; ++i ) { @@ -105,12 +98,6 @@ XPropertyList::~XPropertyList() } } -/************************************************************************* -|* -|* XPropertyList::Clear() -|* -*************************************************************************/ - void XPropertyList::Clear() { for( size_t i = 0, n = aList.size(); i < n; ++i ) { @@ -126,8 +113,6 @@ void XPropertyList::Clear() } } -/************************************************************************/ - long XPropertyList::Count() const { if( bListDirty ) @@ -139,12 +124,6 @@ long XPropertyList::Count() const return( aList.size() ); } -/************************************************************************* -|* -|* XPropertyEntry* XPropertyList::Get() -|* -*************************************************************************/ - XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const { if( bListDirty ) @@ -156,12 +135,6 @@ XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const return ( (size_t)nIndex < aList.size() ) ? aList[ nIndex ] : NULL; } -/************************************************************************* -|* -|* XPropertyList::Get() -|* -*************************************************************************/ - long XPropertyList::Get(const XubString& rName) { if( bListDirty ) @@ -179,12 +152,6 @@ long XPropertyList::Get(const XubString& rName) return -1; } -/************************************************************************* -|* -|* Bitmap* XPropertyList::GetBitmap() -|* -*************************************************************************/ - Bitmap* XPropertyList::GetBitmap( long nIndex ) const { if( pBmpList ) @@ -200,12 +167,6 @@ Bitmap* XPropertyList::GetBitmap( long nIndex ) const return NULL; } -/************************************************************************* -|* -|* void XPropertyList::Insert() -|* -*************************************************************************/ - void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) { if ( (size_t)nIndex < aList.size() ) { @@ -227,12 +188,6 @@ void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) } } -/************************************************************************* -|* -|* void XPropertyList::Replace() -|* -*************************************************************************/ - XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) { XPropertyEntry* pOldEntry = (size_t)nIndex < aList.size() ? aList[ nIndex ] : NULL; @@ -255,12 +210,6 @@ XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) return pOldEntry; } -/************************************************************************* -|* -|* void XPropertyList::Remove() -|* -*************************************************************************/ - XPropertyEntry* XPropertyList::Remove( long nIndex ) { if( pBmpList && !bBitmapsDirty ) @@ -280,8 +229,6 @@ XPropertyEntry* XPropertyList::Remove( long nIndex ) return pEntry; } -/************************************************************************/ - void XPropertyList::SetName( const String& rString ) { if(rString.Len()) @@ -290,6 +237,47 @@ void XPropertyList::SetName( const String& rString ) } } +sal_Bool XPropertyList::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::createFromAscii( pDefaultExt ) ); + + return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), createInstance() ); + + } + return sal_False; +} + +sal_Bool XPropertyList::Save() +{ + 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::createFromAscii( pDefaultExt ) ); + + return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), createInstance() ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index ebd95efbadde..6ffc62260e2d 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -31,14 +31,7 @@ // include --------------------------------------------------------------- -#include <com/sun/star/container/XNameContainer.hpp> #include "svx/XPropertyTable.hxx" -#include <unotools/ucbstreamhelper.hxx> - -#include "xmlxtexp.hxx" -#include "xmlxtimp.hxx" - -#include <tools/urlobj.hxx> #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> @@ -68,22 +61,8 @@ #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> -#define GLOBALOVERFLOW - using namespace com::sun::star; -using ::rtl::OUString; - -sal_Unicode const pszExtLineEnd[] = {'s','o','e'}; - -static char const aChckLEnd[] = { 0x04, 0x00, 'S','O','E','L'}; // < 5.2 -static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'}; // = 5.2 -static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 - -// -------------------- -// class XLineEndList -// -------------------- - class impXLineEndList { private: @@ -160,19 +139,16 @@ void XLineEndList::impCreate() void XLineEndList::impDestroy() { - if(mpData) - { - delete mpData; - mpData = 0; - } + delete mpData; + mpData = NULL; } XLineEndList::XLineEndList( const String& rPath, XOutdevItemPool* _pXPool ) - : XPropertyList( rPath, _pXPool ) - , mpData(0) + : XPropertyList( "soe", rPath, _pXPool ) + , mpData(NULL) { pBmpList = new BitmapList_impl(); } @@ -197,48 +173,10 @@ XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const return (XLineEndEntry*) XPropertyList::Get(nIndex, 0); } -sal_Bool XLineEndList::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( pszExtLineEnd, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); - } - return( sal_False ); -} - -sal_Bool XLineEndList::Save() +uno::Reference< container::XNameContainer > XLineEndList::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( pszExtLineEnd, 3 ) ); - - uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY ); - return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable ); + return uno::Reference< container::XNameContainer >( + SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY ); } sal_Bool XLineEndList::Create() @@ -261,7 +199,7 @@ sal_Bool XLineEndList::Create() basegfx::B2DPolygon aCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 100.0)); Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) ); - return( sal_True ); + return sal_True; } sal_Bool XLineEndList::CreateBitmapsForUI() @@ -285,7 +223,7 @@ sal_Bool XLineEndList::CreateBitmapsForUI() impDestroy(); - return( sal_True ); + return sal_True; } Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) @@ -310,14 +248,9 @@ Bitmap* XLineEndList::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: */ |