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 .
20 #include <DrawViewShell.hxx>
21 #include <svx/xfillit0.hxx>
22 #include <editeng/eeitem.hxx>
23 #include <sfx2/request.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <svx/svxids.hrc>
26 #include <sfx2/dispatch.hxx>
27 #include <svx/float3d.hxx>
28 #include <svx/f3dchild.hxx>
29 #include <vcl/weld.hxx>
31 #include <strings.hrc>
33 #include <drawdoc.hxx>
35 #include <sdresid.hxx>
37 using namespace ::com::sun::star
;
42 * Handle SfxRequests for EffekteWindow
44 void DrawViewShell::ExecEffectWin( SfxRequest
& rReq
)
48 sal_uInt16 nSId
= rReq
.GetSlot();
54 sal_uInt16 nId
= Svx3DChildWindow::GetChildWindowId();
55 SfxChildWindow
* pWindow
= GetViewFrame()->GetChildWindow( nId
);
58 Svx3DWin
* p3DWin
= static_cast<Svx3DWin
*>( pWindow
->GetWindow() );
60 p3DWin
->InitColorLB();
80 void DrawViewShell::Update3DWindow()
82 sal_uInt16 nId
= Svx3DChildWindow::GetChildWindowId();
83 SfxChildWindow
* pWindow
= GetViewFrame()->GetChildWindow( nId
);
86 Svx3DWin
* p3DWin
= static_cast<Svx3DWin
*>( pWindow
->GetWindow() );
87 if( p3DWin
&& p3DWin
->IsUpdateMode() )
89 SfxItemSet aTmpItemSet
= GetView()->Get3DAttributes();
90 p3DWin
->Update( aTmpItemSet
);
95 /*----------------------------------------------------------------------------*/
97 void DrawViewShell::AssignFrom3DWindow()
99 sal_uInt16 nId
= Svx3DChildWindow::GetChildWindowId();
100 SfxChildWindow
* pWin
= GetViewFrame()->GetChildWindow( nId
);
104 Svx3DWin
* p3DWin
= static_cast<Svx3DWin
*>( pWin
->GetWindow() );
105 if( !(p3DWin
&& GetView()) )
108 if(!GetView()->IsPresObjSelected())
110 SfxItemSetFixed
<SDRATTR_START
, SDRATTR_END
> aSet( GetDoc()->GetPool() );
111 p3DWin
->GetAttr( aSet
);
113 // own UNDO-compounding also around transformation in 3D
114 GetView()->BegUndo(SdResId(STR_UNDO_APPLY_3D_FAVOURITE
));
116 if(GetView()->IsConvertTo3DObjPossible())
118 // assign only text-attribute
119 SfxItemSetFixed
<EE_ITEMS_START
, EE_ITEMS_END
> aTextSet( GetDoc()->GetPool() );
120 aTextSet
.Put( aSet
, false );
121 GetView()->SetAttributes( aTextSet
);
123 // transform text into 3D
124 sal_uInt16 nSId
= SID_CONVERT_TO_3D
;
125 SfxBoolItem
aItem( nSId
, true );
126 GetViewFrame()->GetDispatcher()->ExecuteList(
127 nSId
, SfxCallMode::SYNCHRON
| SfxCallMode::RECORD
,
130 // Determine if a FILL attribute is set.
131 // If not, hard set a fill attribute
132 drawing::FillStyle eFillStyle
= aSet
.Get(XATTR_FILLSTYLE
).GetValue();
133 if(eFillStyle
== drawing::FillStyle_NONE
)
134 aSet
.Put(XFillStyleItem (drawing::FillStyle_SOLID
));
136 // remove some 3DSCENE attributes since these were
137 // created by convert to 3D and may not be changed
138 // to the defaults again.
139 aSet
.ClearItem(SDRATTR_3DSCENE_DISTANCE
);
140 aSet
.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH
);
141 aSet
.ClearItem(SDRATTR_3DOBJ_DEPTH
);
145 GetView()->Set3DAttributes( aSet
);
148 GetView()->EndUndo();
152 vcl::Window
* pWindow
= GetActiveWindow();
153 std::unique_ptr
<weld::MessageDialog
> xInfoBox(Application::CreateMessageDialog(pWindow
? pWindow
->GetFrameWeld() : nullptr,
154 VclMessageType::Info
, VclButtonsType::Ok
,
155 SdResId(STR_ACTION_NOTPOSSIBLE
)));
160 GetActiveWindow()->GrabFocus();
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */