LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - drtxtob1.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1 45 2.2 %
Date: 2014-04-11 Functions: 2 5 40.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "scitems.hxx"
      21             : #include <editeng/eeitem.hxx>
      22             : 
      23             : #include <svx/svxdlg.hxx>
      24             : #include <editeng/formatbreakitem.hxx>
      25             : #include <editeng/hyphenzoneitem.hxx>
      26             : #include <editeng/orphitem.hxx>
      27             : #include <editeng/outliner.hxx>
      28             : #include <editeng/spltitem.hxx>
      29             : #include <editeng/widwitem.hxx>
      30             : #include <sot/exchange.hxx>
      31             : #include <vcl/msgbox.hxx>
      32             : #include <svtools/transfer.hxx>
      33             : 
      34             : #include "sc.hrc"
      35             : #include "drtxtob.hxx"
      36             : #include "drawview.hxx"
      37             : #include "viewdata.hxx"
      38             : #include "scresid.hxx"
      39             : 
      40             : #include "scabstdlg.hxx"
      41             : 
      42             : 
      43           0 : bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
      44             :                                                 SfxItemSet& rOutSet , sal_uInt16 nSlot)
      45             : {
      46           0 :     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
      47             :     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
      48             : 
      49             :     SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg(
      50             :         pViewData->GetDialogParent(), &rArgs,
      51           0 :         pViewData->GetSfxDocShell());
      52             :     OSL_ENSURE(pDlg, "Dialog create fail!");
      53           0 :     if (nSlot == SID_CHAR_DLG_EFFECT)
      54             :     {
      55           0 :         pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
      56             :     }
      57           0 :     bool bRet = ( pDlg->Execute() == RET_OK );
      58             : 
      59           0 :     if ( bRet )
      60             :     {
      61           0 :         const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
      62           0 :         if ( pNewAttrs )
      63           0 :             rOutSet.Put( *pNewAttrs );
      64             :     }
      65           0 :     delete pDlg;
      66             : 
      67           0 :     return bRet;
      68             : }
      69             : 
      70           0 : bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
      71             :                                                 SfxItemSet& rOutSet )
      72             : {
      73           0 :     SfxItemPool* pArgPool = rArgs.GetPool();
      74             :     SfxItemSet aNewAttr( *pArgPool,
      75             :                             EE_ITEMS_START, EE_ITEMS_END,
      76             :                             SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
      77             :                             SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
      78             :                             SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
      79             :                             SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
      80             :                             SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
      81           0 :                             0 );
      82           0 :     aNewAttr.Put( rArgs );
      83             : 
      84             :     // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
      85             :     // Muss natuerlich noch geaendert werden
      86             :     // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
      87             : 
      88           0 :     aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
      89           0 :     aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
      90           0 :     aNewAttr.Put( SvxFmtSplitItem( true, SID_ATTR_PARA_SPLIT)  );
      91           0 :     aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
      92           0 :     aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
      93             : 
      94           0 :     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
      95             :     OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
      96             : 
      97             :     SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg(
      98           0 :         pViewData->GetDialogParent(), &aNewAttr);
      99             :     OSL_ENSURE(pDlg, "Dialog create fail!");
     100           0 :     bool bRet = ( pDlg->Execute() == RET_OK );
     101             : 
     102           0 :     if ( bRet )
     103             :     {
     104           0 :         const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
     105           0 :         if ( pNewAttrs )
     106           0 :             rOutSet.Put( *pNewAttrs );
     107             :     }
     108           0 :     delete pDlg;
     109             : 
     110           0 :     return bRet;
     111             : }
     112             : 
     113           0 : void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
     114             : {
     115           0 :     SdrView* pView = pViewData->GetScDrawView();
     116           0 :     OutlinerView* pOutView = pView->GetTextEditOutlinerView();
     117           0 :     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     118           0 :     SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
     119             : 
     120           0 :     pDlg->Insert( SOT_FORMAT_STRING, EMPTY_OUSTRING );
     121           0 :     pDlg->Insert( SOT_FORMAT_RTF,    EMPTY_OUSTRING );
     122             : 
     123           0 :     TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
     124             : 
     125           0 :     sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
     126             : 
     127             :     //! test if outliner view is still valid
     128             : 
     129           0 :     if (nFormat > 0)
     130             :     {
     131           0 :         if (nFormat == SOT_FORMAT_STRING)
     132           0 :             pOutView->Paste();
     133             :         else
     134           0 :             pOutView->PasteSpecial();
     135             :     }
     136           0 :     delete pDlg;
     137         102 : }
     138             : 
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10