summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/xmloff/nmspmap.hxx5
-rw-r--r--xmloff/inc/xmloff/xmlaustp.hxx4
-rw-r--r--xmloff/source/style/impastp3.cxx40
-rw-r--r--xmloff/source/style/impastp4.cxx41
-rw-r--r--xmloff/source/style/impastpl.hxx8
-rw-r--r--xmloff/source/style/xmlaustp.cxx7
6 files changed, 105 insertions, 0 deletions
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
@@ -98,6 +98,46 @@ sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl* pFamilyData, c
///////////////////////////////////////////////////////////////////////////////
//
+// 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 )
{