https://bugs.documentfoundation.org/show_bug.cgi?id=172883
Bug ID: 172883
Summary: UNO dispatch: TransformParameters lacks type
coercionfor FID slots (e.g., .uno:Move)
Product: LibreOffice
Version: Inherited From OOo
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Base
Assignee: [email protected]
Reporter: [email protected]
## Problem
UNO dispatch of .uno:Move (FID_TAB_MOVE) and similar FID-prefixed slots
silently fail when called with parameters from Python UNO bindings.
## Steps to Reproduce
1. Start LibreOffice with UNO socket
2. Open two Calc documents in the same LO instance
3. Execute via Python UNO:
```
helper.executeDispatch(sourceFrame, '.uno:Move', '', 0, (
PropertyValue('DocName', 0, targetDocTitle, 0),
PropertyValue('Copy', 0, False, 0),
))
```
Expected: sheet moves from source document to target.
Actual: nothing happens.
## Root Cause
File: sfx2/source/appl/appuno.cxx, function TransformParameters()
SfxPoolItem::PutValue() uses >>= requiring EXACT type matching.
Python/UNO passes integers as sal_Int32 (UNO "long"), but SfxUInt16Item expects
sal_uInt16.
When type mismatch occurs, PutValue returns false, xSet->Count() remains 0,
dispatcher sends empty SfxRequest to ExecuteMoveTable. Code sees
aDocName.isEmpty() -> enters SC_DOC_NEW branch -> silent no-op.
The underlying MoveTable() in viewfun2.cxx correctly supports cross-document
sheet operations via TransferTab().
## Suggested Fix
Add TryPutValueWithCoercion() in TransformParameters to retry with coerced
integer types:
```
static bool TryPutValueWithCoercion(SfxPoolItem* pItem,
const css::uno::Any& rValue)
{
css::uno::TypeClass eClass = rValue.getValueTypeClass();
if (eClass == css::uno::TypeClass_LONG)
{
sal_Int32 nVal = 0;
if (rValue >>= nVal)
{
css::uno::Any aTmp;
aTmp <<= static_cast<sal_uInt16>(nVal);
if (pItem->PutValue(aTmp, 0)) return true;
aTmp <<= static_cast<sal_Int16>(nVal);
if (pItem->PutValue(aTmp, 0)) return true;
}
}
return false;
}
```
Then modify the PutValue call site:
```
bool bOk = pItem->PutValue(pProp->Value, 0);
if (!bOk) bOk = TryPutValueWithCoercion(pItem.get(), pProp->Value);
```
## Environment
- LibreOffice 25.2.4.2
- Ubuntu 26.04
- GCC 15.2.0
- Python 3.14 UNO bindings
--
You are receiving this mail because:
You are the assignee for the bug.