summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/qa/unoapi/sc.sce2
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx46
3 files changed, 47 insertions, 2 deletions
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 4727d7413c77..3afcaf2c0bd3 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
JunitTest_sc_complex \
JunitTest_sc_unoapi \
CppunitTest_sc_chart_regression_test \
+ CppunitTest_sc_annotationshapeobj \
CppunitTest_sc_cellrangeobj \
$(if $(filter-out $(OS),IOS), \
CppunitTest_sc_databaserangeobj) \
diff --git a/sc/qa/unoapi/sc.sce b/sc/qa/unoapi/sc.sce
index ab19f923b26d..1ad6d8f06d1c 100644
--- a/sc/qa/unoapi/sc.sce
+++ b/sc/qa/unoapi/sc.sce
@@ -15,7 +15,7 @@
-o sc.ScAccessiblePreviewTable
# fdo#45337 -o sc.ScAccessibleSpreadsheet
-o sc.ScAnnotationObj
-# FIXME -o sc.ScAnnotationShapeObj
+-o sc.ScAnnotationShapeObj
-o sc.ScAnnotationsObj
-o sc.ScAreaLinkObj
-o sc.ScAreaLinksObj
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 8fcfc1d1bffa..0e77d850cc42 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -42,6 +42,7 @@
#include "hints.hxx"
#include "editsrc.hxx"
#include "miscuno.hxx"
+#include "fielduno.hxx"
// setVisible:
#include <svx/svdundo.hxx>
@@ -50,6 +51,7 @@
#include "undocell.hxx"
#include "userdat.hxx"
#include <editeng/outlobj.hxx>
+#include "editeng/unofield.hxx"
#include <svx/unoshape.hxx>
#include <svx/svdocapt.hxx>
#include <svx/svditer.hxx>
@@ -390,7 +392,49 @@ void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< tex
{
SolarMutexGuard aGuard;
- GetUnoText().insertTextContent( xRange, xContent, bAbsorb );
+ // Evil hack to convert a ScEditFieldObj based text field into a
+ // SvxUnoTextField based one. See SvxUnoTextBase::insertTextContent() for
+ // the reason why. We need a clean solution for this.
+
+ ScEditFieldObj* pField = ScEditFieldObj::getImplementation(xContent);
+ uno::Reference<text::XTextContent> xContent2 = xContent;
+ if (pField)
+ {
+ switch (pField->GetFieldType())
+ {
+ case ScEditFieldObj::Date:
+ xContent2.set(new SvxUnoTextField(ID_DATEFIELD));
+ break;
+ case ScEditFieldObj::File:
+ xContent2.set(new SvxUnoTextField(ID_EXT_FILEFIELD));
+ break;
+ case ScEditFieldObj::Page:
+ xContent2.set(new SvxUnoTextField(ID_PAGEFIELD));
+ break;
+ case ScEditFieldObj::Pages:
+ xContent2.set(new SvxUnoTextField(ID_PAGESFIELD));
+ break;
+ case ScEditFieldObj::Sheet:
+ xContent2.set(new SvxUnoTextField(ID_TABLEFIELD));
+ break;
+ case ScEditFieldObj::Time:
+ xContent2.set(new SvxUnoTextField(ID_TIMEFIELD));
+ break;
+ case ScEditFieldObj::ExtTime:
+ xContent2.set(new SvxUnoTextField(ID_EXT_TIMEFIELD));
+ break;
+ case ScEditFieldObj::Title:
+ xContent2.set(new SvxUnoTextField(ID_FILEFIELD));
+ break;
+ case ScEditFieldObj::URL:
+ xContent2.set(new SvxUnoTextField(ID_URLFIELD));
+ break;
+ default:
+ ;
+ }
+ }
+
+ GetUnoText().insertTextContent(xRange, xContent2, bAbsorb);
}
void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )