1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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>
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"
50 #include "sdresid.hxx"
52 using namespace ::com::sun::star
;
56 #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
59 * Handle SfxRequests for EffekteWindow
61 void DrawViewShell::ExecEffectWin( SfxRequest
& rReq
)
65 sal_uInt16 nSId
= rReq
.GetSlot();
71 sal_uInt16 nId
= Svx3DChildWindow::GetChildWindowId();
72 SfxChildWindow
* pWindow
= GetViewFrame()->GetChildWindow( nId
);
75 Svx3DWin
* p3DWin
= (Svx3DWin
*)( pWindow
->GetWindow() );
77 p3DWin
->InitColorLB( GetDoc() );
97 void DrawViewShell::Update3DWindow()
99 sal_uInt16 nId
= Svx3DChildWindow::GetChildWindowId();
100 SfxChildWindow
* pWindow
= GetViewFrame()->GetChildWindow( nId
);
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
);
120 Svx3DWin
* p3DWin
= (Svx3DWin
*) pWin
->GetWindow();
121 if( p3DWin
&& GetView() )
123 if(!GetView()->IsPresObjSelected())
125 SfxItemSet
aSet( GetDoc()->GetPool(),
126 SDRATTR_START
, SDRATTR_END
,
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
);
162 GetView()->Set3DAttributes( aSet
);
165 GetView()->EndUndo();
171 String(SdResId(STR_ACTION_NOTPOSSIBLE
)));
176 GetActiveWindow()->GrabFocus();
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */