summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unoobj.cxx36
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx8
-rw-r--r--sw/source/core/unocore/unoport.cxx6
-rw-r--r--sw/source/core/unocore/unotext.cxx42
4 files changed, 38 insertions, 54 deletions
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 0ffc5b9b55ac..5fc9a010b62c 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1824,6 +1824,18 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
SetPropertyValues(rPaM, rPropSet, aValues, nAttrMode, bTableMode);
}
+// FN_UNO_PARA_STYLE is known to set attributes for nodes, inside
+// SwUnoCursorHelper::SetTxtFmtColl, instead of extending item set.
+// We need to get them from nodes in next call to GetCrsrAttr.
+// The rest could cause similar problems in theory, so we just list them here.
+inline bool propertyCausesSideEffectsInNodes(sal_uInt16 nWID)
+{
+ return nWID == FN_UNO_PARA_STYLE ||
+ nWID == FN_UNO_CHARFMT_SEQUENCE ||
+ nWID == FN_UNO_NUM_START_VALUE ||
+ nWID == FN_UNO_NUM_RULES;
+}
+
void SwUnoCursorHelper::SetPropertyValues(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
const uno::Sequence< beans::PropertyValue > &rPropertyValues,
@@ -1873,20 +1885,28 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
SfxItemSet aItemSet(pDoc->GetAttrPool(), &aWhichPairs[0]);
// Fetch, overwrite, and re-set the attributes from the core
- SwUnoCursorHelper::GetCrsrAttr( rPaM, aItemSet );
- for (sal_Int32 i = 0; ( i < rPropertyValues.getLength() &&
- i < (sal_Int32)aEntries.size() ); ++i)
+ bool bPreviousPropertyCausesSideEffectsInNodes = false;
+ for (size_t i = 0; i < aEntries.size(); ++i)
{
- const uno::Any &rValue = rPropertyValues[i].Value;
SfxItemPropertySimpleEntry const*const pEntry = aEntries[i];
- if (!pEntry)
- continue;
+ bool bPropertyCausesSideEffectsInNodes =
+ propertyCausesSideEffectsInNodes(pEntry->nWID);
+
+ // we need to get up-to-date item set from nodes
+ if (i == 0 || bPreviousPropertyCausesSideEffectsInNodes)
+ SwUnoCursorHelper::GetCrsrAttr(rPaM, aItemSet);
+
+ const uno::Any &rValue = rPropertyValues[i].Value;
+ // this can set some attributes in nodes' mpAttrSet
if (!SwUnoCursorHelper::SetCursorPropertyValue(*pEntry, rValue, rPaM, aItemSet))
rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
- }
- SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode);
+ if (i + 1 == aEntries.size() || bPropertyCausesSideEffectsInNodes)
+ SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode);
+
+ bPreviousPropertyCausesSideEffectsInNodes = bPropertyCausesSideEffectsInNodes;
+ }
}
if (!aUnknownExMsg.isEmpty())
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index fbe7c40f41b2..3d4e97298fbc 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -390,8 +390,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
const SfxItemPropertyMap &rMap = m_rPropSet.getPropertyMap();
SwParaSelection aParaSel( aCursor );
- // FIXME: this should be replaced with the significantly faster
- // SwUnoCursorHelper::SetPropertyValues...
+ uno::Sequence< beans::PropertyValue > aValues( rPropertyNames.getLength() );
for (sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
{
SfxItemPropertySimpleEntry const*const pEntry =
@@ -410,9 +409,10 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ pPropertyNames[nProp],
static_cast< cppu::OWeakObject * >(&m_rThis));
}
- SwUnoCursorHelper::SetPropertyValue(aCursor, m_rPropSet,
- pPropertyNames[nProp], pValues[nProp]);
+ aValues[nProp].Name = pPropertyNames[nProp];
+ aValues[nProp].Value = pValues[nProp];
}
+ SwUnoCursorHelper::SetPropertyValues(aCursor, m_rPropSet, aValues);
}
void SAL_CALL SwXParagraph::setPropertyValues(
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index a50a61c53783..0c817e5e7656 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -459,6 +459,7 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
const OUString* pPropertyNames = rPropertyNames.getConstArray();
const uno::Any* pValues = rValues.getConstArray();
const SfxItemPropertyMap& rMap = m_pPropSet->getPropertyMap();
+ uno::Sequence< beans::PropertyValue > aValues( rPropertyNames.getLength() );
for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
{
const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pPropertyNames[nProp]);
@@ -467,9 +468,10 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ("Property is read-only: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
- SwUnoCursorHelper::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
- pPropertyNames[nProp], pValues[nProp]);
+ aValues[nProp].Name = pPropertyNames[nProp];
+ aValues[nProp].Value = pValues[nProp];
}
+ SwUnoCursorHelper::SetPropertyValues( *pUnoCrsr, *m_pPropSet, aValues );
}
}
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index cfbc5278ce1b..0312b2c03948 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1309,50 +1309,13 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
aPam.Move( fnMoveBackward, fnGoNode );
}
-#if 1 // This section should be removed in favour of the one below when it works.
- if (rProperties.getLength())
- {
- // now set the properties
- SfxItemPropertySet const*const pParaPropSet =
- aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH);
- const SfxItemPropertyMap &rParagraphMap =
- pParaPropSet->getPropertyMap();
- const beans::PropertyValue* pValues = rProperties.getConstArray();
-
- for (sal_Int32 nProp = 0; nProp < rProperties.getLength(); ++nProp)
- {
- if (!rParagraphMap.getByName(pValues[nProp].Name))
- {
- bIllegalException = true;
- break;
- }
- try
- {
- SwUnoCursorHelper::SetPropertyValue(aPam, *pParaPropSet,
- pValues[nProp].Name, pValues[nProp].Value);
- }
- catch (const lang::IllegalArgumentException& rIllegal)
- {
- sMessage = rIllegal.Message;
- bIllegalException = true;
- break;
- }
- catch (const uno::RuntimeException& rRuntime)
- {
- sMessage = rRuntime.Message;
- bRuntimeException = true;
- break;
- }
- }
- }
-#else
try
{
SfxItemPropertySet const*const pParaPropSet =
aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH);
- if (!bIllegalException)
- SwUnoCursorHelper::SetPropertyValues(aPam, *pParaPropSet, rProperties);
+
+ SwUnoCursorHelper::SetPropertyValues(aPam, *pParaPropSet, rProperties);
}
catch (const lang::IllegalArgumentException& rIllegal)
{
@@ -1364,7 +1327,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
sMessage = rRuntime.Message;
bRuntimeException = true;
}
-#endif
m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
if (bIllegalException || bRuntimeException)