diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-01 16:33:58 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-03 20:28:16 -0400 |
commit | c92f5f600d65299c135ca9db2ec7e6d13df1152d (patch) | |
tree | 306cae9677d7e65fa8716811692e041ee70147c8 /sc/source/ui | |
parent | d6d4d00114e267142145f0d6bb80a66dd4bca990 (diff) |
Support sheet name field in cells.
Change-Id: I7883960c482de0637e0bfaffc96f23a0d43cc96d
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 2 |
3 files changed, 22 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 9f874e3fa5c5..db2d9b4d0f24 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6434,8 +6434,10 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang aSelection.nStartPos = aSelection.nEndPos; } - SvxFieldItem aItem(pCellField->CreateFieldItem()); + if (pCellField->GetFieldType() == ScEditFieldObj::Sheet) + pCellField->setPropertyValue("SheetPosition", uno::makeAny<sal_Int32>(aCellPos.Tab())); + SvxFieldItem aItem = pCellField->CreateFieldItem(); SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder(); pForwarder->QuickInsertField( aItem, aSelection ); pEditSource->UpdateData(); diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 693c2c457bde..6ef6625f2d0a 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -699,7 +699,7 @@ SvxFieldData* ScEditFieldObj::getData() mpData.reset(new SvxPagesField); break; case Sheet: - mpData.reset(new SvxTableField); + mpData.reset(new SvxTableField(mnTab)); break; case Time: mpData.reset(new SvxTimeField); @@ -921,6 +921,14 @@ void ScEditFieldObj::setPropertyValueExtTime(const rtl::OUString& rName, const u } } +void ScEditFieldObj::setPropertyValueSheet(const rtl::OUString& rName, const uno::Any& rVal) +{ + if (rName == "SheetPosition") + { + mnTab = rVal.get<sal_Int32>(); + } +} + ScEditFieldObj::ScEditFieldObj( const uno::Reference<text::XTextRange>& rContent, ScEditSource* pEditSrc, FieldType eType, const ESelection& rSel) : @@ -928,7 +936,7 @@ ScEditFieldObj::ScEditFieldObj( pPropSet(NULL), mpEditSource(pEditSrc), aSelection(rSel), - meType(eType), mpData(NULL), mpContent(rContent), mbIsDate(false) + meType(eType), mpData(NULL), mpContent(rContent), mnTab(0), mbIsDate(false) { switch (meType) { @@ -970,6 +978,11 @@ SvxFieldItem ScEditFieldObj::CreateFieldItem() return SvxFieldItem(*getData(), EE_FEATURE_FIELD); } +ScEditFieldObj::FieldType ScEditFieldObj::GetFieldType() const +{ + return meType; +} + void ScEditFieldObj::DeleteField() { if (mpEditSource) @@ -1100,6 +1113,9 @@ void SAL_CALL ScEditFieldObj::setPropertyValue( case ExtTime: setPropertyValueExtTime(aPropertyName, aValue); break; + case Sheet: + setPropertyValueSheet(aPropertyName, aValue); + break; default: throw beans::UnknownPropertyException(); } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index a1814030bef5..cf479772b8b5 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -616,7 +616,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) break; case SID_INSERT_FIELD_TEST: { - SvxDateField aField; + SvxTableField aField(pViewData->GetTabNo()); SvxFieldItem aItem(aField, EE_FEATURE_FIELD); pTableView->InsertField(aItem); } |