diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-04 00:41:59 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-04 00:47:08 -0400 |
commit | 19af8cc580445c1e163960d8cfbf793e4e6465bb (patch) | |
tree | 4c95093e65124f5435a08e7a0d809781b5bed756 /sc | |
parent | 921dce61acd67ee8e5f93e7c5005cb42f8c062de (diff) |
Evil hack to fix the UNO API failure.
We need a clean solution for this, but that will need a bit more
effort & thinking.
Change-Id: I I25d066fa0322cca9a15af1745a758b1aba981e13
Diffstat (limited to 'sc')
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/unoapi/sc.sce | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/notesuno.cxx | 46 |
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 ) |