LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - futransf.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 51 2.0 %
Date: 2012-12-27 Functions: 2 10 20.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 "futransf.hxx"
      21             : 
      22             : #include <svx/dialogs.hrc>
      23             : #include <svx/polysc3d.hxx>
      24             : #include <vcl/msgbox.hxx>
      25             : #include <sfx2/request.hxx>
      26             : 
      27             : #include "strings.hrc"
      28             : #include "ViewShell.hxx"
      29             : #include "View.hxx"
      30             : #include "sdresid.hxx"
      31             : #include "drawdoc.hxx"
      32             : #include <svx/svxdlg.hxx>
      33             : 
      34             : #include <boost/scoped_ptr.hpp>
      35             : 
      36             : namespace sd {
      37             : 
      38           0 : TYPEINIT1( FuTransform, FuPoor );
      39             : 
      40             : /*************************************************************************
      41             : |*
      42             : |* Konstruktor
      43             : |*
      44             : \************************************************************************/
      45             : 
      46           0 : FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
      47             :                          SdDrawDocument* pDoc, SfxRequest& rReq)
      48           0 :     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
      49             : {
      50           0 : }
      51             : 
      52           0 : FunctionReference FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      53             : {
      54           0 :     FunctionReference xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) );
      55           0 :     xFunc->DoExecute(rReq);
      56           0 :     return xFunc;
      57             : }
      58             : 
      59           0 : void FuTransform::DoExecute( SfxRequest& rReq )
      60             : {
      61           0 :     if( mpView->AreObjectsMarked() )
      62             :     {
      63           0 :         const SfxItemSet* pArgs = rReq.GetArgs();
      64             : 
      65           0 :         if( !pArgs )
      66             :         {
      67             :             // --------- itemset for size and position --------
      68           0 :             SfxItemSet aSet( mpView->GetGeoAttrFromMarked() );
      69             : 
      70           0 :             const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
      71           0 :             SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
      72           0 :             if( rMarkList.GetMarkCount() == 1 &&
      73           0 :                 pObj->GetObjInventor() == SdrInventor &&
      74           0 :                 pObj->GetObjIdentifier() == OBJ_CAPTION )
      75             :             {
      76             :                 // --------- itemset for caption --------
      77           0 :                 SfxItemSet aNewAttr( mpDoc->GetPool() );
      78           0 :                 mpView->GetAttributes( aNewAttr );
      79             : 
      80           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      81           0 :                 if ( pFact )
      82             :                 {
      83           0 :                     boost::scoped_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) );
      84             : 
      85           0 :                     const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
      86           0 :                     SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
      87           0 :                     aCombSet.Put( aNewAttr );
      88           0 :                     aCombSet.Put( aSet );
      89           0 :                     pDlg->SetInputSet( &aCombSet );
      90             : 
      91           0 :                     if( pDlg.get() && (pDlg->Execute() == RET_OK) )
      92             :                     {
      93           0 :                         rReq.Done( *( pDlg->GetOutputItemSet() ) );
      94           0 :                         pArgs = rReq.GetArgs();
      95           0 :                     }
      96           0 :                 }
      97             :             }
      98             :             else
      99             :             {
     100           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     101           0 :                 if(pFact)
     102             :                 {
     103           0 :                     boost::scoped_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) );
     104           0 :                     if( pDlg.get() && (pDlg->Execute() == RET_OK) )
     105             :                     {
     106           0 :                         rReq.Done( *( pDlg->GetOutputItemSet() ) );
     107           0 :                         pArgs = rReq.GetArgs();
     108           0 :                     }
     109             :                 }
     110           0 :             }
     111             :         }
     112             : 
     113           0 :         if( pArgs )
     114             :         {
     115             :             // Undo
     116           0 :             String aString( mpView->GetDescriptionOfMarkedObjects() );
     117           0 :             aString.Append( sal_Unicode(' ') );
     118           0 :             aString.Append( String( SdResId( STR_TRANSFORM ) ) );
     119           0 :             mpView->BegUndo( aString );
     120             : 
     121           0 :             mpView->SetGeoAttrToMarked( *pArgs );
     122           0 :             mpView->SetAttributes( *pArgs );
     123           0 :             mpView->EndUndo();
     124             :         }
     125             :     }
     126           0 : }
     127             : 
     128           9 : } // end of namespace sd
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10