diff options
author | Andre Fischer <af@openoffice.org> | 2010-05-18 14:40:19 +0200 |
---|---|---|
committer | Andre Fischer <af@openoffice.org> | 2010-05-18 14:40:19 +0200 |
commit | 9a46474f8c39a16a6a6980a45792b2b51a4a590e (patch) | |
tree | 6b4845b899e6f1f728450eead4d83477677a3ce8 /svx/source/sdr | |
parent | a3f8b65881da98c14d1db26b04f32e626cf8e879 (diff) |
sdk321: #i111636# Look up style before falling back to default.
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/properties/attributeproperties.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 5abd9c4b26f1..0f3325a0027e 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -259,6 +259,8 @@ namespace sdr void AttributeProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) { + OSL_ASSERT(pNewModel!=NULL); + if(pSrcPool && pDestPool && (pSrcPool != pDestPool)) { if(mpItemSet) @@ -291,8 +293,24 @@ namespace sdr } else { - // StyleSheet is NOT from the correct pool; use default - ImpAddStyleSheet(pNewModel->GetDefaultStyleSheet(), sal_True); + // StyleSheet is NOT from the correct pool. + // Look one up in the right pool with the same + // name or use the default. + + // Look up the style in the new document. + OSL_ASSERT(pNewModel->GetStyleSheetPool() != NULL); + SfxStyleSheet* pNewStyleSheet = dynamic_cast<SfxStyleSheet*>( + pNewModel->GetStyleSheetPool()->Find( + pStySheet->GetName(), + SFX_STYLE_FAMILY_ALL)); + if (pNewStyleSheet == NULL + || &pNewStyleSheet->GetPool().GetPool() != pDestPool) + { + // There is no copy of the style in the new + // document. Use the default as a fallback. + pNewStyleSheet = pNewModel->GetDefaultStyleSheet(); + } + ImpAddStyleSheet(pNewStyleSheet, sal_True); } } |