LibreOffice Module sd (master) 1
tpoption.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 <com/sun/star/document/PrinterIndependentLayout.hpp>
21#include <com/sun/star/frame/Desktop.hpp>
22#include <com/sun/star/container/XEnumerationAccess.hpp>
24#include <comphelper/string.hxx>
25#include <com/sun/star/uno/Exception.hpp>
26#include <sfx2/module.hxx>
27#include <svx/svxids.hrc>
28#include <svx/strarray.hxx>
29#include <vcl/svapp.hxx>
30#include <vcl/weld.hxx>
31#include <svtools/unitconv.hxx>
32
33#include <sdattr.hrc>
34#include <sdresid.hxx>
35#include <optsitem.hxx>
36#include <tpoption.hxx>
37#include <strings.hrc>
38#include <app.hrc>
39#include <svl/intitem.hxx>
40#include <o3tl/string_view.hxx>
41
42using namespace ::com::sun::star;
43using namespace ::com::sun::star::uno;
44
46 : SvxGridTabPage(pPage, pController, rInAttrs)
47{
48 m_xSnapFrames->show();
49}
50
52{
53}
54
56{
58 SdOptionsSnapItem aOptsItem;
59
60 aOptsItem.GetOptionsSnap().SetSnapHelplines( m_xCbxSnapHelplines->get_active() );
61 aOptsItem.GetOptionsSnap().SetSnapBorder( m_xCbxSnapBorder->get_active() );
62 aOptsItem.GetOptionsSnap().SetSnapFrame( m_xCbxSnapFrame->get_active() );
63 aOptsItem.GetOptionsSnap().SetSnapPoints( m_xCbxSnapPoints->get_active() );
64 aOptsItem.GetOptionsSnap().SetOrtho( m_xCbxOrtho->get_active() );
65 aOptsItem.GetOptionsSnap().SetBigOrtho( m_xCbxBigOrtho->get_active() );
66 aOptsItem.GetOptionsSnap().SetRotate( m_xCbxRotate->get_active() );
67 aOptsItem.GetOptionsSnap().SetSnapArea(static_cast<sal_Int16>(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL)));
68 aOptsItem.GetOptionsSnap().SetAngle(Degree100(m_xMtrFldAngle->get_value(FieldUnit::DEGREE)));
69 aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE)));
70
71 rAttrs->Put( aOptsItem );
72
73 // we get a possible existing GridItem, this ensures that we do not set
74 // some default values by accident
75 return true;
76}
77
79{
81
82 SdOptionsSnapItem aOptsItem( rAttrs->Get( ATTR_OPTIONS_SNAP ) );
83
84 m_xCbxSnapHelplines->set_active( aOptsItem.GetOptionsSnap().IsSnapHelplines() );
85 m_xCbxSnapBorder->set_active( aOptsItem.GetOptionsSnap().IsSnapBorder() );
86 m_xCbxSnapFrame->set_active( aOptsItem.GetOptionsSnap().IsSnapFrame() );
87 m_xCbxSnapPoints->set_active( aOptsItem.GetOptionsSnap().IsSnapPoints() );
88 m_xCbxOrtho->set_active( aOptsItem.GetOptionsSnap().IsOrtho() );
89 m_xCbxBigOrtho->set_active( aOptsItem.GetOptionsSnap().IsBigOrtho() );
90 m_xCbxRotate->set_active( aOptsItem.GetOptionsSnap().IsRotate() );
91 m_xMtrFldSnapArea->set_value(aOptsItem.GetOptionsSnap().GetSnapArea(), FieldUnit::PIXEL);
92 m_xMtrFldAngle->set_value(aOptsItem.GetOptionsSnap().GetAngle().get(), FieldUnit::DEGREE);
93 m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get(), FieldUnit::DEGREE);
94
95 ClickRotateHdl_Impl(*m_xCbxRotate);
96}
97
98std::unique_ptr<SfxTabPage> SdTpOptionsSnap::Create( weld::Container* pPage, weld::DialogController* pController,
99 const SfxItemSet* rAttrs )
100{
101 return std::make_unique<SdTpOptionsSnap>(pPage, pController, *rAttrs);
102}
103
104/*************************************************************************
105|*
106|* TabPage to adjust the content options
107|*
108\************************************************************************/
110 : SfxTabPage(pPage, pController, "modules/simpress/ui/sdviewpage.ui", "SdViewPage", &rInAttrs)
111 , m_xCbxRuler(m_xBuilder->weld_check_button("ruler"))
112 , m_xCbxDragStripes(m_xBuilder->weld_check_button("dragstripes"))
113 , m_xCbxHandlesBezier(m_xBuilder->weld_check_button("handlesbezier"))
114 , m_xCbxMoveOutline(m_xBuilder->weld_check_button("moveoutline"))
115{
116}
117
119{
120}
121
123{
124 bool bModified = false;
125
126 if( m_xCbxRuler->get_state_changed_from_saved() ||
127 m_xCbxMoveOutline->get_state_changed_from_saved() ||
128 m_xCbxDragStripes->get_state_changed_from_saved() ||
129 m_xCbxHandlesBezier->get_state_changed_from_saved() )
130 {
131 SdOptionsLayoutItem aOptsItem;
132
133 aOptsItem.GetOptionsLayout().SetRulerVisible( m_xCbxRuler->get_active() );
134 aOptsItem.GetOptionsLayout().SetMoveOutline( m_xCbxMoveOutline->get_active() );
135 aOptsItem.GetOptionsLayout().SetDragStripes( m_xCbxDragStripes->get_active() );
136 aOptsItem.GetOptionsLayout().SetHandlesBezier( m_xCbxHandlesBezier->get_active() );
137
138 rAttrs->Put( aOptsItem );
139 bModified = true;
140 }
141 return bModified;
142}
143
145{
146 SdOptionsLayoutItem aLayoutItem( rAttrs->Get( ATTR_OPTIONS_LAYOUT ) );
147
148 m_xCbxRuler->set_active( aLayoutItem.GetOptionsLayout().IsRulerVisible() );
149 m_xCbxMoveOutline->set_active( aLayoutItem.GetOptionsLayout().IsMoveOutline() );
150 m_xCbxDragStripes->set_active( aLayoutItem.GetOptionsLayout().IsDragStripes() );
151 m_xCbxHandlesBezier->set_active( aLayoutItem.GetOptionsLayout().IsHandlesBezier() );
152
153 m_xCbxRuler->save_state();
154 m_xCbxMoveOutline->save_state();
155 m_xCbxDragStripes->save_state();
156 m_xCbxHandlesBezier->save_state();
157}
158
159std::unique_ptr<SfxTabPage> SdTpOptionsContents::Create( weld::Container* pPage, weld::DialogController* pController,
160 const SfxItemSet* rAttrs )
161{
162 return std::make_unique<SdTpOptionsContents>(pPage, pController, *rAttrs);
163}
164
165/*************************************************************************
166|*
167|* TabPage to adjust the misc options
168|*
169\************************************************************************/
170#define TABLE_COUNT 12
171#define TOKEN ':'
172
174 : SfxTabPage(pPage, pController, "modules/simpress/ui/optimpressgeneralpage.ui", "OptSavePage", &rInAttrs)
175 , nWidth(0)
176 , nHeight(0)
177 , m_xCbxQuickEdit(m_xBuilder->weld_check_button("qickedit"))
178 , m_xCbxPickThrough(m_xBuilder->weld_check_button("textselected"))
179 , m_xNewDocumentFrame(m_xBuilder->weld_frame("newdocumentframe"))
180 , m_xCbxStartWithTemplate(m_xBuilder->weld_check_button("startwithwizard"))
181 , m_xCbxMasterPageCache(m_xBuilder->weld_check_button("backgroundback"))
182 , m_xCbxCopy(m_xBuilder->weld_check_button("copywhenmove"))
183 , m_xCbxMarkedHitMovesAlways(m_xBuilder->weld_check_button("objalwymov"))
184 , m_xPresentationFrame(m_xBuilder->weld_frame("presentationframe"))
185 , m_xLbMetric(m_xBuilder->weld_combo_box("units"))
186 , m_xMtrFldTabstop(m_xBuilder->weld_metric_spin_button("metricFields", FieldUnit::MM))
187 , m_xCbxEnableSdremote(m_xBuilder->weld_check_button("enremotcont"))
188 , m_xCbxEnablePresenterScreen(m_xBuilder->weld_check_button("enprsntcons"))
189 , m_xCbxPresenterScreenFullScreen(m_xBuilder->weld_check_button("enprsntconsfullscreen"))
190 , m_xCbxCompatibility(m_xBuilder->weld_check_button("cbCompatibility"))
191 , m_xScaleFrame(m_xBuilder->weld_frame("scaleframe"))
192 , m_xCbScale(m_xBuilder->weld_combo_box("scaleBox"))
193 , m_xNewDocLb(m_xBuilder->weld_label("newdoclbl"))
194 , m_xFiInfo1(m_xBuilder->weld_label("info1"))
195 , m_xMtrFldOriginalWidth(m_xBuilder->weld_metric_spin_button("metricWidthFields", FieldUnit::MM))
196 , m_xWidthLb(m_xBuilder->weld_label("widthlbl"))
197 , m_xHeightLb(m_xBuilder->weld_label("heightlbl"))
198 , m_xFiInfo2(m_xBuilder->weld_label("info2"))
199 , m_xMtrFldOriginalHeight(m_xBuilder->weld_metric_spin_button("metricHeightFields", FieldUnit::MM))
200 , m_xCbxDistort(m_xBuilder->weld_check_button("distortcb"))
201 , m_xMtrFldInfo1(m_xBuilder->weld_metric_spin_button("metricInfo1Fields", FieldUnit::MM))
202 , m_xMtrFldInfo2(m_xBuilder->weld_metric_spin_button("metricInfo2Fields", FieldUnit::MM))
203{
205
206 // set metric
207 FieldUnit eFUnit;
208
209 sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
210 if ( rInAttrs.GetItemState( nWhich ) >= SfxItemState::DEFAULT )
211 {
212 const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rInAttrs.Get( nWhich ));
213 eFUnit = static_cast<FieldUnit>(rItem.GetValue());
214 }
215 else
217
218 SetFieldUnit( *m_xMtrFldTabstop , eFUnit );
219 // tdf#148292 - avoid right frame to change position depending on width of this control
220 m_xMtrFldTabstop->set_size_request(150, -1);
221 // Impress is default mode, let' hide the entire scale frame etc.
222 m_xCbxDistort->hide();
223 m_xScaleFrame->hide();
224
225 // fill ListBox with metrics
226 for (sal_uInt32 i = 0; i < SvxFieldUnitTable::Count(); ++i)
227 {
228 OUString sMetric = SvxFieldUnitTable::GetString(i);
229 sal_uInt32 nFieldUnit = sal_uInt32(SvxFieldUnitTable::GetValue(i));
230 m_xLbMetric->append(OUString::number(nFieldUnit), sMetric);
231 }
232 m_xLbMetric->connect_changed( LINK( this, SdTpOptionsMisc, SelectMetricHdl_Impl ) );
233
236 m_xMtrFldOriginalWidth->set_max(999999999, FieldUnit::NONE);
237 m_xMtrFldOriginalHeight->set_max(999999999, FieldUnit::NONE);
238
239 // temporary fields for info texts (for formatting/calculation)
240 m_xMtrFldInfo1->set_unit( eFUnit );
241 m_xMtrFldInfo1->set_max(999999999, FieldUnit::NONE);
242 m_xMtrFldInfo1->set_digits( 2 );
243 m_xMtrFldInfo2->set_unit( eFUnit );
244 m_xMtrFldInfo2->set_max(999999999, FieldUnit::NONE);
245 m_xMtrFldInfo2->set_digits( 2 );
246
247 // determine PoolUnit
248 SfxItemPool* pPool = rInAttrs.GetPool();
249 DBG_ASSERT( pPool, "Where is the Pool?" );
250 ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
251
252 // Fill the CB
253 sal_uInt16 aTable[ TABLE_COUNT ] =
254 { 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 };
255
256 for( sal_uInt16 i = TABLE_COUNT-1; i > 0 ; i-- )
257 m_xCbScale->append_text( GetScale( 1, aTable[i] ) );
258 for( sal_uInt16 i = 0; i < TABLE_COUNT; i++ )
259 m_xCbScale->append_text( GetScale( aTable[i], 1 ) );
260}
261
263{
264}
265
267{
268 // We have to call save_state again since it can happen that the value
269 // has no effect on other TabPages
270 m_xLbMetric->save_value();
271 // change metric if necessary (since TabPage is in the Dialog where
272 // the metric is set)
273 const SfxUInt16Item* pAttr = rSet.GetItemIfSet( SID_ATTR_METRIC , false );
274 if( !pAttr )
275 return;
276
277 FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<tools::Long>(pAttr->GetValue()));
278
279 if( eFUnit == m_xMtrFldOriginalWidth->get_unit() )
280 return;
281
282 // set metrics
283 sal_Int64 nVal = m_xMtrFldOriginalWidth->denormalize( m_xMtrFldOriginalWidth->get_value( FieldUnit::TWIP ) );
284 SetFieldUnit( *m_xMtrFldOriginalWidth, eFUnit, true );
285 m_xMtrFldOriginalWidth->set_value( m_xMtrFldOriginalWidth->normalize( nVal ), FieldUnit::TWIP );
286
287 nVal = m_xMtrFldOriginalHeight->denormalize( m_xMtrFldOriginalHeight->get_value( FieldUnit::TWIP ) );
288 SetFieldUnit( *m_xMtrFldOriginalHeight, eFUnit, true );
289 m_xMtrFldOriginalHeight->set_value( m_xMtrFldOriginalHeight->normalize( nVal ), FieldUnit::TWIP );
290
291 if( nWidth == 0 || nHeight == 0 )
292 return;
293
294 m_xMtrFldInfo1->set_unit( eFUnit );
295 m_xMtrFldInfo2->set_unit( eFUnit );
296
298 aInfo1 = m_xMtrFldInfo1->get_text();
299 m_xFiInfo1->set_label( aInfo1 );
300
302 aInfo2 = m_xMtrFldInfo2->get_text();
303 m_xFiInfo2->set_label( aInfo2 );
304}
305
307{
308 // check parser
309 sal_Int32 nX, nY;
310 if( SetScale( m_xCbScale->get_active_text(), nX, nY ) )
311 {
312 if( pActiveSet )
313 FillItemSet( pActiveSet );
314 return DeactivateRC::LeavePage;
315 }
316
317 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
318 VclMessageType::Warning, VclButtonsType::YesNo,
319 SdResId(STR_WARN_SCALE_FAIL)));
320 if (xWarn->run() == RET_YES)
321 return DeactivateRC::KeepPage;
322
323 if( pActiveSet )
324 FillItemSet( pActiveSet );
325
326 return DeactivateRC::LeavePage;
327}
328
330{
331 bool bModified = false;
332
333 if( m_xCbxStartWithTemplate->get_state_changed_from_saved() ||
334 m_xCbxMarkedHitMovesAlways->get_state_changed_from_saved() ||
335 m_xCbxQuickEdit->get_state_changed_from_saved() ||
336 m_xCbxPickThrough->get_state_changed_from_saved() ||
337 m_xCbxMasterPageCache->get_state_changed_from_saved() ||
338 m_xCbxCopy->get_state_changed_from_saved() ||
339 m_xCbxEnableSdremote->get_state_changed_from_saved() ||
340 m_xCbxEnablePresenterScreen->get_state_changed_from_saved() ||
341 m_xCbxPresenterScreenFullScreen->get_state_changed_from_saved() ||
342 m_xCbxCompatibility->get_state_changed_from_saved() ||
343 m_xCbxDistort->get_state_changed_from_saved())
344 {
345 SdOptionsMiscItem aOptsItem;
346
349 aOptsItem.GetOptionsMisc().SetQuickEdit( m_xCbxQuickEdit->get_active() );
350 aOptsItem.GetOptionsMisc().SetPickThrough( m_xCbxPickThrough->get_active() );
352 aOptsItem.GetOptionsMisc().SetDragWithCopy( m_xCbxCopy->get_active() );
353 aOptsItem.GetOptionsMisc().SetEnableSdremote( m_xCbxEnableSdremote->get_active() );
357 aOptsItem.GetOptionsMisc().SetCrookNoContortion( m_xCbxDistort->get_active() );
358 rAttrs->Put( aOptsItem );
359
360 bModified = true;
361 }
362
363 // metric
364 if (m_xLbMetric->get_value_changed_from_saved())
365 {
366 const sal_Int32 nMPos = m_xLbMetric->get_active();
367 sal_uInt16 nFieldUnit = m_xLbMetric->get_id(nMPos).toUInt32();
368 rAttrs->Put( SfxUInt16Item( GetWhich( SID_ATTR_METRIC ), nFieldUnit ) );
369 bModified = true;
370 }
371
372 // tabulator space
373 if( m_xMtrFldTabstop->get_value_changed_from_saved() )
374 {
375 MapUnit eUnit = rAttrs->GetPool()->GetMetric( SID_ATTR_DEFTABSTOP );
376 SfxUInt16Item aDef( SID_ATTR_DEFTABSTOP, static_cast<sal_uInt16>(GetCoreValue( *m_xMtrFldTabstop, eUnit )) );
377 rAttrs->Put( aDef );
378 bModified = true;
379 }
380
381 sal_Int32 nX, nY;
382 if( SetScale( m_xCbScale->get_active_text(), nX, nY ) )
383 {
384 rAttrs->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) );
385 rAttrs->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) );
386
387 bModified = true;
388 }
389
390 return bModified;
391}
392
394{
395 SdOptionsMiscItem aOptsItem( rAttrs->Get( ATTR_OPTIONS_MISC ) );
396
399 m_xCbxQuickEdit->set_active( aOptsItem.GetOptionsMisc().IsQuickEdit() );
400 m_xCbxPickThrough->set_active( aOptsItem.GetOptionsMisc().IsPickThrough() );
402 m_xCbxCopy->set_active( aOptsItem.GetOptionsMisc().IsDragWithCopy() );
403 m_xCbxEnableSdremote->set_active( aOptsItem.GetOptionsMisc().IsEnableSdremote() );
407 m_xCbxDistort->set_active( aOptsItem.GetOptionsMisc().IsCrookNoContortion() );
408 m_xCbxStartWithTemplate->save_state();
409 m_xCbxMarkedHitMovesAlways->save_state();
410 m_xCbxQuickEdit->save_state();
411 m_xCbxPickThrough->save_state();
412
413 m_xCbxMasterPageCache->save_state();
414 m_xCbxCopy->save_state();
415 m_xCbxEnableSdremote->save_state();
416 m_xCbxEnablePresenterScreen->save_state();
418 m_xCbxCompatibility->save_state();
419 m_xCbxDistort->save_state();
420
421 // metric
422 sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
423 m_xLbMetric->set_active(-1);
424
425 if ( rAttrs->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
426 {
427 const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rAttrs->Get( nWhich ));
428 sal_uInt32 nFieldUnit = static_cast<sal_uInt32>(rItem.GetValue());
429
430 for (sal_Int32 i = 0, nEntryCount = m_xLbMetric->get_count(); i < nEntryCount; ++i)
431 {
432 if (m_xLbMetric->get_id(i).toUInt32() == nFieldUnit)
433 {
434 m_xLbMetric->set_active( i );
435 break;
436 }
437 }
438 }
439
440 // tabulator space
441 constexpr auto nWhich2 = SID_ATTR_DEFTABSTOP;
442 if( rAttrs->GetItemState( nWhich2 ) >= SfxItemState::DEFAULT )
443 {
444 MapUnit eUnit = rAttrs->GetPool()->GetMetric( nWhich2 );
445 const SfxUInt16Item& rItem = rAttrs->Get( nWhich2 );
446 SetMetricValue( *m_xMtrFldTabstop, rItem.GetValue(), eUnit );
447 }
448 m_xLbMetric->save_value();
449 m_xMtrFldTabstop->save_value();
450 //Scale
451 sal_Int32 nX = rAttrs->Get( ATTR_OPTIONS_SCALE_X ).GetValue();
452 sal_Int32 nY = rAttrs->Get( ATTR_OPTIONS_SCALE_Y ).GetValue();
453 nWidth = rAttrs->Get( ATTR_OPTIONS_SCALE_WIDTH ).GetValue();
454 nHeight = rAttrs->Get( ATTR_OPTIONS_SCALE_HEIGHT ).GetValue();
455
456 m_xCbScale->set_entry_text( GetScale( nX, nY ) );
457
459 m_xMtrFldOriginalWidth->set_text( aInfo1 ); // empty
461 m_xMtrFldOriginalHeight->set_text( aInfo2 ); //empty
462 m_xFiInfo1->hide();
463 m_xFiInfo2->hide();
464
466}
467
468std::unique_ptr<SfxTabPage> SdTpOptionsMisc::Create( weld::Container* pPage, weld::DialogController* pController,
469 const SfxItemSet* rAttrs )
470{
471 return std::make_unique<SdTpOptionsMisc>( pPage, pController, *rAttrs );
472}
473
474IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl, weld::ComboBox&, void)
475{
476 int nPos = m_xLbMetric->get_active();
477 if (nPos != -1)
478 {
479 FieldUnit eUnit = static_cast<FieldUnit>(m_xLbMetric->get_id(nPos).toUInt32());
480 sal_Int64 nVal =
481 m_xMtrFldTabstop->denormalize(m_xMtrFldTabstop->get_value(FieldUnit::TWIP));
482 SetFieldUnit( *m_xMtrFldTabstop, eUnit );
483 m_xMtrFldTabstop->set_value( m_xMtrFldTabstop->normalize( nVal ), FieldUnit::TWIP );
484 }
485}
486
488{
489#ifndef ENABLE_SDREMOTE
490 m_xCbxEnableSdremote->hide();
491#else
492 (void) this; // loplugin:staticmethods
493#endif
494}
495
497{
498 m_xScaleFrame->show();
499 m_xNewDocumentFrame->hide();
500 m_xCbxEnableSdremote->hide();
503 m_xCbxCompatibility->hide();
504 m_xNewDocLb->hide();
505 m_xCbScale->show();
506 m_xPresentationFrame->hide();
507 m_xMtrFldInfo1->hide();
508 m_xMtrFldInfo2->hide();
509 m_xWidthLb->hide();
510 m_xHeightLb->hide();
511 m_xFiInfo1->show();
513 m_xFiInfo2->show();
515 m_xCbxDistort->show();
516 m_xCbxCompatibility->hide();
517}
518
519OUString SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY )
520{
521 return OUString::number(nX) + OUStringChar(TOKEN) + OUString::number(nY);
522}
523
524bool SdTpOptionsMisc::SetScale( std::u16string_view aScale, sal_Int32& rX, sal_Int32& rY )
525{
526 if (aScale.empty())
527 return false;
528
529 sal_Int32 nIdx {0};
530
531 std::u16string_view aTmp(o3tl::getToken(aScale, 0, TOKEN, nIdx));
532 if (nIdx<0)
533 return false; // we expect another token!
534
536 return false;
537
538 rX = static_cast<tools::Long>(o3tl::toInt32(aTmp));
539 if( rX == 0 )
540 return false;
541
542 aTmp = o3tl::getToken(aScale, 0, TOKEN, nIdx);
543 if (nIdx>=0)
544 return false; // we require just 2 tokens!
545
547 return false;
548
549 rY = static_cast<tools::Long>(o3tl::toInt32(aTmp));
550 return rY != 0;
551}
552
554{
555 // Disable the compatibility controls by default. Enable them only when
556 // there is at least one open document.
557 bool bIsEnabled = false;
558
559 try
560 {
561 // Get a component enumeration from the desktop and search it for documents.
562 Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext());
563 do
564 {
565 Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);
566
567 Reference<container::XEnumerationAccess> xComponents =
568 xDesktop->getComponents();
569 if ( ! xComponents.is())
570 break;
571
572 Reference<container::XEnumeration> xEnumeration (
573 xComponents->createEnumeration());
574 if ( ! xEnumeration.is())
575 break;
576
577 while (xEnumeration->hasMoreElements())
578 {
579 Reference<frame::XModel> xModel (xEnumeration->nextElement(), UNO_QUERY);
580 if (xModel.is())
581 {
582 // There is at least one model/document: Enable the compatibility controls.
583 bIsEnabled = true;
584 break;
585 }
586 }
587
588 }
589 while (false); // One 'loop'.
590 }
591 catch (const uno::Exception&)
592 {
593 // When there is an exception then simply use the default value of
594 // bIsEnabled and disable the controls.
595 }
596
597 m_xCbxCompatibility->set_sensitive(bIsEnabled);
598}
599
601{
602 const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_SDMODE_FLAG, false);
603 if (pFlagItem)
604 {
605 sal_uInt32 nFlags=pFlagItem->GetValue();
606 if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
607 SetDrawMode();
608 if ( ( nFlags & SD_IMPRESS_MODE ) == SD_IMPRESS_MODE )
610 }
611}
612
613/* 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)
sal_uInt16 GetValue() const
sal_uInt32 GetValue() const
SdOptionsLayout & GetOptionsLayout()
Definition: optsitem.hxx:160
bool IsMoveOutline() const
Definition: optsitem.hxx:132
bool IsRulerVisible() const
Definition: optsitem.hxx:131
void SetHandlesBezier(bool bOn)
Definition: optsitem.hxx:142
bool IsDragStripes() const
Definition: optsitem.hxx:133
void SetDragStripes(bool bOn)
Definition: optsitem.hxx:141
bool IsHandlesBezier() const
Definition: optsitem.hxx:134
void SetMoveOutline(bool bOn)
Definition: optsitem.hxx:140
void SetRulerVisible(bool bOn)
Definition: optsitem.hxx:139
SdOptionsMisc & GetOptionsMisc()
Definition: optsitem.hxx:334
bool IsMasterPagePaintCaching() const
Definition: optsitem.hxx:247
bool IsCrookNoContortion() const
Definition: optsitem.hxx:245
void SetSummationOfParagraphs(bool bOn)
Definition: optsitem.hxx:299
bool IsEnableSdremote() const
Definition: optsitem.hxx:252
bool IsDragWithCopy() const
Definition: optsitem.hxx:248
bool IsPresenterScreenFullScreen() const
Definition: optsitem.hxx:254
bool IsEnablePresenterScreen() const
Definition: optsitem.hxx:253
void SetPresenterScreenFullScreen(bool bOn)
Definition: optsitem.hxx:298
bool IsMarkedHitMovesAlways() const
Definition: optsitem.hxx:243
bool IsStartWithTemplate() const
Definition: optsitem.hxx:242
void SetMarkedHitMovesAlways(bool bOn)
Definition: optsitem.hxx:287
bool IsQuickEdit() const
Definition: optsitem.hxx:246
bool IsSummationOfParagraphs() const
Definition: optsitem.hxx:256
void SetStartWithTemplate(bool bOn)
Definition: optsitem.hxx:286
void SetCrookNoContortion(bool bOn)
Definition: optsitem.hxx:289
void SetQuickEdit(bool bOn)
Definition: optsitem.hxx:290
void SetMasterPagePaintCaching(bool bOn)
Definition: optsitem.hxx:291
void SetEnablePresenterScreen(bool bOn)
Definition: optsitem.hxx:297
void SetEnableSdremote(bool bOn)
Definition: optsitem.hxx:296
void SetDragWithCopy(bool bOn)
Definition: optsitem.hxx:292
void SetPickThrough(bool bOn)
Definition: optsitem.hxx:293
bool IsPickThrough() const
Definition: optsitem.hxx:249
SdOptionsSnap & GetOptionsSnap()
Definition: optsitem.hxx:402
void SetAngle(Degree100 nIn)
Definition: optsitem.hxx:386
void SetRotate(bool bOn)
Definition: optsitem.hxx:384
void SetSnapFrame(bool bOn)
Definition: optsitem.hxx:380
bool IsBigOrtho() const
Definition: optsitem.hxx:372
void SetSnapArea(sal_Int16 nIn)
Definition: optsitem.hxx:385
void SetSnapPoints(bool bOn)
Definition: optsitem.hxx:381
bool IsSnapHelplines() const
Definition: optsitem.hxx:367
void SetSnapHelplines(bool bOn)
Definition: optsitem.hxx:378
void SetEliminatePolyPointLimitAngle(Degree100 nIn)
Definition: optsitem.hxx:387
bool IsSnapPoints() const
Definition: optsitem.hxx:370
Degree100 GetAngle() const
Definition: optsitem.hxx:375
bool IsOrtho() const
Definition: optsitem.hxx:371
void SetSnapBorder(bool bOn)
Definition: optsitem.hxx:379
bool IsSnapBorder() const
Definition: optsitem.hxx:368
Degree100 GetEliminatePolyPointLimitAngle() const
Definition: optsitem.hxx:376
void SetBigOrtho(bool bOn)
Definition: optsitem.hxx:383
sal_Int16 GetSnapArea() const
Definition: optsitem.hxx:374
void SetOrtho(bool bOn)
Definition: optsitem.hxx:382
bool IsSnapFrame() const
Definition: optsitem.hxx:369
bool IsRotate() const
Definition: optsitem.hxx:373
std::unique_ptr< weld::CheckButton > m_xCbxMoveOutline
Definition: tpoption.hxx:48
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tpoption.cxx:159
std::unique_ptr< weld::CheckButton > m_xCbxDragStripes
Definition: tpoption.hxx:46
virtual bool FillItemSet(SfxItemSet *) override
Definition: tpoption.cxx:122
std::unique_ptr< weld::CheckButton > m_xCbxRuler
Definition: tpoption.hxx:45
virtual ~SdTpOptionsContents() override
Definition: tpoption.cxx:118
SdTpOptionsContents(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Definition: tpoption.cxx:109
std::unique_ptr< weld::CheckButton > m_xCbxHandlesBezier
Definition: tpoption.hxx:47
virtual void Reset(const SfxItemSet *) override
Definition: tpoption.cxx:144
Option-Tab-Page: View.
Definition: tpoption.hxx:64
std::unique_ptr< weld::Label > m_xHeightLb
Definition: tpoption.hxx:101
std::unique_ptr< weld::CheckButton > m_xCbxMarkedHitMovesAlways
Definition: tpoption.hxx:83
virtual ~SdTpOptionsMisc() override
Definition: tpoption.cxx:262
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldInfo2
Definition: tpoption.hxx:106
std::unique_ptr< weld::CheckButton > m_xCbxPickThrough
Definition: tpoption.hxx:76
SdTpOptionsMisc(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Definition: tpoption.cxx:173
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tpoption.cxx:266
MapUnit ePoolUnit
Definition: tpoption.hxx:73
std::unique_ptr< weld::CheckButton > m_xCbxEnablePresenterScreen
Definition: tpoption.hxx:90
std::unique_ptr< weld::ComboBox > m_xLbMetric
Definition: tpoption.hxx:86
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldTabstop
Definition: tpoption.hxx:87
std::unique_ptr< weld::CheckButton > m_xCbxCopy
Definition: tpoption.hxx:82
std::unique_ptr< weld::CheckButton > m_xCbxMasterPageCache
Definition: tpoption.hxx:81
std::unique_ptr< weld::CheckButton > m_xCbxQuickEdit
Definition: tpoption.hxx:75
sal_uInt32 nHeight
Definition: tpoption.hxx:69
std::unique_ptr< weld::CheckButton > m_xCbxEnableSdremote
Definition: tpoption.hxx:89
std::unique_ptr< weld::Label > m_xWidthLb
Definition: tpoption.hxx:100
virtual bool FillItemSet(SfxItemSet *) override
Definition: tpoption.cxx:329
std::unique_ptr< weld::Label > m_xFiInfo2
Definition: tpoption.hxx:102
void SetImpressMode()
Hide Draw specific controls, make Impress specific controls visible and arrange the visible controls.
Definition: tpoption.cxx:487
std::unique_ptr< weld::Label > m_xNewDocLb
Definition: tpoption.hxx:97
std::unique_ptr< weld::CheckButton > m_xCbxCompatibility
Definition: tpoption.hxx:92
std::unique_ptr< weld::CheckButton > m_xCbxPresenterScreenFullScreen
Definition: tpoption.hxx:91
std::unique_ptr< weld::Frame > m_xScaleFrame
Definition: tpoption.hxx:95
std::unique_ptr< weld::CheckButton > m_xCbxDistort
Definition: tpoption.hxx:104
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldOriginalHeight
Definition: tpoption.hxx:103
std::unique_ptr< weld::Frame > m_xPresentationFrame
Definition: tpoption.hxx:84
void SetDrawMode()
Hide Impress specific controls, make Draw specific controls visible and arrange the visible controls.
Definition: tpoption.cxx:496
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldOriginalWidth
Definition: tpoption.hxx:99
OUString aInfo1
Definition: tpoption.hxx:70
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: tpoption.cxx:600
static bool SetScale(std::u16string_view aScale, sal_Int32 &rX, sal_Int32 &rY)
Definition: tpoption.cxx:524
sal_uInt32 nWidth
Definition: tpoption.hxx:68
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tpoption.cxx:468
std::unique_ptr< weld::Frame > m_xNewDocumentFrame
Definition: tpoption.hxx:78
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldInfo1
Definition: tpoption.hxx:105
std::unique_ptr< weld::Label > m_xFiInfo1
Definition: tpoption.hxx:98
std::unique_ptr< weld::CheckButton > m_xCbxStartWithTemplate
Definition: tpoption.hxx:79
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpoption.cxx:306
void UpdateCompatibilityControls()
Enable or disable the controls in the compatibility section of the 'general' tab page depending on wh...
Definition: tpoption.cxx:553
virtual void Reset(const SfxItemSet *) override
Definition: tpoption.cxx:393
std::unique_ptr< weld::ComboBox > m_xCbScale
Definition: tpoption.hxx:96
OUString aInfo2
Definition: tpoption.hxx:71
static OUString GetScale(sal_Int32 nX, sal_Int32 nY)
Definition: tpoption.cxx:519
virtual void Reset(const SfxItemSet *) override
Definition: tpoption.cxx:78
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tpoption.cxx:98
virtual bool FillItemSet(SfxItemSet *) override
Definition: tpoption.cxx:55
virtual ~SdTpOptionsSnap() override
Definition: tpoption.cxx:51
SdTpOptionsSnap(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Definition: tpoption.cxx:45
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static FieldUnit GetCurrentFieldUnit()
void SetExchangeSupport()
weld::Window * GetFrameWeld() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
static FieldUnit GetValue(sal_uInt32 i)
static sal_uInt32 Count()
static OUString GetString(sal_uInt32 i)
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldSnapArea
std::unique_ptr< weld::CheckButton > m_xCbxOrtho
std::unique_ptr< weld::CheckButton > m_xCbxRotate
std::unique_ptr< weld::Widget > m_xSnapFrames
std::unique_ptr< weld::CheckButton > m_xCbxSnapFrame
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldBezAngle
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldAngle
virtual bool FillItemSet(SfxItemSet *rSet) override
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::CheckButton > m_xCbxSnapBorder
std::unique_ptr< weld::CheckButton > m_xCbxSnapPoints
std::unique_ptr< weld::CheckButton > m_xCbxSnapHelplines
std::unique_ptr< weld::CheckButton > m_xCbxBigOrtho
#define DBG_ASSERT(sCon, aError)
FieldUnit
sal_uInt16 nPos
MapUnit
bool isdigitAsciiString(std::string_view rString)
int i
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
long Long
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
static SfxItemSet & rSet
UNDERLYING_TYPE get() const
Reference< XModel > xModel
DeactivateRC
bool bIsEnabled
#define TABLE_COUNT
Definition: tpoption.cxx:170
#define TOKEN
Definition: tpoption.cxx:171
IMPL_LINK_NOARG(SdTpOptionsMisc, SelectMetricHdl_Impl, weld::ComboBox &, void)
Definition: tpoption.cxx:474
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
RET_YES