1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*5b190011SAndrew Rist * distributed with this work for additional information
6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at
10*5b190011SAndrew Rist *
11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*5b190011SAndrew Rist *
13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist * software distributed under the License is distributed on an
15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the
17*5b190011SAndrew Rist * specific language governing permissions and limitations
18*5b190011SAndrew Rist * under the License.
19*5b190011SAndrew Rist *
20*5b190011SAndrew Rist *************************************************************/
21*5b190011SAndrew Rist
22*5b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir #include <svx/xtable.hxx>
29cdf0e10cSrcweir #include "sdattr.hxx"
30cdf0e10cSrcweir #include <svl/aeitem.hxx>
31cdf0e10cSrcweir #include <editeng/eeitem.hxx>
32cdf0e10cSrcweir #include <sfx2/request.hxx>
33cdf0e10cSrcweir #include <svx/svditer.hxx>
34cdf0e10cSrcweir #include <editeng/colritem.hxx>
35cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
36cdf0e10cSrcweir #ifndef _SVXIDS_HRC
37cdf0e10cSrcweir #include <svx/svxids.hrc>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <svx/svdundo.hxx>
40cdf0e10cSrcweir #include <svx/view3d.hxx>
41cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
42cdf0e10cSrcweir #include <svx/float3d.hxx>
43cdf0e10cSrcweir #include <svx/f3dchild.hxx>
44cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC //autogen
45cdf0e10cSrcweir #include <svx/dialogs.hrc>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #include <vcl/msgbox.hxx>
48cdf0e10cSrcweir
49cdf0e10cSrcweir
50cdf0e10cSrcweir #include "app.hrc"
51cdf0e10cSrcweir #include "strings.hrc"
52cdf0e10cSrcweir
53cdf0e10cSrcweir #include "drawdoc.hxx"
54cdf0e10cSrcweir #include "DrawDocShell.hxx"
55cdf0e10cSrcweir #include "anminfo.hxx"
56cdf0e10cSrcweir #include "unoaprms.hxx" // Undo-Action
57cdf0e10cSrcweir #include "sdundogr.hxx" // Undo Gruppe
58cdf0e10cSrcweir #include "drawview.hxx"
59cdf0e10cSrcweir #include "Window.hxx"
60cdf0e10cSrcweir #include "sdresid.hxx"
61cdf0e10cSrcweir
62cdf0e10cSrcweir using namespace ::com::sun::star;
63cdf0e10cSrcweir
64cdf0e10cSrcweir namespace sd {
65cdf0e10cSrcweir
66cdf0e10cSrcweir #define ATTR_MISSING 0 // Attribut nicht verfuegbar
67cdf0e10cSrcweir #define ATTR_MIXED 1 // Attribut uneindeutig (bei Mehrfachselektion)
68cdf0e10cSrcweir #define ATTR_SET 2 // Attribut eindeutig
69cdf0e10cSrcweir
70cdf0e10cSrcweir #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
71cdf0e10cSrcweir
72cdf0e10cSrcweir /*************************************************************************
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir |* SfxRequests fuer EffekteWindow bearbeiten
75cdf0e10cSrcweir |*
76cdf0e10cSrcweir \************************************************************************/
77cdf0e10cSrcweir
ExecEffectWin(SfxRequest & rReq)78cdf0e10cSrcweir void DrawViewShell::ExecEffectWin( SfxRequest& rReq )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir CheckLineTo (rReq);
81cdf0e10cSrcweir
82cdf0e10cSrcweir sal_uInt16 nSId = rReq.GetSlot();
83cdf0e10cSrcweir
84cdf0e10cSrcweir switch( nSId )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir case SID_3D_INIT:
87cdf0e10cSrcweir {
88cdf0e10cSrcweir sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
89cdf0e10cSrcweir SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
90cdf0e10cSrcweir if( pWindow )
91cdf0e10cSrcweir {
92cdf0e10cSrcweir Svx3DWin* p3DWin = (Svx3DWin*)( pWindow->GetWindow() );
93cdf0e10cSrcweir if( p3DWin )
94cdf0e10cSrcweir p3DWin->InitColorLB( GetDoc() );
95cdf0e10cSrcweir }
96cdf0e10cSrcweir }
97cdf0e10cSrcweir break;
98cdf0e10cSrcweir
99cdf0e10cSrcweir case SID_3D_STATE:
100cdf0e10cSrcweir {
101cdf0e10cSrcweir Update3DWindow();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir break;
104cdf0e10cSrcweir
105cdf0e10cSrcweir case SID_3D_ASSIGN:
106cdf0e10cSrcweir {
107cdf0e10cSrcweir AssignFrom3DWindow();
108cdf0e10cSrcweir }
109cdf0e10cSrcweir break;
110cdf0e10cSrcweir
111cdf0e10cSrcweir }
112cdf0e10cSrcweir }
113cdf0e10cSrcweir
114cdf0e10cSrcweir /*************************************************************************
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir |* 3D - Assign / Update
117cdf0e10cSrcweir |*
118cdf0e10cSrcweir \************************************************************************/
Update3DWindow()119cdf0e10cSrcweir void DrawViewShell::Update3DWindow()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
122cdf0e10cSrcweir SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
123cdf0e10cSrcweir if( pWindow )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir Svx3DWin* p3DWin = (Svx3DWin*) pWindow->GetWindow();
126cdf0e10cSrcweir if( p3DWin && p3DWin->IsUpdateMode() )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
129cdf0e10cSrcweir p3DWin->Update( aTmpItemSet );
130cdf0e10cSrcweir }
131cdf0e10cSrcweir }
132cdf0e10cSrcweir }
133cdf0e10cSrcweir
134cdf0e10cSrcweir /*----------------------------------------------------------------------------*/
135cdf0e10cSrcweir
AssignFrom3DWindow()136cdf0e10cSrcweir void DrawViewShell::AssignFrom3DWindow()
137cdf0e10cSrcweir {
138cdf0e10cSrcweir sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
139cdf0e10cSrcweir SfxChildWindow* pWin = GetViewFrame()->GetChildWindow( nId );
140cdf0e10cSrcweir if( pWin )
141cdf0e10cSrcweir {
142cdf0e10cSrcweir Svx3DWin* p3DWin = (Svx3DWin*) pWin->GetWindow();
143cdf0e10cSrcweir if( p3DWin && GetView() )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir if(!GetView()->IsPresObjSelected())
146cdf0e10cSrcweir {
147cdf0e10cSrcweir SfxItemSet aSet( GetDoc()->GetPool(),
148cdf0e10cSrcweir SDRATTR_START, SDRATTR_END,
149cdf0e10cSrcweir 0, 0);
150cdf0e10cSrcweir p3DWin->GetAttr( aSet );
151cdf0e10cSrcweir
152cdf0e10cSrcweir // Eigene UNDO-Klammerung auch um die Wandlung in 3D
153cdf0e10cSrcweir GetView()->BegUndo(String(SdResId(STR_UNDO_APPLY_3D_FAVOURITE)));
154cdf0e10cSrcweir
155cdf0e10cSrcweir if(GetView()->IsConvertTo3DObjPossible())
156cdf0e10cSrcweir {
157cdf0e10cSrcweir // Nur TextAttribute zuweisen
158cdf0e10cSrcweir SfxItemSet aTextSet( GetDoc()->GetPool(),
159cdf0e10cSrcweir EE_ITEMS_START, EE_ITEMS_END, 0 );
160cdf0e10cSrcweir aTextSet.Put( aSet, sal_False );
161cdf0e10cSrcweir GetView()->SetAttributes( aTextSet );
162cdf0e10cSrcweir
163cdf0e10cSrcweir // Text in 3D umwandeln
164cdf0e10cSrcweir sal_uInt16 nSId = SID_CONVERT_TO_3D;
165cdf0e10cSrcweir SfxBoolItem aItem( nSId, sal_True );
166cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(
167cdf0e10cSrcweir nSId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
168cdf0e10cSrcweir
169cdf0e10cSrcweir // Feststellen, ob ein FILL_Attribut gesetzt ist.
170cdf0e10cSrcweir // Falls nicht, Fuellattribut hart setzen
171cdf0e10cSrcweir XFillStyle eFillStyle = ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem );
172cdf0e10cSrcweir if(eFillStyle == XFILL_NONE)
173cdf0e10cSrcweir aSet.Put(XFillStyleItem (XFILL_SOLID));
174cdf0e10cSrcweir
175cdf0e10cSrcweir // remove some 3DSCENE attributes since these were
176cdf0e10cSrcweir // created by convert to 3D and may not be changed
177cdf0e10cSrcweir // to the defaults again.
178cdf0e10cSrcweir aSet.ClearItem(SDRATTR_3DSCENE_DISTANCE);
179cdf0e10cSrcweir aSet.ClearItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
180cdf0e10cSrcweir aSet.ClearItem(SDRATTR_3DOBJ_DEPTH);
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir // Attribute zuweisen
184cdf0e10cSrcweir GetView()->Set3DAttributes( aSet );
185cdf0e10cSrcweir
186cdf0e10cSrcweir // Ende UNDO
187cdf0e10cSrcweir GetView()->EndUndo();
188cdf0e10cSrcweir }
189cdf0e10cSrcweir else
190cdf0e10cSrcweir {
191cdf0e10cSrcweir InfoBox aInfoBox (
192cdf0e10cSrcweir GetActiveWindow(),
193cdf0e10cSrcweir String(SdResId(STR_ACTION_NOTPOSSIBLE)));
194cdf0e10cSrcweir aInfoBox.Execute();
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir // Focus zurueckholen
198cdf0e10cSrcweir GetActiveWindow()->GrabFocus();
199cdf0e10cSrcweir }
200cdf0e10cSrcweir }
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
203cdf0e10cSrcweir }
204