LibreOffice Module sd (master) 1
drviewsi.cxx
Go to the documentation of this file.
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#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>
30
31#include <strings.hrc>
32
33#include <drawdoc.hxx>
34#include <Window.hxx>
35#include <sdresid.hxx>
36
37using namespace ::com::sun::star;
38
39namespace sd {
40
45{
46 CheckLineTo (rReq);
47
48 sal_uInt16 nSId = rReq.GetSlot();
49
50 switch( nSId )
51 {
52 case SID_3D_INIT:
53 {
54 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
56 if( pWindow )
57 {
58 Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWindow->GetWindow() );
59 if( p3DWin )
60 p3DWin->InitColorLB();
61 }
62 }
63 break;
64
65 case SID_3D_STATE:
66 {
68 }
69 break;
70
71 case SID_3D_ASSIGN:
72 {
74 }
75 break;
76
77 }
78}
79
81{
82 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
84 if( pWindow )
85 {
86 Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWindow->GetWindow() );
87 if( p3DWin && p3DWin->IsUpdateMode() )
88 {
89 SfxItemSet aTmpItemSet = GetView()->Get3DAttributes();
90 p3DWin->Update( aTmpItemSet );
91 }
92 }
93}
94
95/*----------------------------------------------------------------------------*/
96
98{
99 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
101 if( !pWin )
102 return;
103
104 Svx3DWin* p3DWin = static_cast<Svx3DWin*>( pWin->GetWindow() );
105 if( !(p3DWin && GetView()) )
106 return;
107
108 if(!GetView()->IsPresObjSelected())
109 {
111 p3DWin->GetAttr( aSet );
112
113 // own UNDO-compounding also around transformation in 3D
114 GetView()->BegUndo(SdResId(STR_UNDO_APPLY_3D_FAVOURITE));
115
116 if(GetView()->IsConvertTo3DObjPossible())
117 {
118 // assign only text-attribute
120 aTextSet.Put( aSet, false );
121 GetView()->SetAttributes( aTextSet );
122
123 // transform text into 3D
124 sal_uInt16 nSId = SID_CONVERT_TO_3D;
125 SfxBoolItem aItem( nSId, true );
127 nSId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
128 { &aItem });
129
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));
135
136 // remove some 3DSCENE attributes since these were
137 // created by convert to 3D and may not be changed
138 // to the defaults again.
142 }
143
144 // assign attribute
145 GetView()->Set3DAttributes( aSet );
146
147 // end UNDO
148 GetView()->EndUndo();
149 }
150 else
151 {
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)));
156 xInfoBox->run();
157 }
158
159 // get focus back
161}
162
163}
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
SfxItemSet Get3DAttributes() const
void Set3DAttributes(const SfxItemSet &rAttr)
void BegUndo()
void EndUndo()
vcl::Window * GetWindow() const
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetSlot() const
SfxItemPool & GetPool() const
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
void InitColorLB()
bool IsUpdateMode() const
void Update(SfxItemSet const &rSet)
void GetAttr(SfxItemSet &rSet)
static void CheckLineTo(SfxRequest &rReq)
check if we have to draw a polyline
Definition: drviewsa.cxx:404
void AssignFrom3DWindow()
Definition: drviewsi.cxx:97
void ExecEffectWin(SfxRequest &rReq)
Handle SfxRequests for EffekteWindow.
Definition: drviewsi.cxx:44
void Update3DWindow()
Definition: drviewsi.cxx:80
SdDrawDocument * GetDoc() const
Definition: viewshel.cxx:1412
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
::sd::View * GetView() const
Definition: ViewShell.hxx:144
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
bool IsPresObjSelected(bool bOnPage=true, bool bOnMasterPage=true, bool bCheckPresObjListOnly=false, bool bCheckLayoutOnly=false) const
Is a presentation object selected?
Definition: sdview.cxx:523
virtual bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false, bool bSlide=false, bool bMaster=false)
Definition: sdview.cxx:509
void GrabFocus()
Activate window.
Definition: sdwindow.cxx:750
weld::Window * GetFrameWeld() const
sal_Int16 nId
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_DEPTH(SDRATTR_3DOBJ_FIRST+2)
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DSCENE_FOCAL_LENGTH(SDRATTR_3DSCENE_FIRST+2)
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DSCENE_DISTANCE(SDRATTR_3DSCENE_FIRST+1)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)