summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 17:40:32 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 19:25:38 -0400
commitd64b5cc1c3d232ba42479fe0a3c186ecabd25144 (patch)
treeb97a85cc801efe431d49caad3459271155fecb9c /editeng/source
parent11637831312a7a92af9c0148aa6b1e30db4b55b2 (diff)
fdo#62116: Be sure to convert relative URLs into absolute ones.
Just to preserve the old (and correct) behavior. Change-Id: I229e0b80097f6d70ff3023072b52576815010b15
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/editobj.cxx40
-rw-r--r--editeng/source/editeng/editobj2.hxx2
2 files changed, 42 insertions, 0 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 0433ea5aa195..823139622d44 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -256,6 +256,11 @@ const SvxFieldItem* EditTextObject::GetField() const
return mpImpl->GetField();
}
+const SvxFieldData* EditTextObject::GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const
+{
+ return mpImpl->GetFieldData(nPara, nPos, nType);
+}
+
bool EditTextObject::HasField( sal_Int32 nType ) const
{
return mpImpl->HasField(nType);
@@ -703,6 +708,41 @@ const SvxFieldItem* EditTextObjectImpl::GetField() const
return 0;
}
+const SvxFieldData* EditTextObjectImpl::GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const
+{
+ if (nPara >= aContents.size())
+ return NULL;
+
+ const ContentInfo& rC = aContents[nPara];
+ if (nPos >= rC.aAttribs.size())
+ // URL position is out-of-bound.
+ return NULL;
+
+ ContentInfo::XEditAttributesType::const_iterator it = rC.aAttribs.begin(), itEnd = rC.aAttribs.end();
+ size_t nCurPos = 0;
+ for (; it != itEnd; ++it)
+ {
+ const XEditAttribute& rAttr = *it;
+ if (rAttr.GetItem()->Which() != EE_FEATURE_FIELD)
+ // Skip attributes that are not fields.
+ continue;
+
+ const SvxFieldItem* pField = static_cast<const SvxFieldItem*>(rAttr.GetItem());
+ const SvxFieldData* pFldData = pField->GetField();
+ if (nType != text::textfield::Type::UNSPECIFIED && nType != pFldData->GetClassId())
+ // Field type doesn't match. Skip it. UNSPECIFIED matches all field types.
+ continue;
+
+ if (nCurPos == nPos)
+ // Found it!
+ return pFldData;
+
+ ++nCurPos;
+ }
+
+ return NULL; // field not found.
+}
+
bool EditTextObjectImpl::HasField( sal_Int32 nType ) const
{
size_t nParagraphs = aContents.size();
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 5c5905023887..c1aa77ffc58d 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -221,6 +221,8 @@ public:
bool IsFieldObject() const;
const SvxFieldItem* GetField() const;
+ const SvxFieldData* GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const;
+
bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const;
const SfxItemSet& GetParaAttribs(size_t nPara) const;