LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsi.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 58 0.0 %
Date: 2014-04-14 Functions: 0 5 0.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             : 
      21             : #include "DrawViewShell.hxx"
      22             : #include <svx/xtable.hxx>
      23             : #include "sdattr.hxx"
      24             : #include <svl/aeitem.hxx>
      25             : #include <editeng/eeitem.hxx>
      26             : #include <sfx2/request.hxx>
      27             : #include <svx/svditer.hxx>
      28             : #include <editeng/colritem.hxx>
      29             : #include <sfx2/viewfrm.hxx>
      30             : #include <svx/svxids.hrc>
      31             : #include <svx/svdundo.hxx>
      32             : #include <svx/view3d.hxx>
      33             : #include <sfx2/dispatch.hxx>
      34             : #include <svx/float3d.hxx>
      35             : #include <svx/f3dchild.hxx>
      36             : #include <svx/dialogs.hrc>
      37             : #include <vcl/msgbox.hxx>
      38             : 
      39             : 
      40             : #include "app.hrc"
      41             : #include "strings.hrc"
      42             : 
      43             : #include "drawdoc.hxx"
      44             : #include "DrawDocShell.hxx"
      45             : #include "anminfo.hxx"
      46             : #include "unoaprms.hxx"
      47             : #include "sdundogr.hxx"
      48             : #include "drawview.hxx"
      49             : #include "Window.hxx"
      50             : #include "sdresid.hxx"
      51             : 
      52             : using namespace ::com::sun::star;
      53             : 
      54             : namespace sd {
      55             : 
      56             : #define ITEMVALUE(ItemSet,Id,Cast)  ((const Cast&)(ItemSet).Get(Id)).GetValue()
      57             : 
      58             : /**
      59             :  * Handle SfxRequests for EffekteWindow
      60             :  */
      61           0 : void DrawViewShell::ExecEffectWin( SfxRequest& rReq )
      62             : {
      63           0 :     CheckLineTo (rReq);
      64             : 
      65           0 :     sal_uInt16 nSId = rReq.GetSlot();
      66             : 
      67           0 :     switch( nSId )
      68             :     {
      69             :         case SID_3D_INIT:
      70             :         {
      71           0 :             sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
      72           0 :             SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
      73           0 :             if( pWindow )
      74             :             {
      75           0 :                 Svx3DWin* p3DWin = (Svx3DWin*)( pWindow->GetWindow() );
      76           0 :                 if( p3DWin )
      77           0 :                     p3DWin->InitColorLB( GetDoc() );
      78             :             }
      79             :         }
      80           0 :         break;
      81             : 
      82             :         case SID_3D_STATE:
      83             :         {
      84           0 :             Update3DWindow();
      85             :         }
      86           0 :         break;
      87             : 
      88             :         case SID_3D_ASSIGN:
      89             :         {
      90           0 :             AssignFrom3DWindow();
      91             :         }
      92           0 :         break;
      93             : 
      94             :     }
      95           0 : }
      96             : 
      97           0 : void DrawViewShell::Update3DWindow()
      98             : {
      99           0 :     sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
     100           0 :     SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
     101           0 :     if( pWindow )
     102             :     {
     103           0 :         Svx3DWin* p3DWin = (Svx3DWin*) pWindow->GetWindow();
     104           0 :         if( p3DWin && p3DWin->IsUpdateMode() )
     105             :         {
     106           0 :             SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
     107           0 :             p3DWin->Update( aTmpItemSet );
     108             :         }
     109             :     }
     110           0 : }
     111             : 
     112             : /*----------------------------------------------------------------------------*/
     113             : 
     114           0 : void DrawViewShell::AssignFrom3DWindow()
     115             : {
     116           0 :     sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
     117           0 :     SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId );
     118           0 :     if( pWin )
     119             :     {
     120           0 :         Svx3DWin* p3DWin = (Svx3DWin*) pWin->GetWindow();
     121           0 :         if( p3DWin && GetView() )
     122             :         {
     123           0 :             if(!GetView()->IsPresObjSelected())
     124             :             {
     125           0 :                 SfxItemSet aSet( GetDoc()->GetPool(),
     126             :                     SDRATTR_START,  SDRATTR_END,
     127           0 :                     0, 0);
     128           0 :                 p3DWin->GetAttr( aSet );
     129             : 
     130             :                 // own UNDO-compounding also around transformation in 3D
     131           0 :                 GetView()->BegUndo(SD_RESSTR(STR_UNDO_APPLY_3D_FAVOURITE));
     132             : 
     133           0 :                 if(GetView()->IsConvertTo3DObjPossible())
     134             :                 {
     135             :                     // assign only text-attribute
     136           0 :                     SfxItemSet aTextSet( GetDoc()->GetPool(),
     137           0 :                         EE_ITEMS_START, EE_ITEMS_END, 0 );
     138           0 :                     aTextSet.Put( aSet, false );
     139           0 :                     GetView()->SetAttributes( aTextSet );
     140             : 
     141             :                     // transform text into 3D
     142           0 :                     sal_uInt16 nSId = SID_CONVERT_TO_3D;
     143           0 :                     SfxBoolItem aItem( nSId, true );
     144             :                     GetViewFrame()->GetDispatcher()->Execute(
     145           0 :                         nSId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
     146             : 
     147             :                     // Determine if a FILL attribute is set.
     148             :                     // If not, hard set a fill attribut
     149           0 :                     XFillStyle eFillStyle = ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem );
     150           0 :                     if(eFillStyle == XFILL_NONE)
     151           0 :                         aSet.Put(XFillStyleItem (XFILL_SOLID));
     152             : 
     153             :                     // remove some 3DSCENE attributes since these were
     154             :                     // created by convert to 3D and may not be changed
     155             :                     // to the defaults again.
     156           0 :                     aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE);
     157           0 :                     aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
     158           0 :                     aSet.ClearItem(SDRATTR_3DOBJ_DEPTH);
     159             :                 }
     160             : 
     161             :                 // assign attribute
     162           0 :                 GetView()->Set3DAttributes( aSet );
     163             : 
     164             :                 // end UNDO
     165           0 :                 GetView()->EndUndo();
     166             :             }
     167             :             else
     168             :             {
     169             :                 InfoBox aInfoBox (
     170           0 :                     GetActiveWindow(),
     171           0 :                     SD_RESSTR(STR_ACTION_NOTPOSSIBLE));
     172           0 :                 aInfoBox.Execute();
     173             :             }
     174             : 
     175             :             // get focus back
     176           0 :             GetActiveWindow()->GrabFocus();
     177             :         }
     178             :     }
     179           0 : }
     180             : 
     181           0 : }
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10