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/source/ui/unoobj | |
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/source/ui/unoobj')
-rw-r--r-- | sc/source/ui/unoobj/notesuno.cxx | 46 |
1 files changed, 45 insertions, 1 deletions
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 ) |