summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-07 15:22:54 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-08 14:23:05 -0400
commitaac15b638410f181133dc15343136b4e9a1675ba (patch)
tree8ce171d69b7dd884a546544d53993a61dc6e38e3 /editeng/source
parentc601d86ce154e43266e0185b2fba2c1b4f196d1d (diff)
Set anchor to XTextContent using UNO API.
Change-Id: Id1ccae62037369917a46d620c0c46ac2447a0910
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/uno/unofield.cxx11
-rw-r--r--editeng/source/uno/unotext.cxx8
2 files changed, 17 insertions, 2 deletions
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 7b97684275cb..50c578f567ee 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -41,6 +41,8 @@
#include <comphelper/serviceinfohelper.hxx>
#include <comphelper/servicehelper.hxx>
+#include "editeng/unonames.hxx"
+
using namespace ::rtl;
using namespace ::cppu;
using namespace ::com::sun::star;
@@ -671,6 +673,12 @@ void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName,
if( mpImpl == NULL )
throw uno::RuntimeException();
+ if (aPropertyName == UNO_TC_PROP_ANCHOR)
+ {
+ aValue >>= mxAnchor;
+ return;
+ }
+
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( aPropertyName );
if ( !pMap )
throw beans::UnknownPropertyException();
@@ -838,6 +846,9 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
{
SolarMutexGuard aGuard;
+ if (PropertyName == UNO_TC_PROP_ANCHOR)
+ return uno::makeAny(mxAnchor);
+
uno::Any aValue;
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( PropertyName );
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index a13bb0ca768f..52d31bb56aae 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -55,7 +55,7 @@
#include <comphelper/serviceinfohelper.hxx>
#include <comphelper/servicehelper.hxx>
-#define UNO_TR_PROP_SELECTION "Selection"
+#include "editeng/unonames.hxx"
using namespace ::rtl;
using namespace ::cppu;
@@ -1821,7 +1821,11 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
pForwarder->QuickInsertField(aField, toESelection(aSel));
GetEditSource()->UpdateData();
- pField->SetAnchor( uno::Reference< text::XTextRange >::query( (cppu::OWeakObject*)this ) );
+ uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
+ if (!xContent.is())
+ throw lang::IllegalArgumentException();
+
+ xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
aSel.End.PositionInParagraph += 1;
aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;