summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-08-11 12:32:09 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-08-11 18:13:48 +0200
commite11a0e646b8eb75e102f878dc70f5196c4efbea2 (patch)
tree1fc3f9a3eb4bb77380ea4b76f3a946e3fa2d0287 /sc/source/filter/oox
parent6945d031e759823ab52bdf077e43196b67f594a4 (diff)
rearrange to collect the properties set on the annotation together
and set them in one block. No behavior change intended. note: type passed as TextFitToSize seems to be wrong Change-Id: I349aeba5176ef6c10163069a73d0367469aadd6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155588 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source/filter/oox')
-rw-r--r--sc/source/filter/oox/commentsbuffer.cxx43
1 files changed, 34 insertions, 9 deletions
diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx
index 55bcb7e2cc73..9307ad707006 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -169,10 +169,11 @@ void Comment::finalizeImport()
// setting a property triggers expensive process, so set them all at once
// Add shape formatting properties (autoFill, colHidden and rowHidden are dropped)
- static_cast<SvxShape*>(xAnnoShape.get())->setPropertyValues(
- Sequence<OUString> { "TextFitToSize", "MoveProtect", "TextHorizontalAdjust", "TextVerticalAdjust" },
- Sequence<Any> { Any(maModel.mbAutoScale), Any(maModel.mbLocked),
- Any(lcl_ToHorizAlign( maModel.mnTHA )), Any(lcl_ToVertAlign( maModel.mnTVA )) });
+ // vvv TODO vvv TextFitToSize should be a drawing::TextFitToSizeType not bool
+ Sequence<OUString> aPropertyNames{ "TextFitToSize", "MoveProtect", "TextHorizontalAdjust", "TextVerticalAdjust" };
+ Sequence<Any> aPropertyValues{ Any(maModel.mbAutoScale), Any(maModel.mbLocked),
+ Any(lcl_ToHorizAlign( maModel.mnTHA )), Any(lcl_ToVertAlign( maModel.mnTVA )) };
+
if( maModel.maAnchor.Width > 0 && maModel.maAnchor.Height > 0 )
{
xAnnoShape->setPosition( css::awt::Point( maModel.maAnchor.X, maModel.maAnchor.Y ) );
@@ -191,18 +192,42 @@ void Comment::finalizeImport()
xAnnoShape->setSize(css::awt::Size(aShapeRect.Width, aShapeRect.Height));
::oox::drawingml::ShapePropertyMap aPropMap(pVmlNoteShape->makeShapePropertyMap());
- css::uno::Reference<css::drawing::XShape> xShape(xAnnoShape);
- PropertySet(xShape).setProperties(aPropMap);
+
+ Sequence<OUString> aVMLPropNames;
+ Sequence<Any> aVMLPropValues;
+ aPropMap.fillSequences(aVMLPropNames, aVMLPropValues);
+
+ sal_uInt32 nOldPropLen = aPropertyNames.getLength();
+ sal_uInt32 nVMLPropLen = aVMLPropNames.getLength();
+ aPropertyNames.realloc(nOldPropLen + nVMLPropLen);
+ aPropertyValues.realloc(nOldPropLen + nVMLPropLen);
+ OUString* pNames = aPropertyNames.getArray();
+ Any* pValues = aPropertyValues.getArray();
+ for (sal_uInt32 i = 0; i < nVMLPropLen; ++i)
+ {
+ pNames[nOldPropLen + i] = aVMLPropNames[i];
+ pValues[nOldPropLen + i] = aVMLPropValues[i];
+ }
}
+
// visibility
bVisible = pVmlNoteShape->getTypeModel().mbVisible;
// Setting comment text alignment
const ::oox::vml::ClientData* xClientData = pVmlNoteShape->getClientData();
- static_cast<SvxShape*>(xAnnoShape.get())->setPropertyValues(
- Sequence<OUString> { "TextVerticalAdjust", "ParaAdjust" },
- Sequence<Any> { Any(lcl_ToVertAlign( xClientData->mnTextVAlign )), Any(lcl_ToParaAlign( xClientData->mnTextHAlign )) });
+ sal_uInt32 nOldPropLen = aPropertyNames.getLength();
+ aPropertyNames.realloc(nOldPropLen + 2);
+ aPropertyValues.realloc(nOldPropLen + 2);
+ OUString* pNames = aPropertyNames.getArray();
+ Any* pValues = aPropertyValues.getArray();
+ pNames[nOldPropLen] = "TextVerticalAdjust";
+ pValues[nOldPropLen] <<= lcl_ToVertAlign(xClientData->mnTextVAlign);
+ pNames[nOldPropLen + 1] = "ParaAdjust";
+ pValues[nOldPropLen + 1] <<= lcl_ToParaAlign( xClientData->mnTextHAlign);
}
+
+ static_cast<SvxShape*>(xAnnoShape.get())->setPropertyValues(aPropertyNames, aPropertyValues);
+
if (bVisible)
pDocShell->GetDocFunc().ShowNote( maModel.maRange.aStart, bVisible );