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

Generated by: LCOV version 1.10