LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoframe.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1563 2017 77.5 %
Date: 2014-04-11 Functions: 125 152 82.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
      21             : #include <com/sun/star/container/XChild.hpp>
      22             : #include <com/sun/star/drawing/BitmapMode.hpp>
      23             : #include <com/sun/star/drawing/FillStyle.hpp>
      24             : #include <com/sun/star/awt/Gradient.hpp>
      25             : #include <com/sun/star/embed/XClassifiedObject.hpp>
      26             : #include <com/sun/star/embed/XVisualObject.hpp>
      27             : #include <com/sun/star/embed/XComponentSupplier.hpp>
      28             : #include <com/sun/star/embed/EmbedStates.hpp>
      29             : #include <com/sun/star/embed/Aspects.hpp>
      30             : #include <com/sun/star/graphic/XGraphicProvider.hpp>
      31             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      32             : #include <svx/svxids.hrc>
      33             : #include <svx/xfillit0.hxx>
      34             : #include <svx/xflgrit.hxx>
      35             : #include <svx/sdtaitm.hxx>
      36             : #include <svx/xflclit.hxx>
      37             : #include <editeng/memberids.hrc>
      38             : 
      39             : #include <swtypes.hxx>
      40             : #include <cmdid.h>
      41             : 
      42             : #include <memory>
      43             : #include <hints.hxx>
      44             : #include <doc.hxx>
      45             : #include <IDocumentUndoRedo.hxx>
      46             : #include <docsh.hxx>
      47             : #include <editsh.hxx>
      48             : #include <swcli.hxx>
      49             : #include <ndindex.hxx>
      50             : #include <pam.hxx>
      51             : #include <ndnotxt.hxx>
      52             : #include <svx/unomid.hxx>
      53             : #include <unocrsr.hxx>
      54             : #include <unocrsrhelper.hxx>
      55             : #include <docstyle.hxx>
      56             : #include <dcontact.hxx>
      57             : #include <fmtcnct.hxx>
      58             : #include <ndole.hxx>
      59             : #include <frmfmt.hxx>
      60             : #include <frame.hxx>
      61             : #include <unotextrange.hxx>
      62             : #include <unotextcursor.hxx>
      63             : #include <unoparagraph.hxx>
      64             : #include <unomap.hxx>
      65             : #include <unoprnms.hxx>
      66             : #include <unoevent.hxx>
      67             : #include <com/sun/star/util/XModifyBroadcaster.hpp>
      68             : #include <com/sun/star/table/ShadowFormat.hpp>
      69             : #include <com/sun/star/style/GraphicLocation.hpp>
      70             : #include <com/sun/star/text/GraphicCrop.hpp>
      71             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      72             : #include <com/sun/star/text/XTextColumns.hpp>
      73             : #include <com/sun/star/text/WrapTextMode.hpp>
      74             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      75             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      76             : #include <com/sun/star/drawing/PointSequence.hpp>
      77             : #include <com/sun/star/drawing/ColorMode.hpp>
      78             : #include <tools/poly.hxx>
      79             : #include <swundo.hxx>
      80             : #include <unostyle.hxx>
      81             : #include <svx/svdmodel.hxx>
      82             : #include <svx/svdpage.hxx>
      83             : #include <editeng/brushitem.hxx>
      84             : #include <editeng/protitem.hxx>
      85             : #include <fmtornt.hxx>
      86             : #include <fmturl.hxx>
      87             : #include <editeng/lrspitem.hxx>
      88             : #include <editeng/ulspitem.hxx>
      89             : #include <editeng/boxitem.hxx>
      90             : #include <editeng/opaqitem.hxx>
      91             : #include <editeng/prntitem.hxx>
      92             : #include <editeng/shaditem.hxx>
      93             : #include <fmtsrnd.hxx>
      94             : #include <fmtfsize.hxx>
      95             : #include <grfatr.hxx>
      96             : #include <unoframe.hxx>
      97             : #include <fmtanchr.hxx>
      98             : #include <fmtclds.hxx>
      99             : #include <fmtcntnt.hxx>
     100             : #include <frmatr.hxx>
     101             : #include <ndtxt.hxx>
     102             : #include <ndgrf.hxx>
     103             : #include <osl/mutex.hxx>
     104             : #include <vcl/svapp.hxx>
     105             : #include <sfx2/printer.hxx>
     106             : #include <SwStyleNameMapper.hxx>
     107             : #include <editeng/xmlcnitm.hxx>
     108             : #include <poolfmt.hxx>
     109             : #include <pagedesc.hxx>
     110             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
     111             : #include <editeng/frmdiritem.hxx>
     112             : #include <fmtfollowtextflow.hxx>
     113             : #include <fmtwrapinfluenceonobjpos.hxx>
     114             : #include <toolkit/helper/vclunohelper.hxx>
     115             : #include <switerator.hxx>
     116             : #include <comphelper/servicehelper.hxx>
     117             : #include <cppuhelper/supportsservice.hxx>
     118             : 
     119             : //UUUU
     120             : #include <unobrushitemhelper.hxx>
     121             : #include <svx/xfillit0.hxx>
     122             : #include <svx/xbtmpit.hxx>
     123             : #include <svx/xgrscit.hxx>
     124             : #include <svx/xflbmtit.hxx>
     125             : #include <svx/xflbmpit.hxx>
     126             : #include <svx/xflbmsxy.hxx>
     127             : #include <svx/xflbmsxy.hxx>
     128             : #include <svx/xflftrit.hxx>
     129             : #include <svx/xsflclit.hxx>
     130             : #include <svx/xflbmsli.hxx>
     131             : #include <svx/xflbtoxy.hxx>
     132             : #include <svx/xflbstit.hxx>
     133             : #include <svx/xflboxy.hxx>
     134             : #include <svx/xflbckit.hxx>
     135             : #include <svx/unoshape.hxx>
     136             : #include <svx/xflhtit.hxx>
     137             : #include <svx/xfltrit.hxx>
     138             : 
     139             : // from fefly1.cxx
     140             : extern sal_Bool sw_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
     141             : 
     142             : using namespace ::com::sun::star;
     143             : 
     144             : using ::com::sun::star::frame::XModel;
     145             : using ::com::sun::star::container::XNameAccess;
     146             : using ::com::sun::star::style::XStyleFamiliesSupplier;
     147             : 
     148             : const sal_Char sPackageProtocol[] = "vnd.sun.star.Package:";
     149             : const sal_Char sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
     150             : 
     151             : //UUUU
     152             : #define OWN_ATTR_FILLBMP_MODE   (OWN_ATTR_VALUE_START+45)
     153             : 
     154             : /****************************************************************************
     155             :     Rahmenbeschreibung
     156             : ****************************************************************************/
     157        1170 : class BaseFrameProperties_Impl
     158             : {
     159             :     SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
     160             : 
     161             : public:
     162             :     virtual ~BaseFrameProperties_Impl();
     163             : 
     164             :     void            SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal);
     165             :     bool            GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& pAny );
     166             :     bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, bool& rSizeFound);
     167             : 
     168             :     virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound) = 0;
     169             : };
     170             : 
     171        1170 : BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
     172             : {
     173        1170 : }
     174             : 
     175       14478 : void BaseFrameProperties_Impl::SetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any& rVal)
     176             : {
     177       14478 :     aAnyMap.SetValue( nWID, nMemberId, rVal );
     178       14478 : }
     179             : 
     180      119519 : bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const uno::Any*& rpAny)
     181             : {
     182      119519 :     return aAnyMap.FillValue( nWID, nMemberId, rpAny );
     183             : }
     184             : 
     185        1169 : bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound)
     186             : {
     187        1169 :     bool bRet = true;
     188             :     //Anker kommt auf jeden Fall in den Set
     189        1169 :     SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
     190             :     {
     191             :         const ::uno::Any* pAnchorPgNo;
     192        1169 :         if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
     193          85 :             bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
     194             :         const ::uno::Any* pAnchorType;
     195        1169 :         if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
     196         797 :             bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
     197             :     }
     198             : 
     199        1169 :     rToSet.Put(aAnchor);
     200             : 
     201             :     //UUUU check for SvxBrushItem (RES_BACKGROUND) properties
     202        1169 :     const ::uno::Any* pCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
     203        1169 :     const ::uno::Any* pRGBCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
     204        1169 :     const ::uno::Any* pColTrans = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
     205        1169 :     const ::uno::Any* pTrans = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
     206        1169 :     const ::uno::Any* pGrLoc = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
     207        1169 :     const ::uno::Any* pGrURL = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL     );
     208        1169 :     const ::uno::Any* pGrFilter = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter     );
     209        1169 :     const ::uno::Any* pGrTranparency = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency     );
     210             :     const bool bSvxBrushItemPropertiesUsed(
     211         894 :         pCol ||
     212         893 :         pTrans ||
     213         873 :         pGrURL ||
     214         873 :         pGrFilter ||
     215         873 :         pGrLoc ||
     216         873 :         pGrTranparency ||
     217        2019 :         pColTrans ||
     218        1169 :         pRGBCol);
     219             : 
     220             :     //UUUU check for FillStyle properties in the range XATTR_FILL_FIRST, XATTR_FILL_LAST
     221        1169 :     const uno::Any* pXFillStyleItem = 0; GetProperty(XATTR_FILLSTYLE, 0, pXFillStyleItem);
     222        1169 :     const uno::Any* pXFillColorItem = 0; GetProperty(XATTR_FILLCOLOR, 0, pXFillColorItem);
     223             : 
     224             :     // XFillGradientItem: two possible slots supported in UNO API
     225        1169 :     const uno::Any* pXFillGradientItem = 0; GetProperty(XATTR_FILLGRADIENT, MID_FILLGRADIENT, pXFillGradientItem);
     226        1169 :     const uno::Any* pXFillGradientNameItem = 0; GetProperty(XATTR_FILLGRADIENT, MID_NAME, pXFillGradientNameItem);
     227             : 
     228             :     // XFillHatchItem: two possible slots supported in UNO API
     229        1169 :     const uno::Any* pXFillHatchItem = 0; GetProperty(XATTR_FILLHATCH, MID_FILLHATCH, pXFillHatchItem);
     230        1169 :     const uno::Any* pXFillHatchNameItem = 0; GetProperty(XATTR_FILLHATCH, MID_NAME, pXFillHatchNameItem);
     231             : 
     232             :     // XFillBitmapItem: three possible slots supported in UNO API
     233        1169 :     const uno::Any* pXFillBitmapItem = 0; GetProperty(XATTR_FILLBITMAP, MID_BITMAP, pXFillBitmapItem);
     234        1169 :     const uno::Any* pXFillBitmapNameItem = 0; GetProperty(XATTR_FILLBITMAP, MID_NAME, pXFillBitmapNameItem);
     235        1169 :     const uno::Any* pXFillBitmapURLItem = 0; GetProperty(XATTR_FILLBITMAP, MID_GRAFURL, pXFillBitmapURLItem);
     236             : 
     237        1169 :     const uno::Any* pXFillTransparenceItem = 0; GetProperty(XATTR_FILLTRANSPARENCE, 0, pXFillTransparenceItem);
     238        1169 :     const uno::Any* pXGradientStepCountItem = 0; GetProperty(XATTR_GRADIENTSTEPCOUNT, 0, pXGradientStepCountItem);
     239        1169 :     const uno::Any* pXFillBmpPosItem = 0; GetProperty(XATTR_FILLBMP_POS, 0, pXFillBmpPosItem);
     240        1169 :     const uno::Any* pXFillBmpSizeXItem = 0; GetProperty(XATTR_FILLBMP_SIZEX, 0, pXFillBmpSizeXItem);
     241        1169 :     const uno::Any* pXFillBmpSizeYItem = 0; GetProperty(XATTR_FILLBMP_SIZEY, 0, pXFillBmpSizeYItem);
     242             : 
     243             :     // XFillFloatTransparenceItem: two possible slots supported in UNO API
     244        1169 :     const uno::Any* pXFillFloatTransparenceItem = 0; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT, pXFillFloatTransparenceItem);
     245        1169 :     const uno::Any* pXFillFloatTransparenceNameItem = 0; GetProperty(XATTR_FILLFLOATTRANSPARENCE, MID_NAME, pXFillFloatTransparenceNameItem);
     246             : 
     247        1169 :     const uno::Any* pXSecondaryFillColorItem = 0; GetProperty(XATTR_SECONDARYFILLCOLOR, 0, pXSecondaryFillColorItem);
     248        1169 :     const uno::Any* pXFillBmpSizeLogItem = 0; GetProperty(XATTR_FILLBMP_SIZELOG, 0, pXFillBmpSizeLogItem);
     249        1169 :     const uno::Any* pXFillBmpTileOffsetXItem = 0; GetProperty(XATTR_FILLBMP_TILEOFFSETX, 0, pXFillBmpTileOffsetXItem);
     250        1169 :     const uno::Any* pXFillBmpTileOffsetYItem = 0; GetProperty(XATTR_FILLBMP_TILEOFFSETY, 0, pXFillBmpTileOffsetYItem);
     251        1169 :     const uno::Any* pXFillBmpPosOffsetXItem = 0; GetProperty(XATTR_FILLBMP_POSOFFSETX, 0, pXFillBmpPosOffsetXItem);
     252        1169 :     const uno::Any* pXFillBmpPosOffsetYItem = 0; GetProperty(XATTR_FILLBMP_POSOFFSETY, 0, pXFillBmpPosOffsetYItem);
     253        1169 :     const uno::Any* pXFillBackgroundItem = 0; GetProperty(XATTR_FILLBACKGROUND, 0, pXFillBackgroundItem);
     254        1169 :     const uno::Any* pOwnAttrFillBmpItem = 0; GetProperty(OWN_ATTR_FILLBMP_MODE, 0, pOwnAttrFillBmpItem);
     255             : 
     256             :     const bool bXFillStyleItemUsed(
     257         824 :         pXFillStyleItem ||
     258         824 :         pXFillColorItem ||
     259         824 :         pXFillGradientItem || pXFillGradientNameItem ||
     260         824 :         pXFillHatchItem || pXFillHatchNameItem ||
     261         824 :         pXFillBitmapItem || pXFillBitmapNameItem || pXFillBitmapURLItem ||
     262         824 :         pXFillTransparenceItem ||
     263         824 :         pXGradientStepCountItem ||
     264         824 :         pXFillBmpPosItem ||
     265         824 :         pXFillBmpSizeXItem ||
     266         824 :         pXFillBmpSizeYItem ||
     267         824 :         pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem ||
     268         824 :         pXSecondaryFillColorItem ||
     269         824 :         pXFillBmpSizeLogItem ||
     270         824 :         pXFillBmpTileOffsetXItem ||
     271         824 :         pXFillBmpTileOffsetYItem ||
     272         824 :         pXFillBmpPosOffsetXItem ||
     273         824 :         pXFillBmpPosOffsetYItem ||
     274        1993 :         pXFillBackgroundItem ||
     275        1169 :         pOwnAttrFillBmpItem);
     276             : 
     277             :     // use brush items, but *only* if no FillStyle properties are used; if both are used and when applying both
     278             :     // in the obvious order some attributes may be wrong since they are set by the 1st set, but not
     279             :     // redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If
     280             :     // it is necessary for any reason to set both (it should not) a in-between step will be needed
     281             :     // that resets the items for FillAttributes in rToSet to default
     282        1169 :     if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed)
     283             :     {
     284             :         //UUUU create a temporary SvxBrushItem, fill the attributes to it and use it to set
     285             :         // the corresponding FillAttributes
     286          51 :         SvxBrushItem aBrush(RES_BACKGROUND);
     287             : 
     288          51 :         if(pCol)
     289             :         {
     290          27 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR    );
     291             :         }
     292             : 
     293          51 :         if(pColTrans)
     294             :         {
     295          23 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
     296             :         }
     297             : 
     298          51 :         if(pRGBCol)
     299             :         {
     300           1 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
     301             :         }
     302             : 
     303          51 :         if(pTrans)
     304             :         {
     305             :             // don't overwrite transparency with a non-transparence flag
     306           1 :             if(!pColTrans || Any2Bool( *pTrans ))
     307           1 :                 bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
     308             :         }
     309             : 
     310          51 :         if(pGrURL)
     311             :         {
     312           0 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL);
     313             :         }
     314             : 
     315          51 :         if(pGrFilter)
     316             :         {
     317           0 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
     318             :         }
     319             : 
     320          51 :         if(pGrLoc)
     321             :         {
     322           0 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
     323             :         }
     324             : 
     325          51 :         if(pGrTranparency)
     326             :         {
     327           0 :             bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
     328             :         }
     329             : 
     330          51 :         sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
     331             :     }
     332             : 
     333        1169 :     if(bXFillStyleItemUsed)
     334             :     {
     335         345 :         XFillStyleItem aXFillStyleItem;
     336         690 :         SvxBrushItem aBrush(RES_BACKGROUND);
     337             : 
     338         345 :         if(pXFillStyleItem)
     339             :         {
     340         345 :             aXFillStyleItem.PutValue(*pXFillStyleItem);
     341         345 :             rToSet.Put(aXFillStyleItem);
     342             :         }
     343             : 
     344         345 :         if(pXFillColorItem)
     345             :         {
     346           5 :             const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
     347           5 :             XFillColorItem aXFillColorItem(OUString(), aNullCol);
     348             : 
     349           5 :             aXFillColorItem.PutValue(*pXFillColorItem);
     350           5 :             rToSet.Put(aXFillColorItem);
     351             :         }
     352         340 :         else if (aXFillStyleItem.GetValue() == XFILL_SOLID && pCol)
     353             :         {
     354             :             // Fill style is set to solid, but no fill color is given.
     355             :             // On the other hand, we have a BackColor, so use that.
     356         242 :             aBrush.PutValue(*pCol, MID_BACK_COLOR);
     357         242 :             sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
     358             :         }
     359             : 
     360         345 :         if(pXFillGradientItem || pXFillGradientNameItem)
     361             :         {
     362          45 :             if(pXFillGradientItem)
     363             :             {
     364          39 :                 const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
     365          39 :                 XFillGradientItem aXFillGradientItem(aNullGrad);
     366             : 
     367          39 :                 aXFillGradientItem.PutValue(*pXFillGradientItem, MID_FILLGRADIENT);
     368          39 :                 rToSet.Put(aXFillGradientItem);
     369             :             }
     370             : 
     371          45 :             if(pXFillGradientNameItem)
     372             :             {
     373           6 :                 OUString aTempName;
     374             : 
     375           6 :                 if(!(*pXFillGradientNameItem >>= aTempName ))
     376             :                 {
     377           0 :                     throw lang::IllegalArgumentException();
     378             :                 }
     379             : 
     380           6 :                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLGRADIENT, aTempName, rToSet);
     381             :             }
     382             :         }
     383             : 
     384         345 :         if(pXFillHatchItem || pXFillHatchNameItem)
     385             :         {
     386           0 :             if(pXFillHatchItem)
     387             :             {
     388           0 :                 const Color aNullCol(COL_DEFAULT_SHAPE_STROKE);
     389           0 :                 const XHatch aNullHatch(aNullCol);
     390           0 :                 XFillHatchItem aXFillHatchItem(rToSet.GetPool(), aNullHatch);
     391             : 
     392           0 :                 aXFillHatchItem.PutValue(*pXFillHatchItem, MID_FILLHATCH);
     393           0 :                 rToSet.Put(aXFillHatchItem);
     394             :             }
     395             : 
     396           0 :             if(pXFillHatchNameItem)
     397             :             {
     398           0 :                 OUString aTempName;
     399             : 
     400           0 :                 if(!(*pXFillHatchNameItem >>= aTempName ))
     401             :                 {
     402           0 :                     throw lang::IllegalArgumentException();
     403             :                 }
     404             : 
     405           0 :                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLHATCH, aTempName, rToSet);
     406             :             }
     407             :         }
     408             : 
     409         345 :         if(pXFillBitmapItem || pXFillBitmapNameItem || pXFillBitmapURLItem)
     410             :         {
     411           3 :             if(pXFillBitmapItem)
     412             :             {
     413           0 :                 const Graphic aNullGraphic;
     414           0 :                 XFillBitmapItem aXFillBitmapItem(rToSet.GetPool(), aNullGraphic);
     415             : 
     416           0 :                 aXFillBitmapItem.PutValue(*pXFillBitmapItem, MID_BITMAP);
     417           0 :                 rToSet.Put(aXFillBitmapItem);
     418             :             }
     419             : 
     420           3 :             if(pXFillBitmapNameItem)
     421             :             {
     422           3 :                 OUString aTempName;
     423             : 
     424           3 :                 if(!(*pXFillBitmapNameItem >>= aTempName ))
     425             :                 {
     426           0 :                     throw lang::IllegalArgumentException();
     427             :                 }
     428             : 
     429           3 :                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLBITMAP, aTempName, rToSet);
     430             :             }
     431             : 
     432           3 :             if(pXFillBitmapURLItem)
     433             :             {
     434           0 :                 const Graphic aNullGraphic;
     435           0 :                 XFillBitmapItem aXFillBitmapItem(rToSet.GetPool(), aNullGraphic);
     436             : 
     437           0 :                 aXFillBitmapItem.PutValue(*pXFillBitmapURLItem, MID_GRAFURL);
     438           0 :                 rToSet.Put(aXFillBitmapItem);
     439             :             }
     440             :         }
     441             : 
     442         345 :         if(pXFillTransparenceItem)
     443             :         {
     444           0 :             const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
     445           0 :             XFillTransparenceItem aXFillTransparenceItem;
     446             : 
     447           0 :             aXFillTransparenceItem.PutValue(*pXFillTransparenceItem);
     448           0 :             rToSet.Put(aXFillTransparenceItem);
     449             :         }
     450         345 :         else if (aXFillStyleItem.GetValue() == XFILL_SOLID && pColTrans)
     451             :         {
     452             :             // Fill style is set to solid, but no fill transparency is given.
     453             :             // On the other hand, we have a BackColorTransparency, so use that.
     454          31 :             aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
     455          31 :             sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
     456             :         }
     457             : 
     458         345 :         if(pXGradientStepCountItem)
     459             :         {
     460           0 :             XGradientStepCountItem aXGradientStepCountItem;
     461             : 
     462           0 :             aXGradientStepCountItem.PutValue(*pXGradientStepCountItem);
     463           0 :             rToSet.Put(aXGradientStepCountItem);
     464             :         }
     465             : 
     466         345 :         if(pXFillBmpPosItem)
     467             :         {
     468           0 :             XFillBmpPosItem aXFillBmpPosItem;
     469             : 
     470           0 :             aXFillBmpPosItem.PutValue(*pXFillBmpPosItem);
     471           0 :             rToSet.Put(aXFillBmpPosItem);
     472             :         }
     473             : 
     474         345 :         if(pXFillBmpSizeXItem)
     475             :         {
     476           0 :             XFillBmpSizeXItem aXFillBmpSizeXItem;
     477             : 
     478           0 :             aXFillBmpSizeXItem.PutValue(*pXFillBmpSizeXItem);
     479           0 :             rToSet.Put(aXFillBmpSizeXItem);
     480             :         }
     481             : 
     482         345 :         if(pXFillBmpSizeYItem)
     483             :         {
     484           0 :             XFillBmpSizeYItem aXFillBmpSizeYItem;
     485             : 
     486           0 :             aXFillBmpSizeYItem.PutValue(*pXFillBmpSizeYItem);
     487           0 :             rToSet.Put(aXFillBmpSizeYItem);
     488             :         }
     489             : 
     490         345 :         if(pXFillFloatTransparenceItem || pXFillFloatTransparenceNameItem)
     491             :         {
     492          16 :             if(pXFillFloatTransparenceItem)
     493             :             {
     494           0 :                 const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
     495           0 :                 XFillFloatTransparenceItem aXFillFloatTransparenceItem(rToSet.GetPool(), aNullGrad, false);
     496             : 
     497           0 :                 aXFillFloatTransparenceItem.PutValue(*pXFillFloatTransparenceItem, MID_FILLGRADIENT);
     498           0 :                 rToSet.Put(aXFillFloatTransparenceItem);
     499             :             }
     500             : 
     501          16 :             if(pXFillFloatTransparenceNameItem)
     502             :             {
     503          16 :                 OUString aTempName;
     504             : 
     505          16 :                 if(!(*pXFillFloatTransparenceNameItem >>= aTempName ))
     506             :                 {
     507           0 :                     throw lang::IllegalArgumentException();
     508             :                 }
     509             : 
     510          16 :                 bRet &= SvxShape::SetFillAttribute(XATTR_FILLFLOATTRANSPARENCE, aTempName, rToSet);
     511             :             }
     512             :         }
     513             : 
     514         345 :         if(pXSecondaryFillColorItem)
     515             :         {
     516           0 :             const Color aNullCol(COL_DEFAULT_SHAPE_FILLING);
     517           0 :             XSecondaryFillColorItem aXSecondaryFillColorItem(OUString(), aNullCol);
     518             : 
     519           0 :             aXSecondaryFillColorItem.PutValue(*pXSecondaryFillColorItem);
     520           0 :             rToSet.Put(aXSecondaryFillColorItem);
     521             :         }
     522             : 
     523         345 :         if(pXFillBmpSizeLogItem)
     524             :         {
     525           0 :             XFillBmpSizeLogItem aXFillBmpSizeLogItem;
     526             : 
     527           0 :             aXFillBmpSizeLogItem.PutValue(*pXFillBmpSizeLogItem);
     528           0 :             rToSet.Put(aXFillBmpSizeLogItem);
     529             :         }
     530             : 
     531         345 :         if(pXFillBmpTileOffsetXItem)
     532             :         {
     533           0 :             XFillBmpTileOffsetXItem aXFillBmpTileOffsetXItem;
     534             : 
     535           0 :             aXFillBmpTileOffsetXItem.PutValue(*pXFillBmpTileOffsetXItem);
     536           0 :             rToSet.Put(aXFillBmpTileOffsetXItem);
     537             :         }
     538             : 
     539         345 :         if(pXFillBmpTileOffsetYItem)
     540             :         {
     541           0 :             XFillBmpTileOffsetYItem aXFillBmpTileOffsetYItem;
     542             : 
     543           0 :             aXFillBmpTileOffsetYItem.PutValue(*pXFillBmpTileOffsetYItem);
     544           0 :             rToSet.Put(aXFillBmpTileOffsetYItem);
     545             :         }
     546             : 
     547         345 :         if(pXFillBmpPosOffsetXItem)
     548             :         {
     549           0 :             XFillBmpPosOffsetXItem aXFillBmpPosOffsetXItem;
     550             : 
     551           0 :             aXFillBmpPosOffsetXItem.PutValue(*pXFillBmpPosOffsetXItem);
     552           0 :             rToSet.Put(aXFillBmpPosOffsetXItem);
     553             :         }
     554             : 
     555         345 :         if(pXFillBmpPosOffsetYItem)
     556             :         {
     557           0 :             XFillBmpPosOffsetYItem aXFillBmpPosOffsetYItem;
     558             : 
     559           0 :             aXFillBmpPosOffsetYItem.PutValue(*pXFillBmpPosOffsetYItem);
     560           0 :             rToSet.Put(aXFillBmpPosOffsetYItem);
     561             :         }
     562             : 
     563         345 :         if(pXFillBackgroundItem)
     564             :         {
     565           0 :             XFillBackgroundItem aXFillBackgroundItem;
     566             : 
     567           0 :             aXFillBackgroundItem.PutValue(*pXFillBackgroundItem);
     568           0 :             rToSet.Put(aXFillBackgroundItem);
     569             :         }
     570             : 
     571         345 :         if(pOwnAttrFillBmpItem)
     572             :         {
     573             :             drawing::BitmapMode eMode;
     574             : 
     575           3 :             if(!(*pOwnAttrFillBmpItem >>= eMode))
     576             :             {
     577           0 :                 sal_Int32 nMode = 0;
     578             : 
     579           0 :                 if(!(*pOwnAttrFillBmpItem >>= nMode))
     580             :                 {
     581           0 :                     throw lang::IllegalArgumentException();
     582             :                 }
     583             : 
     584           0 :                 eMode = (drawing::BitmapMode)nMode;
     585             :             }
     586             : 
     587           3 :             rToSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
     588           3 :             rToSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
     589         345 :         }
     590             :     }
     591             :     {
     592        1169 :         const ::uno::Any* pCont = 0;
     593        1169 :         GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont );
     594        1169 :         const ::uno::Any* pPos = 0;
     595        1169 :         GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos );
     596        1169 :         const ::uno::Any* pName = 0;
     597        1169 :         GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName );
     598        1169 :         if(pCont||pPos||pName)
     599             :         {
     600           0 :             SvxProtectItem aProt ( static_cast < const :: SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) );
     601           0 :             if(pCont)
     602           0 :                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
     603           0 :             if(pPos )
     604           0 :                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION);
     605           0 :             if(pName)
     606           0 :                 bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE);
     607           0 :             rToSet.Put(aProt);
     608             :         }
     609             :     }
     610             :     {
     611        1169 :         const ::uno::Any* pHori  = 0;
     612        1169 :         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori );
     613        1169 :         const ::uno::Any* pHoriP = 0;
     614        1169 :         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP );
     615        1169 :         const ::uno::Any* pHoriR = 0;
     616        1169 :         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR );
     617        1169 :         const ::uno::Any* pPageT = 0;
     618        1169 :         GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT);
     619        1169 :         if(pHori||pHoriP||pHoriR||pPageT)
     620             :         {
     621         343 :             SwFmtHoriOrient aOrient ( static_cast < const :: SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) );
     622         343 :             if(pHori )
     623         343 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
     624         343 :             if(pHoriP)
     625         281 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
     626         343 :             if(pHoriR)
     627         321 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
     628         343 :             if(pPageT)
     629         199 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
     630         343 :             rToSet.Put(aOrient);
     631             :         }
     632             :     }
     633             : 
     634             :     {
     635        1169 :         const ::uno::Any* pVert  = 0;
     636        1169 :         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert);
     637        1169 :         const ::uno::Any* pVertP = 0;
     638        1169 :         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP );
     639        1169 :         const ::uno::Any* pVertR = 0;
     640        1169 :         GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR );
     641        1169 :         if(pVert||pVertP||pVertR)
     642             :         {
     643         350 :             SwFmtVertOrient aOrient ( static_cast < const :: SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) );
     644         350 :             if(pVert )
     645         350 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
     646         350 :             if(pVertP)
     647         288 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
     648         350 :             if(pVertR)
     649         317 :                 bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
     650         350 :             rToSet.Put(aOrient);
     651             :         }
     652             :     }
     653             :     {
     654        1169 :         const ::uno::Any* pURL = 0;
     655        1169 :         GetProperty(RES_URL, MID_URL_URL, pURL );
     656        1169 :         const ::uno::Any* pTarget = 0;
     657        1169 :         GetProperty(RES_URL, MID_URL_TARGET, pTarget );
     658        1169 :         const ::uno::Any* pHyLNm = 0;
     659        1169 :         GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm );
     660        1169 :         const ::uno::Any* pHySMp = 0;
     661        1169 :         GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp );
     662        1169 :         if(pURL||pTarget||pHyLNm||pHySMp)
     663             :         {
     664           0 :             SwFmtURL aURL ( static_cast < const :: SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) );
     665           0 :             if(pURL)
     666           0 :                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL);
     667           0 :             if(pTarget)
     668           0 :                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET);
     669           0 :             if(pHyLNm)
     670           0 :                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME  );
     671           0 :             if(pHySMp)
     672           0 :                 bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
     673           0 :             rToSet.Put(aURL);
     674             :         }
     675             :     }
     676        1169 :     const ::uno::Any* pL = 0;
     677        1169 :     GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL );
     678        1169 :     const ::uno::Any* pR = 0;
     679        1169 :     GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR );
     680        1169 :     if(pL||pR)
     681             :     {
     682         295 :         SvxLRSpaceItem aLR ( static_cast < const :: SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) );
     683         295 :         if(pL)
     684         295 :             bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
     685         295 :         if(pR)
     686         295 :             bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
     687         295 :         rToSet.Put(aLR);
     688             :     }
     689        1169 :     const ::uno::Any* pT = 0;
     690        1169 :     GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT );
     691        1169 :     const ::uno::Any* pB = 0;
     692        1169 :     GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB );
     693        1169 :     if(pT||pB)
     694             :     {
     695         293 :         SvxULSpaceItem aTB ( static_cast < const :: SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) );
     696         293 :         if(pT)
     697         293 :             bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
     698         293 :         if(pB)
     699         293 :             bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
     700         293 :         rToSet.Put(aTB);
     701             :     }
     702             :     const ::uno::Any* pOp;
     703        1169 :     if(GetProperty(RES_OPAQUE, 0, pOp))
     704             :     {
     705         330 :         SvxOpaqueItem aOp ( static_cast < const :: SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) );
     706         330 :         bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0);
     707         330 :         rToSet.Put(aOp);
     708             :     }
     709             :     const ::uno::Any* pPrt;
     710        1169 :     if(GetProperty(RES_PRINT, 0, pPrt))
     711             :     {
     712           0 :         SvxPrintItem aPrt ( static_cast < const :: SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) );
     713           0 :         bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0);
     714           0 :         rToSet.Put(aPrt);
     715             :     }
     716             :     const ::uno::Any* pSh;
     717        1169 :     if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh))
     718             :     {
     719          47 :         SvxShadowItem aSh ( static_cast < const :: SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) );
     720          47 :         bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
     721          47 :         rToSet.Put(aSh);
     722             :     }
     723             :     const ::uno::Any* pShTr;
     724        1169 :     if(GetProperty(RES_SHADOW, MID_SHADOW_TRANSPARENCE, pShTr) && rToSet.HasItem(RES_SHADOW))
     725             :     {
     726          16 :         SvxShadowItem aSh(static_cast<const SvxShadowItem&>(rToSet.Get(RES_SHADOW)));
     727          16 :         bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE);
     728          16 :         rToSet.Put(aSh);
     729             :     }
     730        1169 :     const ::uno::Any* pSur      = 0;
     731        1169 :     GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
     732        1169 :     const ::uno::Any* pSurAnch = 0;
     733        1169 :     GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
     734        1169 :     if(pSur || pSurAnch)
     735             :     {
     736         138 :         SwFmtSurround aSrnd ( static_cast < const :: SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) );
     737         138 :         if(pSur)
     738         138 :             bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
     739         138 :         if(pSurAnch)
     740          22 :             bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
     741         138 :         rToSet.Put(aSrnd);
     742             :     }
     743        1169 :     const ::uno::Any* pLeft        = 0;
     744        1169 :     GetProperty(RES_BOX, LEFT_BORDER  |CONVERT_TWIPS,    pLeft  );
     745        1169 :     const ::uno::Any* pRight       = 0;
     746        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER ,    pRight );
     747        1169 :     const ::uno::Any* pTop         = 0;
     748        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER     , pTop   );
     749        1169 :     const ::uno::Any* pBottom  = 0;
     750        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER,    pBottom);
     751        1169 :     const ::uno::Any* pDistance    = 0;
     752        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE,  pDistance);
     753        1169 :     const ::uno::Any* pLeftDistance    = 0;
     754        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance);
     755        1169 :     const ::uno::Any* pRightDistance   = 0;
     756        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE,    pRightDistance);
     757        1169 :     const ::uno::Any* pTopDistance     = 0;
     758        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE,  pTopDistance);
     759        1169 :     const ::uno::Any* pBottomDistance  = 0;
     760        1169 :     GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE,   pBottomDistance);
     761        1169 :     const ::uno::Any* pLineStyle  = 0;
     762        1169 :     GetProperty(RES_BOX, LINE_STYLE,   pLineStyle);
     763        1169 :     const ::uno::Any* pLineWidth  = 0;
     764        1169 :     GetProperty(RES_BOX, LINE_WIDTH,   pLineWidth);
     765        1169 :     if( pLeft || pRight || pTop ||  pBottom || pDistance ||
     766         617 :         pLeftDistance  || pRightDistance || pTopDistance || pBottomDistance ||
     767         559 :         pLineStyle || pLineWidth )
     768             :     {
     769         610 :         SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
     770         610 :         if( pLeft )
     771         544 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
     772         610 :         if( pRight )
     773         544 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
     774         610 :         if( pTop )
     775         544 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
     776         610 :         if( pBottom )
     777         544 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
     778         610 :         if( pDistance )
     779           0 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
     780         610 :         if( pLeftDistance )
     781         149 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
     782         610 :         if( pRightDistance )
     783         149 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
     784         610 :         if( pTopDistance )
     785         149 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
     786         610 :         if( pBottomDistance )
     787         149 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
     788         610 :         if( pLineStyle )
     789         323 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineStyle, LINE_STYLE);
     790         610 :         if( pLineWidth )
     791           0 :             bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS);
     792         610 :         rToSet.Put(aBox);
     793             :     }
     794             :     {
     795        1169 :         const ::uno::Any* pRelH = 0;
     796        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH);
     797        1169 :         const ::uno::Any* pRelHRelation = 0;
     798        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT_RELATION, pRelHRelation);
     799        1169 :         const ::uno::Any* pRelW = 0;
     800        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW);
     801        1169 :         const ::uno::Any* pRelWRelation = 0;
     802        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH_RELATION, pRelWRelation);
     803        1169 :         const ::uno::Any* pSyncWidth = 0;
     804        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth);
     805        1169 :         const ::uno::Any* pSyncHeight = 0;
     806        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight);
     807        1169 :         const ::uno::Any* pWidth = 0;
     808        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth);
     809        1169 :         const ::uno::Any* pHeight = 0;
     810        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight);
     811        1169 :         const ::uno::Any* pSize = 0;
     812        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize);
     813        1169 :         const ::uno::Any* pSizeType = 0;
     814        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType);
     815        1169 :         const ::uno::Any* pWidthType = 0;
     816        1169 :         GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType);
     817        1169 :         if( pWidth || pHeight ||pRelH || pRelHRelation || pRelW || pRelWRelation || pSize ||pSizeType ||
     818         395 :             pWidthType ||pSyncWidth || pSyncHeight )
     819             :         {
     820         774 :             rSizeFound = true;
     821         774 :             SwFmtFrmSize aFrmSz ( static_cast < const :: SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
     822         774 :             if(pWidth)
     823         701 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
     824         774 :             if(pHeight)
     825         675 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
     826         774 :             if(pRelH )
     827         185 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
     828         774 :             if (pRelHRelation)
     829           9 :                 bRet &= const_cast<SwFmtFrmSize&>(aFrmSz).PutValue(*pRelHRelation, MID_FRMSIZE_REL_HEIGHT_RELATION);
     830         774 :             if(pRelW )
     831         188 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
     832         774 :             if (pRelWRelation)
     833           9 :                 bRet &= const_cast<SwFmtFrmSize&>(aFrmSz).PutValue(*pRelWRelation, MID_FRMSIZE_REL_WIDTH_RELATION);
     834         774 :             if(pSyncWidth)
     835         182 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
     836         774 :             if(pSyncHeight)
     837         182 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
     838         774 :             if(pSize)
     839         241 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
     840         774 :             if(pSizeType)
     841         143 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
     842         774 :             if(pWidthType)
     843          83 :                 bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE);
     844         774 :             if(!aFrmSz.GetWidth())
     845           3 :                 aFrmSz.SetWidth(MINFLY);
     846         774 :             if(!aFrmSz.GetHeight())
     847          29 :                 aFrmSz.SetHeight(MINFLY);
     848         774 :             rToSet.Put(aFrmSz);
     849             :         }
     850             :         else
     851             :         {
     852         395 :             rSizeFound = false;
     853         395 :             SwFmtFrmSize aFrmSz;
     854         395 :             awt::Size aSize;
     855         395 :             aSize.Width = 2 * MM50;
     856         395 :             aSize.Height = 2 * MM50;
     857         790 :             ::uno::Any aSizeVal;
     858         395 :             aSizeVal <<= aSize;
     859         395 :             ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
     860         790 :             rToSet.Put(aFrmSz);
     861             :         }
     862             :     }
     863        1169 :     const ::uno::Any* pFrameDirection = 0;
     864        1169 :     GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
     865        1169 :     if(pFrameDirection)
     866             :     {
     867          30 :         SvxFrameDirectionItem aAttr(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
     868          30 :         aAttr.PutValue(*pFrameDirection, 0);
     869          30 :         rToSet.Put(aAttr);
     870             :     }
     871        1169 :     const ::uno::Any* pUnknown = 0;
     872        1169 :     GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown);
     873        1169 :     if(pUnknown)
     874             :     {
     875           0 :         SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER);
     876           0 :         aAttr.PutValue(*pUnknown, 0);
     877           0 :         rToSet.Put(aAttr);
     878             :     }
     879             : 
     880             :     // #i18732#
     881        1169 :     const ::uno::Any* pFollowTextFlow = 0;
     882        1169 :     GetProperty(RES_FOLLOW_TEXT_FLOW, 0, pFollowTextFlow);
     883        1169 :     if ( pFollowTextFlow )
     884             :     {
     885           0 :         SwFmtFollowTextFlow aFmtFollowTextFlow;
     886           0 :         aFmtFollowTextFlow.PutValue(*pFollowTextFlow, 0);
     887           0 :         rToSet.Put(aFmtFollowTextFlow);
     888             :     }
     889             : 
     890             :     // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS
     891        1169 :     const ::uno::Any* pWrapInfluenceOnObjPos = 0;
     892        1169 :     GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos);
     893        1169 :     if ( pWrapInfluenceOnObjPos )
     894             :     {
     895           0 :         SwFmtWrapInfluenceOnObjPos aFmtWrapInfluenceOnObjPos;
     896           0 :         aFmtWrapInfluenceOnObjPos.PutValue( *pWrapInfluenceOnObjPos, MID_WRAP_INFLUENCE );
     897           0 :         rToSet.Put(aFmtWrapInfluenceOnObjPos);
     898             :     }
     899             : 
     900             :     {
     901        1169 :         const ::uno::Any* pTextVertAdjust = 0;
     902        1169 :         GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust);
     903        1169 :         if ( pTextVertAdjust )
     904             :         {
     905         297 :             SdrTextVertAdjustItem aTextVertAdjust(static_cast <const :: SdrTextVertAdjustItem & > ( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) ));
     906         297 :             bRet &= ((SfxPoolItem&)aTextVertAdjust).PutValue(*pTextVertAdjust);
     907         297 :             rToSet.Put(aTextVertAdjust);
     908             :         }
     909             :     }
     910             : 
     911        1169 :     return bRet;
     912             : }
     913             : 
     914             : class SwFrameProperties_Impl : public BaseFrameProperties_Impl
     915             : {
     916             : public:
     917             :     SwFrameProperties_Impl();
     918        1370 :     virtual ~SwFrameProperties_Impl(){}
     919             : 
     920             :     bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound) SAL_OVERRIDE;
     921             : };
     922             : 
     923         857 : SwFrameProperties_Impl::SwFrameProperties_Impl():
     924         857 :     BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
     925             : {
     926         857 : }
     927             : 
     928         856 : static inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const :: uno::Any *pAny)
     929             : {
     930         856 :     if ( pAny )
     931             :     {
     932           0 :         SwFmtCol aCol ( static_cast < const :: SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) );
     933           0 :         ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS);
     934           0 :         rToSet.Put(aCol);
     935             :     }
     936         856 : }
     937             : 
     938         856 : bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, bool& rSizeFound)
     939             : {
     940             :     //Properties fuer alle Frames
     941             :     const ::uno::Any *pStyleName;
     942         856 :     SwDocStyleSheet* pStyle = NULL;
     943             :     bool bRet;
     944             : 
     945         856 :     if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
     946             :     {
     947          48 :         OUString sStyle;
     948          48 :         *pStyleName >>= sStyle;
     949          48 :         pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
     950          48 :                                                     SFX_STYLE_FAMILY_FRAME);
     951             :     }
     952             : 
     953         856 :     const ::uno::Any* pColumns = NULL;
     954         856 :     GetProperty (RES_COL, MID_COLUMNS, pColumns);
     955         856 :     if ( pStyle )
     956             :     {
     957          48 :         rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
     958          48 :         const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
     959          48 :            bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
     960          48 :         lcl_FillCol ( rSet, *pItemSet, pColumns );
     961             :     }
     962             :     else
     963             :     {
     964         808 :         const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
     965         808 :            bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
     966         808 :         lcl_FillCol ( rSet, *pItemSet, pColumns );
     967             :     }
     968             :     const ::uno::Any* pEdit;
     969         856 :     if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
     970             :     {
     971           0 :         SfxBoolItem aBool(RES_EDIT_IN_READONLY);
     972           0 :         ((SfxPoolItem&)aBool).PutValue(*pEdit, 0);
     973           0 :         rSet.Put(aBool);
     974             :     }
     975         856 :     return bRet;
     976             : }
     977             : 
     978             : /****************************************************************************
     979             :     Grafik-Descriptor
     980             : ****************************************************************************/
     981             : class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
     982             : {
     983             : public:
     984             :     SwGraphicProperties_Impl();
     985         626 :     virtual ~SwGraphicProperties_Impl(){}
     986             : 
     987             :     virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound) SAL_OVERRIDE;
     988             : };
     989             : 
     990         313 : SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
     991         313 :     BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
     992             : {
     993         313 : }
     994             : 
     995         313 : static inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, bool &rRet )
     996             : {
     997         313 :     if(pHEvenMirror || pHOddMirror || pVMirror )
     998             :     {
     999          12 :         SwMirrorGrf aMirror ( static_cast < const :: SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) );
    1000          12 :         if(pHEvenMirror)
    1001          12 :             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
    1002          12 :         if(pHOddMirror)
    1003          12 :             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
    1004          12 :         if(pVMirror)
    1005          12 :             rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
    1006          12 :         rToSet.Put(aMirror);
    1007             :     }
    1008         313 : }
    1009             : 
    1010         313 : bool SwGraphicProperties_Impl::AnyToItemSet(
    1011             :             SwDoc* pDoc,
    1012             :             SfxItemSet& rFrmSet,
    1013             :             SfxItemSet& rGrSet,
    1014             :             bool& rSizeFound)
    1015             : {
    1016             :     //Properties fuer alle Frames
    1017             :     bool bRet;
    1018             :     const ::uno::Any *pStyleName;
    1019         313 :     SwDocStyleSheet* pStyle = NULL;
    1020             : 
    1021         313 :     if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
    1022             :     {
    1023         135 :         OUString sStyle;
    1024         135 :         *pStyleName >>= sStyle;
    1025         135 :         pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
    1026         135 :                                                     SFX_STYLE_FAMILY_FRAME);
    1027             :     }
    1028             : 
    1029         313 :     const ::uno::Any* pHEvenMirror = 0;
    1030         313 :     const ::uno::Any* pHOddMirror = 0;
    1031         313 :     const ::uno::Any* pVMirror = 0;
    1032         313 :     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror);
    1033         313 :     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror);
    1034         313 :     GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror);
    1035             : 
    1036         313 :     if ( pStyle )
    1037             :     {
    1038         135 :         rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) );
    1039         135 :         const :: SfxItemSet *pItemSet = &xStyle->GetItemSet();
    1040         135 :         bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
    1041         135 :         lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
    1042             :     }
    1043             :     else
    1044             :     {
    1045         178 :         const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
    1046         178 :         bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
    1047         178 :         lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
    1048             :     }
    1049             : 
    1050             :     static const :: sal_uInt16 nIDs[] =
    1051             :     {
    1052             :         RES_GRFATR_CROPGRF,
    1053             :         RES_GRFATR_ROTATION,
    1054             :         RES_GRFATR_LUMINANCE,
    1055             :         RES_GRFATR_CONTRAST,
    1056             :         RES_GRFATR_CHANNELR,
    1057             :         RES_GRFATR_CHANNELG,
    1058             :         RES_GRFATR_CHANNELB,
    1059             :         RES_GRFATR_GAMMA,
    1060             :         RES_GRFATR_INVERT,
    1061             :         RES_GRFATR_TRANSPARENCY,
    1062             :         RES_GRFATR_DRAWMODE,
    1063             :         0
    1064             :     };
    1065             :     const ::uno::Any* pAny;
    1066        3756 :     for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
    1067             :     {
    1068        3443 :         sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
    1069        3443 :         if(GetProperty(nIDs[nIndex], nMId, pAny ))
    1070             :         {
    1071         475 :             SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone();
    1072         475 :             bRet &= pItem->PutValue(*pAny, nMId );
    1073         475 :             rGrSet.Put(*pItem);
    1074         475 :             delete pItem;
    1075             :         }
    1076             :     }
    1077             : 
    1078         313 :     return bRet;
    1079             : }
    1080             : 
    1081             : class SwOLEProperties_Impl : public SwFrameProperties_Impl
    1082             : {
    1083             : public:
    1084         344 :     SwOLEProperties_Impl() :
    1085         344 :         SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){}
    1086         688 :     virtual ~SwOLEProperties_Impl(){}
    1087             : 
    1088             :     virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound) SAL_OVERRIDE;
    1089             : };
    1090             : 
    1091         344 : bool SwOLEProperties_Impl::AnyToItemSet(
    1092             :         SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, bool& rSizeFound)
    1093             : {
    1094             :     const ::uno::Any* pTemp;
    1095        1029 :     if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp)
    1096         663 :          && !GetProperty(FN_EMBEDDED_OBJECT, 0, pTemp) )
    1097           0 :         return false;
    1098         344 :     SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound);
    1099             : 
    1100         344 :     return true;
    1101             : }
    1102             : 
    1103        2200 : class SwXFrame::Impl
    1104             : {
    1105             : private:
    1106             :     ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
    1107             : 
    1108             : public:
    1109             :     ::cppu::OInterfaceContainerHelper m_EventListeners;
    1110             : 
    1111        2201 :     Impl() : m_EventListeners(m_Mutex) { }
    1112             : };
    1113             : 
    1114             : namespace
    1115             : {
    1116             :     class theSwXFrameUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFrameUnoTunnelId > {};
    1117             : }
    1118             : 
    1119       11176 : const :: uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
    1120             : {
    1121       11176 :     return theSwXFrameUnoTunnelId::get().getSeq();
    1122             : }
    1123             : 
    1124       11150 : sal_Int64 SAL_CALL SwXFrame::getSomething( const :: uno::Sequence< sal_Int8 >& rId )
    1125             :     throw(uno::RuntimeException, std::exception)
    1126             : {
    1127       22300 :     if( rId.getLength() == 16
    1128       33450 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    1129       22300 :                                         rId.getConstArray(), 16 ) )
    1130             :     {
    1131          17 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    1132             :     }
    1133       11133 :     return 0;
    1134             : }
    1135             : 
    1136       41097 : TYPEINIT1(SwXFrame, SwClient);
    1137             : 
    1138           0 : OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException, std::exception )
    1139             : {
    1140           0 :     return OUString("SwXFrame");
    1141             : }
    1142             : 
    1143           0 : sal_Bool SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException, std::exception )
    1144             : {
    1145           0 :     return cppu::supportsService(this, rServiceName);
    1146             : }
    1147             : 
    1148        2106 : uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
    1149             : {
    1150        2106 :     uno::Sequence< OUString > aRet(3);
    1151        2106 :     aRet[0] = "com.sun.star.text.BaseFrame";
    1152        2106 :     aRet[1] = "com.sun.star.text.TextContent";
    1153        2106 :     aRet[2] = "com.sun.star.document.LinkTarget";
    1154        2106 :     return aRet;
    1155             : }
    1156             : 
    1157        1170 : SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc)
    1158        1170 :     : m_pImpl(new Impl)
    1159             :     , m_pPropSet(pSet)
    1160             :     , m_pDoc(pDoc)
    1161             :     , eType(eSet)
    1162             :     , bIsDescriptor(true)
    1163        2340 :     , m_pCopySource(0)
    1164             : {
    1165             :     // Register ourselves as a listener to the document (via the page descriptor)
    1166        1170 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    1167             :     // get the property set for the default style data
    1168             :     // First get the model
    1169        1170 :     uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
    1170             :     // Ask the model for it's family supplier interface
    1171        2340 :     uno::Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
    1172             :     // Get the style families
    1173        2340 :     uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
    1174             :     // Get the Frame family (and keep it for later)
    1175        2340 :     const ::uno::Any aAny = xFamilies->getByName ("FrameStyles");
    1176        1170 :     aAny >>= mxStyleFamily;
    1177             :     // In the derived class, we'll ask mxStyleFamily for the relevant default style
    1178             :     // mxStyleFamily is initialised in the SwXFrame constructor
    1179        1170 :     switch(eType)
    1180             :     {
    1181             :         case FLYCNTTYPE_FRM:
    1182             :         {
    1183         513 :             uno::Any aAny2 = mxStyleFamily->getByName ("Frame");
    1184         513 :             aAny2 >>= mxStyleData;
    1185         513 :             pProps = new SwFrameProperties_Impl( );
    1186             :         }
    1187         513 :         break;
    1188             :         case FLYCNTTYPE_GRF:
    1189             :         {
    1190         313 :             uno::Any aAny2 = mxStyleFamily->getByName ("Graphics");
    1191         313 :             aAny2 >>= mxStyleData;
    1192         313 :             pProps = new SwGraphicProperties_Impl( );
    1193             :         }
    1194         313 :         break;
    1195             :         case FLYCNTTYPE_OLE:
    1196             :         {
    1197         344 :             uno::Any aAny2 = mxStyleFamily->getByName ("OLE");
    1198         344 :             aAny2 >>= mxStyleData;
    1199         344 :             pProps = new SwOLEProperties_Impl( );
    1200             :         }
    1201         344 :         break;
    1202             : 
    1203             :         default:
    1204           0 :             pProps = NULL;
    1205             :             ;
    1206        1170 :     }
    1207        1170 : }
    1208             : 
    1209        1031 : SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet)
    1210             :     : SwClient( &rFrmFmt )
    1211        1031 :     , m_pImpl(new Impl)
    1212             :     ,
    1213             :     m_pPropSet(pSet),
    1214             :     m_pDoc( 0 ),
    1215             :     eType(eSet),
    1216             :     pProps(0),
    1217             :     bIsDescriptor(false),
    1218        2062 :     m_pCopySource(0)
    1219             : {
    1220             : 
    1221        1031 : }
    1222             : 
    1223        4400 : SwXFrame::~SwXFrame()
    1224             : {
    1225        2200 :     delete m_pCopySource;
    1226        2200 :     delete pProps;
    1227        2200 : }
    1228             : 
    1229         490 : OUString SwXFrame::getName(void) throw( uno::RuntimeException, std::exception )
    1230             : {
    1231         490 :     SolarMutexGuard aGuard;
    1232         490 :     SwFrmFmt* pFmt = GetFrmFmt();
    1233         490 :     if(pFmt)
    1234         307 :         return pFmt->GetName();
    1235         183 :     if(!bIsDescriptor)
    1236           0 :         throw uno::RuntimeException();
    1237         183 :     return m_sName;
    1238             : }
    1239             : 
    1240         706 : void SwXFrame::setName(const OUString& rName) throw( uno::RuntimeException, std::exception )
    1241             : {
    1242         706 :     SolarMutexGuard aGuard;
    1243         706 :     SwFrmFmt* pFmt = GetFrmFmt();
    1244         706 :     if(pFmt)
    1245             :     {
    1246         353 :         pFmt->GetDoc()->SetFlyName((SwFlyFrmFmt&)*pFmt, rName);
    1247         353 :         if(pFmt->GetName() != rName)
    1248             :         {
    1249          39 :             throw uno::RuntimeException();
    1250             :         }
    1251             :     }
    1252         353 :     else if(bIsDescriptor)
    1253         353 :         m_sName = rName;
    1254             :     else
    1255           0 :         throw uno::RuntimeException();
    1256         667 : }
    1257             : 
    1258        2705 : uno::Reference< beans::XPropertySetInfo >  SwXFrame::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception )
    1259             : {
    1260        2705 :     uno::Reference< beans::XPropertySetInfo >  xRef;
    1261        2705 :     static uno::Reference< beans::XPropertySetInfo >  xFrmRef;
    1262        2705 :     static uno::Reference< beans::XPropertySetInfo >  xGrfRef;
    1263        2705 :     static uno::Reference< beans::XPropertySetInfo >  xOLERef;
    1264        2705 :     switch(eType)
    1265             :     {
    1266             :     case FLYCNTTYPE_FRM:
    1267        2206 :         if( !xFrmRef.is() )
    1268          11 :             xFrmRef = m_pPropSet->getPropertySetInfo();
    1269        2206 :         xRef = xFrmRef;
    1270        2206 :         break;
    1271             :     case FLYCNTTYPE_GRF:
    1272         373 :         if( !xGrfRef.is() )
    1273          10 :             xGrfRef = m_pPropSet->getPropertySetInfo();
    1274         373 :         xRef = xGrfRef;
    1275         373 :         break;
    1276             :     case FLYCNTTYPE_OLE:
    1277         126 :         if( !xOLERef.is() )
    1278           7 :             xOLERef = m_pPropSet->getPropertySetInfo();
    1279         126 :         xRef = xOLERef;
    1280         126 :         break;
    1281             :     default:
    1282             :         ;
    1283             :     }
    1284        2705 :     return xRef;
    1285             : }
    1286             : 
    1287          62 : void SwXFrame::SetSelection(SwPaM& rCopySource)
    1288             : {
    1289          62 :     delete m_pCopySource;
    1290          62 :     m_pCopySource = new SwPaM( *rCopySource.Start() );
    1291          62 :     m_pCopySource->SetMark();
    1292          62 :     *m_pCopySource->GetMark() = *rCopySource.End();
    1293          62 : }
    1294             : 
    1295        2295 : SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
    1296             : {
    1297        2295 :     SdrObject* pObject = pFmt->FindSdrObject();
    1298        2295 :     if( !pObject )
    1299             :     {
    1300         941 :         SwDoc *pDoc = pFmt->GetDoc();
    1301             :         // #i52858# - method name changed
    1302         941 :         SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel();
    1303             :         SwFlyDrawContact* pContactObject
    1304         941 :                     = new SwFlyDrawContact( pFmt, pDrawModel );
    1305         941 :         pObject = pContactObject->GetMaster();
    1306             : 
    1307         941 :         const :: SwFmtSurround& rSurround = pFmt->GetSurround();
    1308             :         pObject->SetLayer(
    1309        1087 :             ( SURROUND_THROUGHT == rSurround.GetSurround() &&
    1310         218 :               !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId()
    1311        1954 :                                              : pDoc->GetHeavenId() );
    1312             : 
    1313         941 :         pDrawModel->GetPage(0)->InsertObject( pObject );
    1314             :     }
    1315             : 
    1316        2295 :     return pObject;
    1317             : }
    1318             : 
    1319         210 : static SwFrmFmt *lcl_GetFrmFmt( const :: uno::Any& rValue, SwDoc *pDoc )
    1320             : {
    1321         210 :     SwFrmFmt *pRet = 0;
    1322         210 :     SwDocShell* pDocSh = pDoc->GetDocShell();
    1323         210 :     if(pDocSh)
    1324             :     {
    1325         210 :         OUString uTemp;
    1326         210 :         rValue >>= uTemp;
    1327         420 :         OUString sStyle;
    1328             :         SwStyleNameMapper::FillUIName(uTemp, sStyle,
    1329         210 :                 nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, true);
    1330             :         SwDocStyleSheet* pStyle =
    1331         210 :                 (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle,
    1332         210 :                                                     SFX_STYLE_FAMILY_FRAME);
    1333         210 :         if(pStyle)
    1334         420 :             pRet = pStyle->GetFrmFmt();
    1335             :     }
    1336             : 
    1337         210 :     return pRet;
    1338             : }
    1339             : 
    1340       26062 : void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::Any& _rValue)
    1341             :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1342             : {
    1343       26062 :     SolarMutexGuard aGuard;
    1344       26062 :     SwFrmFmt* pFmt = GetFrmFmt();
    1345       26062 :     const :: SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1346             : 
    1347       26062 :     if (!pEntry)
    1348        2720 :         throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    1349             : 
    1350             :     //UUUU
    1351       23342 :     const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
    1352       46684 :     uno::Any aValue(_rValue);
    1353             : 
    1354             :     //UUUU check for needed metric translation
    1355       23342 :     if(pEntry->nMemberId & SFX_METRIC_ITEM)
    1356             :     {
    1357           3 :         bool bDoIt(true);
    1358             : 
    1359           3 :         if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
    1360             :         {
    1361             :             // exception: If these ItemTypes are used, do not convert when these are negative
    1362             :             // since this means they are intended as percent values
    1363           0 :             sal_Int32 nValue = 0;
    1364             : 
    1365           0 :             if(aValue >>= nValue)
    1366             :             {
    1367           0 :                 bDoIt = nValue > 0;
    1368             :             }
    1369             :         }
    1370             : 
    1371           3 :         if(bDoIt)
    1372             :         {
    1373           3 :             const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrmFmt()->GetDoc());
    1374           3 :             const SfxItemPool& rPool = pDoc->GetAttrPool();
    1375           3 :             const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
    1376             : 
    1377           3 :             if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    1378             :             {
    1379           3 :                 SvxUnoConvertFromMM(eMapUnit, aValue);
    1380             :             }
    1381             :         }
    1382             :     }
    1383             : 
    1384       23342 :     if(pFmt)
    1385             :     {
    1386        8864 :         bool bNextFrame = false;
    1387        8864 :         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    1388           6 :             throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    1389             : 
    1390        8858 :         SwDoc* pDoc = pFmt->GetDoc();
    1391       27044 :         if ( ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) ||
    1392       17666 :             (FN_PARAM_COUNTOUR_PP        == pEntry->nWID) ||
    1393       26500 :             (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) ||
    1394        8821 :             (FN_UNO_IS_PIXEL_CONTOUR     == pEntry->nWID) )
    1395             :         {
    1396          37 :             const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1397          37 :             if(pIdx)
    1398             :             {
    1399          37 :                 SwNodeIndex aIdx(*pIdx, 1);
    1400          37 :                 SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    1401          37 :                 if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
    1402             :                 {
    1403          24 :                     drawing::PointSequenceSequence aParam;
    1404          24 :                     if(!aValue.hasValue())
    1405          24 :                         pNoTxt->SetContour(0);
    1406           0 :                     else if(aValue >>= aParam)
    1407             :                     {
    1408           0 :                         PolyPolygon aPoly((sal_uInt16)aParam.getLength());
    1409           0 :                         for(sal_Int32 i = 0; i < aParam.getLength(); i++)
    1410             :                         {
    1411           0 :                             const :: drawing::PointSequence* pPointSeq = aParam.getConstArray();
    1412           0 :                             sal_Int32 nPoints = pPointSeq[i].getLength();
    1413           0 :                             const :: awt::Point* pPoints = pPointSeq[i].getConstArray();
    1414           0 :                             Polygon aSet( (sal_uInt16)nPoints );
    1415           0 :                             for(sal_Int32 j = 0; j < nPoints; j++)
    1416             :                             {
    1417           0 :                                 Point aPoint(pPoints[j].X, pPoints[j].Y);
    1418           0 :                                 aSet.SetPoint(aPoint, (sal_uInt16)j);
    1419             :                             }
    1420             :                             // Close polygon if it isn't closed already.
    1421           0 :                             aSet.Optimize( POLY_OPTIMIZE_CLOSE );
    1422           0 :                             aPoly.Insert( aSet );
    1423           0 :                         }
    1424           0 :                         pNoTxt->SetContourAPI( &aPoly );
    1425             :                     }
    1426             :                     else
    1427           0 :                         throw lang::IllegalArgumentException();
    1428             :                 }
    1429          13 :                 else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
    1430             :                 {
    1431           0 :                     pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() );
    1432             :                 }
    1433          13 :                 else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
    1434             :                 {
    1435             :                     // The IsPixelContour property can only be set if there
    1436             :                     // is no contour, or if the contour has been set by the
    1437             :                     // API itself (or in other words, if the contour isn't
    1438             :                     // used already).
    1439           0 :                     if( !pNoTxt->_HasContour() ||
    1440           0 :                         !pNoTxt->IsContourMapModeValid() )
    1441           0 :                         pNoTxt->SetPixelContour( *(sal_Bool *)aValue.getValue() );
    1442             :                     else
    1443           0 :                         throw lang::IllegalArgumentException();
    1444             :                 }
    1445             :                 else
    1446             :                 {
    1447          13 :                     SfxItemSet aSet(pNoTxt->GetSwAttrSet());
    1448          13 :                     m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
    1449          13 :                     pNoTxt->SetAttr(aSet);
    1450          37 :                 }
    1451             :             }
    1452             :         }
    1453             :         // New attribute Title
    1454        8821 :         else if( FN_UNO_TITLE == pEntry->nWID )
    1455             :         {
    1456         416 :             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    1457             :             OSL_ENSURE( pFmt,
    1458             :                     "unexpected type of <pFmt> --> crash" );
    1459         416 :             OUString sTitle;
    1460         416 :             aValue >>= sTitle;
    1461             :             // assure that <SdrObject> instance exists.
    1462         416 :             GetOrCreateSdrObject( pFlyFmt );
    1463         416 :             pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), sTitle );
    1464             :         }
    1465             :         // New attribute Description
    1466        8405 :         else if( FN_UNO_DESCRIPTION == pEntry->nWID )
    1467             :         {
    1468         421 :             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    1469             :             OSL_ENSURE( pFmt,
    1470             :                     "unexpected type of <pFmt> --> crash" );
    1471         421 :             OUString sDescription;
    1472         421 :             aValue >>= sDescription;
    1473             :             // assure that <SdrObject> instance exists.
    1474         421 :             GetOrCreateSdrObject( pFlyFmt );
    1475         421 :             pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), sDescription );
    1476             :         }
    1477        7984 :         else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
    1478             :         {
    1479          27 :             SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
    1480          27 :             if( pFrmFmt )
    1481             :             {
    1482          27 :                 UnoActionContext aAction(pFmt->GetDoc());
    1483             : 
    1484          27 :                 SfxItemSet* pSet = 0;
    1485             :                 // #i31771#, #i25798# - No adjustment of
    1486             :                 // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
    1487             :                 // if document is currently in reading mode.
    1488          27 :                 if ( !pFmt->GetDoc()->IsInReading() )
    1489             :                 {
    1490             :                     // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, bool bKeepOrient, Point* pDocPos )
    1491          19 :                     SwFlyFrm *pFly = 0;
    1492             :                     {
    1493          19 :                         const :: SwFrmFmt* pFmtXX = pFmt;
    1494          19 :                         if (PTR_CAST(SwFlyFrmFmt, pFmtXX))
    1495          19 :                             pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm();
    1496             :                     }
    1497          19 :                     if ( pFly )
    1498             :                     {
    1499             :                         const :: SfxPoolItem* pItem;
    1500          19 :                         if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, false, &pItem ))
    1501             :                         {
    1502          19 :                             pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
    1503          19 :                             pSet->Put( *pItem );
    1504          38 :                             if ( pFmt->GetDoc()->GetEditShell() != NULL
    1505          19 :                                  && !sw_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, *pSet ) )
    1506           1 :                                 delete pSet, pSet = 0;
    1507             :                         }
    1508             :                     }
    1509             :                 }
    1510             : 
    1511          27 :                 pFmt->GetDoc()->SetFrmFmtToFly( *pFmt, *pFrmFmt, pSet, false );
    1512          27 :                 delete pSet;
    1513             :             }
    1514             :             else
    1515           0 :                 throw lang::IllegalArgumentException();
    1516             :         }
    1517       15909 :         else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID ||
    1518        7952 :                 FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
    1519             :         {
    1520           6 :             OUString sGrfName;
    1521          12 :             OUString sFltName;
    1522           6 :             GraphicObject *pGrfObj = 0;
    1523           6 :             pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
    1524          12 :             OUString sTmp;
    1525           6 :             aValue >>= sTmp;
    1526          12 :             UnoActionContext aAction(pFmt->GetDoc());
    1527           6 :             if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
    1528             :             {
    1529           5 :                 if( sTmp.startsWith(sPackageProtocol) )
    1530             :                 {
    1531           0 :                     pGrfObj = new GraphicObject;
    1532           0 :                     pGrfObj->SetUserData( sTmp );
    1533           0 :                     pGrfObj->SetSwapState();
    1534           0 :                     sGrfName = "";
    1535             :                 }
    1536           5 :                 else if( sTmp.startsWith(sGraphicObjectProtocol) )
    1537             :                 {
    1538             :                     const OString sId(OUStringToOString(
    1539           0 :                         sTmp.copy(sizeof(sGraphicObjectProtocol)-1),
    1540           0 :                         RTL_TEXTENCODING_ASCII_US));
    1541           0 :                     pGrfObj = new GraphicObject( sId );
    1542           0 :                     sGrfName = "";
    1543             :                 }
    1544             :                 else
    1545             :                 {
    1546           5 :                     sGrfName = sTmp;
    1547             :                 }
    1548             :             }
    1549             :             else
    1550             :             {
    1551           1 :                 sFltName = sTmp;
    1552             :             }
    1553             : 
    1554           6 :             const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1555           6 :             if(pIdx)
    1556             :             {
    1557           6 :                 SwNodeIndex aIdx(*pIdx, 1);
    1558             : //              SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    1559           6 :                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
    1560           6 :                 if(!pGrfNode)
    1561             :                 {
    1562           0 :                     delete pGrfObj;
    1563           0 :                     throw uno::RuntimeException();
    1564             :                 }
    1565          12 :                 SwPaM aGrfPaM(*pGrfNode);
    1566           6 :                 pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
    1567          12 :                                         pGrfObj );
    1568             :             }
    1569          12 :             delete pGrfObj;
    1570             :         }
    1571        7951 :         else if( FN_UNO_GRAPHIC == pEntry->nWID )
    1572             :         {
    1573           0 :             uno::Reference< graphic::XGraphic > xGraphic;
    1574           0 :             aValue >>= xGraphic;
    1575           0 :             if(xGraphic.is())
    1576             :             {
    1577           0 :                 const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1578           0 :                 if(pIdx)
    1579             :                 {
    1580           0 :                     SwNodeIndex aIdx(*pIdx, 1);
    1581           0 :                     SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
    1582           0 :                     if(!pGrfNode)
    1583             :                     {
    1584           0 :                         throw uno::RuntimeException();
    1585             :                     }
    1586           0 :                     SwPaM aGrfPaM(*pGrfNode);
    1587           0 :                     Graphic aGraphic( xGraphic );
    1588           0 :                     pFmt->GetDoc()->ReRead( aGrfPaM, OUString(), OUString(), &aGraphic, 0 );
    1589             :                 }
    1590           0 :             }
    1591             :         }
    1592        7951 :         else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID )
    1593             :         {
    1594          30 :             bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID;
    1595          30 :             bool bApply = false;
    1596          30 :             Graphic aGraphic;
    1597          30 :             if( bURL )
    1598             :             {
    1599           8 :                 GraphicObject *pGrfObj = 0;
    1600           8 :                 OUString aGrfUrl;
    1601           8 :                 aValue >>= aGrfUrl;
    1602             : 
    1603             :                 // the package URL based graphics are handled in different way currently
    1604             :                 // TODO/LATER: actually this is the correct place to handle them
    1605          16 :                 OUString aGraphicProtocol( sGraphicObjectProtocol );
    1606           8 :                 if( aGrfUrl.startsWith( aGraphicProtocol ) )
    1607             :                 {
    1608             :                     OString sId(OUStringToOString(
    1609           0 :                         aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1),
    1610           0 :                         RTL_TEXTENCODING_ASCII_US));
    1611           0 :                     pGrfObj = new GraphicObject( sId );
    1612           0 :                     aGraphic = pGrfObj->GetGraphic();
    1613           0 :                     bApply = true;
    1614           8 :                 }
    1615             :             }
    1616             :             else
    1617             :             {
    1618          22 :                 uno::Reference< graphic::XGraphic > xGraphic;
    1619          22 :                 aValue >>= xGraphic;
    1620          22 :                 if( xGraphic.is() )
    1621             :                 {
    1622          22 :                     aGraphic = Graphic( xGraphic );
    1623          22 :                     bApply = true;
    1624          22 :                 }
    1625             :             }
    1626             : 
    1627          30 :             if ( bApply )
    1628             :             {
    1629          22 :                 const :: SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    1630          22 :                 if ( pCnt->GetCntntIdx() && pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ] )
    1631             :                 {
    1632          22 :                     SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode();
    1633             : 
    1634          22 :                     if ( pOleNode )
    1635             :                     {
    1636          22 :                         svt::EmbeddedObjectRef &rObj = pOleNode->GetOLEObj().GetObject();
    1637             : 
    1638          22 :                         OUString aMediaType;
    1639          22 :                         rObj.SetGraphic( aGraphic, aMediaType );
    1640             :                     }
    1641             :                 }
    1642          30 :             }
    1643             :         }
    1644        7921 :         else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
    1645        7921 :             || rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
    1646             :         {
    1647           1 :             OUString sChainName;
    1648           1 :             aValue >>= sChainName;
    1649           1 :             if (sChainName.isEmpty())
    1650             :             {
    1651           0 :                 if(bNextFrame)
    1652           0 :                     pDoc->Unchain(*pFmt);
    1653             :                 else
    1654             :                 {
    1655           0 :                     SwFmtChain aChain( pFmt->GetChain() );
    1656           0 :                     SwFrmFmt *pPrev = aChain.GetPrev();
    1657           0 :                     if(pPrev)
    1658           0 :                         pDoc->Unchain(*pPrev);
    1659             :                 }
    1660             :             }
    1661             :             else
    1662             :             {
    1663           1 :                 sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
    1664             : 
    1665           1 :                 SwFrmFmt* pChain = 0;
    1666           1 :                 for( sal_uInt16 i = 0; i < nCount; i++)
    1667             :                 {
    1668           1 :                     SwFrmFmt* pFmt2 = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
    1669           1 :                     if(sChainName == pFmt2->GetName() )
    1670             :                     {
    1671           1 :                         pChain = pFmt2;
    1672           1 :                         break;
    1673             :                     }
    1674             :                 }
    1675           1 :                 if(pChain)
    1676             :                 {
    1677           1 :                     SwFrmFmt* pSource = bNextFrame ? pFmt : pChain;
    1678           1 :                     SwFrmFmt* pDest = bNextFrame ? pChain: pFmt;
    1679           1 :                     pDoc->Chain(*pSource, *pDest);
    1680             :                 }
    1681           1 :             }
    1682             :         }
    1683        7920 :         else if(FN_UNO_Z_ORDER == pEntry->nWID)
    1684             :         {
    1685         353 :             sal_Int32 nZOrder = - 1;
    1686         353 :             aValue >>= nZOrder;
    1687         353 :             if( nZOrder >= 0)
    1688             :             {
    1689             :                 SdrObject* pObject =
    1690         353 :                     GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
    1691         353 :                 SdrModel *pDrawModel = pDoc->GetDrawModel();
    1692         353 :                 pDrawModel->GetPage(0)->
    1693         353 :                             SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
    1694             :             }
    1695             :         }
    1696        7567 :         else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == nMemberId)
    1697             :         {
    1698           0 :             bool bDone = false;
    1699           0 :             uno::Reference<text::XTextFrame> xFrame;
    1700           0 :             if(aValue >>= xFrame)
    1701             :             {
    1702           0 :                 uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
    1703           0 :                 SwXFrame* pFrame = xTunnel.is() ?
    1704           0 :                         reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
    1705           0 :                         : 0;
    1706           0 :                 if(pFrame && this != pFrame && pFrame->GetFrmFmt() && pFrame->GetFrmFmt()->GetDoc() == pDoc)
    1707             :                 {
    1708           0 :                     SfxItemSet aSet( pDoc->GetAttrPool(),
    1709           0 :                                 RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
    1710           0 :                     aSet.SetParent(&pFmt->GetAttrSet());
    1711           0 :                     SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
    1712             : 
    1713           0 :                     SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
    1714           0 :                     aAnchor.SetAnchor(&aPos);
    1715           0 :                     aAnchor.SetType(FLY_AT_FLY);
    1716           0 :                     aSet.Put(aAnchor);
    1717           0 :                     pDoc->SetFlyFrmAttr( *pFmt, aSet );
    1718           0 :                     bDone = true;
    1719           0 :                 }
    1720             :             }
    1721           0 :             if(!bDone)
    1722           0 :                 throw lang::IllegalArgumentException();
    1723             :         }
    1724             :         else
    1725             :         {   //UUUU
    1726             :             // standard UNO API write attributes
    1727             :             // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
    1728        7567 :             SfxItemSet aSet( pDoc->GetAttrPool(),
    1729             :                 RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
    1730             :                 RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
    1731             : 
    1732             :                 //UUUU FillAttribute support
    1733             :                 XATTR_FILL_FIRST, XATTR_FILL_LAST,
    1734             : 
    1735        7567 :                 0L);
    1736        7567 :             bool bDone(false);
    1737             : 
    1738        7567 :             aSet.SetParent(&pFmt->GetAttrSet());
    1739             : 
    1740        7567 :             if(RES_BACKGROUND == pEntry->nWID)
    1741             :             {
    1742          14 :                 const SwAttrSet& rSet = pFmt->GetAttrSet();
    1743          14 :                 const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
    1744          28 :                 SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
    1745             : 
    1746          14 :                 aChangedBrushItem.PutValue(aValue, nMemberId);
    1747             : 
    1748          14 :                 if(!(aChangedBrushItem == aOriginalBrushItem))
    1749             :                 {
    1750          14 :                     sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
    1751          14 :                     pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
    1752             :                 }
    1753             : 
    1754          28 :                 bDone = true;
    1755             :             }
    1756        7553 :             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
    1757             :             {
    1758             :                 //UUUU
    1759             :                 drawing::BitmapMode eMode;
    1760             : 
    1761           0 :                 if(!(aValue >>= eMode))
    1762             :                 {
    1763           0 :                     sal_Int32 nMode = 0;
    1764             : 
    1765           0 :                     if(!(aValue >>= nMode))
    1766             :                     {
    1767           0 :                         throw lang::IllegalArgumentException();
    1768             :                     }
    1769             : 
    1770           0 :                     eMode = (drawing::BitmapMode)nMode;
    1771             :                 }
    1772             : 
    1773           0 :                 aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
    1774           0 :                 aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
    1775           0 :                 pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
    1776           0 :                 bDone = true;
    1777             :             }
    1778             : 
    1779        7567 :             if(!bDone)
    1780             :             {
    1781        7553 :                 m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
    1782             :             }
    1783             : 
    1784        7567 :             if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == nMemberId)
    1785             :             {
    1786         610 :                 SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID);
    1787         610 :                 if(aAnchor.GetAnchorId() == FLY_AT_FLY)
    1788             :                 {
    1789           2 :                     const :: SwPosition* pPosition = aAnchor.GetCntntAnchor();
    1790           2 :                     SwFrmFmt* pFlyFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0;
    1791           2 :                     if(!pFlyFmt || pFlyFmt->Which() == RES_DRAWFRMFMT)
    1792             :                     {
    1793           2 :                         lang::IllegalArgumentException aExcept;
    1794           2 :                         aExcept.Message = "Anchor to frame: no frame found";
    1795           2 :                         throw aExcept;
    1796             :                     }
    1797             :                     else
    1798             :                     {
    1799           0 :                         SwPosition aPos = *pPosition;
    1800           0 :                         aPos.nNode = *pFlyFmt->GetCntnt().GetCntntIdx();
    1801           0 :                         aAnchor.SetAnchor(&aPos);
    1802           0 :                         aSet.Put(aAnchor);
    1803             :                     }
    1804             :                 }
    1805        1208 :                 else if ((aAnchor.GetAnchorId() != FLY_AT_PAGE) &&
    1806         600 :                          !aAnchor.GetCntntAnchor())
    1807             :                 {
    1808           1 :                     SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
    1809           1 :                     SwPaM aPam(rNode);
    1810           1 :                     aPam.Move( fnMoveBackward, fnGoDoc );
    1811           1 :                     aAnchor.SetAnchor( aPam.Start() );
    1812           1 :                     aSet.Put(aAnchor);
    1813             :                 }
    1814             : 
    1815             :                 // #i31771#, #i25798# - No adjustment of
    1816             :                 // anchor ( no call of method <sw_ChkAndSetNewAnchor(..)> ),
    1817             :                 // if document is currently in reading mode.
    1818         608 :                 if ( !pFmt->GetDoc()->IsInReading() )
    1819             :                 {
    1820             :                     // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
    1821          18 :                     SwFlyFrm *pFly = 0;
    1822          18 :                     if (PTR_CAST(SwFlyFrmFmt, pFmt))
    1823          18 :                         pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm();
    1824          18 :                     if (pFly)
    1825             :                     {
    1826             :                         const :: SfxPoolItem* pItem;
    1827          18 :                         if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, false, &pItem ))
    1828             :                         {
    1829          18 :                             aSet.Put( *pItem );
    1830          18 :                             if ( pFmt->GetDoc()->GetEditShell() != NULL )
    1831             :                             {
    1832          18 :                                 sw_ChkAndSetNewAnchor( *(pFmt->GetDoc()->GetEditShell()), *pFly, aSet );
    1833             :                             }
    1834             :                         }
    1835             :                     }
    1836             :                 }
    1837             : 
    1838         610 :                 pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
    1839             :             }
    1840        6957 :             else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID || FN_EMBEDDED_OBJECT == pEntry->nWID)
    1841             :             {
    1842           0 :                 throw lang::IllegalArgumentException();
    1843             :             }
    1844             :             else
    1845        6959 :                 pFmt->SetFmtAttr(aSet);
    1846             :         }
    1847             :     }
    1848       14478 :     else if(IsDescriptor())
    1849             :     {
    1850       14478 :         pProps->SetProperty(pEntry->nWID, nMemberId, aValue);
    1851       14478 :         if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID )
    1852             :         {
    1853         183 :             OUString sStyleName;
    1854         183 :             aValue >>= sStyleName;
    1855             :             try
    1856             :             {
    1857         183 :                 uno::Any aAny = mxStyleFamily->getByName ( sStyleName );
    1858         183 :                 aAny >>= mxStyleData;
    1859             :             }
    1860           0 :             catch ( container::NoSuchElementException const & )
    1861             :             {
    1862             :             }
    1863           0 :             catch ( lang::WrappedTargetException const  & )
    1864             :             {
    1865             :             }
    1866           0 :             catch ( uno::RuntimeException const & )
    1867             :             {
    1868         183 :             }
    1869             :         }
    1870             :     }
    1871             :     else
    1872       26062 :         throw uno::RuntimeException();
    1873       23334 : }
    1874             : 
    1875        6120 : uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
    1876             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1877             : {
    1878        6120 :     SolarMutexGuard aGuard;
    1879        6120 :     uno::Any aAny;
    1880        6120 :     SwFrmFmt* pFmt = GetFrmFmt();
    1881        6120 :     const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1882        6120 :     if (!pEntry)
    1883         302 :         throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    1884             : 
    1885             :     //UUUU
    1886        5818 :     const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
    1887             : 
    1888        5818 :     if(FN_UNO_ANCHOR_TYPES == pEntry->nWID)
    1889             :     {
    1890           6 :         uno::Sequence<text::TextContentAnchorType> aTypes(5);
    1891           6 :          text::TextContentAnchorType* pArray = aTypes.getArray();
    1892           6 :         pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
    1893           6 :         pArray[1] = text::TextContentAnchorType_AS_CHARACTER;
    1894           6 :         pArray[2] = text::TextContentAnchorType_AT_PAGE;
    1895           6 :         pArray[3] = text::TextContentAnchorType_AT_FRAME;
    1896           6 :         pArray[4] = text::TextContentAnchorType_AT_CHARACTER;
    1897           6 :         aAny.setValue(&aTypes, ::getCppuType(static_cast<uno::Sequence<text::TextContentAnchorType>*>(0)));
    1898             :     }
    1899        5812 :     else if(pFmt)
    1900             :     {
    1901        9518 :         if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
    1902        4407 :                 pEntry &&
    1903        1935 :                 (isGRFATR(pEntry->nWID) ||
    1904        1824 :                         pEntry->nWID == FN_PARAM_COUNTOUR_PP ||
    1905        1814 :                         pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
    1906         907 :                         pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
    1907             :         {
    1908         111 :             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1909         111 :             if(pIdx)
    1910             :             {
    1911         111 :                 SwNodeIndex aIdx(*pIdx, 1);
    1912         111 :                 SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    1913         111 :                 if(pEntry->nWID == FN_PARAM_COUNTOUR_PP)
    1914             :                 {
    1915          10 :                     PolyPolygon aContour;
    1916          10 :                     if( pNoTxt->GetContourAPI( aContour ) )
    1917             :                     {
    1918           0 :                         drawing::PointSequenceSequence aPtSeq(aContour.Count());
    1919           0 :                         drawing::PointSequence* pPSeq = aPtSeq.getArray();
    1920           0 :                         for(sal_uInt16 i = 0; i < aContour.Count(); i++)
    1921             :                         {
    1922           0 :                             const Polygon& rPoly = aContour.GetObject(i);
    1923           0 :                             pPSeq[i].realloc(rPoly.GetSize());
    1924           0 :                             awt::Point* pPoints = pPSeq[i].getArray();
    1925           0 :                             for(sal_uInt16 j = 0; j < rPoly.GetSize(); j++)
    1926             :                             {
    1927           0 :                                 const Point& rPoint = rPoly.GetPoint(j);
    1928           0 :                                 pPoints[j].X = rPoint.X();
    1929           0 :                                 pPoints[j].Y = rPoint.Y();
    1930             :                             }
    1931             :                         }
    1932           0 :                         aAny <<= aPtSeq;
    1933          10 :                     }
    1934             :                 }
    1935         101 :                 else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
    1936             :                 {
    1937           0 :                     sal_Bool bValue = pNoTxt->HasAutomaticContour();
    1938           0 :                     aAny.setValue( &bValue, ::getBooleanCppuType() );
    1939             :                 }
    1940         101 :                 else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
    1941             :                 {
    1942           0 :                     sal_Bool bValue = pNoTxt->IsPixelContour();
    1943           0 :                     aAny.setValue( &bValue, ::getBooleanCppuType() );
    1944             :                 }
    1945             :                 else
    1946             :                 {
    1947         101 :                     SfxItemSet aSet(pNoTxt->GetSwAttrSet());
    1948         101 :                     m_pPropSet->getPropertyValue(*pEntry, aSet, aAny);
    1949         111 :                 }
    1950             :             }
    1951             :         }
    1952        3167 :         else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID)
    1953             :         {
    1954          48 :             OUString sGrfName;
    1955          48 :             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1956          48 :             if(pIdx)
    1957             :             {
    1958          48 :                 SwNodeIndex aIdx(*pIdx, 1);
    1959             : //              SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    1960          48 :                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
    1961          48 :                 if(!pGrfNode)
    1962           0 :                     throw uno::RuntimeException();
    1963          48 :                 if( pGrfNode->IsGrfLink() )
    1964             :                 {
    1965           2 :                     pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, 0 );
    1966             :                 }
    1967             :                 else
    1968             :                 {
    1969             :                     OUString sId(OStringToOUString(
    1970          46 :                         pGrfNode->GetGrfObj().GetUniqueID(),
    1971          46 :                         RTL_TEXTENCODING_ASCII_US));
    1972          46 :                     sGrfName = sGraphicObjectProtocol + sId;
    1973          48 :                 }
    1974             :             }
    1975          48 :             aAny <<= sGrfName;
    1976             :         }
    1977        3119 :         else if( FN_UNO_REPLACEMENT_GRAPHIC_U_R_L == pEntry->nWID)
    1978             :         {
    1979           1 :             OUString sGrfName;
    1980           1 :             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    1981             : 
    1982           1 :             if(pIdx)
    1983             :             {
    1984           1 :                 SwNodeIndex aIdx(*pIdx, 1);
    1985           1 :                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
    1986           1 :                 if(!pGrfNode)
    1987           0 :                     throw uno::RuntimeException();
    1988             : 
    1989           1 :                 const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
    1990             : 
    1991           1 :                 if(pGraphicObject)
    1992             :                 {
    1993           0 :                     sGrfName = sGraphicObjectProtocol
    1994           0 :                              + OStringToOUString( pGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
    1995           1 :                 }
    1996             :             }
    1997             : 
    1998           1 :             aAny <<= sGrfName;
    1999             :         }
    2000        3118 :         else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
    2001             :         {
    2002           3 :             OUString sFltName;
    2003           3 :             pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName );
    2004           3 :                 aAny <<= sFltName;
    2005             :         }
    2006        3115 :         else if( FN_UNO_GRAPHIC == pEntry->nWID )
    2007             :         {
    2008           2 :             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2009           2 :             if(pIdx)
    2010             :             {
    2011           2 :                 SwNodeIndex aIdx(*pIdx, 1);
    2012           2 :                 SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
    2013           2 :                 if(!pGrfNode)
    2014           0 :                     throw uno::RuntimeException();
    2015           2 :                 aAny <<= pGrfNode->GetGrf().GetXGraphic();
    2016             :             }
    2017             :         }
    2018        3113 :         else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID)
    2019             :         {
    2020          38 :             aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) );
    2021             :         }
    2022             :         // #i73249#
    2023             :         // Attribute AlternativeText was never published.
    2024             :         // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
    2025             : //        else if(eType != FLYCNTTYPE_FRM &&
    2026             : //                FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
    2027             : //        {
    2028             : //            const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2029             : //            if(pIdx)
    2030             : //            {
    2031             : //                SwNodeIndex aIdx(*pIdx, 1);
    2032             : //                SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    2033             : //                aAny <<= OUString(pNoTxt->GetAlternateText());
    2034             : //            }
    2035             : //        }
    2036        3075 :         else if( FN_UNO_TITLE == pEntry->nWID )
    2037             :         {
    2038          16 :             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    2039             :             OSL_ENSURE( pFmt,
    2040             :                     "unexpected type of <pFmt> --> crash" );
    2041             :             // assure that <SdrObject> instance exists.
    2042          16 :             GetOrCreateSdrObject( pFlyFmt );
    2043          16 :             aAny <<= OUString(pFlyFmt->GetObjTitle());
    2044             :         }
    2045             :         // New attribute Description
    2046        3059 :         else if( FN_UNO_DESCRIPTION == pEntry->nWID )
    2047             :         {
    2048          20 :             SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    2049             :             OSL_ENSURE( pFmt,
    2050             :                     "unexpected type of <pFmt> --> crash" );
    2051             :             // assure that <SdrObject> instance exists.
    2052          20 :             GetOrCreateSdrObject( pFlyFmt );
    2053          20 :             aAny <<= OUString(pFlyFmt->GetObjDescription());
    2054             :         }
    2055        3189 :         else if(eType == FLYCNTTYPE_GRF &&
    2056         150 :                 (rPropertyName == UNO_NAME_ACTUAL_SIZE))
    2057             :         {
    2058           2 :             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2059           2 :             if(pIdx)
    2060             :             {
    2061           2 :                 SwNodeIndex aIdx(*pIdx, 1);
    2062             :                 // --> OD #i85105#
    2063             : //                SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    2064             : //                Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize();
    2065           2 :                 Size aActSize;
    2066             :                 {
    2067           2 :                     SwGrfNode* pGrfNode = dynamic_cast<SwGrfNode*>(aIdx.GetNode().GetNoTxtNode());
    2068           2 :                     if ( pGrfNode )
    2069             :                     {
    2070           2 :                         aActSize = pGrfNode->GetTwipSize();
    2071           4 :                         if ( aActSize.Width() == 0 && aActSize.Height() == 0 &&
    2072           2 :                              pGrfNode->IsLinkedFile() )
    2073             :                         {
    2074           2 :                             pGrfNode->SwapIn( true );
    2075           2 :                             aActSize = pGrfNode->GetTwipSize();
    2076             :                         }
    2077             :                     }
    2078             :                 }
    2079             :                 // <--
    2080           2 :                 awt::Size aTmp;
    2081           2 :                 aTmp.Width = TWIP_TO_MM100(aActSize.Width());
    2082           2 :                 aTmp.Height = TWIP_TO_MM100(aActSize.Height());
    2083           2 :                 aAny.setValue(&aTmp, ::getCppuType(static_cast<const awt::Size*>(0)));
    2084             :             }
    2085             :         }
    2086        3037 :         else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID)
    2087             :         {
    2088           0 :             aAny <<= pFmt->GetName();
    2089             :         }
    2090        3037 :         else if(FN_UNO_Z_ORDER == pEntry->nWID)
    2091             :         {
    2092         254 :             const SdrObject* pObj = pFmt->FindRealSdrObject();
    2093         254 :             if( pObj == NULL )
    2094         233 :                 pObj = pFmt->FindSdrObject();
    2095         254 :             if( pObj )
    2096             :             {
    2097         254 :                 aAny <<= (sal_Int32)pObj->GetOrdNum();
    2098             :             }
    2099             :         }
    2100        5291 :         else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
    2101        7520 :                 FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
    2102        2506 :                 FN_EMBEDDED_OBJECT == pEntry->nWID)
    2103             :         {
    2104         278 :             SwDoc* pDoc = pFmt->GetDoc();
    2105         278 :             const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    2106             :             OSL_ENSURE( pCnt->GetCntntIdx() &&
    2107             :                            pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    2108             :                                             GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    2109             : 
    2110         278 :             SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
    2111         556 :                                             ->GetIndex() + 1 ]->GetOLENode();
    2112         278 :             uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
    2113         556 :             OUString aHexCLSID;
    2114             :             {
    2115         278 :                 SvGlobalName aClassName( xIP->getClassID() );
    2116         278 :                 aHexCLSID = aClassName.GetHexName();
    2117         278 :                 if(FN_UNO_CLSID != pEntry->nWID)
    2118             :                 {
    2119         239 :                     if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
    2120             :                     {
    2121         232 :                         uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
    2122         464 :                         uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
    2123         232 :                         if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
    2124             :                         {
    2125             :                             // ensure the
    2126             :                             OSL_ENSURE( pDoc->GetDocShell(), "no doc shell => no client site" );
    2127           1 :                             if ( pDoc->GetDocShell() )
    2128           1 :                                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
    2129           1 :                             aAny <<= xIP;
    2130             :                         }
    2131         231 :                         else if ( xModel.is() )
    2132         231 :                             aAny <<= xModel;
    2133           0 :                         else if ( FN_UNO_COMPONENT == pEntry->nWID )
    2134         232 :                             aAny <<= xComp;
    2135             :                     }
    2136         278 :                 }
    2137             :             }
    2138             : 
    2139         278 :             if(FN_UNO_CLSID == pEntry->nWID)
    2140          39 :                 aAny <<= aHexCLSID;
    2141         239 :             else if(FN_UNO_STREAM_NAME == pEntry->nWID)
    2142             :             {
    2143           0 :                 aAny <<= OUString(pOleNode->GetOLEObj().GetCurrentPersistName());
    2144             :             }
    2145         239 :             else if(FN_EMBEDDED_OBJECT == pEntry->nWID)
    2146             :             {
    2147           1 :                 aAny <<= pOleNode->GetOLEObj().GetOleRef();
    2148         278 :             }
    2149             :         }
    2150        2505 :         else if(WID_LAYOUT_SIZE == pEntry->nWID)
    2151             :         {
    2152             :             // format document completely in order to get correct value
    2153           0 :             pFmt->GetDoc()->GetEditShell()->CalcLayout();
    2154             : 
    2155           0 :             SwFrm* pTmpFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt );
    2156           0 :             if ( pTmpFrm )
    2157             :             {
    2158             :                 OSL_ENSURE( pTmpFrm->IsValid(), "frame not valid" );
    2159           0 :                 const SwRect &rRect = pTmpFrm->Frm();
    2160             :                 Size aMM100Size = OutputDevice::LogicToLogic(
    2161             :                         Size( rRect.Width(), rRect.Height() ),
    2162           0 :                         MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ));
    2163           0 :                 aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() );
    2164             :             }
    2165             :         }
    2166             :         else
    2167             :         {   //UUUU
    2168             :             // standard UNO API read attributes
    2169             :             // adapt former attr from SvxBrushItem::PutValue to new items XATTR_FILL_FIRST, XATTR_FILL_LAST
    2170        2505 :             const SwAttrSet& rSet = pFmt->GetAttrSet();
    2171        2505 :             bool bDone(false);
    2172             : 
    2173        2505 :             if(RES_BACKGROUND == pEntry->nWID)
    2174             :             {
    2175             :                 //UUUU
    2176         112 :                 const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
    2177             : 
    2178         112 :                 if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
    2179             :                 {
    2180             :                     OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
    2181             :                 }
    2182             : 
    2183         112 :                 bDone = true;
    2184             :             }
    2185        2393 :             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
    2186             :             {
    2187             :                 //UUUU
    2188           1 :                 const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
    2189           1 :                 const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));
    2190             : 
    2191           1 :                 if( pTileItem && pTileItem->GetValue() )
    2192             :                 {
    2193           0 :                     aAny <<= drawing::BitmapMode_REPEAT;
    2194             :                 }
    2195           1 :                 else if( pStretchItem && pStretchItem->GetValue() )
    2196             :                 {
    2197           1 :                     aAny <<= drawing::BitmapMode_STRETCH;
    2198             :                 }
    2199             :                 else
    2200             :                 {
    2201           0 :                     aAny <<= drawing::BitmapMode_NO_REPEAT;
    2202             :                 }
    2203             : 
    2204           1 :                 bDone = true;
    2205             :             }
    2206             : 
    2207        2505 :             if(!bDone)
    2208             :             {
    2209        2392 :                 m_pPropSet->getPropertyValue(*pEntry, rSet, aAny);
    2210             :             }
    2211             :         }
    2212             :     }
    2213        2534 :     else if(IsDescriptor())
    2214             :     {
    2215        2534 :         if ( ! m_pDoc )
    2216           0 :             throw uno::RuntimeException();
    2217        2534 :         if(WID_LAYOUT_SIZE != pEntry->nWID)  // there is no LayoutSize in a descriptor
    2218             :         {
    2219        2534 :             const uno::Any* pAny = 0;
    2220        2534 :             if( !pProps->GetProperty( pEntry->nWID, nMemberId, pAny ) )
    2221        1795 :                 aAny = mxStyleData->getPropertyValue( rPropertyName );
    2222         739 :             else if ( pAny )
    2223         739 :                 aAny = *pAny;
    2224             :         }
    2225             :     }
    2226             :     else
    2227           0 :         throw uno::RuntimeException();
    2228             : 
    2229             :     //UUUU
    2230        5818 :     if(pEntry && pEntry->aType == ::getCppuType((const sal_Int16*)0) && pEntry->aType != aAny.getValueType())
    2231             :     {
    2232             :         // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
    2233           8 :         sal_Int32 nValue = 0;
    2234           8 :         aAny >>= nValue;
    2235           8 :         aAny <<= (sal_Int16)nValue;
    2236             :     }
    2237             : 
    2238             :     //UUUU check for needed metric translation
    2239        5818 :     if(pEntry->nMemberId & SFX_METRIC_ITEM)
    2240             :     {
    2241           6 :         bool bDoIt(true);
    2242             : 
    2243           6 :         if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
    2244             :         {
    2245             :             // exception: If these ItemTypes are used, do not convert when these are negative
    2246             :             // since this means they are intended as percent values
    2247           0 :             sal_Int32 nValue = 0;
    2248             : 
    2249           0 :             if(aAny >>= nValue)
    2250             :             {
    2251           0 :                 bDoIt = nValue > 0;
    2252             :             }
    2253             :         }
    2254             : 
    2255           6 :         if(bDoIt)
    2256             :         {
    2257           6 :             const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrmFmt()->GetDoc());
    2258           6 :             const SfxItemPool& rPool = pDoc->GetAttrPool();
    2259           6 :             const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
    2260             : 
    2261           6 :             if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    2262             :             {
    2263           6 :                 SvxUnoConvertToMM(eMapUnit, aAny);
    2264             :             }
    2265             :         }
    2266             :     }
    2267             : 
    2268        6120 :     return aAny;
    2269             : }
    2270             : 
    2271           0 : void SwXFrame::addPropertyChangeListener(const OUString& /*PropertyName*/,
    2272             :     const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
    2273             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2274             : {
    2275             :     OSL_FAIL("not implemented");
    2276           0 : }
    2277             : 
    2278           0 : void SwXFrame::removePropertyChangeListener(const OUString& /*PropertyName*/,
    2279             :     const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
    2280             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2281             : {
    2282             :     OSL_FAIL("not implemented");
    2283           0 : }
    2284             : 
    2285           0 : void SwXFrame::addVetoableChangeListener(const OUString& /*PropertyName*/,
    2286             :                                 const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
    2287             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2288             : {
    2289             :     OSL_FAIL("not implemented");
    2290           0 : }
    2291             : 
    2292           0 : void SwXFrame::removeVetoableChangeListener(
    2293             :     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
    2294             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2295             : {
    2296             :     OSL_FAIL("not implemented");
    2297           0 : }
    2298             : 
    2299          17 : beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
    2300             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2301             : {
    2302          17 :     SolarMutexGuard aGuard;
    2303          34 :     uno::Sequence< OUString > aPropertyNames(1);
    2304          17 :     OUString* pNames = aPropertyNames.getArray();
    2305          17 :     pNames[0] = rPropertyName;
    2306          34 :     uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aPropertyNames);
    2307          34 :     return aStates.getConstArray()[0];
    2308             : }
    2309             : 
    2310             : //UUUU
    2311         225 : bool SwXFrame::needToMapFillItemsToSvxBrushItemTypes() const
    2312             : {
    2313         225 :     SwFrmFmt* pFmt = GetFrmFmt();
    2314             : 
    2315         225 :     if(!pFmt)
    2316             :     {
    2317           0 :         return false;
    2318             :     }
    2319             : 
    2320         225 :     const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
    2321         225 :     const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  >(rFmtSet.GetItem(XATTR_FILLSTYLE, false)));
    2322             : 
    2323         225 :     if(!pXFillStyleItem)
    2324             :     {
    2325         126 :         return false;
    2326             :     }
    2327             : 
    2328             :     //UUUU here different FillStyles can be excluded for export; it will depend on the
    2329             :     // quality these fallbacks can reach. That again is done in sw::getSvxBrushItemFromSourceSet,
    2330             :     // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem.
    2331             :     // For now, take them all - except XFILL_NONE
    2332             : 
    2333          99 :     if(XFILL_NONE != pXFillStyleItem->GetValue())
    2334             :     {
    2335          99 :         return true;
    2336             :     }
    2337             : 
    2338             :     //if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue())
    2339             :     //{
    2340             :     //    return true;
    2341             :     //}
    2342             : 
    2343           0 :     return false;
    2344             : }
    2345             : 
    2346          49 : uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
    2347             :     const uno::Sequence< OUString >& aPropertyNames )
    2348             :         throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2349             : {
    2350          49 :     SolarMutexGuard aGuard;
    2351          49 :     uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength());
    2352          49 :     beans::PropertyState* pStates = aStates.getArray();
    2353          49 :     SwFrmFmt* pFmt = GetFrmFmt();
    2354          49 :     if(pFmt)
    2355             :     {
    2356          49 :         const OUString* pNames = aPropertyNames.getConstArray();
    2357          49 :         const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
    2358        1684 :         for(int i = 0; i < aPropertyNames.getLength(); i++)
    2359             :         {
    2360        1635 :             const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(pNames[i]);
    2361        1635 :             if (!pEntry)
    2362           0 :                 throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
    2363             : 
    2364        3270 :             if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
    2365        3270 :                 pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
    2366        3270 :                 FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
    2367        3270 :                 FN_UNO_GRAPHIC_U_R_L == pEntry->nWID||
    2368        3270 :                 FN_UNO_GRAPHIC_FILTER     == pEntry->nWID||
    2369        3270 :                 FN_UNO_ACTUAL_SIZE == pEntry->nWID||
    2370        1635 :                 FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
    2371             :             {
    2372           0 :                 pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2373             :             }
    2374        1635 :             else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
    2375             :             {
    2376             :                 //UUUU
    2377          28 :                 if(SFX_ITEM_SET == rFmtSet.GetItemState(XATTR_FILLBMP_STRETCH, false)
    2378          14 :                     || SFX_ITEM_SET == rFmtSet.GetItemState(XATTR_FILLBMP_TILE, false))
    2379             :                 {
    2380           0 :                     pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2381             :                 }
    2382             :                 else
    2383             :                 {
    2384          14 :                     pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
    2385             :                 }
    2386             :             }
    2387             :             //UUUU for FlyFrames we need to mark all properties from type RES_BACKGROUND
    2388             :             // as beans::PropertyState_DIRECT_VALUE to let users of this property call
    2389             :             // getPropertyValue where the member properties will be mapped from the
    2390             :             // fill attributes to the according SvxBrushItem entries
    2391        1621 :             else if(RES_BACKGROUND == pEntry->nWID && needToMapFillItemsToSvxBrushItemTypes())
    2392             :             {
    2393          99 :                 pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2394             :             }
    2395             :             else
    2396             :             {
    2397        3153 :                 if ((eType == FLYCNTTYPE_GRF) &&
    2398        1631 :                         pEntry && isGRFATR(pEntry->nWID))
    2399             :                 {
    2400          26 :                     const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2401          26 :                     if(pIdx)
    2402             :                     {
    2403          26 :                         SwNodeIndex aIdx(*pIdx, 1);
    2404          26 :                         SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    2405          52 :                         SfxItemSet aSet(pNoTxt->GetSwAttrSet());
    2406          26 :                         aSet.GetItemState(pEntry->nWID);
    2407          26 :                         if(SFX_ITEM_SET == aSet.GetItemState( pEntry->nWID, false ))
    2408          52 :                             pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2409             :                     }
    2410             :                 }
    2411             :                 else
    2412             :                 {
    2413        1496 :                     if(SFX_ITEM_SET == rFmtSet.GetItemState( pEntry->nWID, false ))
    2414         534 :                         pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2415             :                     else
    2416         962 :                         pStates[i] = beans::PropertyState_DEFAULT_VALUE;
    2417             :                 }
    2418             :             }
    2419             :         }
    2420             :     }
    2421           0 :     else if(IsDescriptor())
    2422             :     {
    2423           0 :         for(int i = 0; i < aPropertyNames.getLength(); i++)
    2424           0 :             pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2425             :     }
    2426             :     else
    2427           0 :         throw uno::RuntimeException();
    2428          49 :     return aStates;
    2429             : }
    2430             : 
    2431           0 : void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
    2432             :     throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2433             : {
    2434           0 :     SolarMutexGuard aGuard;
    2435           0 :     SwFrmFmt* pFmt = GetFrmFmt();
    2436           0 :     if(pFmt)
    2437             :     {
    2438           0 :         const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
    2439           0 :         if (!pEntry)
    2440           0 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2441           0 :         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    2442           0 :             throw uno::RuntimeException("setPropertyToDefault: property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2443             : 
    2444             :         bool bNextFrame;
    2445           0 :         if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
    2446             :         {
    2447             :             //UUUU
    2448           0 :             SwDoc* pDoc = pFmt->GetDoc();
    2449           0 :             SfxItemSet aSet(pDoc->GetAttrPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
    2450           0 :             aSet.SetParent(&pFmt->GetAttrSet());
    2451             : 
    2452           0 :             aSet.ClearItem(XATTR_FILLBMP_STRETCH);
    2453           0 :             aSet.ClearItem(XATTR_FILLBMP_TILE);
    2454             : 
    2455           0 :             pFmt->SetFmtAttr(aSet);
    2456             :         }
    2457           0 :         else if( pEntry->nWID &&
    2458           0 :             pEntry->nWID != FN_UNO_ANCHOR_TYPES &&
    2459           0 :             pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME)
    2460             :         {
    2461           0 :             if ( (eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) )
    2462             :             {
    2463           0 :                 const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2464           0 :                 if(pIdx)
    2465             :                 {
    2466           0 :                     SwNodeIndex aIdx(*pIdx, 1);
    2467           0 :                     SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    2468             :                     {
    2469           0 :                         SfxItemSet aSet(pNoTxt->GetSwAttrSet());
    2470           0 :                         aSet.ClearItem(pEntry->nWID);
    2471           0 :                         pNoTxt->SetAttr(aSet);
    2472           0 :                     }
    2473             :                 }
    2474             :             }
    2475             :             // #i73249#
    2476             :             // Attribute AlternativeText was never published.
    2477             :             // Now it has been replaced by Attribute Title - valid for all <SwXFrame> instances
    2478             : //            else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID )
    2479             : //            {
    2480             : //                const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2481             : //                if(pIdx)
    2482             : //                {
    2483             : //                    SwNodeIndex aIdx(*pIdx, 1);
    2484             : //                    SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    2485             : //                    pNoTxt->SetAlternateText(aEmptyOUStr);
    2486             : //                }
    2487             : //            }
    2488             :             // New attribute Title
    2489           0 :             else if( FN_UNO_TITLE == pEntry->nWID )
    2490             :             {
    2491           0 :                 SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    2492             :                 OSL_ENSURE( pFmt,
    2493             :                         "unexpected type of <pFmt> --> crash" );
    2494             :                 // assure that <SdrObject> instance exists.
    2495           0 :                 GetOrCreateSdrObject( pFlyFmt );
    2496           0 :                 pFlyFmt->GetDoc()->SetFlyFrmTitle( *(pFlyFmt), aEmptyOUStr );
    2497             :             }
    2498             :             // New attribute Description
    2499           0 :             else if( FN_UNO_DESCRIPTION == pEntry->nWID )
    2500             :             {
    2501           0 :                 SwFlyFrmFmt* pFlyFmt = dynamic_cast<SwFlyFrmFmt*>(pFmt);
    2502             :                 OSL_ENSURE( pFmt,
    2503             :                         "unexpected type of <pFmt> --> crash" );
    2504             :                 // assure that <SdrObject> instance exists.
    2505           0 :                 GetOrCreateSdrObject( pFlyFmt );
    2506           0 :                 pFlyFmt->GetDoc()->SetFlyFrmDescription( *(pFlyFmt), aEmptyOUStr );
    2507             :             }
    2508             :             else
    2509             :             {
    2510           0 :                 SwDoc* pDoc = pFmt->GetDoc();
    2511           0 :                 SfxItemSet aSet( pDoc->GetAttrPool(),
    2512           0 :                     RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
    2513           0 :                 aSet.SetParent(&pFmt->GetAttrSet());
    2514           0 :                 aSet.ClearItem(pEntry->nWID);
    2515           0 :                 if(rPropertyName != UNO_NAME_ANCHOR_TYPE)
    2516           0 :                     pFmt->SetFmtAttr(aSet);
    2517           0 :             }
    2518             :         }
    2519           0 :         else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
    2520           0 :                 || rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
    2521             :         {
    2522           0 :             SwDoc* pDoc = pFmt->GetDoc();
    2523           0 :             if(bNextFrame)
    2524           0 :                 pDoc->Unchain(*pFmt);
    2525             :             else
    2526             :             {
    2527           0 :                 SwFmtChain aChain( pFmt->GetChain() );
    2528           0 :                 SwFrmFmt *pPrev = aChain.GetPrev();
    2529           0 :                 if(pPrev)
    2530           0 :                     pDoc->Unchain(*pPrev);
    2531             :             }
    2532             :         }
    2533             :     }
    2534           0 :     else if(!IsDescriptor())
    2535           0 :         throw uno::RuntimeException();
    2536             : 
    2537           0 : }
    2538             : 
    2539           0 : uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
    2540             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    2541             : {
    2542           0 :     SolarMutexGuard aGuard;
    2543           0 :     uno::Any aRet;
    2544           0 :     SwFrmFmt* pFmt = GetFrmFmt();
    2545           0 :     if(pFmt)
    2546             :     {
    2547           0 :         const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
    2548           0 :         if(pEntry)
    2549             :         {
    2550           0 :             if ( pEntry->nWID < RES_FRMATR_END )
    2551             :             {
    2552             :                 const SfxPoolItem& rDefItem =
    2553           0 :                     pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
    2554             :                 //UUUU
    2555           0 :                 const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM));
    2556             : 
    2557           0 :                 rDefItem.QueryValue(aRet, nMemberId);
    2558             :             }
    2559             :         }
    2560             :         else
    2561           0 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2562             :     }
    2563           0 :     else if(!IsDescriptor())
    2564           0 :         throw uno::RuntimeException();
    2565           0 :     return aRet;
    2566             : }
    2567             : 
    2568           6 : void SAL_CALL SwXFrame::addEventListener(
    2569             :         const uno::Reference<lang::XEventListener> & xListener)
    2570             : throw (uno::RuntimeException, std::exception)
    2571             : {
    2572             :     // no need to lock here as m_pImpl is const and container threadsafe
    2573           6 :     m_pImpl->m_EventListeners.addInterface(xListener);
    2574           6 : }
    2575             : 
    2576           3 : void SAL_CALL SwXFrame::removeEventListener(
    2577             :         const uno::Reference<lang::XEventListener> & xListener)
    2578             : throw (uno::RuntimeException, std::exception)
    2579             : {
    2580             :     // no need to lock here as m_pImpl is const and container threadsafe
    2581           3 :     m_pImpl->m_EventListeners.removeInterface(xListener);
    2582           3 : }
    2583             : 
    2584        8185 : void    SwXFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    2585             : {
    2586        8185 :     ClientModify(this, pOld, pNew);
    2587        8185 :     if(!GetRegisteredIn())
    2588             :     {
    2589          62 :         mxStyleData.clear();
    2590          62 :         mxStyleFamily.clear();
    2591          62 :         m_pDoc = 0;
    2592          62 :         lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
    2593          62 :         m_pImpl->m_EventListeners.disposeAndClear(ev);
    2594             :     }
    2595        8185 : }
    2596             : 
    2597           6 : void SwXFrame::dispose(void) throw( uno::RuntimeException, std::exception )
    2598             : {
    2599           6 :     SolarMutexGuard aGuard;
    2600           6 :     SwFrmFmt* pFmt = GetFrmFmt();
    2601           6 :     if ( pFmt )
    2602             :     {
    2603           6 :         SdrObject* pObj = pFmt->FindSdrObject();
    2604             :         // OD 11.09.2003 #112039# - add condition to perform delete of
    2605             :         // format/anchor sign, not only if the object is inserted, but also
    2606             :         // if a contact object is registered, which isn't in the destruction.
    2607          18 :         if ( pObj &&
    2608          10 :              ( pObj->IsInserted() ||
    2609           8 :                ( pObj->GetUserCall() &&
    2610           4 :                  !static_cast<SwContact*>(pObj->GetUserCall())->IsInDTOR() ) ) )
    2611             :         {
    2612           6 :             if (pFmt->GetAnchor().GetAnchorId() == FLY_AS_CHAR)
    2613             :             {
    2614           3 :                 const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
    2615           3 :                 SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
    2616           3 :                 const sal_Int32 nIdx = rPos.nContent.GetIndex();
    2617           3 :                 pTxtNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
    2618             :             }
    2619             :             else
    2620           3 :                 pFmt->GetDoc()->DelLayoutFmt(pFmt);
    2621             :         }
    2622           6 :     }
    2623             : 
    2624           6 : }
    2625             : 
    2626          48 : uno::Reference< text::XTextRange >  SwXFrame::getAnchor(void) throw( uno::RuntimeException, std::exception )
    2627             : {
    2628          48 :     SolarMutexGuard aGuard;
    2629          48 :     uno::Reference< text::XTextRange >  aRef;
    2630          48 :     SwFrmFmt* pFmt = GetFrmFmt();
    2631          48 :     if(pFmt)
    2632             :     {
    2633          48 :         const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
    2634             :         // return an anchor for non-page bound frames
    2635             :         // and for page bound frames that have a page no == NULL and a content position
    2636          96 :         if ((rAnchor.GetAnchorId() != FLY_AT_PAGE) ||
    2637           0 :             (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
    2638             :         {
    2639          48 :             const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
    2640          48 :             aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
    2641             :         }
    2642             :     }
    2643             :     else
    2644           0 :         throw uno::RuntimeException();
    2645          48 :     return aRef;
    2646             : }
    2647             : 
    2648        1169 : void SwXFrame::ResetDescriptor()
    2649             : {
    2650        1169 :     bIsDescriptor = false;
    2651        1169 :     mxStyleData.clear();
    2652        1169 :     mxStyleFamily.clear();
    2653        1169 :     DELETEZ(pProps);
    2654        1169 : }
    2655             : 
    2656        1169 : void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
    2657             :             throw( lang::IllegalArgumentException, uno::RuntimeException )
    2658             : {
    2659        1169 :     SolarMutexGuard aGuard;
    2660        1169 :     if(!IsDescriptor())
    2661           0 :         throw uno::RuntimeException();
    2662        2338 :     uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
    2663        1169 :     SwXTextRange* pRange = 0;
    2664        1169 :     OTextCursorHelper* pCursor = 0;
    2665        1169 :     if(xRangeTunnel.is())
    2666             :     {
    2667             :         pRange  = reinterpret_cast< SwXTextRange * >(
    2668        1169 :                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
    2669             :         pCursor = reinterpret_cast< OTextCursorHelper * >(
    2670        1169 :                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
    2671             :     }
    2672             : 
    2673        1169 :     SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
    2674        1169 :     if(pDoc)
    2675             :     {
    2676        1169 :         SwUnoInternalPaM aIntPam(*pDoc);
    2677             :         //das muss jetzt true liefern
    2678        1169 :         ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
    2679             : 
    2680        1169 :         SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
    2681        2338 :         SwPaM aPam(rNode);
    2682        1169 :         aPam.Move( fnMoveBackward, fnGoDoc );
    2683             :         static sal_uInt16 const aFrmAttrRange[] =
    2684             :         {
    2685             :             RES_FRMATR_BEGIN,       RES_FRMATR_END-1,
    2686             :             RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
    2687             : 
    2688             :             //UUUU FillAttribute support
    2689             :             XATTR_FILL_FIRST, XATTR_FILL_LAST,
    2690             : 
    2691             :             SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,
    2692             :             0
    2693             :         };
    2694             :         static sal_uInt16 const aGrAttrRange[] =
    2695             :         {
    2696             :             RES_GRFATR_BEGIN,       RES_GRFATR_END-1,
    2697             :             0
    2698             :         };
    2699        2338 :         SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
    2700             : 
    2701        2338 :         SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
    2702             :         //jetzt muessen die passenden Items in den Set
    2703             :         bool bSizeFound;
    2704        1169 :         if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
    2705           0 :             throw lang::IllegalArgumentException();
    2706             :         //der TextRange wird einzeln behandelt
    2707        1169 :         *aPam.GetPoint() = *aIntPam.GetPoint();
    2708        1169 :         if(aIntPam.HasMark())
    2709             :         {
    2710          62 :             aPam.SetMark();
    2711          62 :             *aPam.GetMark() = *aIntPam.GetMark();
    2712             :         }
    2713             : 
    2714             :         const SfxPoolItem* pItem;
    2715        1169 :         RndStdIds eAnchorId = FLY_AT_PARA;
    2716        1169 :         if(SFX_ITEM_SET == aFrmSet.GetItemState(RES_ANCHOR, false, &pItem) )
    2717             :         {
    2718        1169 :             eAnchorId = ((const SwFmtAnchor*)pItem)->GetAnchorId();
    2719        1169 :             if( FLY_AT_FLY == eAnchorId &&
    2720           0 :                 !aPam.GetNode()->FindFlyStartNode())
    2721             :             {
    2722             :                 //rahmengebunden geht nur dort, wo ein Rahmen ist!
    2723           0 :                 SwFmtAnchor aAnchor(FLY_AT_PARA);
    2724           0 :                 aFrmSet.Put(aAnchor);
    2725             :             }
    2726        1261 :             else if ((FLY_AT_PAGE == eAnchorId) &&
    2727          92 :                      0 == ((const SwFmtAnchor*)pItem)->GetPageNum() )
    2728             :             {
    2729           7 :                 SwFmtAnchor aAnchor( *((const SwFmtAnchor*)pItem) );
    2730           7 :                 aAnchor.SetAnchor( aPam.GetPoint() );
    2731           7 :                 aFrmSet.Put(aAnchor);
    2732             :             }
    2733             :         }
    2734             : 
    2735             :         const ::uno::Any* pStyle;
    2736        1169 :         SwFrmFmt *pParentFrmFmt = 0;
    2737        1169 :         if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
    2738         183 :             pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc );
    2739             : 
    2740        1169 :         SwFlyFrmFmt* pFmt = 0;
    2741        1169 :         if( eType == FLYCNTTYPE_FRM)
    2742             :         {
    2743         512 :             UnoActionContext aCont(pDoc);
    2744         512 :             if(m_pCopySource)
    2745             :             {
    2746          62 :                 SwFmtAnchor* pAnchorItem = 0;
    2747             :                 // the frame is inserted bound to page
    2748             :                 // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text
    2749          62 :                 if (eAnchorId != FLY_AT_PAGE)
    2750             :                 {
    2751          62 :                     pAnchorItem = static_cast<SwFmtAnchor*>(aFrmSet.Get(RES_ANCHOR).Clone());
    2752          62 :                     aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
    2753             :                 }
    2754             : 
    2755          62 :                 aPam.DeleteMark(); // mark position node will be deleted!
    2756          62 :                 aIntPam.DeleteMark(); // mark position node will be deleted!
    2757             :                 pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
    2758             :                                0,
    2759          62 :                                pParentFrmFmt );
    2760          62 :                 if(pAnchorItem && pFmt)
    2761             :                 {
    2762          62 :                     pFmt->DelFrms();
    2763          62 :                     pAnchorItem->SetAnchor( m_pCopySource->Start() );
    2764          62 :                     SfxItemSet aAnchorSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
    2765          62 :                     aAnchorSet.Put( *pAnchorItem );
    2766          62 :                     pDoc->SetFlyFrmAttr( *pFmt, aAnchorSet );
    2767          62 :                     delete pAnchorItem;
    2768             :                 }
    2769          62 :                 DELETEZ( m_pCopySource );
    2770             :             }
    2771             :             else
    2772             :             {
    2773         450 :                 pFmt = pDoc->MakeFlySection( FLY_AT_PARA, aPam.GetPoint(),
    2774         450 :                                          &aFrmSet, pParentFrmFmt );
    2775             :             }
    2776         512 :             if(pFmt)
    2777             :             {
    2778         512 :                 pFmt->Add(this);
    2779         512 :                 if(!m_sName.isEmpty())
    2780          79 :                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, m_sName);
    2781             :             }
    2782             :             //den SwXText wecken
    2783         512 :             ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrmFmt()->GetDoc() );
    2784             :         }
    2785         657 :         else if( eType == FLYCNTTYPE_GRF)
    2786             :         {
    2787         313 :             UnoActionContext aCont(pDoc);
    2788             :             const ::uno::Any* pGraphicURL;
    2789         626 :             OUString sGraphicURL;
    2790         313 :             GraphicObject *pGrfObj = 0;
    2791         313 :             if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
    2792             :             {
    2793         135 :                 (*pGraphicURL) >>= sGraphicURL;
    2794         135 :                 if( sGraphicURL.startsWith(sPackageProtocol) )
    2795             :                 {
    2796          12 :                     pGrfObj = new GraphicObject;
    2797          12 :                     pGrfObj->SetUserData( sGraphicURL );
    2798          12 :                     pGrfObj->SetSwapState();
    2799          12 :                     sGraphicURL = "";
    2800             :                 }
    2801         123 :                 else if( sGraphicURL.startsWith(sGraphicObjectProtocol) )
    2802             :                 {
    2803             :                     OString sId(OUStringToOString(
    2804         123 :                         sGraphicURL.copy( sizeof(sGraphicObjectProtocol)-1 ),
    2805         123 :                         RTL_TEXTENCODING_ASCII_US));
    2806         123 :                     pGrfObj = new GraphicObject( sId );
    2807         123 :                     sGraphicURL = "";
    2808             :                 }
    2809             :             }
    2810         626 :             Graphic aGraphic;
    2811             :             const ::uno::Any* pGraphic;
    2812         313 :             if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic ))
    2813             :             {
    2814         172 :                 uno::Reference< graphic::XGraphic > xGraphic;
    2815         172 :                 (*pGraphic) >>= xGraphic;
    2816         172 :                 aGraphic = Graphic( xGraphic );
    2817             :             }
    2818             : 
    2819         626 :             OUString sFltName;
    2820             :             const ::uno::Any* pFilter;
    2821         313 :             if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
    2822             :             {
    2823         135 :                 (*pFilter) >>= sFltName;
    2824             :             }
    2825             : 
    2826             :             pFmt =
    2827             :                 pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
    2828         135 :                                         pParentFrmFmt )
    2829             :                         : pDoc->Insert( aPam, sGraphicURL, sFltName, &aGraphic,
    2830         448 :                                         &aFrmSet, &aGrSet, pParentFrmFmt  );
    2831         313 :             delete pGrfObj;
    2832         313 :             if(pFmt)
    2833             :             {
    2834         626 :                 SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
    2835         626 :                                             ->GetIndex()+1 ]->GetGrfNode();
    2836         313 :                 if (pGrfNd)
    2837         313 :                     pGrfNd->SetChgTwipSize( !bSizeFound );
    2838         313 :                 pFmt->Add(this);
    2839         313 :                 if(!m_sName.isEmpty())
    2840         272 :                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, m_sName);
    2841             : 
    2842             :             }
    2843             :             const ::uno::Any* pSurroundContour;
    2844         313 :             if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
    2845          24 :                 setPropertyValue(UNO_NAME_SURROUND_CONTOUR, *pSurroundContour);
    2846             :             const ::uno::Any* pContourOutside;
    2847         313 :             if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
    2848          24 :                 setPropertyValue(UNO_NAME_CONTOUR_OUTSIDE, *pContourOutside);
    2849             :             const ::uno::Any* pContourPoly;
    2850         313 :             if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly))
    2851          24 :                 setPropertyValue(UNO_NAME_CONTOUR_POLY_POLYGON, *pContourPoly);
    2852             :             const ::uno::Any* pPixelContour;
    2853         313 :             if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
    2854           0 :                 setPropertyValue(UNO_NAME_IS_PIXEL_CONTOUR, *pPixelContour);
    2855             :             const ::uno::Any* pAutoContour;
    2856         313 :             if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
    2857         313 :                 setPropertyValue(UNO_NAME_IS_AUTOMATIC_CONTOUR, *pAutoContour);
    2858             :         }
    2859             :         else
    2860             :         {
    2861         344 :             const ::uno::Any* pCLSID = 0;
    2862         344 :             const ::uno::Any* pStreamName = 0;
    2863         344 :             const ::uno::Any* pEmbeddedObject = 0;
    2864         688 :             if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID)
    2865         341 :                 && !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName )
    2866         663 :                 && !pProps->GetProperty( FN_EMBEDDED_OBJECT, 0, pEmbeddedObject ))
    2867           0 :                 throw uno::RuntimeException();
    2868         344 :             if(pCLSID)
    2869             :             {
    2870           3 :                 OUString aCLSID;
    2871           6 :                 SvGlobalName aClassName;
    2872           6 :                 uno::Reference < embed::XEmbeddedObject > xIPObj;
    2873           6 :                 std::auto_ptr < comphelper::EmbeddedObjectContainer > pCnt;
    2874           3 :                 if( (*pCLSID) >>= aCLSID )
    2875             :                 {
    2876           3 :                     if( !aClassName.MakeId( aCLSID ) )
    2877             :                     {
    2878           0 :                         lang::IllegalArgumentException aExcept;
    2879           0 :                         aExcept.Message = "CLSID invalid";
    2880           0 :                         throw aExcept;
    2881             :                     }
    2882             : 
    2883           3 :                     pCnt.reset( new comphelper::EmbeddedObjectContainer );
    2884           3 :                     OUString aName;
    2885           3 :                     xIPObj = pCnt->CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
    2886             :                 }
    2887           3 :                 if ( xIPObj.is() )
    2888             :                 {
    2889             :                     //TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
    2890             :                     //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->getPrinter( false ) )
    2891             :                     //    xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
    2892             : 
    2893           3 :                     UnoActionContext aAction(pDoc);
    2894           3 :                     pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
    2895           3 :                     if(!bSizeFound)
    2896             :                     {
    2897             :                         //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
    2898           2 :                         sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
    2899             : 
    2900             :                         // TODO/LEAN: VisualArea still needs running state
    2901           2 :                         svt::EmbeddedObjectRef::TryRunningState( xIPObj );
    2902             : 
    2903             :                         // set parent to get correct VisArea(in case of object needing parent printer)
    2904           2 :                         uno::Reference < container::XChild > xChild( xIPObj, uno::UNO_QUERY );
    2905           2 :                         if ( xChild.is() )
    2906           2 :                             xChild->setParent( pDoc->GetDocShell()->GetModel() );
    2907             : 
    2908             :                         //The Size should be suggested by the OLE server if not manually set
    2909           2 :                         MapUnit aRefMap = VCLUnoHelper::UnoEmbed2VCLMapUnit( xIPObj->getMapUnit( nAspect ) );
    2910           2 :                         awt::Size aSize;
    2911             :                         try
    2912             :                         {
    2913           2 :                             aSize = xIPObj->getVisualAreaSize( nAspect );
    2914             :                         }
    2915           0 :                         catch ( embed::NoVisualAreaSizeException& )
    2916             :                         {
    2917             :                             // the default size will be set later
    2918             :                         }
    2919             : 
    2920           2 :                         Size aSz( aSize.Width, aSize.Height );
    2921           2 :                         if ( !aSz.Width() || !aSz.Height() )
    2922             :                         {
    2923           0 :                             aSz.Width() = aSz.Height() = 5000;
    2924             :                             aSz = OutputDevice::LogicToLogic
    2925           0 :                                                     ( aSz, MapMode( MAP_100TH_MM ), aRefMap );
    2926             :                         }
    2927           4 :                         MapMode aMyMap( MAP_TWIP );
    2928           2 :                         aSz = OutputDevice::LogicToLogic( aSz, aRefMap, aMyMap );
    2929           4 :                         SwFmtFrmSize aFrmSz;
    2930           2 :                         aFrmSz.SetSize(aSz);
    2931           4 :                         aFrmSet.Put(aFrmSz);
    2932             :                     }
    2933           3 :                     SwFlyFrmFmt* pFmt2 = 0;
    2934             : 
    2935             :                     // TODO/LATER: Is it the only possible aspect here?
    2936           3 :                     sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
    2937           6 :                     ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect );
    2938           3 :                     pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
    2939             :                     OSL_ENSURE( pFmt2, "Doc->Insert(notxt) failed." );
    2940             : 
    2941           3 :                     pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
    2942           3 :                     pFmt2->Add(this);
    2943           3 :                     if(!m_sName.isEmpty())
    2944           3 :                         pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, m_sName);
    2945           3 :                 }
    2946             :             }
    2947         341 :             else if( pStreamName )
    2948             :             {
    2949          22 :                 OUString sStreamName;
    2950          22 :                 (*pStreamName) >>= sStreamName;
    2951          22 :                 pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
    2952             : 
    2953          22 :                 SwFlyFrmFmt* pFrmFmt = 0;
    2954          22 :                 pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL );
    2955          22 :                 pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
    2956          22 :                 pFrmFmt->Add(this);
    2957          22 :                 if(!m_sName.isEmpty())
    2958           0 :                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, m_sName);
    2959             :             }
    2960         319 :             else if( pEmbeddedObject || pStreamName )
    2961             :             {
    2962         319 :                 uno::Reference< embed::XEmbeddedObject > obj;
    2963         319 :                 (*pEmbeddedObject) >>= obj;
    2964         638 :                 svt::EmbeddedObjectRef xObj;
    2965         319 :                 xObj.Assign( obj, embed::Aspects::MSOLE_CONTENT );
    2966             : 
    2967         319 :                 pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
    2968             : 
    2969             :                 // Not sure if these setParent() and InsertEmbeddedObject() calls are really
    2970             :                 // needed, it seems to work without, but logic from code elsewhere suggests
    2971             :                 // they should be done.
    2972         319 :                 SfxObjectShell& mrPers = *pDoc->GetPersist();
    2973         638 :                 uno::Reference < container::XChild > xChild( obj, uno::UNO_QUERY );
    2974         319 :                 if ( xChild.is() )
    2975         319 :                     xChild->setParent( mrPers.GetModel() );
    2976         638 :                 OUString rName;
    2977         319 :                 mrPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName );
    2978             : 
    2979         319 :                 SwFlyFrmFmt* pFrmFmt = 0;
    2980         319 :                 pFrmFmt = pDoc->Insert( aPam, xObj, &aFrmSet, NULL, NULL );
    2981         319 :                 pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
    2982         319 :                 pFrmFmt->Add(this);
    2983         319 :                 if(!m_sName.isEmpty())
    2984         319 :                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, m_sName);
    2985             :             }
    2986             :         }
    2987        1169 :         if( pFmt && pDoc->GetDrawModel() )
    2988         825 :             GetOrCreateSdrObject( pFmt );
    2989             :         const ::uno::Any* pOrder;
    2990        1169 :         if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
    2991          68 :             setPropertyValue(UNO_NAME_Z_ORDER, *pOrder);
    2992             :         const ::uno::Any* pReplacement;
    2993        1169 :         if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) )
    2994          22 :             setPropertyValue(UNO_NAME_GRAPHIC, *pReplacement);
    2995             :         // new attribute Title
    2996             :         const ::uno::Any* pTitle;
    2997        1169 :         if ( pProps->GetProperty(FN_UNO_TITLE, 0, pTitle) )
    2998             :         {
    2999         172 :             setPropertyValue(UNO_NAME_TITLE, *pTitle);
    3000             :         }
    3001             :         // new attribute Description
    3002             :         const ::uno::Any* pDescription;
    3003        1169 :         if ( pProps->GetProperty(FN_UNO_DESCRIPTION, 0, pDescription) )
    3004             :         {
    3005         172 :             setPropertyValue(UNO_NAME_DESCRIPTION, *pDescription);
    3006        1169 :         }
    3007             :     }
    3008             :     else
    3009           0 :         throw lang::IllegalArgumentException();
    3010             :     //setzt das Flag zurueck und loescht den Descriptor-Pointer
    3011        2338 :     ResetDescriptor();
    3012        1169 : }
    3013             : 
    3014        1825 : void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
    3015             :     throw( lang::IllegalArgumentException, uno::RuntimeException )
    3016             : {
    3017             :     SwFrmFmt* pFmt;
    3018        1825 :     if(IsDescriptor())
    3019        1169 :         attachToRange(xTextRange);
    3020         656 :     else if(0 != (pFmt = GetFrmFmt()))
    3021             :     {
    3022         656 :         uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
    3023         656 :         SwDoc* pDoc = pFmt->GetDoc();
    3024        1312 :         SwUnoInternalPaM aIntPam(*pDoc);
    3025         656 :         if (::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
    3026             :         {
    3027         655 :             SfxItemSet aSet( pDoc->GetAttrPool(), RES_ANCHOR, RES_ANCHOR );
    3028         655 :             aSet.SetParent(&pFmt->GetAttrSet());
    3029        1310 :             SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(RES_ANCHOR);
    3030         655 :             aAnchor.SetAnchor( aIntPam.Start() );
    3031         655 :             aSet.Put(aAnchor);
    3032        1310 :             pDoc->SetFlyFrmAttr( *pFmt, aSet );
    3033             :         }
    3034             :         else
    3035         657 :             throw lang::IllegalArgumentException();
    3036             :     }
    3037        1824 : }
    3038             : 
    3039          30 : awt::Point SwXFrame::getPosition(void) throw( uno::RuntimeException, std::exception )
    3040             : {
    3041          30 :     SolarMutexGuard aGuard;
    3042          60 :     uno::RuntimeException aRuntime;
    3043          30 :     aRuntime.Message = "position cannot be determined with this method";
    3044          60 :     throw aRuntime;
    3045             : }
    3046             : 
    3047           0 : void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeException, std::exception )
    3048             : {
    3049           0 :     SolarMutexGuard aGuard;
    3050           0 :     uno::RuntimeException aRuntime;
    3051           0 :     aRuntime.Message = "position cannot be changed with this method";
    3052           0 :     throw aRuntime;
    3053             : }
    3054             : 
    3055         330 : awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException, std::exception )
    3056             : {
    3057         330 :     const ::uno::Any aVal = getPropertyValue("Size");
    3058         330 :     awt::Size* pRet =  (awt::Size*)aVal.getValue();
    3059         330 :     return *pRet;
    3060             : }
    3061             : 
    3062         369 : void SwXFrame::setSize(const awt::Size& aSize)
    3063             :     throw( beans::PropertyVetoException, uno::RuntimeException, std::exception )
    3064             : {
    3065         369 :     const ::uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0)));
    3066         369 :     setPropertyValue("Size", aVal);
    3067         369 : }
    3068             : 
    3069           8 : OUString SwXFrame::getShapeType(void) throw( uno::RuntimeException, std::exception )
    3070             : {
    3071           8 :     return OUString("FrameShape");
    3072             : }
    3073             : 
    3074             : /******************************************************************
    3075             :  *  SwXTextFrame
    3076             :  ******************************************************************/
    3077         513 : SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) :
    3078             :     SwXText(0, CURSOR_FRAME),
    3079         513 :     SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc )
    3080             : {
    3081         513 : }
    3082             : 
    3083         537 : SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) :
    3084             :     SwXText(rFmt.GetDoc(), CURSOR_FRAME),
    3085         537 :     SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME))
    3086             : {
    3087             : 
    3088         537 : }
    3089             : 
    3090        2098 : SwXTextFrame::~SwXTextFrame()
    3091             : {
    3092        2098 : }
    3093             : 
    3094       58612 : void SAL_CALL SwXTextFrame::acquire(  )throw()
    3095             : {
    3096       58612 :     SwXFrame::acquire();
    3097       58612 : }
    3098             : 
    3099       58611 : void SAL_CALL SwXTextFrame::release(  )throw()
    3100             : {
    3101       58611 :     SwXFrame::release();
    3102       58611 : }
    3103             : 
    3104       14431 : ::uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType )
    3105             :     throw (uno::RuntimeException, std::exception)
    3106             : {
    3107       14431 :     ::uno::Any aRet = SwXFrame::queryInterface(aType);
    3108       14431 :     if(aRet.getValueType() == ::getCppuVoidType())
    3109        3503 :         aRet = SwXText::queryInterface(aType);
    3110       14431 :     if(aRet.getValueType() == ::getCppuVoidType())
    3111        2734 :         aRet = SwXTextFrameBaseClass::queryInterface(aType);
    3112       14431 :     return aRet;
    3113             : }
    3114             : 
    3115           0 : uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes(  ) throw(uno::RuntimeException, std::exception)
    3116             : {
    3117           0 :     uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes();
    3118           0 :     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
    3119           0 :     uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
    3120             : 
    3121           0 :     long nIndex = aTextFrameTypes.getLength();
    3122             :     aTextFrameTypes.realloc(
    3123           0 :         aTextFrameTypes.getLength() +
    3124           0 :         aFrameTypes.getLength() +
    3125           0 :         aTextTypes.getLength());
    3126             : 
    3127           0 :     uno::Type* pTextFrameTypes = aTextFrameTypes.getArray();
    3128           0 :     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
    3129             :     long nPos;
    3130           0 :     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
    3131           0 :         pTextFrameTypes[nIndex++] = pFrameTypes[nPos];
    3132             : 
    3133           0 :     const uno::Type* pTextTypes = aTextTypes.getConstArray();
    3134           0 :     for(nPos = 0; nPos <aTextTypes.getLength(); nPos++)
    3135           0 :         pTextFrameTypes[nIndex++] = pTextTypes[nPos];
    3136             : 
    3137           0 :     return aTextFrameTypes;
    3138             : }
    3139             : 
    3140           0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId(  ) throw(uno::RuntimeException, std::exception)
    3141             : {
    3142           0 :     return css::uno::Sequence<sal_Int8>();
    3143             : }
    3144             : 
    3145          68 : uno::Reference< text::XText >  SwXTextFrame::getText(void) throw( uno::RuntimeException, std::exception )
    3146             : {
    3147          68 :     return this;
    3148             : }
    3149             : 
    3150        1044 : const SwStartNode *SwXTextFrame::GetStartNode() const
    3151             : {
    3152        1044 :     const SwStartNode *pSttNd = 0;
    3153             : 
    3154        1044 :     SwFrmFmt* pFmt = GetFrmFmt();
    3155        1044 :     if(pFmt)
    3156             :     {
    3157        1044 :         const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
    3158        1044 :         if( rFlyCntnt.GetCntntIdx() )
    3159        1044 :             pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
    3160             :     }
    3161             : 
    3162        1044 :     return pSttNd;
    3163             : }
    3164             : 
    3165             : uno::Reference< text::XTextCursor >
    3166        2546 : SwXTextFrame::CreateCursor() throw (uno::RuntimeException)
    3167             : {
    3168        2546 :     return createTextCursor();
    3169             : }
    3170             : 
    3171        3728 : uno::Reference< text::XTextCursor >  SwXTextFrame::createTextCursor(void) throw( uno::RuntimeException, std::exception )
    3172             : {
    3173        3728 :     SolarMutexGuard aGuard;
    3174        3728 :     uno::Reference< text::XTextCursor >  aRef;
    3175        3728 :     SwFrmFmt* pFmt = GetFrmFmt();
    3176        3728 :     if(pFmt)
    3177             :     {
    3178             :         //save current start node to be able to check if there is content after the table -
    3179             :         //otherwise the cursor would be in the body text!
    3180        3728 :         const SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
    3181        3728 :         const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
    3182             : 
    3183        3728 :         SwPaM aPam(rNode);
    3184        3728 :         aPam.Move(fnMoveForward, fnGoNode);
    3185        3728 :         SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
    3186        3728 :         SwCntntNode* pCont = 0;
    3187        7467 :         while( pTblNode )
    3188             :         {
    3189          11 :             aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
    3190          11 :             pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
    3191          11 :             pTblNode = pCont->FindTableNode();
    3192             :         }
    3193        3728 :         if(pCont)
    3194          11 :             aPam.GetPoint()->nContent.Assign(pCont, 0);
    3195             : 
    3196             :         const SwStartNode* pNewStartNode =
    3197        3728 :             aPam.GetNode()->FindSttNodeByType(SwFlyStartNode);
    3198        3728 :         if(!pNewStartNode || pNewStartNode != pOwnStartNode)
    3199             :         {
    3200           0 :             uno::RuntimeException aExcept;
    3201           0 :             aExcept.Message = "no text available";
    3202           0 :             throw aExcept;
    3203             :         }
    3204             : 
    3205             :         SwXTextCursor *const pXCursor = new SwXTextCursor(
    3206        3728 :                  *pFmt->GetDoc(), this, CURSOR_FRAME, *aPam.GetPoint());
    3207        3728 :         aRef =  static_cast<text::XWordCursor*>(pXCursor);
    3208             : #if OSL_DEBUG_LEVEL > 1
    3209             :         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
    3210             :         (void) pUnoCrsr;
    3211             : #endif
    3212             :     }
    3213             :     else
    3214           0 :         throw uno::RuntimeException();
    3215        3728 :     return aRef;
    3216             : }
    3217             : 
    3218         464 : uno::Reference< text::XTextCursor >  SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition) throw( uno::RuntimeException, std::exception )
    3219             : {
    3220         464 :     SolarMutexGuard aGuard;
    3221         464 :     uno::Reference< text::XTextCursor >  aRef;
    3222         464 :     SwFrmFmt* pFmt = GetFrmFmt();
    3223         928 :     SwUnoInternalPaM aPam(*GetDoc());
    3224         464 :     if (pFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
    3225             :     {
    3226         464 :         SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
    3227             : #if OSL_DEBUG_LEVEL > 1
    3228             :         const SwStartNode* p1 = aPam.GetNode()->FindFlyStartNode();
    3229             :         const SwStartNode* p2 = rNode.FindFlyStartNode();
    3230             :         (void)p1;
    3231             :         (void)p2;
    3232             : #endif
    3233         464 :         if(aPam.GetNode()->FindFlyStartNode() == rNode.FindFlyStartNode())
    3234             :         {
    3235             :             aRef = static_cast<text::XWordCursor*>(
    3236         463 :                     new SwXTextCursor(*pFmt->GetDoc(), this, CURSOR_FRAME,
    3237         463 :                         *aPam.GetPoint(), aPam.GetMark()));
    3238             :         }
    3239             :     }
    3240             :     else
    3241           0 :         throw uno::RuntimeException();
    3242         928 :     return aRef;
    3243             : }
    3244             : 
    3245          18 : uno::Reference< container::XEnumeration >  SwXTextFrame::createEnumeration(void) throw( uno::RuntimeException, std::exception )
    3246             : {
    3247          18 :     SolarMutexGuard aGuard;
    3248          18 :     uno::Reference< container::XEnumeration >  aRef;
    3249          18 :     SwFrmFmt* pFmt = GetFrmFmt();
    3250          18 :     if(pFmt)
    3251             :     {
    3252          18 :         SwPosition aPos(pFmt->GetCntnt().GetCntntIdx()->GetNode());
    3253             :         ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
    3254          36 :                 GetDoc()->CreateUnoCrsr(aPos, false));
    3255          18 :         pUnoCursor->Move(fnMoveForward, fnGoNode);
    3256             : //      // no Cursor in protected sections
    3257             : //      SwCrsrSaveState aSave( *pUnoCrsr );
    3258             : //      if(pUnoCrsr->IsInProtectTable(true) ||
    3259             : //          pUnoCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
    3260             : //          throw  uno::RuntimeException() );
    3261          36 :         aRef = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_FRAME);
    3262             :     }
    3263          18 :     return aRef;
    3264             : }
    3265             : 
    3266           1 : uno::Type  SwXTextFrame::getElementType(void) throw( uno::RuntimeException, std::exception )
    3267             : {
    3268           1 :     return ::getCppuType(static_cast<uno::Reference<text::XTextRange>*>(0));
    3269             : }
    3270             : 
    3271           1 : sal_Bool SwXTextFrame::hasElements(void) throw( uno::RuntimeException, std::exception )
    3272             : {
    3273           1 :     return sal_True;
    3274             : }
    3275             : 
    3276        1167 : void SwXTextFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
    3277             :     throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception )
    3278             : {
    3279        1167 :     SwXFrame::attach(xTextRange);
    3280        1167 : }
    3281             : 
    3282           8 : uno::Reference< text::XTextRange >  SwXTextFrame::getAnchor(void) throw( uno::RuntimeException, std::exception )
    3283             : {
    3284           8 :     SolarMutexGuard aGuard;
    3285           8 :     return SwXFrame::getAnchor();
    3286             : }
    3287             : 
    3288           2 : void SwXTextFrame::dispose(void) throw( uno::RuntimeException, std::exception )
    3289             : {
    3290           2 :     SolarMutexGuard aGuard;
    3291           2 :     SwXFrame::dispose();
    3292           2 : }
    3293             : 
    3294           2 : void SwXTextFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception )
    3295             : {
    3296           2 :     SwXFrame::addEventListener(aListener);
    3297           2 : }
    3298             : 
    3299           1 : void SwXTextFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception )
    3300             : {
    3301           1 :     SwXFrame::removeEventListener(aListener);
    3302           1 : }
    3303             : 
    3304           0 : OUString SwXTextFrame::getImplementationName(void) throw( uno::RuntimeException, std::exception )
    3305             : {
    3306           0 :     return OUString("SwXTextFrame");
    3307             : }
    3308             : 
    3309        2041 : sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
    3310             : {
    3311        2041 :     return cppu::supportsService(this, rServiceName);
    3312             : }
    3313             : 
    3314        2042 : uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
    3315             : {
    3316        2042 :     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
    3317        2042 :     aRet.realloc(aRet.getLength() + 2);
    3318        2042 :     OUString* pArray = aRet.getArray();
    3319        2042 :     pArray[aRet.getLength() - 2] = "com.sun.star.text.TextFrame";
    3320        2042 :     pArray[aRet.getLength() - 1] = "com.sun.star.text.Text";
    3321        2042 :     return aRet;
    3322             : }
    3323             : 
    3324        1050 : void * SAL_CALL SwXTextFrame::operator new( size_t t) throw()
    3325             : {
    3326        1050 :     return SwXTextFrameBaseClass::operator new( t);
    3327             : }
    3328             : 
    3329        1049 : void SAL_CALL SwXTextFrame::operator delete( void * p) throw()
    3330             : {
    3331        1049 :     SwXTextFrameBaseClass::operator delete(p);
    3332        1049 : }
    3333             : 
    3334           7 : uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
    3335             :     throw(uno::RuntimeException, std::exception)
    3336             : {
    3337           7 :     return new SwFrameEventDescriptor( *this );
    3338             : }
    3339             : 
    3340        6911 : sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
    3341             :     throw(uno::RuntimeException, std::exception)
    3342             : {
    3343        6911 :     sal_Int64 nRet = SwXFrame::getSomething( rId );
    3344        6911 :     if( !nRet )
    3345        6911 :         nRet = SwXText::getSomething( rId );
    3346             : 
    3347        6911 :     return nRet;
    3348             : }
    3349             : 
    3350        4844 : ::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
    3351             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    3352             : {
    3353        4844 :     SolarMutexGuard aGuard;
    3354        4844 :     ::uno::Any aRet;
    3355        9680 :     if(rPropertyName == UNO_NAME_START_REDLINE||
    3356        4836 :             rPropertyName == UNO_NAME_END_REDLINE)
    3357             :     {
    3358             :         //redline can only be returned if it's a living object
    3359          16 :         if(!IsDescriptor())
    3360          16 :             aRet = SwXText::getPropertyValue(rPropertyName);
    3361             :     }
    3362             :     else
    3363        4828 :         aRet = SwXFrame::getPropertyValue(rPropertyName);
    3364        4542 :     return aRet;
    3365             : }
    3366             : 
    3367             : /******************************************************************
    3368             :  *  SwXTextGraphicObject
    3369             :  ******************************************************************/
    3370         313 : SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) :
    3371         313 :     SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
    3372             : {
    3373         313 : }
    3374             : 
    3375         130 : SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) :
    3376         130 :     SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC))
    3377             : {
    3378             : 
    3379         130 : }
    3380             : 
    3381         886 : SwXTextGraphicObject::~SwXTextGraphicObject()
    3382             : {
    3383             : 
    3384         886 : }
    3385             : 
    3386        4706 : void SAL_CALL SwXTextGraphicObject::acquire(  )throw()
    3387             : {
    3388        4706 :     SwXFrame::acquire();
    3389        4706 : }
    3390             : 
    3391        4706 : void SAL_CALL SwXTextGraphicObject::release(  )throw()
    3392             : {
    3393        4706 :     SwXFrame::release();
    3394        4706 : }
    3395             : 
    3396        2640 : ::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType )
    3397             :     throw(uno::RuntimeException, std::exception)
    3398             : {
    3399        2640 :     ::uno::Any aRet = SwXFrame::queryInterface(aType);
    3400        2640 :     if(aRet.getValueType() == ::getCppuVoidType())
    3401         599 :         aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType);
    3402        2640 :     return aRet;
    3403             : }
    3404             : 
    3405             : uno::Sequence< uno::Type > SAL_CALL
    3406           0 :     SwXTextGraphicObject::getTypes(  ) throw(uno::RuntimeException, std::exception)
    3407             : {
    3408           0 :     uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes();
    3409           0 :     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
    3410             : 
    3411           0 :     long nIndex = aGraphicTypes.getLength();
    3412             :     aGraphicTypes.realloc(
    3413           0 :         aGraphicTypes.getLength() +
    3414           0 :         aFrameTypes.getLength());
    3415             : 
    3416           0 :     uno::Type* pGraphicTypes = aGraphicTypes.getArray();
    3417           0 :     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
    3418             :     long nPos;
    3419           0 :     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
    3420           0 :         pGraphicTypes[nIndex++] = pFrameTypes[nPos];
    3421             : 
    3422           0 :     return aGraphicTypes;
    3423             : }
    3424             : 
    3425           0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId(  ) throw(uno::RuntimeException, std::exception)
    3426             : {
    3427           0 :     return css::uno::Sequence<sal_Int8>();
    3428             : }
    3429             : 
    3430         313 : void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception )
    3431             : {
    3432         313 :     SwXFrame::attach(xTextRange);
    3433         313 : }
    3434             : 
    3435           1 : uno::Reference< text::XTextRange >  SwXTextGraphicObject::getAnchor(void) throw( uno::RuntimeException, std::exception )
    3436             : {
    3437           1 :     SolarMutexGuard aGuard;
    3438           1 :     return SwXFrame::getAnchor();
    3439             : }
    3440             : 
    3441           3 : void SwXTextGraphicObject::dispose(void) throw( uno::RuntimeException, std::exception )
    3442             : {
    3443           3 :     SolarMutexGuard aGuard;
    3444           3 :     SwXFrame::dispose();
    3445           3 : }
    3446             : 
    3447           2 : void SwXTextGraphicObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
    3448             :                                                     throw( uno::RuntimeException, std::exception )
    3449             : {
    3450           2 :     SwXFrame::addEventListener(aListener);
    3451           2 : }
    3452             : 
    3453           1 : void SwXTextGraphicObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
    3454             :                                                     throw( uno::RuntimeException, std::exception )
    3455             : {
    3456           1 :     SwXFrame::removeEventListener(aListener);
    3457           1 : }
    3458             : 
    3459           0 : OUString SwXTextGraphicObject::getImplementationName(void) throw( uno::RuntimeException, std::exception )
    3460             : {
    3461           0 :     return OUString("SwXTextGraphicObject");
    3462             : }
    3463             : 
    3464           9 : sal_Bool SwXTextGraphicObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
    3465             : {
    3466           9 :     return cppu::supportsService(this, rServiceName);
    3467             : }
    3468             : 
    3469          10 : uno::Sequence< OUString > SwXTextGraphicObject::getSupportedServiceNames(void)
    3470             :         throw( uno::RuntimeException, std::exception )
    3471             : {
    3472          10 :     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
    3473          10 :     aRet.realloc(aRet.getLength() + 1);
    3474          10 :     OUString* pArray = aRet.getArray();
    3475          10 :     pArray[aRet.getLength() - 1] = "com.sun.star.text.TextGraphicObject";
    3476          10 :     return aRet;
    3477             : }
    3478             : 
    3479         443 : void * SAL_CALL SwXTextGraphicObject::operator new( size_t t) throw()
    3480             : {
    3481         443 :     return SwXTextGraphicObjectBaseClass::operator new(t);
    3482             : }
    3483             : 
    3484         443 : void SAL_CALL SwXTextGraphicObject::operator delete( void * p) throw()
    3485             : {
    3486         443 :     SwXTextGraphicObjectBaseClass::operator delete(p);
    3487         443 : }
    3488             : 
    3489             : uno::Reference<container::XNameReplace> SAL_CALL
    3490           1 :     SwXTextGraphicObject::getEvents()
    3491             :         throw(uno::RuntimeException, std::exception)
    3492             : {
    3493           1 :     return new SwFrameEventDescriptor( *this );
    3494             : }
    3495             : 
    3496         344 : SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) :
    3497         344 :     SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
    3498             : {
    3499         344 : }
    3500             : 
    3501         364 : SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) :
    3502         364 :     SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT))
    3503             : {
    3504             : 
    3505         364 : }
    3506             : 
    3507        1416 : SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
    3508             : {
    3509             : 
    3510        1416 : }
    3511        5250 : void SAL_CALL SwXTextEmbeddedObject::acquire()throw()
    3512             : {
    3513        5250 :     SwXFrame::acquire();
    3514        5250 : }
    3515             : 
    3516        5250 : void SAL_CALL SwXTextEmbeddedObject::release()throw()
    3517             : {
    3518        5250 :     SwXFrame::release();
    3519        5250 : }
    3520             : 
    3521        2762 : ::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType )
    3522             :     throw( uno::RuntimeException, std::exception)
    3523             : {
    3524        2762 :     ::uno::Any aRet = SwXFrame::queryInterface(aType);;
    3525        2762 :     if(aRet.getValueType() == ::getCppuVoidType())
    3526         667 :         aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType);
    3527        2762 :     return aRet;
    3528             : }
    3529             : 
    3530           0 : uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes(  ) throw(uno::RuntimeException, std::exception)
    3531             : {
    3532           0 :     uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes();
    3533           0 :     uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
    3534             : 
    3535           0 :     long nIndex = aTextEmbeddedTypes.getLength();
    3536             :     aTextEmbeddedTypes.realloc(
    3537           0 :         aTextEmbeddedTypes.getLength() +
    3538           0 :         aFrameTypes.getLength());
    3539             : 
    3540           0 :     uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray();
    3541             : 
    3542           0 :     const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
    3543             :     long nPos;
    3544           0 :     for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
    3545           0 :         pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos];
    3546             : 
    3547           0 :     return aTextEmbeddedTypes;
    3548             : }
    3549             : 
    3550           0 : uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId(  ) throw(uno::RuntimeException, std::exception)
    3551             : {
    3552           0 :     return css::uno::Sequence<sal_Int8>();
    3553             : }
    3554             : 
    3555         345 : void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception )
    3556             : {
    3557         345 :     SwXFrame::attach(xTextRange);
    3558         344 : }
    3559             : 
    3560          39 : uno::Reference< text::XTextRange >  SwXTextEmbeddedObject::getAnchor(void) throw( uno::RuntimeException, std::exception )
    3561             : {
    3562          39 :     SolarMutexGuard aGuard;
    3563          39 :     return SwXFrame::getAnchor();
    3564             : }
    3565             : 
    3566           1 : void SwXTextEmbeddedObject::dispose(void) throw( uno::RuntimeException, std::exception )
    3567             : {
    3568           1 :     SolarMutexGuard aGuard;
    3569           1 :     SwXFrame::dispose();
    3570           1 : }
    3571             : 
    3572           2 : void SwXTextEmbeddedObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception )
    3573             : {
    3574           2 :     SwXFrame::addEventListener(aListener);
    3575           2 : }
    3576             : 
    3577           1 : void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception )
    3578             : {
    3579           1 :     SwXFrame::removeEventListener(aListener);
    3580           1 : }
    3581             : 
    3582          14 : uno::Reference< lang::XComponent >  SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException, std::exception )
    3583             : {
    3584          14 :     uno::Reference< lang::XComponent >  xRet;
    3585          14 :     SwFrmFmt*   pFmt = GetFrmFmt();
    3586          14 :     if(pFmt)
    3587             :     {
    3588          14 :         SwDoc* pDoc = pFmt->GetDoc();
    3589          14 :         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    3590             :         OSL_ENSURE( pCnt->GetCntntIdx() &&
    3591             :                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    3592             :                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    3593             : 
    3594          14 :         SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
    3595          28 :                                         ->GetIndex() + 1 ]->GetOLENode();
    3596          14 :         uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
    3597          14 :         if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
    3598             :         {
    3599             :             // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
    3600          14 :             if ( pDoc->GetDocShell() )
    3601          14 :                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
    3602             : 
    3603          14 :             xRet = uno::Reference < lang::XComponent >( xIP->getComponent(), uno::UNO_QUERY );
    3604          14 :             uno::Reference< util::XModifyBroadcaster >  xBrdcst( xRet, uno::UNO_QUERY);
    3605          28 :             uno::Reference< frame::XModel > xModel( xRet, uno::UNO_QUERY);
    3606          14 :             if( xBrdcst.is() && xModel.is() )
    3607             :             {
    3608          14 :                 SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
    3609             :                 //create a new one if the OLE object doesn't have one already
    3610          14 :                 if( !pListener )
    3611             :                 {
    3612          14 :                     uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
    3613          14 :                     xBrdcst->addModifyListener( xOLEListener );
    3614             :                 }
    3615          14 :             }
    3616          14 :         }
    3617             :     }
    3618          14 :     return xRet;
    3619             : }
    3620             : 
    3621           0 : uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()
    3622             :         throw( uno::RuntimeException, std::exception )
    3623             : {
    3624           0 :     uno::Reference< embed::XEmbeddedObject > xResult;
    3625           0 :     SwFrmFmt*   pFmt = GetFrmFmt();
    3626           0 :     if(pFmt)
    3627             :     {
    3628           0 :         SwDoc* pDoc = pFmt->GetDoc();
    3629           0 :         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    3630             :         OSL_ENSURE( pCnt->GetCntntIdx() &&
    3631             :                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    3632             :                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    3633             : 
    3634           0 :         SwOLENode* pOleNode =  pDoc->GetNodes()[ pCnt->GetCntntIdx()
    3635           0 :                                         ->GetIndex() + 1 ]->GetOLENode();
    3636           0 :         xResult = pOleNode->GetOLEObj().GetOleRef();
    3637           0 :         if ( svt::EmbeddedObjectRef::TryRunningState( xResult ) )
    3638             :         {
    3639             :             // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
    3640           0 :             if ( pDoc->GetDocShell() )
    3641           0 :                 pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xResult, embed::Aspects::MSOLE_CONTENT ) );
    3642             : 
    3643           0 :             uno::Reference < lang::XComponent > xComp( xResult->getComponent(), uno::UNO_QUERY );
    3644           0 :             uno::Reference< util::XModifyBroadcaster >  xBrdcst( xComp, uno::UNO_QUERY);
    3645           0 :             uno::Reference< frame::XModel > xModel( xComp, uno::UNO_QUERY);
    3646           0 :             if( xBrdcst.is() && xModel.is() )
    3647             :             {
    3648           0 :                 SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>::FirstElement( *pFmt );
    3649             :                 //create a new one if the OLE object doesn't have one already
    3650           0 :                 if( !pListener )
    3651             :                 {
    3652           0 :                     uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
    3653           0 :                     xBrdcst->addModifyListener( xOLEListener );
    3654             :                 }
    3655           0 :             }
    3656             :         }
    3657             :     }
    3658           0 :     return xResult;
    3659             : }
    3660             : 
    3661           0 : sal_Int64 SAL_CALL SwXTextEmbeddedObject::getAspect() throw (uno::RuntimeException, std::exception)
    3662             : {
    3663           0 :     SwFrmFmt*   pFmt = GetFrmFmt();
    3664           0 :     if(pFmt)
    3665             :     {
    3666           0 :         SwDoc* pDoc = pFmt->GetDoc();
    3667           0 :         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    3668             :         OSL_ENSURE( pCnt->GetCntntIdx() &&
    3669             :                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    3670             :                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    3671             : 
    3672           0 :         return pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetAspect();
    3673             :     }
    3674             : 
    3675           0 :     return embed::Aspects::MSOLE_CONTENT; // return the default value
    3676             : }
    3677             : 
    3678           0 : void SAL_CALL SwXTextEmbeddedObject::setAspect( sal_Int64 nAspect ) throw (uno::RuntimeException, std::exception)
    3679             : {
    3680           0 :     SwFrmFmt*   pFmt = GetFrmFmt();
    3681           0 :     if(pFmt)
    3682             :     {
    3683           0 :         SwDoc* pDoc = pFmt->GetDoc();
    3684           0 :         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    3685             :         OSL_ENSURE( pCnt->GetCntntIdx() &&
    3686             :                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    3687             :                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    3688             : 
    3689           0 :         pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->SetAspect( nAspect );
    3690             :     }
    3691           0 : }
    3692             : 
    3693           1 : uno::Reference< graphic::XGraphic > SAL_CALL SwXTextEmbeddedObject::getReplacementGraphic() throw (uno::RuntimeException, std::exception)
    3694             : {
    3695           1 :     SwFrmFmt*   pFmt = GetFrmFmt();
    3696           1 :     if(pFmt)
    3697             :     {
    3698           1 :         SwDoc* pDoc = pFmt->GetDoc();
    3699           1 :         const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
    3700             :         OSL_ENSURE( pCnt->GetCntntIdx() &&
    3701             :                        pDoc->GetNodes()[ pCnt->GetCntntIdx()->
    3702             :                                         GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
    3703             : 
    3704           1 :         const Graphic* pGraphic = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode()->GetGraphic();
    3705           1 :         if ( pGraphic )
    3706           1 :             return pGraphic->GetXGraphic();
    3707             :     }
    3708             : 
    3709           0 :     return uno::Reference< graphic::XGraphic >();
    3710             : }
    3711             : 
    3712           0 : OUString SwXTextEmbeddedObject::getImplementationName(void) throw( uno::RuntimeException, std::exception )
    3713             : {
    3714           0 :     return OUString("SwXTextEmbeddedObject");
    3715             : }
    3716             : 
    3717          53 : sal_Bool SwXTextEmbeddedObject::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
    3718             : {
    3719          53 :     return cppu::supportsService(this, rServiceName);
    3720             : }
    3721             : 
    3722          54 : uno::Sequence< OUString > SwXTextEmbeddedObject::getSupportedServiceNames(void)
    3723             :         throw( uno::RuntimeException, std::exception )
    3724             : {
    3725          54 :     uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
    3726          54 :     aRet.realloc(aRet.getLength() + 1);
    3727          54 :     OUString* pArray = aRet.getArray();
    3728          54 :     pArray[aRet.getLength() - 1] = "com.sun.star.text.TextEmbeddedObject";
    3729          54 :     return aRet;
    3730             : }
    3731             : 
    3732         708 : void * SAL_CALL SwXTextEmbeddedObject::operator new( size_t t) throw()
    3733             : {
    3734         708 :     return SwXTextEmbeddedObjectBaseClass::operator new(t);
    3735             : }
    3736             : 
    3737         708 : void SAL_CALL SwXTextEmbeddedObject::operator delete( void * p) throw()
    3738             : {
    3739         708 :     SwXTextEmbeddedObjectBaseClass::operator delete(p);
    3740         708 : }
    3741             : 
    3742             : uno::Reference<container::XNameReplace> SAL_CALL
    3743           8 :     SwXTextEmbeddedObject::getEvents()
    3744             :         throw(uno::RuntimeException, std::exception)
    3745             : {
    3746           8 :     return new SwFrameEventDescriptor( *this );
    3747             : }
    3748             : 
    3749         188 : TYPEINIT1(SwXOLEListener, SwClient);
    3750             : 
    3751          14 : SwXOLEListener::SwXOLEListener( SwFmt& rOLEFmt, uno::Reference< XModel > xOLE) :
    3752             :     SwClient(&rOLEFmt),
    3753          14 :     xOLEModel(xOLE)
    3754             : {
    3755          14 : }
    3756             : 
    3757          28 : SwXOLEListener::~SwXOLEListener()
    3758          28 : {}
    3759             : 
    3760          14 : void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
    3761             :                                         throw( uno::RuntimeException, std::exception )
    3762             : {
    3763          14 :     SolarMutexGuard aGuard;
    3764             : 
    3765          14 :     SwOLENode* pNd = 0;
    3766          14 :     SwFmt* pFmt = GetFmt();
    3767          14 :     if(pFmt)
    3768          14 :     {const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    3769          14 :         if(pIdx)
    3770             :         {
    3771          14 :             SwNodeIndex aIdx(*pIdx, 1);
    3772          14 :             SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
    3773          14 :             pNd = pNoTxt->GetOLENode();
    3774             :         }
    3775             :     }
    3776          14 :     if(!pNd)
    3777           0 :         throw uno::RuntimeException();
    3778             : 
    3779          28 :     uno::Reference < embed::XEmbeddedObject > xIP = pNd->GetOLEObj().GetOleRef();
    3780          14 :     if ( xIP.is() )
    3781             :     {
    3782          14 :         sal_Int32 nState = xIP->getCurrentState();
    3783          14 :         if ( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE )
    3784          14 :             return;
    3785             :     }
    3786             : 
    3787             :     // if the OLE-Node is UI-Active do nothing
    3788          14 :     pNd->SetOLESizeInvalid(true);
    3789          28 :     pNd->GetDoc()->SetOLEObjModified();
    3790             : }
    3791             : 
    3792          14 : void SwXOLEListener::disposing( const lang::EventObject& rEvent )
    3793             :                         throw( uno::RuntimeException, std::exception )
    3794             : {
    3795          14 :     SolarMutexGuard aGuard;
    3796             : 
    3797          28 :     uno::Reference< util::XModifyListener >  xListener( this );
    3798             : 
    3799          28 :     uno::Reference< frame::XModel >  xModel( rEvent.Source, uno::UNO_QUERY );
    3800          28 :     uno::Reference< util::XModifyBroadcaster >  xBrdcst(xModel, uno::UNO_QUERY);
    3801             : 
    3802             :     try
    3803             :     {
    3804          14 :         if( xBrdcst.is() )
    3805          14 :             xBrdcst->removeModifyListener( xListener );
    3806             :     }
    3807           0 :     catch(uno::Exception const &)
    3808             :     {
    3809             :         OSL_FAIL("OLE Listener couldn't be removed");
    3810          14 :     }
    3811          14 : }
    3812             : 
    3813          20 : void SwXOLEListener::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
    3814             : {
    3815          20 :     ClientModify(this, pOld, pNew);
    3816          20 :     if(!GetRegisteredIn())
    3817           6 :         xOLEModel = 0;
    3818          20 : }
    3819             : 
    3820             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10