LCOV - code coverage report
Current view: top level - sw/source/ui/shells - textsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 31 618 5.0 %
Date: 2012-08-25 Functions: 11 19 57.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 23 1632 1.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : 
      31                 :            : #define _SW_FRMVALID_HXX
      32                 :            : #include <hintids.hxx>
      33                 :            : #include <comphelper/string.hxx>
      34                 :            : #include <svl/globalnameitem.hxx>
      35                 :            : #include <svl/ownlist.hxx>
      36                 :            : #include <sfx2/frmdescr.hxx>
      37                 :            : #include <sfx2/objface.hxx>
      38                 :            : #include <sfx2/lnkbase.hxx>
      39                 :            : 
      40                 :            : #include <tools/errinf.hxx>
      41                 :            : #include <svx/svdview.hxx>
      42                 :            : #include <svl/ptitem.hxx>
      43                 :            : #include <svl/stritem.hxx>
      44                 :            : #include <unotools/moduleoptions.hxx>
      45                 :            : #include <vcl/msgbox.hxx>
      46                 :            : #include <sfx2/fcontnr.hxx>
      47                 :            : #include <svx/hlnkitem.hxx>
      48                 :            : #include <svl/srchitem.hxx>
      49                 :            : #include <sfx2/dispatch.hxx>
      50                 :            : #include <sfx2/docfile.hxx>
      51                 :            : #include <svl/urihelper.hxx>
      52                 :            : #include <basic/sbxvar.hxx>
      53                 :            : #include <svl/whiter.hxx>
      54                 :            : #include <sfx2/request.hxx>
      55                 :            : #include <editeng/opaqitem.hxx>
      56                 :            : #include <editeng/fontitem.hxx>
      57                 :            : #include <editeng/adjitem.hxx>
      58                 :            : #include <editeng/boxitem.hxx>
      59                 :            : #include <editeng/sizeitem.hxx>
      60                 :            : #include <editeng/svxacorr.hxx>
      61                 :            : #include <editeng/scripttypeitem.hxx>
      62                 :            : #include <svtools/filter.hxx>
      63                 :            : #include <svx/htmlmode.hxx>
      64                 :            : #include <svx/pfiledlg.hxx>
      65                 :            : #include <svtools/htmlcfg.hxx>
      66                 :            : #include <com/sun/star/i18n/TransliterationModules.hpp>
      67                 :            : #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
      68                 :            : 
      69                 :            : #include <sot/clsids.hxx>
      70                 :            : #include <editeng/acorrcfg.hxx>
      71                 :            : #include <wdocsh.hxx>
      72                 :            : #include <fmtinfmt.hxx>
      73                 :            : #include <fmtclds.hxx>
      74                 :            : #include <fmtsrnd.hxx>
      75                 :            : #include <fmtfsize.hxx>
      76                 :            : #include <swmodule.hxx>
      77                 :            : #include <wrtsh.hxx>
      78                 :            : #include <view.hxx>
      79                 :            : #include <docsh.hxx>
      80                 :            : #include <doc.hxx>
      81                 :            : #include <uitool.hxx>
      82                 :            : #include <cmdid.h>
      83                 :            : #include <globals.hrc>
      84                 :            : #include <frmmgr.hxx>
      85                 :            : #include <textsh.hxx>
      86                 :            : #include <frmfmt.hxx>
      87                 :            : #include <tablemgr.hxx>
      88                 :            : #include <swundo.hxx>       // fuer Undo-IDs
      89                 :            : #include <shellio.hxx>
      90                 :            : #include <frmdlg.hxx>
      91                 :            : #include <usrpref.hxx>
      92                 :            : #include <swtable.hxx>
      93                 :            : #include <tblafmt.hxx>
      94                 :            : #include <caption.hxx>
      95                 :            : #include <idxmrk.hxx>
      96                 :            : #include <poolfmt.hxx>
      97                 :            : #include <breakit.hxx>
      98                 :            : #include <crsskip.hxx>
      99                 :            : #include <modcfg.hxx>
     100                 :            : #include <column.hxx>
     101                 :            : #include <edtwin.hxx>
     102                 :            : #include <shells.hrc>
     103                 :            : #include <popup.hrc>
     104                 :            : #include <swerror.h>
     105                 :            : #include <unochart.hxx>
     106                 :            : 
     107                 :            : #include <chartins.hxx>
     108                 :            : 
     109                 :            : #define SwTextShell
     110                 :            : #define Paragraph
     111                 :            : #define HyphenZone
     112                 :            : #define TextFont
     113                 :            : #define DropCap
     114                 :            : #include <sfx2/msg.hxx>
     115                 :            : #include <swslots.hxx>
     116                 :            : #include <SwRewriter.hxx>
     117                 :            : #include <comcore.hrc>
     118                 :            : 
     119                 :            : using namespace ::com::sun::star;
     120                 :            : using ::rtl::OUString;
     121                 :            : 
     122                 :            : #include <svx/svxdlg.hxx>
     123                 :            : #include <svx/dialogs.hrc>
     124                 :            : #include "swabstdlg.hxx"
     125                 :            : #include <misc.hrc>
     126                 :            : #include <table.hrc>
     127                 :            : #include <frmui.hrc>
     128                 :            : #include <unomid.h>
     129                 :            : 
     130 [ +  + ][ +  - ]:     391118 : SFX_IMPL_INTERFACE(SwTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_TEXT))
         [ +  - ][ +  - ]
     131                 :            : {
     132 [ +  - ][ +  - ]:         73 :     SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU));
     133 [ +  - ][ +  - ]:         73 :     SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
     134                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA);
     135                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD);
     136                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_IDX_ENTRY_DLG);
     137                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_AUTH_ENTRY_DLG);
     138                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(SID_RUBY_DIALOG);
     139                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(FN_WORDCOUNT_DIALOG);
     140                 :         73 : }
     141                 :            : 
     142 [ -  + ][ +  + ]:      28313 : TYPEINIT1(SwTextShell,SwBaseShell)
     143                 :            : 
     144                 :          4 : void SwTextShell::ExecInsert(SfxRequest &rReq)
     145                 :            : {
     146         [ +  - ]:          4 :     SwWrtShell &rSh = GetShell();
     147                 :            : 
     148                 :            :     OSL_ENSURE( !rSh.IsObjSelected() && !rSh.IsFrmSelected(),
     149                 :            :             "wrong shell on dispatcher" );
     150                 :            : 
     151                 :          4 :     const SfxItemSet *pArgs = rReq.GetArgs();
     152                 :          4 :     const SfxPoolItem* pItem = 0;
     153                 :          4 :     sal_uInt16 nSlot = rReq.GetSlot();
     154         [ +  - ]:          4 :     if(pArgs)
     155         [ +  - ]:          4 :         pArgs->GetItemState(nSlot, sal_False, &pItem );
     156                 :            : 
     157   [ +  -  -  -  :          4 :     switch( nSlot )
          -  -  -  -  -  
          -  -  -  -  -  
          -  -  -  -  -  
                   -  - ]
     158                 :            :     {
     159                 :            :     case FN_INSERT_STRING:
     160         [ +  - ]:          4 :         if( pItem )
     161         [ +  - ]:          4 :             rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue());
     162                 :          4 :     break;
     163                 :            :     case FN_INSERT_SOFT_HYPHEN:
     164 [ #  # ][ #  # ]:          0 :         if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, 0 ) &&
         [ #  # ][ #  # ]
     165         [ #  # ]:          0 :             CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, -1 ))
     166 [ #  # ][ #  # ]:          0 :             rSh.Insert( rtl::OUString( CHAR_SOFTHYPHEN ) );
                 [ #  # ]
     167                 :          0 :         break;
     168                 :            : 
     169                 :            :     case FN_INSERT_HARDHYPHEN:
     170                 :            :     case FN_INSERT_HARD_SPACE:
     171                 :            :         {
     172                 :            :             sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK
     173         [ #  # ]:          0 :                                                              : CHAR_HARDHYPHEN;
     174                 :            : 
     175         [ #  # ]:          0 :             SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
     176                 :          0 :             SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
     177   [ #  #  #  # ]:          0 :             if( pACorr && rACfg.IsAutoFmtByInput() &&
         [ #  # ][ #  # ]
     178                 :            :                     pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
     179                 :            :                                 AddNonBrkSpace | ChgOrdinalNumber |
     180                 :          0 :                                 ChgToEnEmDash | SetINetAttr | Autocorrect ))
     181         [ #  # ]:          0 :                 rSh.AutoCorrect( *pACorr, cIns );
     182                 :            :             else
     183 [ #  # ][ #  # ]:          0 :                 rSh.Insert( rtl::OUString( cIns ) );
                 [ #  # ]
     184                 :            :         }
     185                 :          0 :         break;
     186                 :            :     case SID_INSERT_RLM :
     187                 :            :     case SID_INSERT_LRM :
     188                 :            :     case SID_INSERT_ZWNBSP :
     189                 :            :     case SID_INSERT_ZWSP:
     190                 :            :     {
     191                 :          0 :         sal_Unicode cIns = 0;
     192   [ #  #  #  #  :          0 :         switch(nSlot)
                      # ]
     193                 :            :         {
     194                 :          0 :             case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
     195                 :          0 :             case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
     196                 :          0 :             case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
     197                 :          0 :             case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
     198                 :            :         }
     199 [ #  # ][ #  # ]:          0 :         rSh.Insert( rtl::OUString( cIns ) );
                 [ #  # ]
     200                 :            :     }
     201                 :          0 :     break;
     202                 :            :     case FN_INSERT_BREAK:
     203         [ #  # ]:          0 :         rSh.SplitNode();
     204         [ #  # ]:          0 :         rReq.Done();
     205                 :          0 :     break;
     206                 :            :     case FN_INSERT_PAGEBREAK:
     207         [ #  # ]:          0 :         rSh.InsertPageBreak();
     208         [ #  # ]:          0 :         rReq.Done();
     209                 :          0 :     break;
     210                 :            :     case FN_INSERT_LINEBREAK:
     211         [ #  # ]:          0 :         rSh.InsertLineBreak();
     212         [ #  # ]:          0 :         rReq.Done();
     213                 :          0 :     break;
     214                 :            :     case FN_INSERT_COLUMN_BREAK:
     215         [ #  # ]:          0 :         rSh.InsertColumnBreak();
     216         [ #  # ]:          0 :         rReq.Done();
     217                 :          0 :     break;
     218                 :            :     case SID_HYPERLINK_SETLINK:
     219         [ #  # ]:          0 :         if (pItem)
     220         [ #  # ]:          0 :             InsertHyperlink(*((const SvxHyperlinkItem *)pItem));
     221         [ #  # ]:          0 :         rReq.Done();
     222                 :          0 :         break;
     223                 :            :     case SID_INSERT_AVMEDIA:
     224 [ #  # ][ #  # ]:          0 :         rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq )));
         [ #  # ][ #  # ]
     225                 :          0 :         break;
     226                 :            :     case  SID_INSERT_SOUND:
     227                 :            :     case  SID_INSERT_VIDEO:
     228                 :            :     {
     229 [ #  # ][ #  # ]:          0 :         SvxPluginFileDlg aDlg( &GetView().GetViewFrame()->GetWindow(), nSlot );
     230 [ #  # ][ #  # ]:          0 :         aDlg.SetContext( nSlot == SID_INSERT_SOUND? sfx2::FileDialogHelper::SW_INSERT_SOUND : sfx2::FileDialogHelper::SW_INSERT_VIDEO );
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :         if ( ERRCODE_NONE == aDlg.Execute() )
     233                 :            :         {
     234                 :            :             // URL ermitteln
     235         [ #  # ]:          0 :             String aStrURL( aDlg.GetPath() );
     236                 :            :             aStrURL = URIHelper::SmartRel2Abs(
     237 [ #  # ][ #  # ]:          0 :                 INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     238                 :            : 
     239 [ #  # ][ #  # ]:          0 :             INetURLObject* pURL = new INetURLObject();
     240                 :          0 :             pURL->SetSmartProtocol( INET_PROT_FILE );
     241                 :            : 
     242 [ #  # ][ #  # ]:          0 :             if ( pURL->SetURL( aStrURL, INetURLObject::WAS_ENCODED ) )
                 [ #  # ]
     243                 :            :             {
     244                 :          0 :                 ::rtl::OUString aName;
     245         [ #  # ]:          0 :                 comphelper::EmbeddedObjectContainer aCnt;
     246 [ #  # ][ #  # ]:          0 :                 svt::EmbeddedObjectRef xObj( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     247         [ #  # ]:          0 :                 if ( xObj.is() )
     248                 :            :                 {
     249         [ #  # ]:          0 :                     svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
     250                 :            : 
     251                 :            :                     // set properties from dialog
     252 [ #  # ][ #  # ]:          0 :                     uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
                 [ #  # ]
     253         [ #  # ]:          0 :                     if ( xSet.is() )
     254                 :            :                     {
     255         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginURL")),
     256 [ #  # ][ #  # ]:          0 :                                 uno::makeAny( ::rtl::OUString( pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) );
         [ #  # ][ #  # ]
     257                 :          0 :                     }
     258                 :            :                 }
     259                 :            : 
     260 [ #  # ][ #  # ]:          0 :                 rSh.InsertObject( xObj, 0, sal_True, nSlot);
                 [ #  # ]
     261         [ #  # ]:          0 :             }
     262         [ #  # ]:          0 :         }
     263                 :            :     }
     264                 :          0 :     break;
     265                 :            :     case SID_INSERT_OBJECT:
     266                 :            :     case SID_INSERT_PLUGIN:
     267                 :            :     {
     268 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, sal_False );
     269                 :          0 :         SvGlobalName *pName = NULL;
     270         [ #  # ]:          0 :         SvGlobalName aName;
     271         [ #  # ]:          0 :         if ( pNameItem )
     272                 :            :         {
     273 [ #  # ][ #  # ]:          0 :             aName = pNameItem->GetValue();
                 [ #  # ]
     274                 :          0 :             pName = &aName;
     275                 :            :         }
     276                 :            : 
     277 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pClassLocationItem,  SfxStringItem, FN_PARAM_2, sal_False );
     278 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pCommandsItem,       SfxStringItem, FN_PARAM_3, sal_False );
     279                 :            :         //TODO/LATER: recording currently not working, need code for Commandlist
     280         [ #  # ]:          0 :         svt::EmbeddedObjectRef xObj;
     281 [ #  # ][ #  # ]:          0 :         if( nSlot == SID_INSERT_PLUGIN && ( pClassLocationItem || pCommandsItem ) )
                 [ #  # ]
     282                 :            :         {
     283         [ #  # ]:          0 :             String sClassLocation;
     284         [ #  # ]:          0 :             if(pClassLocationItem)
     285         [ #  # ]:          0 :                 sClassLocation = pClassLocationItem->GetValue();
     286                 :            : 
     287         [ #  # ]:          0 :             SvCommandList aCommandList;
     288         [ #  # ]:          0 :             if(pCommandsItem)
     289                 :            :             {
     290                 :            :                 sal_Int32 nTemp;
     291 [ #  # ][ #  # ]:          0 :                 aCommandList.AppendCommands( pCommandsItem->GetValue(), &nTemp );
     292                 :            :             }
     293                 :            : 
     294                 :            :             {
     295         [ #  # ]:          0 :                 comphelper::EmbeddedObjectContainer aCnt;
     296                 :          0 :                 ::rtl::OUString sName;
     297                 :            :                 xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), sName ),
     298 [ #  # ][ #  # ]:          0 :                             embed::Aspects::MSOLE_CONTENT );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     299         [ #  # ]:          0 :                 svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
     300 [ #  # ][ #  # ]:          0 :                 uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
                 [ #  # ]
     301         [ #  # ]:          0 :                 if ( xSet.is() )
     302                 :            :                 {
     303                 :            :                     try
     304                 :            :                     {
     305         [ #  # ]:          0 :                         if ( sClassLocation.Len() )
     306         [ #  # ]:          0 :                             xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginURL")),
     307                 :            :                                 uno::makeAny(
     308                 :            :                                     ::rtl::OUString(
     309                 :            :                                         URIHelper::SmartRel2Abs(
     310                 :            :                                             INetURLObject(), sClassLocation,
     311 [ #  # ][ #  # ]:          0 :                                             URIHelper::GetMaybeFileHdl()) ) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     312         [ #  # ]:          0 :                         uno::Sequence< beans::PropertyValue > aSeq;
     313         [ #  # ]:          0 :                         if ( aCommandList.size() )
     314                 :            :                         {
     315         [ #  # ]:          0 :                             aCommandList.FillSequence( aSeq );
     316 [ #  # ][ #  # ]:          0 :                             xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginCommands")), uno::makeAny( aSeq ) );
         [ #  # ][ #  # ]
     317 [ #  # ][ #  # ]:          0 :                         }
     318                 :            :                     }
     319         [ #  # ]:          0 :                     catch (const uno::Exception&)
     320                 :            :                     {
     321                 :            :                     }
     322         [ #  # ]:          0 :                 }
     323                 :            :             }
     324                 :            : 
     325         [ #  # ]:          0 :             if(xObj.is())
     326 [ #  # ][ #  # ]:          0 :                 rSh.InsertOleObject( xObj );
     327                 :            :         }
     328                 :            :         else
     329                 :            :         {
     330                 :            :             OSL_ENSURE( !pNameItem || nSlot == SID_INSERT_OBJECT, "Superfluous argument!" );
     331         [ #  # ]:          0 :             rSh.InsertObject( xObj, pName, sal_True, nSlot);
     332         [ #  # ]:          0 :             rReq.Done();
     333                 :            :         }
     334 [ #  # ][ #  # ]:          0 :         break;
     335                 :            :     }
     336                 :            :     case SID_INSERT_FLOATINGFRAME:
     337                 :            :     {
     338         [ #  # ]:          0 :         svt::EmbeddedObjectRef xObj;
     339 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pNameItem,   SfxStringItem, FN_PARAM_1, sal_False );
     340 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pURLItem,    SfxStringItem, FN_PARAM_2, sal_False );
     341 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pMarginItem, SvxSizeItem, FN_PARAM_3, sal_False );
     342 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pScrollingItem, SfxByteItem, FN_PARAM_4, sal_False );
     343 [ #  # ][ #  # ]:          0 :         SFX_REQUEST_ARG( rReq, pBorderItem, SfxBoolItem, FN_PARAM_5, sal_False );
     344                 :            : 
     345         [ #  # ]:          0 :         if(pURLItem) // URL is a _must_
     346                 :            :         {
     347         [ #  # ]:          0 :             comphelper::EmbeddedObjectContainer aCnt;
     348                 :          0 :             ::rtl::OUString aName;
     349                 :            :             xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence(), aName ),
     350 [ #  # ][ #  # ]:          0 :                         embed::Aspects::MSOLE_CONTENT );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     351         [ #  # ]:          0 :             svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
     352 [ #  # ][ #  # ]:          0 :             uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
                 [ #  # ]
     353         [ #  # ]:          0 :             if ( xSet.is() )
     354                 :            :             {
     355                 :            :                 try
     356                 :            :                 {
     357                 :          0 :                     ScrollingMode eScroll = ScrollingAuto;
     358 [ #  # ][ #  # ]:          0 :                     if( pScrollingItem && pScrollingItem->GetValue() <= ScrollingAuto )
                 [ #  # ]
     359                 :          0 :                         eScroll = (ScrollingMode) pScrollingItem->GetValue();
     360                 :            : 
     361                 :          0 :                     Size aMargin;
     362         [ #  # ]:          0 :                     if ( pMarginItem )
     363                 :          0 :                         aMargin = pMarginItem->GetSize();
     364                 :            : 
     365         [ #  # ]:          0 :                     if ( pURLItem )
     366 [ #  # ][ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL")), uno::makeAny( ::rtl::OUString( pURLItem->GetValue() ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     367         [ #  # ]:          0 :                     if ( pNameItem )
     368 [ #  # ][ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName")), uno::makeAny( ::rtl::OUString( pNameItem->GetValue() ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     369                 :            : 
     370         [ #  # ]:          0 :                     if ( eScroll == ScrollingAuto )
     371         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll")),
     372 [ #  # ][ #  # ]:          0 :                             uno::makeAny( sal_True ) );
                 [ #  # ]
     373                 :            :                     else
     374         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode")),
     375 [ #  # ][ #  # ]:          0 :                             uno::makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
                 [ #  # ]
     376                 :            : 
     377         [ #  # ]:          0 :                     if ( pBorderItem )
     378         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder")),
     379 [ #  # ][ #  # ]:          0 :                             uno::makeAny( (sal_Bool) pBorderItem->GetValue() ) );
                 [ #  # ]
     380                 :            : 
     381         [ #  # ]:          0 :                     if ( pMarginItem )
     382                 :            :                     {
     383         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth")),
     384 [ #  # ][ #  # ]:          0 :                             uno::makeAny( sal_Int32( aMargin.Width() ) ) );
                 [ #  # ]
     385                 :            : 
     386         [ #  # ]:          0 :                         xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight")),
     387 [ #  # ][ #  # ]:          0 :                             uno::makeAny( sal_Int32( aMargin.Height() ) ) );
         [ #  # ][ #  # ]
     388                 :            :                     }
     389                 :            :                 }
     390         [ #  # ]:          0 :                 catch (const uno::Exception&)
     391                 :            :                 {
     392                 :            :                 }
     393                 :            :             }
     394                 :            : 
     395 [ #  # ][ #  # ]:          0 :             rSh.InsertOleObject( xObj );
     396                 :            :         }
     397                 :            :         else
     398                 :            :         {
     399         [ #  # ]:          0 :             rSh.InsertObject( xObj, 0, sal_True, nSlot);
     400         [ #  # ]:          0 :             rReq.Done();
     401         [ #  # ]:          0 :         }
     402                 :            :     }
     403                 :          0 :     break;
     404                 :            :     case SID_INSERT_DIAGRAM:
     405                 :            :         {
     406         [ #  # ]:          0 :             SvtModuleOptions aMOpt;
     407 [ #  # ][ #  # ]:          0 :             if ( !aMOpt.IsChart() )
     408                 :            :                 break;
     409 [ #  # ][ #  # ]:          0 :             if(!rReq.IsAPI())
     410                 :            :             {
     411                 :          0 :                 SfxViewFrame* pVFrame = GetView().GetViewFrame();
     412         [ #  # ]:          0 :                 SwInsertChart( &GetView().GetEditWin(), &pVFrame->GetBindings() );
     413                 :            :             }
     414                 :            :             else
     415                 :            :             {
     416                 :          0 :                 uno::Reference< chart2::data::XDataProvider > xDataProvider;
     417                 :          0 :                 sal_Bool bFillWithData = sal_True;
     418                 :          0 :                 OUString aRangeString;
     419 [ #  # ][ #  # ]:          0 :                 if (!GetShell().IsTblComplexForChart())
                 [ #  # ]
     420                 :            :                 {
     421 [ #  # ][ #  # ]:          0 :                     SwFrmFmt* pTblFmt = GetShell().GetTableFmt();
     422         [ #  # ]:          0 :                     String aCurrentTblName = pTblFmt->GetName();
     423         [ #  # ]:          0 :                     aRangeString = aCurrentTblName;
     424                 :          0 :                     aRangeString += OUString::valueOf( sal_Unicode('.') );
     425 [ #  # ][ #  # ]:          0 :                     aRangeString += GetShell().GetBoxNms();
         [ #  # ][ #  # ]
     426                 :            : 
     427                 :            :                     // get table data provider
     428 [ #  # ][ #  # ]:          0 :                     xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     429                 :            :                 }
     430                 :            :                 else
     431                 :          0 :                     bFillWithData = sal_False;  // will create chart with only it's default image
     432                 :            : 
     433 [ #  # ][ #  # ]:          0 :                 SwTableFUNC( &rSh, sal_False ).InsertChart( xDataProvider, bFillWithData, aRangeString );
                 [ #  # ]
     434         [ #  # ]:          0 :                 rSh.LaunchOLEObj();
     435                 :            : 
     436         [ #  # ]:          0 :                 svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject();
     437 [ #  # ][ #  # ]:          0 :                 if(pItem && xObj.is())
                 [ #  # ]
     438                 :            :                 {
     439                 :          0 :                     Size aSize(((SvxSizeItem*)pItem)->GetSize());
     440                 :            :                     aSize = OutputDevice::LogicToLogic
     441 [ #  # ][ #  # ]:          0 :                                     ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 :                     if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY)
                 [ #  # ]
     444                 :            :                     {
     445                 :          0 :                         awt::Size aSz;
     446                 :          0 :                         aSz.Width = aSize.Width();
     447                 :          0 :                         aSz.Height = aSize.Height();
     448 [ #  # ][ #  # ]:          0 :                         xObj->setVisualAreaSize( xObj.GetViewAspect(), aSz );
                 [ #  # ]
     449                 :            :                     }
     450                 :          0 :                 }
     451 [ #  # ][ #  # ]:          0 :             }
     452                 :            :         }
     453                 :          0 :         break;
     454                 :            : 
     455                 :            :     case FN_INSERT_SMA:
     456                 :            :         {
     457                 :            :             // #i34343# Inserting a math object into an autocompletion crashes
     458                 :            :             // the suggestion has to be removed before
     459         [ #  # ]:          0 :             GetView().GetEditWin().StopQuickHelp();
     460         [ #  # ]:          0 :             SvGlobalName aGlobalName( SO3_SM_CLASSID );
     461 [ #  # ][ #  # ]:          0 :             rSh.InsertObject( svt::EmbeddedObjectRef(), &aGlobalName, sal_True, 0 );
         [ #  # ][ #  # ]
     462                 :            :         }
     463                 :          0 :         break;
     464                 :            : 
     465                 :            :     case FN_INSERT_TABLE:
     466         [ #  # ]:          0 :         InsertTable( rReq );
     467                 :          0 :         break;
     468                 :            : 
     469                 :            :     case FN_INSERT_FRAME_INTERACT_NOCOL:
     470                 :            :     case FN_INSERT_FRAME_INTERACT:
     471                 :            :     {
     472                 :          0 :         sal_uInt16 nCols = 1;
     473         [ #  # ]:          0 :         sal_Bool bModifier1 = rReq.GetModifier() == KEY_MOD1;
     474         [ #  # ]:          0 :         if(pArgs)
     475                 :            :         {
     476 [ #  # ][ #  # ]:          0 :             if(FN_INSERT_FRAME_INTERACT_NOCOL != nSlot &&
                 [ #  # ]
     477         [ #  # ]:          0 :                 pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET)
     478                 :          0 :                 nCols = ((SfxUInt16Item *)pItem)->GetValue();
     479 [ #  # ][ #  # ]:          0 :             if(pArgs->GetItemState(SID_MODIFIER, sal_False, &pItem) == SFX_ITEM_SET)
     480                 :          0 :                 bModifier1 |= KEY_MOD1 == ((SfxUInt16Item *)pItem)->GetValue();
     481                 :            :         }
     482         [ #  # ]:          0 :         if(bModifier1 )
     483                 :            :         {
     484                 :          0 :             SwEditWin& rEdtWin = GetView().GetEditWin();
     485         [ #  # ]:          0 :             Size aWinSize = rEdtWin.GetSizePixel();
     486                 :          0 :             Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2);
     487         [ #  # ]:          0 :             aStartPos = rEdtWin.PixelToLogic(aStartPos);
     488                 :          0 :             aStartPos.X() -= 8 * MM50;
     489                 :          0 :             aStartPos.Y() -= 4 * MM50;
     490                 :          0 :             Size aSize(16 * MM50, 8 * MM50);
     491 [ #  # ][ #  # ]:          0 :             GetShell().LockPaint();
     492 [ #  # ][ #  # ]:          0 :             GetShell().StartAllAction();
     493 [ #  # ][ #  # ]:          0 :             SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT );
     494         [ #  # ]:          0 :             if(nCols > 1)
     495                 :            :             {
     496         [ #  # ]:          0 :                 SwFmtCol aCol;
     497 [ #  # ][ #  # ]:          0 :                 aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
     498 [ #  # ][ #  # ]:          0 :                 aMgr.SetCol( aCol );
     499                 :            :             }
     500         [ #  # ]:          0 :             aMgr.InsertFlyFrm(FLY_AT_PARA, aStartPos, aSize);
     501 [ #  # ][ #  # ]:          0 :             GetShell().EndAllAction();
     502 [ #  # ][ #  # ]:          0 :             GetShell().UnlockPaint();
                 [ #  # ]
     503                 :            :         }
     504                 :            :         else
     505                 :            :         {
     506         [ #  # ]:          0 :             GetView().InsFrmMode(nCols);
     507                 :            :         }
     508         [ #  # ]:          0 :         rReq.Ignore();
     509                 :            :     }
     510                 :          0 :     break;
     511                 :            :     case FN_INSERT_FRAME:
     512                 :            :     {
     513                 :          0 :         sal_Bool bSingleCol = sal_False;
     514 [ #  # ][ #  # ]:          0 :         if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) )
         [ #  # ][ #  # ]
     515                 :            :         {
     516         [ #  # ]:          0 :             SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
     517         [ #  # ]:          0 :             sal_uInt16 nExport = rHtmlOpt.GetExportMode();
     518         [ #  # ]:          0 :             if( HTML_CFG_MSIE == nExport )
     519                 :            :             {
     520                 :          0 :                 bSingleCol = sal_True;
     521                 :            :             }
     522                 :            : 
     523                 :            :         }
     524                 :            :         // Rahmen neu anlegen
     525 [ #  # ][ #  # ]:          0 :         SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT );
     526         [ #  # ]:          0 :         if(pArgs)
     527                 :            :         {
     528         [ #  # ]:          0 :             Size aSize(aMgr.GetSize());
     529 [ #  # ][ #  # ]:          0 :             aSize.Width() = GetShell().GetAnyCurRect(RECT_PAGE_PRT).Width();
     530         [ #  # ]:          0 :             Point aPos = aMgr.GetPos();
     531                 :          0 :             RndStdIds eAnchor = FLY_AT_PARA;
     532 [ #  # ][ #  # ]:          0 :             if(pArgs->GetItemState(nSlot, sal_False, &pItem) == SFX_ITEM_SET)
     533                 :          0 :                 eAnchor = (RndStdIds)((SfxUInt16Item *)pItem)->GetValue();
     534 [ #  # ][ #  # ]:          0 :             if(pArgs->GetItemState(FN_PARAM_1, sal_False, &pItem)  == SFX_ITEM_SET)
     535                 :          0 :                 aPos = ((SfxPointItem *)pItem)->GetValue();
     536 [ #  # ][ #  # ]:          0 :             if(pArgs->GetItemState(FN_PARAM_2, sal_False, &pItem)  == SFX_ITEM_SET)
     537                 :          0 :                 aSize = ((SvxSizeItem *)pItem)->GetSize();
     538 [ #  # ][ #  # ]:          0 :             if(pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem)  == SFX_ITEM_SET)
     539                 :            :             {
     540                 :          0 :                 sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue();
     541 [ #  # ][ #  # ]:          0 :                 if( !bSingleCol && 1 < nCols )
     542                 :            :                 {
     543         [ #  # ]:          0 :                     SwFmtCol aFmtCol;
     544         [ #  # ]:          0 :                     aFmtCol.Init( nCols , (rReq.IsAPI() ? 0
     545 [ #  # ][ #  # ]:          0 :                                         : DEF_GUTTER_WIDTH), USHRT_MAX );
     546 [ #  # ][ #  # ]:          0 :                     aMgr.SetCol(aFmtCol);
     547                 :            :                 }
     548                 :            :             }
     549                 :            : 
     550 [ #  # ][ #  # ]:          0 :             GetShell().LockPaint();
     551 [ #  # ][ #  # ]:          0 :             GetShell().StartAllAction();
     552                 :            : 
     553         [ #  # ]:          0 :             aMgr.InsertFlyFrm(eAnchor, aPos, aSize);
     554                 :            : 
     555 [ #  # ][ #  # ]:          0 :             GetShell().EndAllAction();
     556 [ #  # ][ #  # ]:          0 :             GetShell().UnlockPaint();
     557                 :            :         }
     558                 :            :         else
     559                 :            :         {
     560                 :            :             static sal_uInt16 aFrmAttrRange[] =
     561                 :            :             {
     562                 :            :                 RES_FRMATR_BEGIN,       RES_FRMATR_END-1,
     563                 :            :                 SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,
     564                 :            :                 FN_GET_PRINT_AREA,      FN_GET_PRINT_AREA,
     565                 :            :                 SID_ATTR_PAGE_SIZE,     SID_ATTR_PAGE_SIZE,
     566                 :            :                 FN_SET_FRM_NAME,        FN_SET_FRM_NAME,
     567                 :            :                 SID_HTML_MODE,          SID_HTML_MODE,
     568                 :            :                 0
     569                 :            :             };
     570                 :            : 
     571         [ #  # ]:          0 :             SfxItemSet aSet(GetPool(), aFrmAttrRange );
     572 [ #  # ][ #  # ]:          0 :             aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
         [ #  # ][ #  # ]
                 [ #  # ]
     573 [ #  # ][ #  # ]:          0 :             const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
     574         [ #  # ]:          0 :             SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
     575         [ #  # ]:          0 :             aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
     576         [ #  # ]:          0 :             aSet.Put(aFrmSize);
     577                 :            : 
     578 [ #  # ][ #  # ]:          0 :             const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT);
     579         [ #  # ]:          0 :             SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
     580         [ #  # ]:          0 :             aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
     581         [ #  # ]:          0 :             aSet.Put(aPrtSize);
     582                 :            : 
     583         [ #  # ]:          0 :             aSet.Put(aMgr.GetAttrSet());
     584                 :          0 :             aSet.SetParent( aMgr.GetAttrSet().GetParent() );
     585                 :            : 
     586                 :            :             // Minimalgroesse in Spalten loeschen
     587 [ #  # ][ #  # ]:          0 :             SvxBoxInfoItem aBoxInfo((SvxBoxInfoItem &)aSet.Get(SID_ATTR_BORDER_INNER));
     588         [ #  # ]:          0 :             const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
     589                 :          0 :             aBoxInfo.SetMinDist(sal_False);
     590         [ #  # ]:          0 :             aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT));
     591         [ #  # ]:          0 :             aSet.Put(aBoxInfo);
     592                 :            : 
     593 [ #  # ][ #  # ]:          0 :             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell()));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     594 [ #  # ][ #  # ]:          0 :             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
         [ #  # ][ #  # ]
     595         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     596                 :            :             OSL_ENSURE(pFact, "Dialogdiet fail!");
     597                 :            :             SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD,
     598 [ #  # ][ #  # ]:          0 :                                                     GetView().GetViewFrame(), &GetView().GetViewFrame()->GetWindow(), aSet, sal_True);
     599                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     600 [ #  # ][ #  # ]:          0 :             if(pDlg->Execute() && pDlg->GetOutputItemSet())
         [ #  # ][ #  # ]
                 [ #  # ]
     601                 :            :             {
     602                 :            :                 //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point
     603         [ #  # ]:          0 :                 SwWrtShell& rShell = GetShell();
     604         [ #  # ]:          0 :                 rShell.LockPaint();
     605         [ #  # ]:          0 :                 rShell.StartAllAction();
     606         [ #  # ]:          0 :                 rShell.StartUndo(UNDO_INSERT);
     607                 :            : 
     608         [ #  # ]:          0 :                 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     609         [ #  # ]:          0 :                 aMgr.SetAttrSet(*pOutSet);
     610                 :            : 
     611                 :            :                 // beim ClickToEditFeld erst die Selektion loeschen
     612         [ #  # ]:          0 :                 if( rShell.IsInClickToEdit() )
     613         [ #  # ]:          0 :                     rShell.DelRight();
     614                 :            : 
     615         [ #  # ]:          0 :                 aMgr.InsertFlyFrm();
     616                 :            : 
     617                 :            :                 uno::Reference< frame::XDispatchRecorder > xRecorder =
     618         [ #  # ]:          0 :                         GetView().GetViewFrame()->GetBindings().GetRecorder();
     619         [ #  # ]:          0 :                 if ( xRecorder.is() )
     620                 :            :                 {
     621                 :            :                     //FN_INSERT_FRAME
     622         [ #  # ]:          0 :                     sal_uInt16 nAnchor = (sal_uInt16)aMgr.GetAnchor();
     623 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor));
                 [ #  # ]
     624 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos()));
         [ #  # ][ #  # ]
     625 [ #  # ][ #  # ]:          0 :                         rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize()));
         [ #  # ][ #  # ]
     626         [ #  # ]:          0 :                     rReq.Done();
     627                 :            :                 }
     628                 :            : 
     629         [ #  # ]:          0 :                 GetView().AutoCaption(FRAME_CAP);
     630                 :            : 
     631                 :            :                 {
     632         [ #  # ]:          0 :                     SwRewriter aRewriter;
     633                 :            : 
     634 [ #  # ][ #  # ]:          0 :                     aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_FRAME));
         [ #  # ][ #  # ]
     635                 :            : 
     636 [ #  # ][ #  # ]:          0 :                     rShell.EndUndo(UNDO_INSERT, &aRewriter);
     637                 :            :                 }
     638         [ #  # ]:          0 :                 rShell.EndAllAction();
     639         [ #  # ]:          0 :                 rShell.UnlockPaint();
     640                 :            :             }
     641                 :            : 
     642 [ #  # ][ #  # ]:          0 :             DELETEZ(pDlg);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     643                 :            :         }
     644         [ #  # ]:          0 :         break;
     645                 :            :     }
     646                 :            :     case FN_INSERT_HRULER:
     647                 :            :     {
     648         [ #  # ]:          0 :         String sPath;
     649                 :          0 :         sal_Bool bSimpleLine = sal_False;
     650                 :          0 :         sal_Bool bRet = sal_False;
     651                 :          0 :         Window* pParent = GetView().GetWindow();
     652         [ #  # ]:          0 :         if ( pItem )
     653                 :            :         {
     654         [ #  # ]:          0 :             sPath = ((SfxStringItem*)pItem)->GetValue();
     655 [ #  # ][ #  # ]:          0 :             SFX_REQUEST_ARG( rReq, pSimple, SfxBoolItem, FN_PARAM_1 , sal_False );
     656         [ #  # ]:          0 :             if ( pSimple )
     657                 :          0 :                 bSimpleLine = pSimple->GetValue();
     658                 :            :         }
     659                 :            :         else
     660                 :            :         {
     661         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     662                 :            :             OSL_ENSURE(pFact, "Dialogdiet fail!");
     663                 :            :             AbstractInsertGrfRulerDlg* pDlg = pFact->CreateInsertGrfRulerDlg( DLG_INSERT_RULER,
     664         [ #  # ]:          0 :                                                         pParent );
     665                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     666                 :            :             // MessageBox fuer fehlende Grafiken
     667 [ #  # ][ #  # ]:          0 :             if(!pDlg->HasImages())
     668 [ #  # ][ #  # ]:          0 :                 InfoBox( pParent, SW_RES(MSG_NO_RULER)).Execute();
                 [ #  # ]
     669 [ #  # ][ #  # ]:          0 :             if(RET_OK == pDlg->Execute())
     670                 :            :             {
     671 [ #  # ][ #  # ]:          0 :                 sPath = pDlg->GetGraphicName();
                 [ #  # ]
     672         [ #  # ]:          0 :                 bSimpleLine = pDlg->IsSimpleLine();
     673                 :            :             }
     674                 :            : 
     675 [ #  # ][ #  # ]:          0 :             delete pDlg;
     676 [ #  # ][ #  # ]:          0 :             rReq.AppendItem( SfxStringItem( FN_INSERT_HRULER, sPath ) );
                 [ #  # ]
     677 [ #  # ][ #  # ]:          0 :             rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bSimpleLine ) );
                 [ #  # ]
     678                 :            :         }
     679                 :            : 
     680         [ #  # ]:          0 :         rSh.StartAllAction();
     681         [ #  # ]:          0 :         rSh.StartUndo(UNDO_UI_INSERT_RULER);
     682         [ #  # ]:          0 :         if(bSimpleLine)
     683                 :            :         {
     684 [ #  # ][ #  # ]:          0 :             if(!(rSh.IsSttOfPara() && rSh.IsEndOfPara())) // kein leerer Absatz?
         [ #  # ][ #  # ]
                 [ #  # ]
     685         [ #  # ]:          0 :                 rSh.SplitNode( sal_False, sal_False ); // dann Platz schaffen
     686         [ #  # ]:          0 :             rSh.SplitNode( sal_False, sal_False );
     687         [ #  # ]:          0 :             rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
     688 [ #  # ][ #  # ]:          0 :             rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_HTML_HR ));
     689         [ #  # ]:          0 :             rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
     690                 :          0 :             bRet = sal_True;
     691                 :            :         }
     692         [ #  # ]:          0 :         else if(sPath.Len())
     693                 :            :         {
     694         [ #  # ]:          0 :             SwFlyFrmAttrMgr aFrmMgr( sal_True, &rSh, FRMMGR_TYPE_GRF );
     695                 :            :             // am FrmMgr muessen die richtigen Parameter eingestellt werden
     696                 :            : 
     697         [ #  # ]:          0 :             aFrmMgr.SetAnchor(FLY_AS_CHAR);
     698                 :            : 
     699         [ #  # ]:          0 :             rSh.SplitNode( sal_False, sal_False );
     700         [ #  # ]:          0 :             rSh.SplitNode( sal_False, sal_False );
     701         [ #  # ]:          0 :             rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
     702 [ #  # ][ #  # ]:          0 :             rSh.SetAttr(SvxAdjustItem(SVX_ADJUST_CENTER,RES_PARATR_ADJUST ));
                 [ #  # ]
     703 [ #  # ][ #  # ]:          0 :             if(GRFILTER_OK == GetView().InsertGraphic(sPath, aEmptyStr, sal_True, 0, 0 ))
     704                 :          0 :                 bRet = sal_True;
     705         [ #  # ]:          0 :             rSh.EnterStdMode();
     706 [ #  # ][ #  # ]:          0 :             rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
     707                 :            :         }
     708         [ #  # ]:          0 :         rSh.EndAllAction();
     709         [ #  # ]:          0 :         rSh.EndUndo(UNDO_UI_INSERT_RULER);
     710 [ #  # ][ #  # ]:          0 :         rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
                 [ #  # ]
     711 [ #  # ][ #  # ]:          0 :         rReq.Done();
     712                 :            :     }
     713                 :          0 :     break;
     714                 :            :     case FN_FORMAT_COLUMN :
     715                 :            :     {
     716         [ #  # ]:          0 :         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     717                 :            :         OSL_ENSURE(pFact, "Dialogdiet fail!");
     718         [ #  # ]:          0 :         VclAbstractDialog* pColDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_COLUMN);
     719                 :            :         OSL_ENSURE(pColDlg, "Dialogdiet fail!");
     720         [ #  # ]:          0 :         pColDlg->Execute();
     721 [ #  # ][ #  # ]:          0 :         delete pColDlg;
     722                 :            :     }
     723                 :          4 :     break;
     724                 :            : 
     725                 :            :     default:
     726                 :            :         OSL_ENSURE(!this, "wrong  dispatcher");
     727                 :          4 :         return;
     728                 :            :     }
     729                 :            : }
     730                 :            : 
     731                 :          0 : bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect )
     732                 :            : {
     733                 :          0 :     rWrtSh.SwapPam();
     734                 :          0 :     bool bRet = pSect == rWrtSh.GetCurrSection();
     735                 :          0 :     rWrtSh.SwapPam();
     736                 :          0 :     return bRet;
     737                 :            : }
     738                 :            : 
     739                 :          0 : void SwTextShell::StateInsert( SfxItemSet &rSet )
     740                 :            : {
     741 [ #  # ][ #  # ]:          0 :     sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
     742         [ #  # ]:          0 :     SfxWhichIter aIter( rSet );
     743         [ #  # ]:          0 :     SwWrtShell &rSh = GetShell();
     744         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     745         [ #  # ]:          0 :     SvtModuleOptions aMOpt;
     746                 :            :     SfxObjectCreateMode eCreateMode =
     747         [ #  # ]:          0 :                         GetView().GetDocShell()->GetCreateMode();
     748                 :            : 
     749         [ #  # ]:          0 :     rSh.Push();
     750         [ #  # ]:          0 :     const sal_Bool bCrsrInHidden = rSh.SelectHiddenRange();
     751                 :            :     // #i103839#
     752                 :            :     // Do not call method <SwCrsrShell::Pop(..)> with 1st parameter = <sal_False>
     753                 :            :     // in order to avoid that the view jumps to the visible cursor.
     754         [ #  # ]:          0 :     rSh.Pop();
     755                 :            : 
     756         [ #  # ]:          0 :     while ( nWhich )
     757                 :            :     {
     758   [ #  #  #  #  :          0 :         switch ( nWhich )
          #  #  #  #  #  
                      # ]
     759                 :            :         {
     760                 :            :             case SID_INSERT_SOUND:
     761                 :            :             case SID_INSERT_VIDEO:
     762                 :            :                 /*!SvxPluginFileDlg::IsAvailable( nWhich ) ||
     763                 :            : 
     764                 :            :                 discussed with mba: for performance reasons we skip the IsAvailable call here
     765                 :            :                 */
     766 [ #  # ][ #  # ]:          0 :                 if ( GetShell().IsSelFrmMode() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     767                 :            :                      SFX_CREATE_MODE_EMBEDDED == eCreateMode || bCrsrInHidden )
     768                 :            :                 {
     769         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     770                 :            :                 }
     771                 :          0 :                 break;
     772                 :            : 
     773                 :            :             case SID_INSERT_DIAGRAM:
     774 [ #  # ][ #  # ]:          0 :                 if( !aMOpt.IsChart() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
         [ #  # ][ #  # ]
                 [ #  # ]
     775                 :            :                 {
     776         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     777                 :            :                 }
     778                 :          0 :                 break;
     779                 :            : 
     780                 :            :             case FN_INSERT_SMA:
     781 [ #  # ][ #  # ]:          0 :                 if( !aMOpt.IsMath() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
         [ #  # ][ #  # ]
                 [ #  # ]
     782                 :            :                 {
     783         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     784                 :            :                 }
     785                 :          0 :                 break;
     786                 :            : 
     787                 :            :             case SID_INSERT_FLOATINGFRAME:
     788                 :            :             case SID_INSERT_OBJECT:
     789                 :            :             case SID_INSERT_PLUGIN:
     790                 :            :             {
     791 [ #  # ][ #  # ]:          0 :                 if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
     792                 :            :                 {
     793         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     794                 :            :                 }
     795 [ #  # ][ #  # ]:          0 :                 else if( GetShell().IsSelFrmMode())
     796         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     797 [ #  # ][ #  # ]:          0 :                 else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
     798                 :            :                 {
     799         [ #  # ]:          0 :                     SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
     800         [ #  # ]:          0 :                     sal_uInt16 nExport = rHtmlOpt.GetExportMode();
     801 [ #  # ][ #  # ]:          0 :                     if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
     802         [ #  # ]:          0 :                         rSet.DisableItem(nWhich);
     803                 :            :                 }
     804                 :            :             }
     805                 :          0 :             break;
     806                 :            :             case FN_INSERT_FRAME_INTERACT_NOCOL :
     807                 :            :             case FN_INSERT_FRAME_INTERACT:
     808                 :            :             {
     809 [ #  # ][ #  # ]:          0 :                 if ( GetShell().IsSelFrmMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     810                 :            :                     (0 != (nHtmlMode & HTMLMODE_ON) && 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)) || bCrsrInHidden )
     811         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     812                 :            :             }
     813                 :          0 :             break;
     814                 :            :             case SID_HYPERLINK_GETLINK:
     815                 :            :                 {
     816         [ #  # ]:          0 :                     SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
     817         [ #  # ]:          0 :                     rSh.GetCurAttr( aSet );
     818                 :            : 
     819         [ #  # ]:          0 :                     SvxHyperlinkItem aHLinkItem;
     820                 :            :                     const SfxPoolItem* pItem;
     821 [ #  # ][ #  # ]:          0 :                     if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
     822                 :            :                     {
     823                 :          0 :                         const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
     824         [ #  # ]:          0 :                         aHLinkItem.SetURL(pINetFmt->GetValue());
     825         [ #  # ]:          0 :                         aHLinkItem.SetTargetFrame(pINetFmt->GetTargetFrame());
     826         [ #  # ]:          0 :                         aHLinkItem.SetIntName(pINetFmt->GetName());
     827         [ #  # ]:          0 :                         const SvxMacro *pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT );
     828         [ #  # ]:          0 :                         if( pMacro )
     829         [ #  # ]:          0 :                             aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOVER_OBJECT, *pMacro);
     830                 :            : 
     831         [ #  # ]:          0 :                         pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
     832         [ #  # ]:          0 :                         if( pMacro )
     833         [ #  # ]:          0 :                             aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSECLICK_OBJECT, *pMacro);
     834                 :            : 
     835         [ #  # ]:          0 :                         pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT );
     836         [ #  # ]:          0 :                         if( pMacro )
     837         [ #  # ]:          0 :                             aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOUT_OBJECT, *pMacro);
     838                 :            : 
     839                 :            :                         // Text des Links besorgen
     840         [ #  # ]:          0 :                         rSh.StartAction();
     841         [ #  # ]:          0 :                         rSh.CreateCrsr();
     842         [ #  # ]:          0 :                         rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT,sal_True);
     843         [ #  # ]:          0 :                         String sLinkName = rSh.GetSelTxt();
     844         [ #  # ]:          0 :                         aHLinkItem.SetName(sLinkName);
     845                 :          0 :                         aHLinkItem.SetInsertMode(HLINK_FIELD);
     846         [ #  # ]:          0 :                         rSh.DestroyCrsr();
     847 [ #  # ][ #  # ]:          0 :                         rSh.EndAction();
     848                 :            :                     }
     849                 :            :                     else
     850                 :            :                     {
     851         [ #  # ]:          0 :                         String sReturn = rSh.GetSelTxt();
     852         [ #  # ]:          0 :                         sReturn.Erase(255);
     853 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     854                 :            :                     }
     855                 :            : 
     856                 :          0 :                     aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
     857         [ #  # ]:          0 :                         ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
     858                 :            :                     aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
     859                 :          0 :                                 HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
     860                 :            : 
     861 [ #  # ][ #  # ]:          0 :                     rSet.Put(aHLinkItem);
                 [ #  # ]
     862                 :            :                 }
     863                 :          0 :                 break;
     864                 :            : 
     865                 :            :             case FN_INSERT_FRAME:
     866         [ #  # ]:          0 :                 if(rSh.IsSelFrmMode())
     867                 :            :                 {
     868         [ #  # ]:          0 :                     const int nSel = rSh.GetSelectionType();
     869 [ #  # ][ #  # ]:          0 :                     if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden )
     870         [ #  # ]:          0 :                         rSet.DisableItem(nWhich);
     871                 :            :                 }
     872                 :          0 :             break;
     873                 :            :             case FN_INSERT_HRULER :
     874 [ #  # ][ #  # ]:          0 :                 if ( (rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) || bCrsrInHidden )
         [ #  # ][ #  # ]
                 [ #  # ]
     875         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     876                 :          0 :             break;
     877                 :            :             case FN_FORMAT_COLUMN :
     878                 :            :             {
     879                 :            :                 //#i80458# column dialog cannot work if the selection contains different page styles and different sections
     880                 :          0 :                 bool bDisable = true;
     881 [ #  # ][ #  # ]:          0 :                 if( rSh.GetFlyFrmFmt() || rSh.GetSelectedPageDescs() )
         [ #  # ][ #  # ]
                 [ #  # ]
     882                 :          0 :                     bDisable = false;
     883         [ #  # ]:          0 :                 if( bDisable )
     884                 :            :                 {
     885         [ #  # ]:          0 :                     const SwSection* pCurrSection = rSh.GetCurrSection();
     886         [ #  # ]:          0 :                     sal_uInt16 nFullSectCnt = rSh.GetFullSelectedSectionCount();
     887 [ #  # ][ #  # ]:          0 :                     if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt ))
         [ #  # ][ #  # ]
                 [ #  # ]
     888                 :          0 :                         bDisable = false;
     889 [ #  # ][ #  # ]:          0 :                     else if(
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     890 [ #  # ][ #  # ]:          0 :                         rSh.HasSelection() && rSh.IsInsRegionAvailable() &&
     891                 :            :                             ( !pCurrSection || ( 1 != nFullSectCnt &&
     892         [ #  # ]:          0 :                                 lcl_IsMarkInSameSection( rSh, pCurrSection ) )))
     893                 :          0 :                         bDisable = false;
     894                 :            :                 }
     895         [ #  # ]:          0 :                 if(bDisable)
     896         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     897                 :            :             }
     898                 :          0 :             break;
     899                 :            :         }
     900         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     901 [ #  # ][ #  # ]:          0 :     }
     902                 :          0 : }
     903                 :            : 
     904                 :          0 : void  SwTextShell::ExecDelete(SfxRequest &rReq)
     905                 :            : {
     906                 :          0 :     SwWrtShell &rSh = GetShell();
     907   [ #  #  #  #  :          0 :     switch( rReq.GetSlot() )
          #  #  #  #  #  
                      # ]
     908                 :            :     {
     909                 :            :         case FN_DELETE_SENT:
     910         [ #  # ]:          0 :             if( rSh.IsTableMode() )
     911                 :            :             {
     912                 :          0 :                 rSh.DeleteRow();
     913                 :          0 :                 rSh.EnterStdMode();
     914                 :            :             }
     915                 :            :             else
     916                 :          0 :                 rSh.DelToEndOfSentence();
     917                 :          0 :             break;
     918                 :            :         case FN_DELETE_BACK_SENT:
     919                 :          0 :             rSh.DelToStartOfSentence();
     920                 :          0 :             break;
     921                 :            :         case FN_DELETE_WORD:
     922                 :          0 :             rSh.DelNxtWord();
     923                 :          0 :             break;
     924                 :            :         case FN_DELETE_BACK_WORD:
     925                 :          0 :             rSh.DelPrvWord();
     926                 :          0 :             break;
     927                 :            :         case FN_DELETE_LINE:
     928                 :          0 :             rSh.DelToEndOfLine();
     929                 :          0 :             break;
     930                 :            :         case FN_DELETE_BACK_LINE:
     931                 :          0 :             rSh.DelToStartOfLine();
     932                 :          0 :             break;
     933                 :            :         case FN_DELETE_PARA:
     934                 :          0 :             rSh.DelToEndOfPara();
     935                 :          0 :             break;
     936                 :            :         case FN_DELETE_BACK_PARA:
     937                 :          0 :             rSh.DelToStartOfPara();
     938                 :          0 :             break;
     939                 :            :         case FN_DELETE_WHOLE_LINE:
     940                 :          0 :             rSh.DelLine();
     941                 :          0 :             break;
     942                 :            :         default:
     943                 :            :             OSL_ENSURE(!this, "wrong dispatcher");
     944                 :          0 :             return;
     945                 :            :     }
     946                 :          0 :     rReq.Done();
     947                 :            : }
     948                 :            : 
     949                 :          0 : void SwTextShell::ExecTransliteration( SfxRequest & rReq )
     950                 :            : {
     951                 :            :     using namespace ::com::sun::star::i18n;
     952                 :          0 :     sal_uInt32 nMode = 0;
     953                 :            : 
     954   [ #  #  #  #  :          0 :     switch( rReq.GetSlot() )
          #  #  #  #  #  
                      # ]
     955                 :            :     {
     956                 :            :     case SID_TRANSLITERATE_SENTENCE_CASE:
     957                 :          0 :         nMode = TransliterationModulesExtra::SENTENCE_CASE;
     958                 :          0 :         break;
     959                 :            :     case SID_TRANSLITERATE_TITLE_CASE:
     960                 :          0 :         nMode = TransliterationModulesExtra::TITLE_CASE;
     961                 :          0 :         break;
     962                 :            :     case SID_TRANSLITERATE_TOGGLE_CASE:
     963                 :          0 :         nMode = TransliterationModulesExtra::TOGGLE_CASE;
     964                 :          0 :         break;
     965                 :            :     case SID_TRANSLITERATE_UPPER:
     966                 :          0 :         nMode = TransliterationModules_LOWERCASE_UPPERCASE;
     967                 :          0 :         break;
     968                 :            :     case SID_TRANSLITERATE_LOWER:
     969                 :          0 :         nMode = TransliterationModules_UPPERCASE_LOWERCASE;
     970                 :          0 :         break;
     971                 :            : 
     972                 :            :     case SID_TRANSLITERATE_HALFWIDTH:
     973                 :          0 :         nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
     974                 :          0 :         break;
     975                 :            :     case SID_TRANSLITERATE_FULLWIDTH:
     976                 :          0 :         nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
     977                 :          0 :         break;
     978                 :            : 
     979                 :            :     case SID_TRANSLITERATE_HIRAGANA:
     980                 :          0 :         nMode = TransliterationModules_KATAKANA_HIRAGANA;
     981                 :          0 :         break;
     982                 :            :     case SID_TRANSLITERATE_KATAGANA:
     983                 :          0 :         nMode = TransliterationModules_HIRAGANA_KATAKANA;
     984                 :          0 :         break;
     985                 :            : 
     986                 :            :     default:
     987                 :            :         OSL_ENSURE(!this, "wrong dispatcher");
     988                 :            :     }
     989                 :            : 
     990         [ #  # ]:          0 :     if( nMode )
     991                 :          0 :         GetShell().TransliterateText( nMode );
     992                 :          0 : }
     993                 :            : 
     994                 :          0 : void SwTextShell::ExecRotateTransliteration( SfxRequest & rReq )
     995                 :            : {
     996         [ #  # ]:          0 :     if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
     997                 :          0 :         GetShell().TransliterateText( m_aRotateCase.getNextMode() );
     998                 :          0 : }
     999                 :            : 
    1000                 :       1314 : SwTextShell::SwTextShell(SwView &_rView) :
    1001                 :       1314 :     SwBaseShell(_rView), pPostItFldMgr( 0 )
    1002                 :            : {
    1003 [ +  - ][ +  - ]:       1314 :     SetName(rtl::OUString("Text"));
                 [ +  - ]
    1004         [ +  - ]:       1314 :     SetHelpId(SW_TEXTSHELL);
    1005                 :       1314 : }
    1006                 :            : 
    1007                 :       1227 : SwTextShell::~SwTextShell()
    1008                 :            : {
    1009         [ -  + ]:       2450 : }
    1010                 :            : 
    1011                 :          0 : void SwTextShell::InsertSymbol( SfxRequest& rReq )
    1012                 :            : {
    1013                 :          0 :     const SfxItemSet *pArgs = rReq.GetArgs();
    1014                 :          0 :     const SfxPoolItem* pItem = 0;
    1015         [ #  # ]:          0 :     if( pArgs )
    1016 [ #  # ][ #  # ]:          0 :         pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem);
    1017                 :            : 
    1018 [ #  # ][ #  # ]:          0 :     String aChars, aFontName;
    1019         [ #  # ]:          0 :     if ( pItem )
    1020                 :            :     {
    1021         [ #  # ]:          0 :         aChars = ((const SfxStringItem*)pItem)->GetValue();
    1022                 :          0 :         const SfxPoolItem* pFtItem = NULL;
    1023 [ #  # ][ #  # ]:          0 :         pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem);
    1024 [ #  # ][ #  # ]:          0 :         const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
         [ #  # ][ #  # ]
    1025         [ #  # ]:          0 :         if ( pFontItem )
    1026         [ #  # ]:          0 :             aFontName = pFontItem->GetValue();
    1027                 :            :     }
    1028                 :            : 
    1029         [ #  # ]:          0 :     SwWrtShell &rSh = GetShell();
    1030                 :          0 :     SfxItemSet aSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
    1031                 :            :                                 RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
    1032                 :            :                                 RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
    1033         [ #  # ]:          0 :                                 0 );
    1034         [ #  # ]:          0 :     rSh.GetCurAttr( aSet );
    1035         [ #  # ]:          0 :     sal_uInt16 nScript = rSh.GetScriptType();
    1036                 :            : 
    1037         [ #  # ]:          0 :     SvxFontItem aFont( RES_CHRATR_FONT );
    1038                 :            :     {
    1039         [ #  # ]:          0 :         SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
    1040         [ #  # ]:          0 :         aSetItem.GetItemSet().Put( aSet, sal_False );
    1041         [ #  # ]:          0 :         const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
    1042         [ #  # ]:          0 :         if( pI )
    1043         [ #  # ]:          0 :             aFont = *(SvxFontItem*)pI;
    1044                 :            :         else
    1045                 :            :             aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
    1046                 :            :                         RES_CHRATR_FONT,
    1047 [ #  # ][ #  # ]:          0 :                         GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
         [ #  # ][ #  # ]
                 [ #  # ]
    1048         [ #  # ]:          0 :         if (!aFontName.Len())
    1049 [ #  # ][ #  # ]:          0 :             aFontName = aFont.GetFamilyName();
    1050                 :            :     }
    1051                 :            : 
    1052         [ #  # ]:          0 :     Font aNewFont(aFontName, Size(1,1)); // Size nur wg. CTOR
    1053         [ #  # ]:          0 :     if( !aChars.Len() )
    1054                 :            :     {
    1055                 :            :         // Eingestellten Font als Default
    1056 [ #  # ][ #  # ]:          0 :         SfxAllItemSet aAllSet( rSh.GetAttrPool() );
    1057 [ #  # ][ #  # ]:          0 :         aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
                 [ #  # ]
    1058                 :            : 
    1059 [ #  # ][ #  # ]:          0 :         SwViewOption aOpt(*GetShell().GetViewOptions());
    1060         [ #  # ]:          0 :         String sSymbolFont = aOpt.GetSymbolFont();
    1061 [ #  # ][ #  # ]:          0 :         if( !aFontName.Len() && sSymbolFont.Len() )
                 [ #  # ]
    1062 [ #  # ][ #  # ]:          0 :             aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
                 [ #  # ]
    1063                 :            :         else
    1064 [ #  # ][ #  # ]:          0 :             aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );
                 [ #  # ]
    1065                 :            : 
    1066         [ #  # ]:          0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
    1067                 :          0 :         SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet,
    1068         [ #  # ]:          0 :             GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
           [ #  #  #  # ]
    1069 [ #  # ][ #  # ]:          0 :         if( RET_OK == pDlg->Execute() )
    1070                 :            :         {
    1071 [ #  # ][ #  # ]:          0 :             SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False );
                 [ #  # ]
    1072 [ #  # ][ #  # ]:          0 :             SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False );
                 [ #  # ]
    1073         [ #  # ]:          0 :             if ( pFontItem )
    1074                 :            :             {
    1075 [ #  # ][ #  # ]:          0 :                 aNewFont.SetName( pFontItem->GetFamilyName() );
    1076         [ #  # ]:          0 :                 aNewFont.SetStyleName( pFontItem->GetStyleName() );
    1077         [ #  # ]:          0 :                 aNewFont.SetCharSet( pFontItem->GetCharSet() );
    1078         [ #  # ]:          0 :                 aNewFont.SetPitch( pFontItem->GetPitch() );
    1079                 :            :             }
    1080                 :            : 
    1081         [ #  # ]:          0 :             if ( pCItem )
    1082                 :            :             {
    1083         [ #  # ]:          0 :                 aChars  = pCItem->GetValue();
    1084 [ #  # ][ #  # ]:          0 :                 aOpt.SetSymbolFont(aNewFont.GetName());
    1085 [ #  # ][ #  # ]:          0 :                 SW_MOD()->ApplyUsrPref(aOpt, &GetView());
    1086                 :            :             }
    1087                 :            :         }
    1088                 :            : 
    1089 [ #  # ][ #  # ]:          0 :         delete pDlg;
         [ #  # ][ #  # ]
                 [ #  # ]
    1090                 :            :     }
    1091                 :            : 
    1092         [ #  # ]:          0 :     if( aChars.Len() )
    1093                 :            :     {
    1094         [ #  # ]:          0 :         rSh.StartAllAction();
    1095                 :            : 
    1096                 :            :         // Selektierten Inhalt loeschen
    1097         [ #  # ]:          0 :         SwRewriter aRewriter;
    1098 [ #  # ][ #  # ]:          0 :         aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_SPECIALCHAR));
         [ #  # ][ #  # ]
    1099                 :            : 
    1100         [ #  # ]:          0 :         rSh.StartUndo( UNDO_INSERT, &aRewriter );
    1101 [ #  # ][ #  # ]:          0 :         if ( rSh.HasSelection() )
    1102                 :            :         {
    1103         [ #  # ]:          0 :             rSh.DelRight();
    1104         [ #  # ]:          0 :             aSet.ClearItem();
    1105         [ #  # ]:          0 :             rSh.GetCurAttr( aSet );
    1106                 :            : 
    1107         [ #  # ]:          0 :             SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
    1108         [ #  # ]:          0 :             aSetItem.GetItemSet().Put( aSet, sal_False );
    1109         [ #  # ]:          0 :             const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
    1110         [ #  # ]:          0 :             if( pI )
    1111         [ #  # ]:          0 :                 aFont = *(SvxFontItem*)pI;
    1112                 :            :             else
    1113                 :            :                 aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
    1114                 :            :                             RES_CHRATR_FONT,
    1115 [ #  # ][ #  # ]:          0 :                             GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1116                 :            :         }
    1117                 :            : 
    1118                 :            :         // Zeichen einfuegen
    1119         [ #  # ]:          0 :         rSh.Insert( aChars );
    1120                 :            : 
    1121                 :            :         // #108876# a font attribute has to be set always due to a guessed script type
    1122 [ #  # ][ #  # ]:          0 :         if( aNewFont.GetName().Len() )
    1123                 :            :         {
    1124         [ #  # ]:          0 :             SvxFontItem aNewFontItem( aFont );
    1125 [ #  # ][ #  # ]:          0 :             aNewFontItem.SetFamilyName( aNewFont.GetName());
    1126         [ #  # ]:          0 :             aNewFontItem.SetFamily(  aNewFont.GetFamily());
    1127         [ #  # ]:          0 :             aNewFontItem.SetPitch(   aNewFont.GetPitch());
    1128         [ #  # ]:          0 :             aNewFontItem.SetCharSet( aNewFont.GetCharSet() );
    1129                 :            : 
    1130                 :          0 :             SfxItemSet aRestoreSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
    1131                 :            :                                                RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
    1132         [ #  # ]:          0 :                                                RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 );
    1133                 :            : 
    1134 [ #  # ][ #  # ]:          0 :             nScript = pBreakIt->GetAllScriptsOfText( aChars );
    1135         [ #  # ]:          0 :             if( SCRIPTTYPE_LATIN & nScript )
    1136                 :            :             {
    1137 [ #  # ][ #  # ]:          0 :                 aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT, sal_True ) );
    1138         [ #  # ]:          0 :                 aSet.Put( aNewFontItem, RES_CHRATR_FONT);
    1139                 :            :             }
    1140         [ #  # ]:          0 :             if( SCRIPTTYPE_ASIAN & nScript )
    1141                 :            :             {
    1142 [ #  # ][ #  # ]:          0 :                 aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT, sal_True ) );
    1143         [ #  # ]:          0 :                 aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT );
    1144                 :            :             }
    1145         [ #  # ]:          0 :             if( SCRIPTTYPE_COMPLEX & nScript )
    1146                 :            :             {
    1147 [ #  # ][ #  # ]:          0 :                 aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT, sal_True ) );
    1148         [ #  # ]:          0 :                 aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT );
    1149                 :            :             }
    1150                 :            : 
    1151         [ #  # ]:          0 :             rSh.SetMark();
    1152         [ #  # ]:          0 :             rSh.ExtendSelection( sal_False, aChars.Len() );
    1153         [ #  # ]:          0 :             rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
    1154 [ #  # ][ #  # ]:          0 :             if( !rSh.IsCrsrPtAtEnd() )
    1155         [ #  # ]:          0 :                 rSh.SwapPam();
    1156                 :            : 
    1157         [ #  # ]:          0 :             rSh.ClearMark();
    1158                 :            : 
    1159                 :            :             // #i75891#
    1160                 :            :             // SETATTR_DONTEXPAND does not work if there are already hard attributes.
    1161                 :            :             // Therefore we have to restore the font attributes.
    1162         [ #  # ]:          0 :             rSh.SetMark();
    1163         [ #  # ]:          0 :             rSh.SetAttr( aRestoreSet );
    1164         [ #  # ]:          0 :             rSh.ClearMark();
    1165                 :            : 
    1166                 :          0 :             rSh.UpdateAttr();
    1167 [ #  # ][ #  # ]:          0 :             aFont = aNewFontItem;
                 [ #  # ]
    1168                 :            :         }
    1169                 :            : 
    1170         [ #  # ]:          0 :         rSh.EndAllAction();
    1171         [ #  # ]:          0 :         rSh.EndUndo();
    1172                 :            : 
    1173         [ #  # ]:          0 :         if ( aChars.Len() )
    1174                 :            :         {
    1175 [ #  # ][ #  # ]:          0 :             rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) );
         [ #  # ][ #  # ]
    1176 [ #  # ][ #  # ]:          0 :             rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) );
         [ #  # ][ #  # ]
    1177         [ #  # ]:          0 :             rReq.Done();
    1178         [ #  # ]:          0 :         }
    1179 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
                 [ #  # ]
    1180                 :          0 : }
    1181                 :            : 
    1182                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10