/src/libreoffice/svx/source/tbxctrls/extrusioncontrols.cxx
Line | Count | Source |
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 <sal/config.h> |
21 | | |
22 | | #include <comphelper/propertyvalue.hxx> |
23 | | #include <svtools/toolbarmenu.hxx> |
24 | | #include <vcl/toolbox.hxx> |
25 | | #include <vcl/weld/Builder.hxx> |
26 | | #include <vcl/weld/ScrolledWindow.hxx> |
27 | | #include <vcl/weld/Toolbar.hxx> |
28 | | |
29 | | #include <svx/strings.hrc> |
30 | | #include <svx/svdtrans.hxx> |
31 | | #include <svx/dialmgr.hxx> |
32 | | |
33 | | #include <helpids.h> |
34 | | #include "extrusioncontrols.hxx" |
35 | | #include <extrusiondepthdialog.hxx> |
36 | | |
37 | | #include <bitmaps.hlst> |
38 | | |
39 | | using namespace ::com::sun::star::uno; |
40 | | using namespace ::com::sun::star::beans; |
41 | | using namespace ::com::sun::star::util; |
42 | | using namespace ::com::sun::star::graphic; |
43 | | |
44 | | namespace svx |
45 | | { |
46 | | |
47 | | const sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; |
48 | | constexpr OUString g_sExtrusionDirection = u".uno:ExtrusionDirection"_ustr; |
49 | | constexpr OUString g_sExtrusionProjection = u".uno:ExtrusionProjection"_ustr; |
50 | | constexpr OUString EMPTY = u""_ustr; |
51 | | |
52 | | constexpr OUString aLightOffBmps[] = |
53 | | { |
54 | | RID_SVXBMP_LIGHT_OFF_FROM_TOP_LEFT, |
55 | | RID_SVXBMP_LIGHT_OFF_FROM_TOP, |
56 | | RID_SVXBMP_LIGHT_OFF_FROM_TOP_RIGHT, |
57 | | RID_SVXBMP_LIGHT_OFF_FROM_LEFT, |
58 | | EMPTY, |
59 | | RID_SVXBMP_LIGHT_OFF_FROM_RIGHT, |
60 | | RID_SVXBMP_LIGHT_OFF_FROM_BOTTOM_LEFT, |
61 | | RID_SVXBMP_LIGHT_OFF_FROM_BOTTOM, |
62 | | RID_SVXBMP_LIGHT_OFF_FROM_BOTTOM_RIGHT |
63 | | }; |
64 | | |
65 | | constexpr OUString aLightOnBmps[] = |
66 | | { |
67 | | RID_SVXBMP_LIGHT_ON_FROM_TOP_LEFT, |
68 | | RID_SVXBMP_LIGHT_ON_FROM_TOP, |
69 | | RID_SVXBMP_LIGHT_ON_FROM_TOP_RIGHT, |
70 | | RID_SVXBMP_LIGHT_ON_FROM_LEFT, |
71 | | EMPTY, |
72 | | RID_SVXBMP_LIGHT_ON_FROM_RIGHT, |
73 | | RID_SVXBMP_LIGHT_ON_FROM_BOTTOM_LEFT, |
74 | | RID_SVXBMP_LIGHT_ON_FROM_BOTTOM, |
75 | | RID_SVXBMP_LIGHT_ON_FROM_BOTTOM_RIGHT |
76 | | }; |
77 | | |
78 | | constexpr OUString aLightPreviewBmps[] = |
79 | | { |
80 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_TOP_LEFT, |
81 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_TOP, |
82 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_TOP_RIGHT, |
83 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_LEFT, |
84 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_FRONT, |
85 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_RIGHT, |
86 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_LEFT, |
87 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM, |
88 | | RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_RIGHT |
89 | | }; |
90 | | |
91 | | constexpr OUString aDirectionBmps[] = |
92 | | { |
93 | | RID_SVXBMP_DIRECTION_DIRECTION_NW, |
94 | | RID_SVXBMP_DIRECTION_DIRECTION_N, |
95 | | RID_SVXBMP_DIRECTION_DIRECTION_NE, |
96 | | RID_SVXBMP_DIRECTION_DIRECTION_W, |
97 | | RID_SVXBMP_DIRECTION_DIRECTION_NONE, |
98 | | RID_SVXBMP_DIRECTION_DIRECTION_E, |
99 | | RID_SVXBMP_DIRECTION_DIRECTION_SW, |
100 | | RID_SVXBMP_DIRECTION_DIRECTION_S, |
101 | | RID_SVXBMP_DIRECTION_DIRECTION_SE |
102 | | }; |
103 | | |
104 | | constexpr TranslateId aDirectionStrs[] = |
105 | | { |
106 | | RID_SVXSTR_DIRECTION_NW, |
107 | | RID_SVXSTR_DIRECTION_N, |
108 | | RID_SVXSTR_DIRECTION_NE, |
109 | | RID_SVXSTR_DIRECTION_W, |
110 | | RID_SVXSTR_DIRECTION_NONE, |
111 | | RID_SVXSTR_DIRECTION_E, |
112 | | RID_SVXSTR_DIRECTION_SW, |
113 | | RID_SVXSTR_DIRECTION_S, |
114 | | RID_SVXSTR_DIRECTION_SE |
115 | | }; |
116 | | |
117 | | ExtrusionDirectionWindow::ExtrusionDirectionWindow( |
118 | | svt::PopupWindowController* pControl, |
119 | | weld::Widget* pParent) |
120 | 0 | : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/directionwindow.ui"_ustr, u"DirectionWindow"_ustr) |
121 | 0 | , mxControl(pControl) |
122 | 0 | , mxDirectionSet(new ValueSet(nullptr)) |
123 | 0 | , mxDirectionSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxDirectionSet)) |
124 | 0 | , mxPerspective(m_xBuilder->weld_radio_button(u"perspective"_ustr)) |
125 | 0 | , mxParallel(m_xBuilder->weld_radio_button(u"parallel"_ustr)) |
126 | 0 | { |
127 | 0 | mxDirectionSet->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); |
128 | |
|
129 | 0 | for (sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; ++i) |
130 | 0 | { |
131 | 0 | maImgDirection[i] = Image(StockImage::Yes, aDirectionBmps[i]); |
132 | 0 | } |
133 | |
|
134 | 0 | mxDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectValueSetHdl ) ); |
135 | 0 | mxDirectionSet->SetColCount( 3 ); |
136 | 0 | mxDirectionSet->EnableFullItemMode( false ); |
137 | |
|
138 | 0 | for (sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; ++i) |
139 | 0 | { |
140 | 0 | mxDirectionSet->InsertItem(i + 1, maImgDirection[i], SvxResId(aDirectionStrs[i])); |
141 | 0 | } |
142 | |
|
143 | 0 | Size aSize(72, 72); |
144 | 0 | mxDirectionSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); |
145 | 0 | mxDirectionSet->SetOutputSizePixel(aSize); |
146 | |
|
147 | 0 | mxPerspective->connect_toggled(LINK(this, ExtrusionDirectionWindow, SelectToolbarMenuHdl)); |
148 | |
|
149 | 0 | AddStatusListener( g_sExtrusionDirection ); |
150 | 0 | AddStatusListener( g_sExtrusionProjection ); |
151 | 0 | } |
152 | | |
153 | | void ExtrusionDirectionWindow::GrabFocus() |
154 | 0 | { |
155 | 0 | mxDirectionSet->GrabFocus(); |
156 | 0 | } |
157 | | |
158 | | ExtrusionDirectionWindow::~ExtrusionDirectionWindow() |
159 | 0 | { |
160 | 0 | } |
161 | | |
162 | | void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled ) |
163 | 0 | { |
164 | 0 | sal_uInt16 nItemId; |
165 | 0 | for( nItemId = DIRECTION_NW; nItemId <= DIRECTION_SE; nItemId++ ) |
166 | 0 | { |
167 | 0 | if( gSkewList[nItemId] == nSkew ) |
168 | 0 | break; |
169 | 0 | } |
170 | |
|
171 | 0 | if( nItemId <= DIRECTION_SE ) |
172 | 0 | { |
173 | 0 | mxDirectionSet->SelectItem( nItemId+1 ); |
174 | 0 | } |
175 | 0 | else |
176 | 0 | { |
177 | 0 | mxDirectionSet->SetNoSelection(); |
178 | 0 | } |
179 | |
|
180 | 0 | if (bEnabled) |
181 | 0 | mxDirectionSet->Enable(); |
182 | 0 | else |
183 | 0 | mxDirectionSet->Disable(); |
184 | 0 | } |
185 | | |
186 | | void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) |
187 | 0 | { |
188 | 0 | mxPerspective->set_active(nProjection == 0 && bEnabled); |
189 | 0 | mxParallel->set_active(nProjection == 1 && bEnabled); |
190 | 0 | mxPerspective->set_sensitive(bEnabled); |
191 | 0 | mxParallel->set_sensitive(bEnabled); |
192 | 0 | } |
193 | | |
194 | | void ExtrusionDirectionWindow::statusChanged( |
195 | | const css::frame::FeatureStateEvent& Event |
196 | | ) |
197 | 0 | { |
198 | 0 | if( Event.FeatureURL.Main == g_sExtrusionDirection ) |
199 | 0 | { |
200 | 0 | if( !Event.IsEnabled ) |
201 | 0 | { |
202 | 0 | implSetDirection( -1, false ); |
203 | 0 | } |
204 | 0 | else |
205 | 0 | { |
206 | 0 | sal_Int32 nValue = 0; |
207 | 0 | if( Event.State >>= nValue ) |
208 | 0 | implSetDirection( nValue, true ); |
209 | 0 | } |
210 | 0 | } |
211 | 0 | else if( Event.FeatureURL.Main == g_sExtrusionProjection ) |
212 | 0 | { |
213 | 0 | if( !Event.IsEnabled ) |
214 | 0 | { |
215 | 0 | implSetProjection( -1, false ); |
216 | 0 | } |
217 | 0 | else |
218 | 0 | { |
219 | 0 | sal_Int32 nValue = 0; |
220 | 0 | if( Event.State >>= nValue ) |
221 | 0 | implSetProjection( nValue, true ); |
222 | 0 | } |
223 | 0 | } |
224 | 0 | } |
225 | | |
226 | | IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectValueSetHdl, ValueSet*, void) |
227 | 0 | { |
228 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
229 | 0 | g_sExtrusionDirection.copy(5), |
230 | 0 | gSkewList[mxDirectionSet->GetSelectedItemId()-1]) }; |
231 | |
|
232 | 0 | mxControl->dispatchCommand( g_sExtrusionDirection, aArgs ); |
233 | |
|
234 | 0 | mxControl->EndPopupMode(); |
235 | 0 | } |
236 | | |
237 | | IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectToolbarMenuHdl, weld::Toggleable&, void) |
238 | 0 | { |
239 | 0 | int nProjection = mxPerspective->get_active() ? 0 : 1; |
240 | |
|
241 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
242 | 0 | g_sExtrusionProjection.copy(5), static_cast<sal_Int32>(nProjection)) }; |
243 | |
|
244 | 0 | mxControl->dispatchCommand( g_sExtrusionProjection, aArgs ); |
245 | 0 | implSetProjection( nProjection, true ); |
246 | |
|
247 | 0 | mxControl->EndPopupMode(); |
248 | 0 | } |
249 | | |
250 | | ExtrusionDirectionControl::ExtrusionDirectionControl( |
251 | | const Reference< XComponentContext >& rxContext |
252 | 0 | ) : svt::PopupWindowController( |
253 | 0 | rxContext, |
254 | 0 | Reference< css::frame::XFrame >(), |
255 | 0 | u".uno:ExtrusionDirectionFloater"_ustr |
256 | 0 | ) |
257 | 0 | { |
258 | 0 | } Unexecuted instantiation: svx::ExtrusionDirectionControl::ExtrusionDirectionControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: svx::ExtrusionDirectionControl::ExtrusionDirectionControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
259 | | |
260 | | std::unique_ptr<WeldToolbarPopup> ExtrusionDirectionControl::weldPopupWindow() |
261 | 0 | { |
262 | 0 | return std::make_unique<ExtrusionDirectionWindow>(this, m_pToolbar); |
263 | 0 | } |
264 | | |
265 | | VclPtr<vcl::Window> ExtrusionDirectionControl::createVclPopupWindow( vcl::Window* pParent ) |
266 | 0 | { |
267 | 0 | mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, |
268 | 0 | std::make_unique<ExtrusionDirectionWindow>(this, pParent->GetFrameWeld())); |
269 | |
|
270 | 0 | mxInterimPopover->Show(); |
271 | |
|
272 | 0 | return mxInterimPopover; |
273 | 0 | } |
274 | | |
275 | | // XInitialization |
276 | | void SAL_CALL ExtrusionDirectionControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) |
277 | 0 | { |
278 | 0 | svt::PopupWindowController::initialize( aArguments ); |
279 | |
|
280 | 0 | ToolBox* pToolBox = nullptr; |
281 | 0 | ToolBoxItemId nId; |
282 | 0 | if ( getToolboxId( nId, &pToolBox ) ) |
283 | 0 | pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); |
284 | 0 | } |
285 | | |
286 | | // XServiceInfo |
287 | | |
288 | | |
289 | | OUString ExtrusionDirectionControl::getImplementationName() |
290 | 0 | { |
291 | 0 | return u"com.sun.star.comp.svx.ExtrusionDirectionController"_ustr; |
292 | 0 | } |
293 | | |
294 | | |
295 | | Sequence< OUString > ExtrusionDirectionControl::getSupportedServiceNames() |
296 | 0 | { |
297 | 0 | return { u"com.sun.star.frame.ToolbarController"_ustr }; |
298 | 0 | } |
299 | | |
300 | | |
301 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
302 | | com_sun_star_comp_svx_ExtrusionDirectionControl_get_implementation( |
303 | | css::uno::XComponentContext* xContext, |
304 | | css::uno::Sequence<css::uno::Any> const &) |
305 | 0 | { |
306 | 0 | return cppu::acquire(new ExtrusionDirectionControl(xContext)); |
307 | 0 | } |
308 | | |
309 | | |
310 | | ExtrusionDepthDialog::ExtrusionDepthDialog(weld::Window* pParent, double fDepth, FieldUnit eDefaultUnit) |
311 | 0 | : GenericDialogController(pParent, u"svx/ui/extrustiondepthdialog.ui"_ustr, u"ExtrustionDepthDialog"_ustr) |
312 | 0 | , m_xMtrDepth(m_xBuilder->weld_metric_spin_button(u"depth"_ustr, eDefaultUnit)) |
313 | 0 | { |
314 | 0 | m_xMtrDepth->set_value(static_cast<int>(fDepth) * 100, FieldUnit::MM_100TH); |
315 | 0 | } |
316 | | |
317 | | ExtrusionDepthDialog::~ExtrusionDepthDialog() |
318 | 0 | { |
319 | 0 | } |
320 | | |
321 | | double ExtrusionDepthDialog::getDepth() const |
322 | 0 | { |
323 | 0 | return static_cast<double>(m_xMtrDepth->get_value(FieldUnit::MM_100TH)) / 100.0; |
324 | 0 | } |
325 | | |
326 | | double const aDepthListInch[] = { 0, 1270,2540,5080,10160 }; |
327 | | double const aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; |
328 | | |
329 | | constexpr OUString gsExtrusionDepth( u".uno:ExtrusionDepth"_ustr ); |
330 | | constexpr OUString gsMetricUnit( u".uno:MetricUnit"_ustr ); |
331 | | |
332 | | ExtrusionDepthWindow::ExtrusionDepthWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) |
333 | 0 | : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/depthwindow.ui"_ustr, u"DepthWindow"_ustr) |
334 | 0 | , mxControl(pControl) |
335 | 0 | , mxDepth0(m_xBuilder->weld_radio_button(u"depth0"_ustr)) |
336 | 0 | , mxDepth1(m_xBuilder->weld_radio_button(u"depth1"_ustr)) |
337 | 0 | , mxDepth2(m_xBuilder->weld_radio_button(u"depth2"_ustr)) |
338 | 0 | , mxDepth3(m_xBuilder->weld_radio_button(u"depth3"_ustr)) |
339 | 0 | , mxDepth4(m_xBuilder->weld_radio_button(u"depth4"_ustr)) |
340 | 0 | , mxInfinity(m_xBuilder->weld_radio_button(u"infinity"_ustr)) |
341 | 0 | , mxCustom(m_xBuilder->weld_radio_button(u"custom"_ustr)) |
342 | 0 | , meUnit(FieldUnit::NONE) |
343 | 0 | , mfDepth( -1.0 ) |
344 | 0 | , mbSettingValue(false) |
345 | 0 | , mbCommandDispatched(false) |
346 | 0 | { |
347 | 0 | mxDepth0->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
348 | 0 | mxDepth1->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
349 | 0 | mxDepth2->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
350 | 0 | mxDepth3->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
351 | 0 | mxDepth4->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
352 | 0 | mxInfinity->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
353 | 0 | mxCustom->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); |
354 | 0 | mxCustom->connect_mouse_release(LINK(this, ExtrusionDepthWindow, MouseReleaseHdl)); |
355 | |
|
356 | 0 | AddStatusListener( gsExtrusionDepth ); |
357 | 0 | AddStatusListener( gsMetricUnit ); |
358 | 0 | } |
359 | | |
360 | | void ExtrusionDepthWindow::GrabFocus() |
361 | 0 | { |
362 | 0 | mxDepth0->grab_focus(); |
363 | 0 | } |
364 | | |
365 | | void ExtrusionDepthWindow::implSetDepth( double fDepth ) |
366 | 0 | { |
367 | 0 | mfDepth = fDepth; |
368 | |
|
369 | 0 | bool bSettingValue = mbSettingValue; |
370 | 0 | mbSettingValue = true; |
371 | |
|
372 | 0 | mxCustom->set_active(true); |
373 | 0 | bool bIsMetric = IsMetric(meUnit); |
374 | 0 | mxDepth0->set_active(fDepth == (bIsMetric ? aDepthListMM[0] : aDepthListInch[0])); |
375 | 0 | mxDepth1->set_active(fDepth == (bIsMetric ? aDepthListMM[1] : aDepthListInch[1])); |
376 | 0 | mxDepth2->set_active(fDepth == (bIsMetric ? aDepthListMM[2] : aDepthListInch[2])); |
377 | 0 | mxDepth3->set_active(fDepth == (bIsMetric ? aDepthListMM[3] : aDepthListInch[3])); |
378 | 0 | mxDepth4->set_active(fDepth == (bIsMetric ? aDepthListMM[4] : aDepthListInch[4])); |
379 | 0 | mxInfinity->set_active(fDepth >= 338666); |
380 | |
|
381 | 0 | mbSettingValue = bSettingValue; |
382 | 0 | } |
383 | | |
384 | | void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) |
385 | 0 | { |
386 | 0 | meUnit = eUnit; |
387 | |
|
388 | 0 | const TranslateId aDepths[] = |
389 | 0 | { |
390 | 0 | RID_SVXSTR_DEPTH_0, |
391 | 0 | RID_SVXSTR_DEPTH_1, |
392 | 0 | RID_SVXSTR_DEPTH_2, |
393 | 0 | RID_SVXSTR_DEPTH_3, |
394 | 0 | RID_SVXSTR_DEPTH_4 |
395 | 0 | }; |
396 | |
|
397 | 0 | const TranslateId aDepthsInch[] = |
398 | 0 | { |
399 | 0 | RID_SVXSTR_DEPTH_0_INCH, |
400 | 0 | RID_SVXSTR_DEPTH_1_INCH, |
401 | 0 | RID_SVXSTR_DEPTH_2_INCH, |
402 | 0 | RID_SVXSTR_DEPTH_3_INCH, |
403 | 0 | RID_SVXSTR_DEPTH_4_INCH |
404 | 0 | }; |
405 | |
|
406 | 0 | static_assert(SAL_N_ELEMENTS(aDepths) == SAL_N_ELEMENTS(aDepthsInch)); |
407 | |
|
408 | 0 | const TranslateId* pResource = IsMetric(eUnit) ? aDepths : aDepthsInch; |
409 | |
|
410 | 0 | mxDepth0->set_label(SvxResId(pResource[0])); |
411 | 0 | mxDepth1->set_label(SvxResId(pResource[1])); |
412 | 0 | mxDepth2->set_label(SvxResId(pResource[2])); |
413 | 0 | mxDepth3->set_label(SvxResId(pResource[3])); |
414 | 0 | mxDepth4->set_label(SvxResId(pResource[4])); |
415 | 0 | } |
416 | | |
417 | | void ExtrusionDepthWindow::statusChanged( |
418 | | const css::frame::FeatureStateEvent& Event |
419 | | ) |
420 | 0 | { |
421 | 0 | if( Event.FeatureURL.Main == gsExtrusionDepth ) |
422 | 0 | { |
423 | 0 | if( !Event.IsEnabled ) |
424 | 0 | { |
425 | 0 | implSetDepth( 0 ); |
426 | 0 | } |
427 | 0 | else |
428 | 0 | { |
429 | 0 | double fValue = 0.0; |
430 | 0 | if( Event.State >>= fValue ) |
431 | 0 | implSetDepth( fValue ); |
432 | 0 | } |
433 | 0 | } |
434 | 0 | else if( Event.FeatureURL.Main == gsMetricUnit ) |
435 | 0 | { |
436 | 0 | if( Event.IsEnabled ) |
437 | 0 | { |
438 | 0 | sal_Int32 nValue = 0; |
439 | 0 | if( Event.State >>= nValue ) |
440 | 0 | { |
441 | 0 | implFillStrings( static_cast<FieldUnit>(nValue) ); |
442 | 0 | if( mfDepth >= 0.0 ) |
443 | 0 | implSetDepth( mfDepth ); |
444 | 0 | } |
445 | 0 | } |
446 | 0 | } |
447 | 0 | } |
448 | | |
449 | | void ExtrusionDepthWindow::DispatchDepthDialog() |
450 | 0 | { |
451 | 0 | Sequence< PropertyValue > aArgs{ |
452 | 0 | comphelper::makePropertyValue(u"Depth"_ustr, mfDepth), |
453 | 0 | comphelper::makePropertyValue(u"Metric"_ustr, static_cast<sal_Int32>( meUnit )) |
454 | 0 | }; |
455 | |
|
456 | 0 | rtl::Reference<svt::PopupWindowController> xControl(mxControl); |
457 | 0 | xControl->EndPopupMode(); |
458 | 0 | xControl->dispatchCommand(u".uno:ExtrusionDepthDialog"_ustr, aArgs); |
459 | 0 | mbCommandDispatched = true; |
460 | 0 | } |
461 | | |
462 | | IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Toggleable&, rButton, void) |
463 | 0 | { |
464 | 0 | if (mbSettingValue || !rButton.get_active()) |
465 | 0 | return; |
466 | | |
467 | | // see MouseReleaseHdl for mbCommandDispatched check, there's no guarantee |
468 | | // this toggle will happen before that mouse release though it does in |
469 | | // practice for vcl and gtk |
470 | 0 | if (mbCommandDispatched) |
471 | 0 | return; |
472 | | |
473 | 0 | if (mxCustom->get_active()) |
474 | 0 | DispatchDepthDialog(); |
475 | 0 | else |
476 | 0 | { |
477 | 0 | double fDepth; |
478 | |
|
479 | 0 | if (mxInfinity->get_active()) |
480 | 0 | { |
481 | 0 | fDepth = 338666.6; |
482 | 0 | } |
483 | 0 | else |
484 | 0 | { |
485 | 0 | int nSelected; |
486 | 0 | if (mxDepth0->get_active()) |
487 | 0 | nSelected = 0; |
488 | 0 | else if (mxDepth1->get_active()) |
489 | 0 | nSelected = 1; |
490 | 0 | else if (mxDepth2->get_active()) |
491 | 0 | nSelected = 2; |
492 | 0 | else if (mxDepth3->get_active()) |
493 | 0 | nSelected = 3; |
494 | 0 | else |
495 | 0 | nSelected = 4; |
496 | |
|
497 | 0 | fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; |
498 | 0 | } |
499 | |
|
500 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
501 | 0 | gsExtrusionDepth.copy(5), fDepth) }; |
502 | |
|
503 | 0 | mxControl->dispatchCommand( gsExtrusionDepth, aArgs ); |
504 | 0 | mbCommandDispatched = true; |
505 | 0 | implSetDepth( fDepth ); |
506 | |
|
507 | 0 | mxControl->EndPopupMode(); |
508 | 0 | } |
509 | 0 | } |
510 | | |
511 | | IMPL_LINK_NOARG(ExtrusionDepthWindow, MouseReleaseHdl, const MouseEvent&, bool) |
512 | 0 | { |
513 | | /* |
514 | | tdf#145296 if the "custom" radiobutton was presented preselected as |
515 | | toggled on and the user clicked on it then there's no toggled signal sent |
516 | | because the item was already toggled on and didn't change state. |
517 | | |
518 | | So if that happens launch the custom spacing dialog explicitly here on |
519 | | mouse release. |
520 | | */ |
521 | 0 | if (mxCustom->get_active() && !mbCommandDispatched) |
522 | 0 | { |
523 | 0 | DispatchDepthDialog(); |
524 | 0 | return true; |
525 | 0 | } |
526 | 0 | return false; |
527 | 0 | } |
528 | | |
529 | | // ExtrusionDirectionControl |
530 | | ExtrusionDepthController::ExtrusionDepthController( |
531 | | const Reference< XComponentContext >& rxContext |
532 | 0 | ) : svt::PopupWindowController( |
533 | 0 | rxContext, |
534 | 0 | Reference< css::frame::XFrame >(), |
535 | 0 | u".uno:ExtrusionDepthFloater"_ustr |
536 | 0 | ) |
537 | 0 | { |
538 | 0 | } Unexecuted instantiation: svx::ExtrusionDepthController::ExtrusionDepthController(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: svx::ExtrusionDepthController::ExtrusionDepthController(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
539 | | |
540 | | std::unique_ptr<WeldToolbarPopup> ExtrusionDepthController::weldPopupWindow() |
541 | 0 | { |
542 | 0 | return std::make_unique<ExtrusionDepthWindow>(this, m_pToolbar); |
543 | 0 | } |
544 | | |
545 | | VclPtr<vcl::Window> ExtrusionDepthController::createVclPopupWindow( vcl::Window* pParent ) |
546 | 0 | { |
547 | 0 | mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, |
548 | 0 | std::make_unique<ExtrusionDepthWindow>(this, pParent->GetFrameWeld())); |
549 | |
|
550 | 0 | mxInterimPopover->Show(); |
551 | |
|
552 | 0 | return mxInterimPopover; |
553 | 0 | } |
554 | | |
555 | | // XInitialization |
556 | | void SAL_CALL ExtrusionDepthController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) |
557 | 0 | { |
558 | 0 | svt::PopupWindowController::initialize( aArguments ); |
559 | |
|
560 | 0 | ToolBox* pToolBox = nullptr; |
561 | 0 | ToolBoxItemId nId; |
562 | 0 | if ( getToolboxId( nId, &pToolBox ) ) |
563 | 0 | pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); |
564 | 0 | } |
565 | | |
566 | | // XServiceInfo |
567 | | |
568 | | |
569 | | OUString ExtrusionDepthController::getImplementationName() |
570 | 0 | { |
571 | 0 | return u"com.sun.star.comp.svx.ExtrusionDepthController"_ustr; |
572 | 0 | } |
573 | | |
574 | | |
575 | | Sequence< OUString > ExtrusionDepthController::getSupportedServiceNames() |
576 | 0 | { |
577 | 0 | return { u"com.sun.star.frame.ToolbarController"_ustr }; |
578 | 0 | } |
579 | | |
580 | | |
581 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
582 | | com_sun_star_comp_svx_ExtrusionDepthController_get_implementation( |
583 | | css::uno::XComponentContext* xContext, |
584 | | css::uno::Sequence<css::uno::Any> const &) |
585 | 0 | { |
586 | 0 | return cppu::acquire(new ExtrusionDepthController(xContext)); |
587 | 0 | } |
588 | | |
589 | | |
590 | | constexpr OUString g_sExtrusionLightingDirection = u".uno:ExtrusionLightingDirection"_ustr; |
591 | | constexpr OUString g_sExtrusionLightingIntensity = u".uno:ExtrusionLightingIntensity"_ustr; |
592 | | |
593 | | ExtrusionLightingWindow::ExtrusionLightingWindow(svt::PopupWindowController* pControl, |
594 | | weld::Widget* pParent) |
595 | 0 | : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/lightingwindow.ui"_ustr, u"LightingWindow"_ustr) |
596 | 0 | , mxControl(pControl) |
597 | 0 | , mxLightingSet(new ValueSet(nullptr)) |
598 | 0 | , mxLightingSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxLightingSet)) |
599 | 0 | , mxBright(m_xBuilder->weld_radio_button(u"bright"_ustr)) |
600 | 0 | , mxNormal(m_xBuilder->weld_radio_button(u"normal"_ustr)) |
601 | 0 | , mxDim(m_xBuilder->weld_radio_button(u"dim"_ustr)) |
602 | 0 | { |
603 | 0 | mxLightingSet->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); |
604 | |
|
605 | 0 | for (sal_uInt16 i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; ++i) |
606 | 0 | { |
607 | 0 | if( i != FROM_FRONT ) |
608 | 0 | { |
609 | 0 | maImgLightingOff[i] = Image(StockImage::Yes, aLightOffBmps[i]); |
610 | 0 | maImgLightingOn[i] = Image(StockImage::Yes, aLightOnBmps[i]); |
611 | 0 | } |
612 | 0 | maImgLightingPreview[i] = Image(StockImage::Yes, aLightPreviewBmps[i]); |
613 | 0 | } |
614 | |
|
615 | 0 | mxLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); |
616 | |
|
617 | 0 | mxLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectValueSetHdl ) ); |
618 | 0 | mxLightingSet->SetColCount( 3 ); |
619 | 0 | mxLightingSet->EnableFullItemMode( false ); |
620 | |
|
621 | 0 | for (sal_uInt16 i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; ++i) |
622 | 0 | { |
623 | 0 | if( i != FROM_FRONT ) |
624 | 0 | { |
625 | 0 | mxLightingSet->InsertItem( i+1, maImgLightingOff[i] ); |
626 | 0 | } |
627 | 0 | else |
628 | 0 | { |
629 | 0 | mxLightingSet->InsertItem( 5, maImgLightingPreview[FROM_FRONT] ); |
630 | 0 | } |
631 | 0 | } |
632 | 0 | Size aSize(72, 72); |
633 | 0 | mxLightingSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); |
634 | 0 | mxLightingSet->SetOutputSizePixel(aSize); |
635 | |
|
636 | 0 | mxBright->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl)); |
637 | 0 | mxNormal->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl)); |
638 | 0 | mxDim->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl)); |
639 | |
|
640 | 0 | AddStatusListener( g_sExtrusionLightingDirection ); |
641 | 0 | AddStatusListener( g_sExtrusionLightingIntensity ); |
642 | 0 | } |
643 | | |
644 | | void ExtrusionLightingWindow::GrabFocus() |
645 | 0 | { |
646 | 0 | mxLightingSet->GrabFocus(); |
647 | 0 | } |
648 | | |
649 | | ExtrusionLightingWindow::~ExtrusionLightingWindow() |
650 | 0 | { |
651 | 0 | } |
652 | | |
653 | | void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) |
654 | 0 | { |
655 | 0 | mxBright->set_sensitive(bEnabled); |
656 | 0 | mxBright->set_active(nLevel == 0 && bEnabled); |
657 | 0 | mxNormal->set_sensitive(bEnabled); |
658 | 0 | mxNormal->set_active(nLevel == 1 && bEnabled); |
659 | 0 | mxDim->set_sensitive(bEnabled); |
660 | 0 | mxDim->set_active(nLevel == 2 && bEnabled); |
661 | 0 | } |
662 | | |
663 | | void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) |
664 | 0 | { |
665 | 0 | if( !bEnabled ) |
666 | 0 | nDirection = FROM_FRONT; |
667 | |
|
668 | 0 | sal_uInt16 nItemId; |
669 | 0 | for( nItemId = FROM_TOP_LEFT; nItemId <= FROM_BOTTOM_RIGHT; nItemId++ ) |
670 | 0 | { |
671 | 0 | if( nItemId == FROM_FRONT ) |
672 | 0 | { |
673 | 0 | mxLightingSet->SetItemImage( nItemId + 1, maImgLightingPreview[ nDirection ] ); |
674 | 0 | } |
675 | 0 | else |
676 | 0 | { |
677 | 0 | mxLightingSet->SetItemImage( |
678 | 0 | nItemId + 1, |
679 | 0 | static_cast<sal_uInt16>(nDirection) == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] |
680 | 0 | ); |
681 | 0 | } |
682 | 0 | } |
683 | |
|
684 | 0 | if (bEnabled) |
685 | 0 | mxLightingSet->Enable(); |
686 | 0 | else |
687 | 0 | mxLightingSet->Disable(); |
688 | 0 | } |
689 | | |
690 | | void ExtrusionLightingWindow::statusChanged( |
691 | | const css::frame::FeatureStateEvent& Event |
692 | | ) |
693 | 0 | { |
694 | 0 | if( Event.FeatureURL.Main == g_sExtrusionLightingIntensity ) |
695 | 0 | { |
696 | 0 | if( !Event.IsEnabled ) |
697 | 0 | { |
698 | 0 | implSetIntensity( 0, false ); |
699 | 0 | } |
700 | 0 | else |
701 | 0 | { |
702 | 0 | sal_Int32 nValue = 0; |
703 | 0 | if( Event.State >>= nValue ) |
704 | 0 | implSetIntensity( nValue, true ); |
705 | 0 | } |
706 | 0 | } |
707 | 0 | else if( Event.FeatureURL.Main == g_sExtrusionLightingDirection ) |
708 | 0 | { |
709 | 0 | if( !Event.IsEnabled ) |
710 | 0 | { |
711 | 0 | implSetDirection( 0, false ); |
712 | 0 | } |
713 | 0 | else |
714 | 0 | { |
715 | 0 | sal_Int32 nValue = 0; |
716 | 0 | if( Event.State >>= nValue ) |
717 | 0 | implSetDirection( nValue, true ); |
718 | 0 | } |
719 | 0 | } |
720 | 0 | } |
721 | | |
722 | | IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectValueSetHdl, ValueSet*, void) |
723 | 0 | { |
724 | 0 | sal_Int32 nDirection = mxLightingSet->GetSelectedItemId(); |
725 | |
|
726 | 0 | if( (nDirection > 0) && (nDirection < 10) ) |
727 | 0 | { |
728 | 0 | nDirection--; |
729 | |
|
730 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
731 | 0 | g_sExtrusionLightingDirection.copy(5), nDirection) }; |
732 | |
|
733 | 0 | mxControl->dispatchCommand( g_sExtrusionLightingDirection, aArgs ); |
734 | |
|
735 | 0 | implSetDirection( nDirection, true ); |
736 | 0 | } |
737 | |
|
738 | 0 | mxControl->EndPopupMode(); |
739 | 0 | } |
740 | | |
741 | | IMPL_LINK(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::Toggleable&, rButton, void) |
742 | 0 | { |
743 | 0 | if (!rButton.get_active()) |
744 | 0 | return; |
745 | | |
746 | 0 | int nLevel; |
747 | 0 | if (mxBright->get_active()) |
748 | 0 | nLevel = 0; |
749 | 0 | else if (mxNormal->get_active()) |
750 | 0 | nLevel = 1; |
751 | 0 | else |
752 | 0 | nLevel = 2; |
753 | |
|
754 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
755 | 0 | g_sExtrusionLightingIntensity.copy(5), static_cast<sal_Int32>(nLevel)) }; |
756 | |
|
757 | 0 | mxControl->dispatchCommand( g_sExtrusionLightingIntensity, aArgs ); |
758 | |
|
759 | 0 | implSetIntensity( nLevel, true ); |
760 | |
|
761 | 0 | mxControl->EndPopupMode(); |
762 | 0 | } |
763 | | |
764 | | ExtrusionLightingControl::ExtrusionLightingControl( |
765 | | const Reference< XComponentContext >& rxContext |
766 | 0 | ) : svt::PopupWindowController( rxContext, |
767 | 0 | Reference< css::frame::XFrame >(), |
768 | 0 | u".uno:ExtrusionDirectionFloater"_ustr |
769 | 0 | ) |
770 | 0 | { |
771 | 0 | } Unexecuted instantiation: svx::ExtrusionLightingControl::ExtrusionLightingControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: svx::ExtrusionLightingControl::ExtrusionLightingControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
772 | | |
773 | | std::unique_ptr<WeldToolbarPopup> ExtrusionLightingControl::weldPopupWindow() |
774 | 0 | { |
775 | 0 | return std::make_unique<ExtrusionLightingWindow>(this, m_pToolbar); |
776 | 0 | } |
777 | | |
778 | | VclPtr<vcl::Window> ExtrusionLightingControl::createVclPopupWindow( vcl::Window* pParent ) |
779 | 0 | { |
780 | 0 | mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, |
781 | 0 | std::make_unique<ExtrusionLightingWindow>(this, pParent->GetFrameWeld())); |
782 | |
|
783 | 0 | mxInterimPopover->Show(); |
784 | |
|
785 | 0 | return mxInterimPopover; |
786 | 0 | } |
787 | | |
788 | | // XInitialization |
789 | | void SAL_CALL ExtrusionLightingControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) |
790 | 0 | { |
791 | 0 | svt::PopupWindowController::initialize( aArguments ); |
792 | |
|
793 | 0 | ToolBox* pToolBox = nullptr; |
794 | 0 | ToolBoxItemId nId; |
795 | 0 | if ( getToolboxId( nId, &pToolBox ) ) |
796 | 0 | pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); |
797 | 0 | } |
798 | | |
799 | | // XServiceInfo |
800 | | |
801 | | |
802 | | OUString ExtrusionLightingControl::getImplementationName() |
803 | 0 | { |
804 | 0 | return u"com.sun.star.comp.svx.ExtrusionLightingController"_ustr; |
805 | 0 | } |
806 | | |
807 | | |
808 | | Sequence< OUString > ExtrusionLightingControl::getSupportedServiceNames() |
809 | 0 | { |
810 | 0 | return { u"com.sun.star.frame.ToolbarController"_ustr }; |
811 | 0 | } |
812 | | |
813 | | |
814 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
815 | | com_sun_star_comp_svx_ExtrusionLightingControl_get_implementation( |
816 | | css::uno::XComponentContext* xContext, |
817 | | css::uno::Sequence<css::uno::Any> const &) |
818 | 0 | { |
819 | 0 | return cppu::acquire(new ExtrusionLightingControl(xContext)); |
820 | 0 | } |
821 | | |
822 | | |
823 | | constexpr OUString g_sExtrusionSurface = u".uno:ExtrusionSurface"_ustr; |
824 | | |
825 | | ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) |
826 | 0 | : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/surfacewindow.ui"_ustr, u"SurfaceWindow"_ustr) |
827 | 0 | , mxControl(pControl) |
828 | 0 | , mxWireFrame(m_xBuilder->weld_radio_button(u"wireframe"_ustr)) |
829 | 0 | , mxMatt(m_xBuilder->weld_radio_button(u"matt"_ustr)) |
830 | 0 | , mxPlastic(m_xBuilder->weld_radio_button(u"plastic"_ustr)) |
831 | 0 | , mxMetal(m_xBuilder->weld_radio_button(u"metal"_ustr)) |
832 | 0 | , mxMetalMSO(m_xBuilder->weld_radio_button(u"metalMSO"_ustr)) |
833 | 0 | { |
834 | 0 | mxWireFrame->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl)); |
835 | 0 | mxMatt->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl)); |
836 | 0 | mxPlastic->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl)); |
837 | 0 | mxMetal->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl)); |
838 | 0 | mxMetalMSO->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl)); |
839 | |
|
840 | 0 | AddStatusListener( g_sExtrusionSurface ); |
841 | 0 | } |
842 | | |
843 | | void ExtrusionSurfaceWindow::GrabFocus() |
844 | 0 | { |
845 | 0 | mxWireFrame->grab_focus(); |
846 | 0 | } |
847 | | |
848 | | void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) |
849 | 0 | { |
850 | 0 | mxWireFrame->set_active(nSurface == 0 && bEnabled); |
851 | 0 | mxWireFrame->set_sensitive(bEnabled); |
852 | 0 | mxMatt->set_active(nSurface == 1 && bEnabled); |
853 | 0 | mxMatt->set_sensitive(bEnabled); |
854 | 0 | mxPlastic->set_active(nSurface == 2 && bEnabled); |
855 | 0 | mxPlastic->set_sensitive(bEnabled); |
856 | 0 | mxMetal->set_active(nSurface == 3 && bEnabled); |
857 | 0 | mxMetal->set_sensitive(bEnabled); |
858 | 0 | mxMetalMSO->set_active(nSurface == 4 && bEnabled); |
859 | 0 | mxMetalMSO->set_sensitive(bEnabled); |
860 | 0 | } |
861 | | |
862 | | void ExtrusionSurfaceWindow::statusChanged( |
863 | | const css::frame::FeatureStateEvent& Event |
864 | | ) |
865 | 0 | { |
866 | 0 | if( Event.FeatureURL.Main != g_sExtrusionSurface ) |
867 | 0 | return; |
868 | | |
869 | 0 | if( !Event.IsEnabled ) |
870 | 0 | { |
871 | 0 | implSetSurface( 0, false ); |
872 | 0 | } |
873 | 0 | else |
874 | 0 | { |
875 | 0 | sal_Int32 nValue = 0; |
876 | 0 | if( Event.State >>= nValue ) |
877 | 0 | implSetSurface( nValue, true ); |
878 | 0 | } |
879 | 0 | } |
880 | | |
881 | | IMPL_LINK(ExtrusionSurfaceWindow, SelectHdl, weld::Toggleable&, rButton, void) |
882 | 0 | { |
883 | 0 | if (!rButton.get_active()) |
884 | 0 | return; |
885 | | |
886 | 0 | sal_Int32 nSurface; |
887 | 0 | if (mxWireFrame->get_active()) |
888 | 0 | nSurface = 0; |
889 | 0 | else if (mxMatt->get_active()) |
890 | 0 | nSurface = 1; |
891 | 0 | else if (mxPlastic->get_active()) |
892 | 0 | nSurface = 2; |
893 | 0 | else if (mxMetal->get_active()) |
894 | 0 | nSurface = 3; |
895 | 0 | else |
896 | 0 | nSurface = 4; |
897 | |
|
898 | 0 | Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( |
899 | 0 | g_sExtrusionSurface.copy(5), nSurface) }; |
900 | |
|
901 | 0 | mxControl->dispatchCommand( g_sExtrusionSurface, aArgs ); |
902 | |
|
903 | 0 | implSetSurface( nSurface, true ); |
904 | |
|
905 | 0 | mxControl->EndPopupMode(); |
906 | 0 | } |
907 | | |
908 | | ExtrusionSurfaceControl::ExtrusionSurfaceControl( |
909 | | const Reference< XComponentContext >& rxContext |
910 | | ) |
911 | 0 | : svt::PopupWindowController( |
912 | 0 | rxContext, |
913 | 0 | Reference< css::frame::XFrame >(), |
914 | 0 | u".uno:ExtrusionSurfaceFloater"_ustr |
915 | 0 | ) |
916 | 0 | { |
917 | 0 | } Unexecuted instantiation: svx::ExtrusionSurfaceControl::ExtrusionSurfaceControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) Unexecuted instantiation: svx::ExtrusionSurfaceControl::ExtrusionSurfaceControl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) |
918 | | |
919 | | std::unique_ptr<WeldToolbarPopup> ExtrusionSurfaceControl::weldPopupWindow() |
920 | 0 | { |
921 | 0 | return std::make_unique<ExtrusionSurfaceWindow>(this, m_pToolbar); |
922 | 0 | } |
923 | | |
924 | | VclPtr<vcl::Window> ExtrusionSurfaceControl::createVclPopupWindow( vcl::Window* pParent ) |
925 | 0 | { |
926 | 0 | mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent, |
927 | 0 | std::make_unique<ExtrusionSurfaceWindow>(this, pParent->GetFrameWeld())); |
928 | |
|
929 | 0 | mxInterimPopover->Show(); |
930 | |
|
931 | 0 | return mxInterimPopover; |
932 | 0 | } |
933 | | |
934 | | // XInitialization |
935 | | void SAL_CALL ExtrusionSurfaceControl::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) |
936 | 0 | { |
937 | 0 | svt::PopupWindowController::initialize( aArguments ); |
938 | |
|
939 | 0 | ToolBox* pToolBox = nullptr; |
940 | 0 | ToolBoxItemId nId; |
941 | 0 | if ( getToolboxId( nId, &pToolBox ) ) |
942 | 0 | pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY ); |
943 | 0 | } |
944 | | |
945 | | // XServiceInfo |
946 | | |
947 | | |
948 | | OUString ExtrusionSurfaceControl::getImplementationName() |
949 | 0 | { |
950 | 0 | return u"com.sun.star.comp.svx.ExtrusionSurfaceController"_ustr; |
951 | 0 | } |
952 | | |
953 | | |
954 | | Sequence< OUString > ExtrusionSurfaceControl::getSupportedServiceNames() |
955 | 0 | { |
956 | 0 | return { u"com.sun.star.frame.ToolbarController"_ustr }; |
957 | 0 | } |
958 | | |
959 | | |
960 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
961 | | com_sun_star_comp_svx_ExtrusionSurfaceControl_get_implementation( |
962 | | css::uno::XComponentContext* xContext, |
963 | | css::uno::Sequence<css::uno::Any> const &) |
964 | 0 | { |
965 | 0 | return cppu::acquire(new ExtrusionSurfaceControl(xContext)); |
966 | 0 | } |
967 | | |
968 | | } |
969 | | |
970 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |