From 047473d4f1a12e867ab7154113f7f1c5422d5368 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Mon, 7 Sep 2009 15:38:19 +0000 Subject: CWS-TOOLING: integrate CWS calcsheetdata 2009-08-13 16:18:48 +0200 nn r274950 : #i102616# shared/remote files, better handling of formula results 2009-08-12 11:17:30 +0200 nn r274884 : CWS-TOOLING: rebase CWS calcsheetdata to trunk@274622 (milestone: DEV300:m54) 2009-08-12 10:30:47 +0200 nn r274881 : #i102616# some clean-up 2009-08-11 19:01:18 +0200 nn r274876 : #i102616# store loaded namespaces, so prefixes remain valid 2009-08-11 19:00:49 +0200 nn r274875 : #i102616# store loaded namespaces, so prefixes remain valid 2009-08-10 19:12:04 +0200 nn r274835 : #i102616# detective, notes, encoding, error handling 2009-08-07 11:18:46 +0200 nn r274751 : #i102616# use new method SvXMLAutoStylePoolP::AddNamed 2009-08-07 11:18:15 +0200 nn r274750 : #i102616# new method SvXMLAutoStylePoolP::AddNamed 2009-08-06 18:02:42 +0200 nn r274740 : #i102616# modification: shapes, notes, pending row heights; skip sheets in export iterator 2009-08-05 18:41:59 +0200 nn r274694 : #i102616# handle text styles in notes 2009-08-03 18:55:59 +0200 nn r274594 : #i102616# handle text styles in cells 2009-07-31 19:00:06 +0200 nn r274548 : #i102616# handle styles for notes 2009-07-28 16:46:20 +0200 nn r274414 : missed a conflict 2009-07-28 14:01:56 +0200 nn r274404 : CWS-TOOLING: rebase CWS calcsheetdata to trunk@274203 (milestone: DEV300:m53) 2009-07-23 18:28:47 +0200 nn r274278 : #i102616# handle table styles 2009-07-22 15:40:24 +0200 nn r274244 : #i102616# handle row styles 2009-07-21 20:09:37 +0200 nn r274211 : #i102616# handle column styles 2009-07-16 13:00:18 +0200 nn r274043 : #i102616# invalidate all stream positions when inserting/deleting sheets 2009-07-15 17:41:15 +0200 nn r274021 : #i102616# don't collect cell styles twice for copied sheets 2009-07-14 18:36:11 +0200 nn r273985 : #i102616# allow to query stream position, clear buffer 2009-07-14 18:32:10 +0200 nn r273984 : #i102616# allow to specify a name for an autostyle 2009-07-09 22:01:23 +0200 nn r273870 : #i102616# copy stream for unchanged sheets 2009-07-08 18:11:42 +0200 nn r273844 : #i102616# store stream positions of sheets 2009-06-24 19:08:18 +0200 nn r273363 : #i102616# detect changed sheets since loading 2009-06-09 15:53:32 +0200 nn r272774 : #i102616# store automatic cell style information after loading --- xmloff/inc/xmloff/nmspmap.hxx | 5 +++++ xmloff/inc/xmloff/xmlaustp.hxx | 4 ++++ xmloff/source/style/impastp3.cxx | 40 +++++++++++++++++++++++++++++++++++++++ xmloff/source/style/impastp4.cxx | 41 ++++++++++++++++++++++++++++++++++++++++ xmloff/source/style/impastpl.hxx | 8 ++++++++ xmloff/source/style/xmlaustp.cxx | 7 +++++++ 6 files changed, 105 insertions(+) diff --git a/xmloff/inc/xmloff/nmspmap.hxx b/xmloff/inc/xmloff/nmspmap.hxx index b20bd0db76b9..c88ac563b0e3 100644 --- a/xmloff/inc/xmloff/nmspmap.hxx +++ b/xmloff/inc/xmloff/nmspmap.hxx @@ -152,6 +152,11 @@ public: sal_uInt16 GetFirstKey() const; sal_uInt16 GetNextKey( sal_uInt16 nOldKey ) const; + /* Give access to all namespace definitions, including multiple entries + for the same key (needed for saving sheets separately in Calc). + This might be replaced by a better interface later. */ + const NameSpaceHash& GetAllEntries() const { return aNameHash; } + static sal_Bool NormalizeOasisURN( ::rtl::OUString& rName ); static sal_Bool NormalizeW3URI( ::rtl::OUString& rName ); static sal_Bool NormalizeURI( ::rtl::OUString& rName ); diff --git a/xmloff/inc/xmloff/xmlaustp.hxx b/xmloff/inc/xmloff/xmlaustp.hxx index beb7fe47d928..e5566628d351 100644 --- a/xmloff/inc/xmloff/xmlaustp.hxx +++ b/xmloff/inc/xmloff/xmlaustp.hxx @@ -112,6 +112,10 @@ public: sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ); sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ); + /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc). + sal_Bool AddNamed( const ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent, + const ::std::vector< XMLPropertyState >& rProperties ); + /// Find an item set's name. ::rtl::OUString Find( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ) const; ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const; diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx index 1f5450204562..0bae295f32de 100644 --- a/xmloff/source/style/impastp3.cxx +++ b/xmloff/source/style/impastp3.cxx @@ -96,6 +96,46 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl* pFamilyData, c return bAdded; } +/////////////////////////////////////////////////////////////////////////////// +// +// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) with a given name. +// If the name exists already, nothing is done. If a style with a different name and +// the same properties exists, a new one is added (like with bDontSeek). +// + +sal_Bool SvXMLAutoStylePoolParentP_Impl::AddNamed( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties, const OUString& rName ) +{ + sal_Bool bAdded = sal_False; + sal_uInt32 i = 0; + sal_Int32 nProperties = rProperties.size(); + sal_uInt32 nCount = maPropertiesList.Count(); + + for( i = 0; i < nCount; i++ ) + { + SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList.GetObject( i ); + if( nProperties > (sal_Int32)pIS->GetProperties().size() ) + { + continue; + } + else if( nProperties < (sal_Int32)pIS->GetProperties().size() ) + { + break; + } + } + + if( !pFamilyData->mpNameList->Seek_Entry( &rName, 0 ) ) + { + SvXMLAutoStylePoolPropertiesP_Impl* pProperties = + new SvXMLAutoStylePoolPropertiesP_Impl( pFamilyData, rProperties ); + // ignore the generated name + pProperties->SetName( rName ); + maPropertiesList.Insert( pProperties, i ); + bAdded = sal_True; + } + + return bAdded; +} + /////////////////////////////////////////////////////////////////////////////// // // Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx index 20772b00a4c0..946b613473db 100644 --- a/xmloff/source/style/impastp4.cxx +++ b/xmloff/source/style/impastp4.cxx @@ -235,6 +235,47 @@ sal_Bool SvXMLAutoStylePoolP_Impl::Add(OUString& rName, sal_Int32 nFamily, return bRet; } +sal_Bool SvXMLAutoStylePoolP_Impl::AddNamed(const OUString& rName, sal_Int32 nFamily, + const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) +{ + // get family and parent the same way as in Add() + sal_Bool bRet(sal_False); + ULONG nPos; + + XMLFamilyData_Impl *pFamily = 0; + XMLFamilyData_Impl aTemporary( nFamily ); + if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) ) + { + pFamily = maFamilyList.GetObject( nPos ); + } + + DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Add: unknown family" ); + if( pFamily ) + { + SvXMLAutoStylePoolParentP_Impl aTmp( rParent ); + SvXMLAutoStylePoolParentP_Impl *pParent = 0; + + SvXMLAutoStylePoolParentsP_Impl *pParents = pFamily->mpParentList; + if( pParents->Seek_Entry( &aTmp, &nPos ) ) + { + pParent = pParents->GetObject( nPos ); + } + else + { + pParent = new SvXMLAutoStylePoolParentP_Impl( rParent ); + pParents->Insert( pParent ); + } + + if( pParent->AddNamed( pFamily, rProperties, rName ) ) + { + pFamily->mnCount++; + bRet = sal_True; + } + } + + return bRet; +} + OUString SvXMLAutoStylePoolP_Impl::AddToCache( sal_Int32 nFamily, const OUString& rParent ) { diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index 3c4145a829a4..d63384a71068 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -124,6 +124,8 @@ public: const ::rtl::OUString& GetName() const { return msName; } const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; } sal_uInt32 GetPos() const { return mnPos; } + + void SetName( const ::rtl::OUString& rNew ) { msName = rNew; } }; typedef SvXMLAutoStylePoolPropertiesP_Impl *SvXMLAutoStylePoolPropertiesPPtr; @@ -150,6 +152,8 @@ public: sal_Bool Add( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties, ::rtl::OUString& rName, bool bDontSeek = false ); + sal_Bool AddNamed( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties, const ::rtl::OUString& rName ); + ::rtl::OUString Find( const XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const; const ::rtl::OUString& GetParent() const { return msParent; } @@ -197,6 +201,10 @@ public: const ::std::vector< XMLPropertyState >& rProperties, sal_Bool bCache = sal_False, bool bDontSeek = false ); + sal_Bool AddNamed( const ::rtl::OUString& rName, sal_Int32 nFamily, + const ::rtl::OUString& rParent, + const ::std::vector< XMLPropertyState >& rProperties ); + ::rtl::OUString AddToCache( sal_Int32 nFamily, const ::rtl::OUString& rParent ); ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent, diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index cc7a4408e1e6..32c53ceb724a 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -381,6 +381,13 @@ sal_Bool SvXMLAutoStylePoolP::Add(OUString& rName, sal_Int32 nFamily, const OUSt return pImpl->Add(rName, nFamily, rParent, rProperties); } +sal_Bool SvXMLAutoStylePoolP::AddNamed( const OUString& rName, sal_Int32 nFamily, const OUString& rParent, + const ::std::vector< XMLPropertyState >& rProperties ) + +{ + return pImpl->AddNamed(rName, nFamily, rParent, rProperties); +} + OUString SvXMLAutoStylePoolP::AddAndCache( sal_Int32 nFamily, const vector< XMLPropertyState >& rProperties ) { -- cgit