fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / view / drviewsi.cxx
blob245d687fb5df527c491eea86a124821979c64d6e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
40 #include "app.hrc"
41 #include "strings.hrc"
43 #include "drawdoc.hxx"
44 #include "DrawDocShell.hxx"
45 #include "anminfo.hxx"
46 #include "unoaprms.hxx" // Undo-Action
47 #include "sdundogr.hxx" // Undo Gruppe
48 #include "drawview.hxx"
49 #include "Window.hxx"
50 #include "sdresid.hxx"
52 using namespace ::com::sun::star;
54 namespace sd {
56 #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
58 /**
59 * Handle SfxRequests for EffekteWindow
61 void DrawViewShell::ExecEffectWin( SfxRequest& rReq )
63 CheckLineTo (rReq);
65 sal_uInt16 nSId = rReq.GetSlot();
67 switch( nSId )
69 case SID_3D_INIT:
71 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
72 SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
73 if( pWindow )
75 Svx3DWin* p3DWin = (Svx3DWin*)( pWindow->GetWindow() );
76 if( p3DWin )
77 p3DWin->InitColorLB( GetDoc() );
80 break;
82 case SID_3D_STATE:
84 Update3DWindow();
86 break;
88 case SID_3D_ASSIGN:
90 AssignFrom3DWindow();
92 break;
97 void DrawViewShell::Update3DWindow()
99 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
100 SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
101 if( pWindow )
103 Svx3DWin* p3DWin = (Svx3DWin*) pWindow->GetWindow();
104 if( p3DWin && p3DWin->IsUpdateMode() )
106 SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
107 p3DWin->Update( aTmpItemSet );
112 /*----------------------------------------------------------------------------*/
114 void DrawViewShell::AssignFrom3DWindow()
116 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
117 SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId );
118 if( pWin )
120 Svx3DWin* p3DWin = (Svx3DWin*) pWin->GetWindow();
121 if( p3DWin && GetView() )
123 if(!GetView()->IsPresObjSelected())
125 SfxItemSet aSet( GetDoc()->GetPool(),
126 SDRATTR_START, SDRATTR_END,
127 0, 0);
128 p3DWin->GetAttr( aSet );
130 // own UNDO-compounding also around transformation in 3D
131 GetView()->BegUndo(String(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)));
133 if(GetView()->IsConvertTo3DObjPossible())
135 // assign only text-attribute
136 SfxItemSet aTextSet( GetDoc()->GetPool(),
137 EE_ITEMS_START, EE_ITEMS_END, 0 );
138 aTextSet.Put( aSet, sal_False );
139 GetView()->SetAttributes( aTextSet );
141 // transform text into 3D
142 sal_uInt16 nSId = SID_CONVERT_TO_3D;
143 SfxBoolItem aItem( nSId, sal_True );
144 GetViewFrame()->GetDispatcher()->Execute(
145 nSId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
147 // Determine if a FILL attribute is set.
148 // If not, hard set a fill attribut
149 XFillStyle eFillStyle = ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem );
150 if(eFillStyle == XFILL_NONE)
151 aSet.Put(XFillStyleItem (XFILL_SOLID));
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 aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE);
157 aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
158 aSet.ClearItem(SDRATTR_3DOBJ_DEPTH);
161 // assign attribute
162 GetView()->Set3DAttributes( aSet );
164 // end UNDO
165 GetView()->EndUndo();
167 else
169 InfoBox aInfoBox (
170 GetActiveWindow(),
171 String(SdResId(STR_ACTION_NOTPOSSIBLE)));
172 aInfoBox.Execute();
175 // get focus back
176 GetActiveWindow()->GrabFocus();
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */