diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
commit | 4c8fba36e0b8955ecb49293e6218829ad7cd40a9 (patch) | |
tree | d24e9d1b546873c85d4f5aaef4b719a315692ca3 /xmloff/source/style | |
parent | e3441919174583045e0b7c8110b2a2d4119b66d1 (diff) | |
parent | 5228b9163b7c889a62b553e543fea51800099f7a (diff) |
merge commit
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/HatchStyle.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/TransGradientStyle.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/impastp3.cxx | 40 | ||||
-rw-r--r-- | xmloff/source/style/impastp4.cxx | 41 | ||||
-rw-r--r-- | xmloff/source/style/impastpl.hxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/xmlaustp.cxx | 7 |
7 files changed, 99 insertions, 3 deletions
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 5652946d04..ac8dff99e3 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -201,7 +201,7 @@ sal_Bool XMLGradientStyleImport::importXML( case XML_TOK_GRADIENT_ANGLE: { sal_Int32 nValue; - SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 360 ); + SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 3600 ); aGradient.Angle = sal_Int16( nValue ); } break; diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx index f0893b8077..a7d1c97871 100644 --- a/xmloff/source/style/HatchStyle.cxx +++ b/xmloff/source/style/HatchStyle.cxx @@ -159,7 +159,7 @@ sal_Bool XMLHatchStyleImport::importXML( case XML_TOK_HATCH_ROTATION: { sal_Int32 nValue; - rUnitConverter.convertNumber( nValue, rStrValue, 0, 360 ); + rUnitConverter.convertNumber( nValue, rStrValue, 0, 3600 ); aHatch.Angle = sal_Int16( nValue ); } break; diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index 65381d4d3f..68a5597133 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -194,7 +194,7 @@ sal_Bool XMLTransGradientStyleImport::importXML( case XML_TOK_GRADIENT_ANGLE: { sal_Int32 nValue; - SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 360 ); + SvXMLUnitConverter::convertNumber( nValue, rStrValue, 0, 3600 ); aGradient.Angle = sal_Int16( nValue ); } break; diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx index 87338c43fd..e6c8b8fb82 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 bd25f22321..daec835a1f 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 f9fd80ca65..64aca01b6a 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 1d5204aca5..4ed59fd092 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 ) { |