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 .
21 #include <sfx2/app.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sfx2/printer.hxx>
24 #include <vcl/graph.hxx>
25 #include <sfx2/viewsh.hxx>
26 #include <svl/itemiter.hxx>
27 #include <svl/languageoptions.hxx>
28 #include <svtools/unitconv.hxx>
29 #include <vcl/svapp.hxx>
30 #include <vcl/weld.hxx>
31 #include <unotools/configitem.hxx>
32 #include <sfx2/htmlmode.hxx>
33 #include <sal/macros.h>
35 #include <svx/strings.hrc>
36 #include <svx/dialmgr.hxx>
38 #include <svx/pageitem.hxx>
39 #include <editeng/brushitem.hxx>
40 #include <editeng/boxitem.hxx>
41 #include <editeng/shaditem.hxx>
42 #include <editeng/pbinitem.hxx>
43 #include <editeng/lrspitem.hxx>
44 #include <editeng/ulspitem.hxx>
45 #include <editeng/sizeitem.hxx>
46 #include <editeng/frmdiritem.hxx>
47 #include <svx/dlgutil.hxx>
48 #include <editeng/paperinf.hxx>
49 #include <sfx2/module.hxx>
50 #include <svl/stritem.hxx>
51 #include <editeng/eerdll.hxx>
52 #include <editeng/editrids.hrc>
53 #include <svx/svxids.hrc>
54 #include <svtools/optionsdrawinglayer.hxx>
55 #include <svl/slstitm.hxx>
56 #include <svl/aeitem.hxx>
57 #include <sfx2/request.hxx>
58 #include <svx/xdef.hxx>
59 #include <svx/unobrushitemhelper.hxx>
60 #include <svx/SvxNumOptionsTabPageHelper.hxx>
62 // static ----------------------------------------------------------------
64 static const long MINBODY
= 284; // 0,5 cm rounded up in twips
66 const sal_uInt16
SvxPageDescPage::pRanges
[] =
68 SID_ATTR_BORDER_OUTER
,
69 SID_ATTR_BORDER_SHADOW
,
72 SID_SWREGISTER_COLLECTION
,
76 // ------- Mapping page layout ------------------------------------------
78 const SvxPageUsage aArr
[] =
87 static sal_uInt16
PageUsageToPos_Impl( SvxPageUsage nUsage
)
89 for ( size_t i
= 0; i
< SAL_N_ELEMENTS(aArr
); ++i
)
90 if ( aArr
[i
] == nUsage
)
96 static SvxPageUsage
PosToPageUsage_Impl( sal_uInt16 nPos
)
98 if ( nPos
>= SAL_N_ELEMENTS(aArr
) )
99 return SvxPageUsage::NONE
;
104 static Size
GetMinBorderSpace_Impl( const SvxShadowItem
& rShadow
, const SvxBoxItem
& rBox
)
107 aSz
.setHeight( rShadow
.CalcShadowSpace( SvxShadowItemSide::BOTTOM
) + rBox
.CalcLineSpace( SvxBoxItemLine::BOTTOM
) );
108 aSz
.AdjustHeight(rShadow
.CalcShadowSpace( SvxShadowItemSide::TOP
) + rBox
.CalcLineSpace( SvxBoxItemLine::TOP
) );
109 aSz
.setWidth( rShadow
.CalcShadowSpace( SvxShadowItemSide::LEFT
) + rBox
.CalcLineSpace( SvxBoxItemLine::LEFT
) );
110 aSz
.AdjustWidth(rShadow
.CalcShadowSpace( SvxShadowItemSide::RIGHT
) + rBox
.CalcLineSpace( SvxBoxItemLine::RIGHT
) );
115 static long ConvertLong_Impl( const long nIn
, MapUnit eUnit
)
117 return OutputDevice::LogicToLogic( nIn
, eUnit
, MapUnit::MapTwip
);
120 static bool IsEqualSize_Impl( const SvxSizeItem
* pSize
, const Size
& rSize
)
124 Size aSize
= pSize
->GetSize();
125 long nDiffW
= std::abs( rSize
.Width () - aSize
.Width () );
126 long nDiffH
= std::abs( rSize
.Height() - aSize
.Height() );
127 return ( nDiffW
< 10 && nDiffH
< 10 );
134 #define MARGIN_LEFT ( MarginPosition(0x0001) )
135 #define MARGIN_RIGHT ( MarginPosition(0x0002) )
136 #define MARGIN_TOP ( MarginPosition(0x0004) )
137 #define MARGIN_BOTTOM ( MarginPosition(0x0008) )
139 // class SvxPageDescPage --------------------------------------------------
141 VclPtr
<SfxTabPage
> SvxPageDescPage::Create( TabPageParent pParent
, const SfxItemSet
* rSet
)
143 return VclPtr
<SvxPageDescPage
>::Create(pParent
, *rSet
);
146 SvxPageDescPage::SvxPageDescPage(TabPageParent pParent
, const SfxItemSet
& rAttr
)
147 : SfxTabPage(pParent
, "cui/ui/pageformatpage.ui", "PageFormatPage", &rAttr
)
149 , eMode(SVX_PAGE_MODE_STANDARD
)
150 , ePaperStart(PAPER_A3
)
152 , mpDefPrinter(nullptr)
153 , mbDelPrinter(false)
154 , mbEnableDrawingLayerFillStyles(false)
155 , m_xPaperSizeBox(new SvxPaperSizeListBox(m_xBuilder
->weld_combo_box("comboPageFormat")))
156 , m_xPaperWidthEdit(m_xBuilder
->weld_metric_spin_button("spinWidth", FieldUnit::CM
))
157 , m_xPaperHeightEdit(m_xBuilder
->weld_metric_spin_button("spinHeight", FieldUnit::CM
))
158 , m_xOrientationFT(m_xBuilder
->weld_label("labelOrientation"))
159 , m_xPortraitBtn(m_xBuilder
->weld_radio_button("radiobuttonPortrait"))
160 , m_xLandscapeBtn(m_xBuilder
->weld_radio_button("radiobuttonLandscape"))
161 , m_xTextFlowLbl(m_xBuilder
->weld_label("labelTextFlow"))
162 , m_xTextFlowBox(new svx::FrameDirectionListBox(m_xBuilder
->weld_combo_box("comboTextFlowBox")))
163 , m_xPaperTrayBox(m_xBuilder
->weld_combo_box("comboPaperTray"))
164 , m_xLeftMarginLbl(m_xBuilder
->weld_label("labelLeftMargin"))
165 , m_xLeftMarginEdit(m_xBuilder
->weld_metric_spin_button("spinMargLeft", FieldUnit::CM
))
166 , m_xRightMarginLbl(m_xBuilder
->weld_label("labelRightMargin"))
167 , m_xRightMarginEdit(m_xBuilder
->weld_metric_spin_button("spinMargRight", FieldUnit::CM
))
168 , m_xTopMarginEdit(m_xBuilder
->weld_metric_spin_button("spinMargTop", FieldUnit::CM
))
169 , m_xBottomMarginEdit(m_xBuilder
->weld_metric_spin_button("spinMargBot", FieldUnit::CM
))
170 , m_xPageText(m_xBuilder
->weld_label("labelPageLayout"))
171 , m_xLayoutBox(m_xBuilder
->weld_combo_box("comboPageLayout"))
172 , m_xNumberFormatBox(new SvxPageNumberListBox(m_xBuilder
->weld_combo_box("comboLayoutFormat")))
173 , m_xTblAlignFT(m_xBuilder
->weld_label("labelTblAlign"))
174 , m_xHorzBox(m_xBuilder
->weld_check_button("checkbuttonHorz"))
175 , m_xVertBox(m_xBuilder
->weld_check_button("checkbuttonVert"))
176 , m_xAdaptBox(m_xBuilder
->weld_check_button("checkAdaptBox"))
177 , m_xRegisterCB(m_xBuilder
->weld_check_button("checkRegisterTrue"))
178 , m_xRegisterFT(m_xBuilder
->weld_label("labelRegisterStyle"))
179 , m_xRegisterLB(m_xBuilder
->weld_combo_box("comboRegisterStyle"))
180 // Strings stored in UI
181 , m_xInsideLbl(m_xBuilder
->weld_label("labelInner"))
182 , m_xOutsideLbl(m_xBuilder
->weld_label("labelOuter"))
183 , m_xPrintRangeQueryText(m_xBuilder
->weld_label("labelMsg"))
184 , m_xBspWin(new weld::CustomWeld(*m_xBuilder
, "drawingareaPageDirection", m_aBspWin
))
186 m_xRegisterLB
->set_size_request(m_xRegisterLB
->get_approximate_digit_width() * 20, -1);
188 bBorderModified
= false;
189 m_aBspWin
.EnableRTL(false);
191 // this page needs ExchangeSupport
192 SetExchangeSupport();
194 SvtLanguageOptions aLangOptions
;
195 bool bCJK
= aLangOptions
.IsAsianTypographyEnabled();
196 bool bCTL
= aLangOptions
.IsCTLFontEnabled();
198 const SfxPoolItem
* pItem
;
200 SfxObjectShell
* pShell
;
201 if(SfxItemState::SET
== rAttr
.GetItemState(SID_HTML_MODE
, false, &pItem
) ||
202 ( nullptr != (pShell
= SfxObjectShell::Current()) &&
203 nullptr != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
204 bWeb
= 0 != (static_cast<const SfxUInt16Item
*>(pItem
)->GetValue() & HTMLMODE_ON
);
206 // fill text flow listbox with valid entries
208 m_xTextFlowBox
->append(SvxFrameDirection::Horizontal_LR_TB
, SvxResId(RID_SVXSTR_PAGEDIR_LTR_HORI
));
211 m_xTextFlowBox
->append(SvxFrameDirection::Horizontal_RL_TB
, SvxResId(RID_SVXSTR_PAGEDIR_RTL_HORI
));
214 // #109989# do not show vertical directions in Writer/Web
217 m_xTextFlowBox
->append(SvxFrameDirection::Vertical_RL_TB
, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT
));
218 m_xTextFlowBox
->append(SvxFrameDirection::Vertical_LR_TB
, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT
));
221 // #109989# show the text direction box in Writer/Web too
222 if( (bCJK
|| bCTL
) &&
223 SfxItemState::UNKNOWN
< rAttr
.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION
)))
225 m_xTextFlowLbl
->show();
226 m_xTextFlowBox
->show();
227 m_xTextFlowBox
->connect_changed(LINK(this, SvxPageDescPage
, FrameDirectionModify_Impl
));
229 m_aBspWin
.EnableFrameDirection(true);
233 FieldUnit eFUnit
= GetModuleFieldUnit( rAttr
);
234 SetFieldUnit( *m_xLeftMarginEdit
, eFUnit
);
235 SetFieldUnit( *m_xRightMarginEdit
, eFUnit
);
236 SetFieldUnit( *m_xTopMarginEdit
, eFUnit
);
237 SetFieldUnit( *m_xBottomMarginEdit
, eFUnit
);
238 SetFieldUnit( *m_xPaperWidthEdit
, eFUnit
);
239 SetFieldUnit( *m_xPaperHeightEdit
, eFUnit
);
241 if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
243 mpDefPrinter
= SfxViewShell::Current()->GetPrinter();
247 mpDefPrinter
= VclPtr
<Printer
>::Create();
251 MapMode aOldMode
= mpDefPrinter
->GetMapMode();
252 mpDefPrinter
->SetMapMode(MapMode(MapUnit::MapTwip
));
254 // set first- and last-values for the margins
255 Size aPaperSize
= mpDefPrinter
->GetPaperSize();
256 Size aPrintSize
= mpDefPrinter
->GetOutputSize();
259 * To convert a point ( 0,0 ) into logic coordinates
260 * looks like nonsense; but it makes sense when the
261 * coordinate system's origin has been moved.
263 Point aPrintOffset
= mpDefPrinter
->GetPageOffset() - mpDefPrinter
->PixelToLogic( Point() );
264 mpDefPrinter
->SetMapMode( aOldMode
);
266 nFirstLeftMargin
= m_xLeftMarginEdit
->convert_value_from(m_xLeftMarginEdit
->normalize(aPrintOffset
.X()), FieldUnit::TWIP
);
267 nFirstRightMargin
= m_xRightMarginEdit
->convert_value_from(m_xRightMarginEdit
->normalize(aPaperSize
.Width() - aPrintSize
.Width() - aPrintOffset
.X()), FieldUnit::TWIP
);
268 nFirstTopMargin
= m_xTopMarginEdit
->convert_value_from(m_xTopMarginEdit
->normalize(aPrintOffset
.Y() ), FieldUnit::TWIP
);
269 nFirstBottomMargin
= m_xBottomMarginEdit
->convert_value_from(m_xBottomMarginEdit
->normalize(aPaperSize
.Height() - aPrintSize
.Height() - aPrintOffset
.Y()), FieldUnit::TWIP
);
270 nLastLeftMargin
= m_xLeftMarginEdit
->convert_value_from(m_xLeftMarginEdit
->normalize(aPrintOffset
.X() + aPrintSize
.Width()), FieldUnit::TWIP
);
271 nLastRightMargin
= m_xRightMarginEdit
->convert_value_from(m_xRightMarginEdit
->normalize(aPrintOffset
.X() + aPrintSize
.Width()), FieldUnit::TWIP
);
272 nLastTopMargin
= m_xTopMarginEdit
->convert_value_from(m_xTopMarginEdit
->normalize(aPrintOffset
.Y() + aPrintSize
.Height()), FieldUnit::TWIP
);
273 nLastBottomMargin
= m_xBottomMarginEdit
->convert_value_from(m_xBottomMarginEdit
->normalize(aPrintOffset
.Y() + aPrintSize
.Height()), FieldUnit::TWIP
);
275 // #i4219# get DrawingLayer options
276 const SvtOptionsDrawinglayer aDrawinglayerOpt
;
278 // #i4219# take Maximum now from configuration (1/100th cm)
279 // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
280 m_xPaperWidthEdit
->set_max(m_xPaperWidthEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperWidth()), FieldUnit::CM
);
281 m_xPaperHeightEdit
->set_max(m_xPaperHeightEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperHeight()), FieldUnit::CM
);
283 // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
284 m_xLeftMarginEdit
->set_max(m_xLeftMarginEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperLeftMargin()), FieldUnit::MM
);
285 m_xRightMarginEdit
->set_max(m_xRightMarginEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperRightMargin()), FieldUnit::MM
);
286 m_xTopMarginEdit
->set_max(m_xTopMarginEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperTopMargin()), FieldUnit::MM
);
287 m_xBottomMarginEdit
->set_max(m_xBottomMarginEdit
->normalize(aDrawinglayerOpt
.GetMaximumPaperBottomMargin()), FieldUnit::MM
);
289 // Get the i18n framework numberings and add them to the listbox.
290 SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox
->get_widget(), std::numeric_limits
<sal_uInt16
>::max());
293 SvxPageDescPage::~SvxPageDescPage()
298 void SvxPageDescPage::dispose()
302 mpDefPrinter
.disposeAndClear();
303 mbDelPrinter
= false;
305 SfxTabPage::dispose();
308 void SvxPageDescPage::Init_Impl()
310 // adjust the handler
311 m_xLayoutBox
->connect_changed(LINK(this, SvxPageDescPage
, LayoutHdl_Impl
));
313 m_xPaperSizeBox
->connect_changed(LINK(this, SvxPageDescPage
, PaperSizeSelect_Impl
));
314 m_xPaperWidthEdit
->connect_value_changed( LINK(this, SvxPageDescPage
, PaperSizeModify_Impl
));
315 m_xPaperHeightEdit
->connect_value_changed(LINK(this, SvxPageDescPage
, PaperSizeModify_Impl
));
316 m_xLandscapeBtn
->connect_clicked(LINK(this, SvxPageDescPage
, SwapOrientation_Impl
));
317 m_xPortraitBtn
->connect_clicked(LINK(this, SvxPageDescPage
, SwapOrientation_Impl
));
319 Link
<weld::MetricSpinButton
&, void> aLink
= LINK(this, SvxPageDescPage
, BorderModify_Impl
);
320 m_xLeftMarginEdit
->connect_value_changed(aLink
);
321 m_xRightMarginEdit
->connect_value_changed(aLink
);
322 m_xTopMarginEdit
->connect_value_changed(aLink
);
323 m_xBottomMarginEdit
->connect_value_changed(aLink
);
325 m_xHorzBox
->connect_toggled(LINK(this, SvxPageDescPage
, CenterHdl_Impl
));
326 m_xVertBox
->connect_toggled(LINK(this, SvxPageDescPage
, CenterHdl_Impl
));
329 void SvxPageDescPage::Reset( const SfxItemSet
* rSet
)
331 SfxItemPool
* pPool
= rSet
->GetPool();
332 DBG_ASSERT( pPool
, "Where is the pool?" );
333 MapUnit eUnit
= pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) );
335 // adjust margins (right/left)
336 const SfxPoolItem
* pItem
= GetItem( *rSet
, SID_ATTR_LRSPACE
);
340 const SvxLRSpaceItem
& rLRSpace
= static_cast<const SvxLRSpaceItem
&>(*pItem
);
341 SetMetricValue( *m_xLeftMarginEdit
, rLRSpace
.GetLeft(), eUnit
);
343 static_cast<sal_uInt16
>(ConvertLong_Impl( rLRSpace
.GetLeft(), eUnit
)) );
344 SetMetricValue( *m_xRightMarginEdit
, rLRSpace
.GetRight(), eUnit
);
346 static_cast<sal_uInt16
>(ConvertLong_Impl( rLRSpace
.GetRight(), eUnit
)) );
349 // adjust margins (top/bottom)
350 pItem
= GetItem( *rSet
, SID_ATTR_ULSPACE
);
354 const SvxULSpaceItem
& rULSpace
= static_cast<const SvxULSpaceItem
&>(*pItem
);
355 SetMetricValue( *m_xTopMarginEdit
, rULSpace
.GetUpper(), eUnit
);
357 static_cast<sal_uInt16
>(ConvertLong_Impl( static_cast<long>(rULSpace
.GetUpper()), eUnit
)) );
358 SetMetricValue( *m_xBottomMarginEdit
, rULSpace
.GetLower(), eUnit
);
360 static_cast<sal_uInt16
>(ConvertLong_Impl( static_cast<long>(rULSpace
.GetLower()), eUnit
)) );
364 SvxNumType eNumType
= SVX_NUM_ARABIC
;
365 bLandscape
= ( mpDefPrinter
->GetOrientation() == Orientation::Landscape
);
366 SvxPageUsage nUse
= SvxPageUsage::All
;
367 pItem
= GetItem( *rSet
, SID_ATTR_PAGE
);
371 const SvxPageItem
& rItem
= static_cast<const SvxPageItem
&>(*pItem
);
372 eNumType
= rItem
.GetNumType();
373 nUse
= rItem
.GetPageUsage();
374 bLandscape
= rItem
.IsLandscape();
378 m_xLayoutBox
->set_active(::PageUsageToPos_Impl(nUse
));
379 m_aBspWin
.SetUsage( nUse
);
380 LayoutHdl_Impl( *m_xLayoutBox
);
382 //adjust numeration type of the page style
383 //Get the Position of the saved NumType
384 for (int i
=0; i
< m_xNumberFormatBox
->get_count(); ++i
)
386 if (eNumType
== m_xNumberFormatBox
->get_id(i
).toInt32())
388 m_xNumberFormatBox
->set_active(i
);
393 m_xPaperTrayBox
->clear();
394 sal_uInt8 nPaperBin
= PAPERBIN_PRINTER_SETTINGS
;
395 pItem
= GetItem( *rSet
, SID_ATTR_PAGE_PAPERBIN
);
399 nPaperBin
= static_cast<const SvxPaperBinItem
*>(pItem
)->GetValue();
401 if ( nPaperBin
>= mpDefPrinter
->GetPaperBinCount() )
402 nPaperBin
= PAPERBIN_PRINTER_SETTINGS
;
407 if ( PAPERBIN_PRINTER_SETTINGS
== nPaperBin
)
408 aBinName
= EditResId(RID_SVXSTR_PAPERBIN_SETTINGS
);
410 aBinName
= mpDefPrinter
->GetPaperBinName( static_cast<sal_uInt16
>(nPaperBin
) );
412 m_xPaperTrayBox
->append(OUString::number(nPaperBin
), aBinName
);
413 m_xPaperTrayBox
->set_active_text(aBinName
);
414 // reset focus handler to default first so know none already connected
415 m_xPaperTrayBox
->connect_focus_in(Link
<weld::Widget
&, void>());
416 // update the list when widget gets focus
417 m_xPaperTrayBox
->connect_focus_in(LINK(this, SvxPageDescPage
, PaperBinHdl_Impl
));
419 Size aPaperSize
= SvxPaperInfo::GetPaperSize( mpDefPrinter
);
420 pItem
= GetItem( *rSet
, SID_ATTR_PAGE_SIZE
);
423 aPaperSize
= static_cast<const SvxSizeItem
*>(pItem
)->GetSize();
425 bool bOrientationSupport
=
426 mpDefPrinter
->HasSupport( PrinterSupport::SetOrientation
);
428 if ( !bOrientationSupport
&&
429 aPaperSize
.Width() > aPaperSize
.Height() )
432 m_xLandscapeBtn
->set_active(bLandscape
);
433 m_xPortraitBtn
->set_active(!bLandscape
);
435 m_aBspWin
.SetSize( Size( ConvertLong_Impl( aPaperSize
.Width(), eUnit
),
436 ConvertLong_Impl( aPaperSize
.Height(), eUnit
) ) );
438 aPaperSize
= OutputDevice::LogicToLogic(aPaperSize
, MapMode(eUnit
), MapMode(MapUnit::Map100thMM
));
442 // Actual Paper Format
443 Paper ePaper
= SvxPaperInfo::GetSvxPaper( aPaperSize
, MapUnit::Map100thMM
);
445 if ( PAPER_USER
!= ePaper
)
446 aPaperSize
= SvxPaperInfo::GetPaperSize( ePaper
, MapUnit::Map100thMM
);
451 // write values into the edits
452 SetMetricValue( *m_xPaperHeightEdit
, aPaperSize
.Height(), MapUnit::Map100thMM
);
453 SetMetricValue( *m_xPaperWidthEdit
, aPaperSize
.Width(), MapUnit::Map100thMM
);
454 m_xPaperSizeBox
->clear();
456 m_xPaperSizeBox
->FillPaperSizeEntries( ( ePaperStart
== PAPER_A3
) ? PaperSizeApp::Std
: PaperSizeApp::Draw
);
457 m_xPaperSizeBox
->SetSelection( ePaper
);
459 // application specific
463 case SVX_PAGE_MODE_CENTER
:
465 m_xTblAlignFT
->show();
468 DisableVerticalPageDir();
470 // horizontal alignment
471 pItem
= GetItem( *rSet
, SID_ATTR_PAGE_EXT1
);
472 m_xHorzBox
->set_active(pItem
&& static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
474 // vertical alignment
475 pItem
= GetItem( *rSet
, SID_ATTR_PAGE_EXT2
);
476 m_xVertBox
->set_active(pItem
&& static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
478 // set example window on the table
479 m_aBspWin
.SetTable( true );
480 m_aBspWin
.SetHorz(m_xHorzBox
->get_active());
481 m_aBspWin
.SetVert(m_xVertBox
->get_active());
486 case SVX_PAGE_MODE_PRESENTATION
:
488 DisableVerticalPageDir();
490 pItem
= GetItem( *rSet
, SID_ATTR_PAGE_EXT1
);
491 m_xAdaptBox
->set_active( pItem
&&
492 static_cast<const SfxBoolItem
*>(pItem
)->GetValue() );
494 //!!! hidden, because not implemented by StarDraw
495 m_xLayoutBox
->hide();
500 default: ;//prevent warning
504 // display background and border in the example
505 ResetBackground_Impl( *rSet
);
506 //! UpdateExample_Impl();
509 InitHeadFoot_Impl( *rSet
);
511 bBorderModified
= false;
512 SwapFirstValues_Impl( false );
513 UpdateExample_Impl();
515 m_xLeftMarginEdit
->save_value();
516 m_xRightMarginEdit
->save_value();
517 m_xTopMarginEdit
->save_value();
518 m_xBottomMarginEdit
->save_value();
519 m_xLayoutBox
->save_value();
520 m_xNumberFormatBox
->save_value();
521 m_xPaperSizeBox
->save_value();
522 m_xPaperWidthEdit
->save_value();
523 m_xPaperHeightEdit
->save_value();
524 m_xPortraitBtn
->save_state();
525 m_xLandscapeBtn
->save_state();
526 m_xPaperTrayBox
->save_value();
527 m_xVertBox
->save_state();
528 m_xHorzBox
->save_state();
529 m_xAdaptBox
->save_state();
531 CheckMarginEdits( true );
534 if(SfxItemState::SET
== rSet
->GetItemState(SID_SWREGISTER_MODE
))
536 m_xRegisterCB
->set_active(static_cast<const SfxBoolItem
&>(rSet
->Get(
537 SID_SWREGISTER_MODE
)).GetValue());
538 m_xRegisterCB
->save_state();
539 RegisterModify(*m_xRegisterCB
);
541 if(SfxItemState::SET
== rSet
->GetItemState(SID_SWREGISTER_COLLECTION
))
543 m_xRegisterLB
->set_active_text(
544 static_cast<const SfxStringItem
&>(rSet
->Get(SID_SWREGISTER_COLLECTION
)).GetValue());
545 m_xRegisterLB
->save_value();
548 SfxItemState eState
= rSet
->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION
),
550 if( SfxItemState::UNKNOWN
!= eState
)
552 SvxFrameDirection nVal
= SfxItemState::SET
== eState
553 ? static_cast<const SvxFrameDirectionItem
*>(pItem
)->GetValue()
554 : SvxFrameDirection::Horizontal_LR_TB
;
555 m_xTextFlowBox
->set_active_id(nVal
);
557 m_xTextFlowBox
->save_value();
558 m_aBspWin
.SetFrameDirection(nVal
);
562 void SvxPageDescPage::FillUserData()
564 if (SVX_PAGE_MODE_PRESENTATION
== eMode
)
565 SetUserData(m_xAdaptBox
->get_active() ? OUString("1") : OUString("0")) ;
569 bool SvxPageDescPage::FillItemSet( SfxItemSet
* rSet
)
571 bool bModified
= false;
572 const SfxItemSet
& rOldSet
= GetItemSet();
573 SfxItemPool
* pPool
= rOldSet
.GetPool();
574 DBG_ASSERT( pPool
, "Where is the pool?" );
575 sal_uInt16 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
576 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
577 const SfxPoolItem
* pOld
= nullptr;
579 // copy old left and right margins
580 SvxLRSpaceItem
aMargin( static_cast<const SvxLRSpaceItem
&>(rOldSet
.Get( nWhich
)) );
582 // copy old top and bottom margins
583 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
584 SvxULSpaceItem
aTopMargin( static_cast<const SvxULSpaceItem
&>(rOldSet
.Get( nWhich
)) );
586 if (m_xLeftMarginEdit
->get_value_changed_from_saved())
588 aMargin
.SetLeft( static_cast<sal_uInt16
>(GetCoreValue( *m_xLeftMarginEdit
, eUnit
)) );
592 if (m_xRightMarginEdit
->get_value_changed_from_saved())
594 aMargin
.SetRight( static_cast<sal_uInt16
>(GetCoreValue( *m_xRightMarginEdit
, eUnit
)) );
598 // set left and right margins
601 pOld
= GetOldItem( *rSet
, SID_ATTR_LRSPACE
);
603 if ( !pOld
|| *static_cast<const SvxLRSpaceItem
*>(pOld
) != aMargin
)
604 rSet
->Put( aMargin
);
611 if (m_xTopMarginEdit
->get_value_changed_from_saved())
613 aTopMargin
.SetUpper( static_cast<sal_uInt16
>(GetCoreValue( *m_xTopMarginEdit
, eUnit
)) );
617 if (m_xBottomMarginEdit
->get_value_changed_from_saved())
619 aTopMargin
.SetLower( static_cast<sal_uInt16
>(GetCoreValue( *m_xBottomMarginEdit
, eUnit
)) );
623 // set top and bottom margins
627 pOld
= GetOldItem( *rSet
, SID_ATTR_ULSPACE
);
629 if ( !pOld
|| *static_cast<const SvxULSpaceItem
*>(pOld
) != aTopMargin
)
632 rSet
->Put( aTopMargin
);
637 nWhich
= GetWhich( SID_ATTR_PAGE_PAPERBIN
);
638 sal_Int32 nPos
= m_xPaperTrayBox
->get_active();
639 sal_uInt16 nBin
= m_xPaperTrayBox
->get_id(nPos
).toInt32();
640 pOld
= GetOldItem( *rSet
, SID_ATTR_PAGE_PAPERBIN
);
642 if ( !pOld
|| static_cast<const SvxPaperBinItem
*>(pOld
)->GetValue() != nBin
)
644 rSet
->Put( SvxPaperBinItem( nWhich
, static_cast<sal_uInt8
>(nBin
) ) );
648 Paper ePaper
= m_xPaperSizeBox
->GetSelection();
649 bool bChecked
= m_xLandscapeBtn
->get_active();
651 if ( PAPER_USER
== ePaper
)
653 if ( m_xPaperSizeBox
->get_value_changed_from_saved() ||
654 m_xPaperWidthEdit
->get_value_changed_from_saved() ||
655 m_xPaperHeightEdit
->get_value_changed_from_saved() ||
656 m_xLandscapeBtn
->get_state_changed_from_saved() )
658 Size
aSize( GetCoreValue( *m_xPaperWidthEdit
, eUnit
),
659 GetCoreValue( *m_xPaperHeightEdit
, eUnit
) );
660 pOld
= GetOldItem( *rSet
, SID_ATTR_PAGE_SIZE
);
662 if ( !pOld
|| static_cast<const SvxSizeItem
*>(pOld
)->GetSize() != aSize
)
664 rSet
->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE
), aSize
) );
671 if (m_xPaperSizeBox
->get_value_changed_from_saved() || m_xLandscapeBtn
->get_state_changed_from_saved())
673 Size
aSize( SvxPaperInfo::GetPaperSize( ePaper
, eUnit
) );
678 pOld
= GetOldItem( *rSet
, SID_ATTR_PAGE_SIZE
);
680 if ( !pOld
|| static_cast<const SvxSizeItem
*>(pOld
)->GetSize() != aSize
)
682 rSet
->Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE
), aSize
) );
688 nWhich
= GetWhich( SID_ATTR_PAGE
);
689 SvxPageItem
aPage( static_cast<const SvxPageItem
&>(rOldSet
.Get( nWhich
)) );
690 bMod
= m_xLayoutBox
->get_value_changed_from_saved();
693 aPage
.SetPageUsage(::PosToPageUsage_Impl(m_xLayoutBox
->get_active()));
695 if (m_xLandscapeBtn
->get_state_changed_from_saved())
697 aPage
.SetLandscape(bChecked
);
701 //Get the NumType value
702 nPos
= m_xNumberFormatBox
->get_active();
703 SvxNumType nEntryData
= static_cast<SvxNumType
>(m_xNumberFormatBox
->get_id(nPos
).toInt32());
704 if (m_xNumberFormatBox
->get_value_changed_from_saved())
706 aPage
.SetNumType( nEntryData
);
712 pOld
= GetOldItem( *rSet
, SID_ATTR_PAGE
);
714 if ( !pOld
|| *static_cast<const SvxPageItem
*>(pOld
) != aPage
)
720 else if ( SfxItemState::DEFAULT
== rOldSet
.GetItemState( nWhich
) )
721 rSet
->ClearItem( nWhich
);
723 rSet
->Put( rOldSet
.Get( nWhich
) );
725 // evaluate mode specific controls
729 case SVX_PAGE_MODE_CENTER
:
731 if (m_xHorzBox
->get_state_changed_from_saved())
733 SfxBoolItem
aHorz( GetWhich( SID_ATTR_PAGE_EXT1
),
734 m_xHorzBox
->get_active() );
739 if (m_xVertBox
->get_state_changed_from_saved())
741 SfxBoolItem
aVert( GetWhich( SID_ATTR_PAGE_EXT2
),
742 m_xVertBox
->get_active() );
749 case SVX_PAGE_MODE_PRESENTATION
:
751 // always put so that draw can evaluate this
752 rSet
->Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1
),
753 m_xAdaptBox
->get_active() ) );
757 default: ;//prevent warning
761 if (m_xRegisterCB
->get_visible() &&
762 (m_xRegisterCB
->get_active() || m_xRegisterCB
->get_state_changed_from_saved()))
764 const SfxBoolItem
& rRegItem
= static_cast<const SfxBoolItem
&>(rOldSet
.Get(SID_SWREGISTER_MODE
));
765 std::unique_ptr
<SfxBoolItem
> pRegItem(static_cast<SfxBoolItem
*>(rRegItem
.Clone()));
766 bool bCheck
= m_xRegisterCB
->get_active();
767 pRegItem
->SetValue(bCheck
);
768 rSet
->Put(std::move(pRegItem
));
773 rSet
->Put(SfxStringItem(SID_SWREGISTER_COLLECTION
,
774 m_xRegisterLB
->get_active_text()));
778 if (m_xTextFlowBox
->get_visible() && m_xTextFlowBox
->get_value_changed_from_saved())
780 SvxFrameDirection eDirection
= m_xTextFlowBox
->get_active_id();
781 rSet
->Put( SvxFrameDirectionItem( eDirection
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
788 IMPL_LINK_NOARG(SvxPageDescPage
, LayoutHdl_Impl
, weld::ComboBox
&, void)
790 // switch inside outside
791 const SvxPageUsage nUsage
= PosToPageUsage_Impl(m_xLayoutBox
->get_active());
793 if (nUsage
== SvxPageUsage::Mirror
)
795 m_xLeftMarginLbl
->hide();
796 m_xRightMarginLbl
->hide();
797 m_xInsideLbl
->show();
798 m_xOutsideLbl
->show();
802 m_xLeftMarginLbl
->show();
803 m_xRightMarginLbl
->show();
804 m_xInsideLbl
->hide();
805 m_xOutsideLbl
->hide();
807 UpdateExample_Impl( true );
810 IMPL_LINK_NOARG(SvxPageDescPage
, PaperBinHdl_Impl
, weld::Widget
&, void)
812 // tdf#124226 disconnect so not called again, unless Reset occurs
813 m_xPaperTrayBox
->connect_focus_in(Link
<weld::Widget
&, void>());
815 OUString aOldName
= m_xPaperTrayBox
->get_active_text();
816 m_xPaperTrayBox
->freeze();
817 m_xPaperTrayBox
->clear();
818 m_xPaperTrayBox
->append(OUString::number(PAPERBIN_PRINTER_SETTINGS
), EditResId(RID_SVXSTR_PAPERBIN_SETTINGS
));
819 OUString
aPaperBin(EditResId(RID_SVXSTR_PAPERBIN
));
820 const sal_uInt16 nBinCount
= mpDefPrinter
->GetPaperBinCount();
822 for (sal_uInt16 i
= 0; i
< nBinCount
; ++i
)
824 OUString aName
= mpDefPrinter
->GetPaperBinName(i
);
827 aName
= aPaperBin
+ " " + OUString::number( i
+1 );
829 m_xPaperTrayBox
->append(OUString::number(i
), aName
);
831 m_xPaperTrayBox
->set_active_text(aOldName
);
832 m_xPaperTrayBox
->thaw();
834 // tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
835 // of there the focus should be
836 m_xPaperTrayBox
->grab_focus();
839 IMPL_LINK_NOARG(SvxPageDescPage
, PaperSizeSelect_Impl
, weld::ComboBox
&, void)
841 Paper ePaper
= m_xPaperSizeBox
->GetSelection();
843 if ( ePaper
!= PAPER_USER
)
845 Size
aSize( SvxPaperInfo::GetPaperSize( ePaper
, MapUnit::Map100thMM
) );
847 if (m_xLandscapeBtn
->get_active())
850 if ( aSize
.Height() < m_xPaperHeightEdit
->get_min( FieldUnit::MM_100TH
) )
851 m_xPaperHeightEdit
->set_min(
852 m_xPaperHeightEdit
->normalize( aSize
.Height() ), FieldUnit::MM_100TH
);
853 if ( aSize
.Width() < m_xPaperWidthEdit
->get_min( FieldUnit::MM_100TH
) )
854 m_xPaperWidthEdit
->set_min(
855 m_xPaperWidthEdit
->normalize( aSize
.Width() ), FieldUnit::MM_100TH
);
856 SetMetricValue( *m_xPaperHeightEdit
, aSize
.Height(), MapUnit::Map100thMM
);
857 SetMetricValue( *m_xPaperWidthEdit
, aSize
.Width(), MapUnit::Map100thMM
);
862 UpdateExample_Impl( true );
864 if ( eMode
== SVX_PAGE_MODE_PRESENTATION
)
866 // Draw: if paper format the margin shall be 1 cm
868 bool bScreen
= (( PAPER_SCREEN_4_3
== ePaper
)||( PAPER_SCREEN_16_9
== ePaper
)||( PAPER_SCREEN_16_10
== ePaper
));
871 // no margin if screen
872 nTmp
= 1; // accordingly 1 cm
874 if ( bScreen
|| m_xRightMarginEdit
->get_value(FieldUnit::NONE
) == 0 )
875 SetMetricValue( *m_xRightMarginEdit
, nTmp
, MapUnit::MapCM
);
876 if ( bScreen
|| m_xLeftMarginEdit
->get_value(FieldUnit::NONE
) == 0 )
877 SetMetricValue( *m_xLeftMarginEdit
, nTmp
, MapUnit::MapCM
);
878 if ( bScreen
|| m_xBottomMarginEdit
->get_value(FieldUnit::NONE
) == 0 )
879 SetMetricValue( *m_xBottomMarginEdit
, nTmp
, MapUnit::MapCM
);
880 if ( bScreen
|| m_xTopMarginEdit
->get_value(FieldUnit::NONE
) == 0 )
881 SetMetricValue( *m_xTopMarginEdit
, nTmp
, MapUnit::MapCM
);
882 UpdateExample_Impl( true );
887 IMPL_LINK_NOARG(SvxPageDescPage
, PaperSizeModify_Impl
, weld::MetricSpinButton
&, void)
889 sal_uInt16 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
890 MapUnit eUnit
= GetItemSet().GetPool()->GetMetric( nWhich
);
891 Size
aSize( GetCoreValue( *m_xPaperWidthEdit
, eUnit
),
892 GetCoreValue( *m_xPaperHeightEdit
, eUnit
) );
894 if ( aSize
.Width() > aSize
.Height() )
896 m_xLandscapeBtn
->set_active(true);
901 m_xPortraitBtn
->set_active(true);
905 Paper ePaper
= SvxPaperInfo::GetSvxPaper( aSize
, eUnit
);
906 m_xPaperSizeBox
->SetSelection( ePaper
);
907 UpdateExample_Impl( true );
912 IMPL_LINK(SvxPageDescPage
, SwapOrientation_Impl
, weld::Button
&, rBtn
, void)
915 (!bLandscape
&& &rBtn
== m_xLandscapeBtn
.get()) ||
916 (bLandscape
&& &rBtn
== m_xPortraitBtn
.get())
919 bLandscape
= m_xLandscapeBtn
->get_active();
921 const long lWidth
= GetCoreValue( *m_xPaperWidthEdit
, MapUnit::Map100thMM
);
922 const long lHeight
= GetCoreValue( *m_xPaperHeightEdit
, MapUnit::Map100thMM
);
924 // swap width and height
925 SetMetricValue(*m_xPaperWidthEdit
, lHeight
, MapUnit::Map100thMM
);
926 SetMetricValue(*m_xPaperHeightEdit
, lWidth
, MapUnit::Map100thMM
);
928 // recalculate margins if necessary
931 PaperSizeSelect_Impl(m_xPaperSizeBox
->get_widget());
933 SwapFirstValues_Impl(bBorderModified
);
934 UpdateExample_Impl(true);
938 void SvxPageDescPage::SwapFirstValues_Impl( bool bSet
)
940 MapMode aOldMode
= mpDefPrinter
->GetMapMode();
941 Orientation eOri
= Orientation::Portrait
;
944 eOri
= Orientation::Landscape
;
945 Orientation eOldOri
= mpDefPrinter
->GetOrientation();
946 mpDefPrinter
->SetOrientation( eOri
);
947 mpDefPrinter
->SetMapMode(MapMode(MapUnit::MapTwip
));
949 // set first- and last-values for margins
950 Size aPaperSize
= mpDefPrinter
->GetPaperSize();
951 Size aPrintSize
= mpDefPrinter
->GetOutputSize();
953 * To convert a point ( 0,0 ) into logic coordinates
954 * looks like nonsense; but it makes sense if the
955 * coordinate system's origin has been moved.
957 Point aPrintOffset
= mpDefPrinter
->GetPageOffset() - mpDefPrinter
->PixelToLogic( Point() );
958 mpDefPrinter
->SetMapMode( aOldMode
);
959 mpDefPrinter
->SetOrientation( eOldOri
);
961 sal_Int64 nSetL
= m_xLeftMarginEdit
->denormalize(
962 m_xLeftMarginEdit
->get_value( FieldUnit::TWIP
) );
963 sal_Int64 nSetR
= m_xRightMarginEdit
->denormalize(
964 m_xRightMarginEdit
->get_value( FieldUnit::TWIP
) );
965 sal_Int64 nSetT
= m_xTopMarginEdit
->denormalize(
966 m_xTopMarginEdit
->get_value( FieldUnit::TWIP
) );
967 sal_Int64 nSetB
= m_xBottomMarginEdit
->denormalize(
968 m_xBottomMarginEdit
->get_value( FieldUnit::TWIP
) );
970 long nNewL
= aPrintOffset
.X();
971 long nNewR
= aPaperSize
.Width() - aPrintSize
.Width() - aPrintOffset
.X();
972 long nNewT
= aPrintOffset
.Y();
973 long nNewB
= aPaperSize
.Height() - aPrintSize
.Height() - aPrintOffset
.Y();
975 nFirstLeftMargin
= m_xLeftMarginEdit
->convert_value_from(m_xLeftMarginEdit
->normalize(nNewL
), FieldUnit::TWIP
);
976 nFirstRightMargin
= m_xRightMarginEdit
->convert_value_from(m_xRightMarginEdit
->normalize(nNewR
), FieldUnit::TWIP
);
977 nFirstTopMargin
= m_xTopMarginEdit
->convert_value_from(m_xTopMarginEdit
->normalize(nNewT
), FieldUnit::TWIP
);
978 nFirstBottomMargin
= m_xBottomMarginEdit
->convert_value_from(m_xBottomMarginEdit
->normalize(nNewB
), FieldUnit::TWIP
);
983 m_xLeftMarginEdit
->set_value( m_xLeftMarginEdit
->normalize( nNewL
),
986 m_xRightMarginEdit
->set_value( m_xRightMarginEdit
->normalize( nNewR
),
989 m_xTopMarginEdit
->set_value( m_xTopMarginEdit
->normalize( nNewT
),
992 m_xBottomMarginEdit
->set_value( m_xBottomMarginEdit
->normalize( nNewB
),
997 IMPL_LINK_NOARG(SvxPageDescPage
, BorderModify_Impl
, weld::MetricSpinButton
&, void)
999 if ( !bBorderModified
)
1000 bBorderModified
= true;
1001 UpdateExample_Impl();
1006 void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground
)
1009 Size
aSize( GetCoreValue( *m_xPaperWidthEdit
, MapUnit::MapTwip
),
1010 GetCoreValue( *m_xPaperHeightEdit
, MapUnit::MapTwip
) );
1012 m_aBspWin
.SetSize( aSize
);
1015 m_aBspWin
.SetTop( GetCoreValue( *m_xTopMarginEdit
, MapUnit::MapTwip
) );
1016 m_aBspWin
.SetBottom( GetCoreValue( *m_xBottomMarginEdit
, MapUnit::MapTwip
) );
1017 m_aBspWin
.SetLeft( GetCoreValue( *m_xLeftMarginEdit
, MapUnit::MapTwip
) );
1018 m_aBspWin
.SetRight( GetCoreValue( *m_xRightMarginEdit
, MapUnit::MapTwip
) );
1021 m_aBspWin
.SetUsage(PosToPageUsage_Impl(m_xLayoutBox
->get_active()));
1022 if ( bResetbackground
)
1023 m_aBspWin
.ResetBackground();
1024 m_aBspWin
.Invalidate();
1028 void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet
& rSet
)
1030 sal_uInt16
nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET
));
1032 if (SfxItemState::SET
== rSet
.GetItemState(nWhich
, false))
1034 const SvxSetItem
& rSetItem
= static_cast< const SvxSetItem
& >(rSet
.Get(nWhich
, false));
1035 const SfxItemSet
& rTmpSet
= rSetItem
.GetItemSet();
1036 const SfxBoolItem
& rOn
= static_cast< const SfxBoolItem
& >(rTmpSet
.Get(GetWhich(SID_ATTR_PAGE_ON
)));
1040 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes
;
1042 if(mbEnableDrawingLayerFillStyles
)
1044 // create FillAttributes directly from DrawingLayer FillStyle entries
1045 aHeaderFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet
));
1049 nWhich
= GetWhich(SID_ATTR_BRUSH
);
1051 if(SfxItemState::SET
== rTmpSet
.GetItemState(nWhich
))
1053 // create FillAttributes from SvxBrushItem
1054 const SvxBrushItem
& rItem
= static_cast< const SvxBrushItem
& >(rTmpSet
.Get(nWhich
));
1055 SfxItemSet
aTempSet(*rTmpSet
.GetPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{});
1057 setSvxBrushItemAsFillAttributesToTargetSet(rItem
, aTempSet
);
1058 aHeaderFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet
));
1062 m_aBspWin
.setHeaderFillAttributes(aHeaderFillAttributes
);
1066 nWhich
= GetWhich(SID_ATTR_PAGE_FOOTERSET
);
1068 if (SfxItemState::SET
== rSet
.GetItemState(nWhich
, false))
1070 const SvxSetItem
& rSetItem
= static_cast< const SvxSetItem
& >(rSet
.Get(nWhich
,false));
1071 const SfxItemSet
& rTmpSet
= rSetItem
.GetItemSet();
1072 const SfxBoolItem
& rOn
= static_cast< const SfxBoolItem
& >(rTmpSet
.Get(GetWhich(SID_ATTR_PAGE_ON
)));
1076 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes
;
1078 if(mbEnableDrawingLayerFillStyles
)
1080 // create FillAttributes directly from DrawingLayer FillStyle entries
1081 aFooterFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet
));
1085 nWhich
= GetWhich(SID_ATTR_BRUSH
);
1087 if(SfxItemState::SET
== rTmpSet
.GetItemState(nWhich
))
1089 // create FillAttributes from SvxBrushItem
1090 const SvxBrushItem
& rItem
= static_cast< const SvxBrushItem
& >(rTmpSet
.Get(nWhich
));
1091 SfxItemSet
aTempSet(*rTmpSet
.GetPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{});
1093 setSvxBrushItemAsFillAttributesToTargetSet(rItem
, aTempSet
);
1094 aFooterFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet
));
1098 m_aBspWin
.setFooterFillAttributes(aFooterFillAttributes
);
1102 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes
;
1103 const SfxPoolItem
* pItem
= nullptr;
1105 if(mbEnableDrawingLayerFillStyles
)
1107 // create FillAttributes directly from DrawingLayer FillStyle entries
1108 aPageFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet
));
1112 pItem
= GetItem(rSet
, SID_ATTR_BRUSH
);
1116 // create FillAttributes from SvxBrushItem
1117 const SvxBrushItem
& rItem
= static_cast< const SvxBrushItem
& >(*pItem
);
1118 SfxItemSet
aTempSet(*rSet
.GetPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{});
1120 setSvxBrushItemAsFillAttributesToTargetSet(rItem
, aTempSet
);
1121 aPageFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet
));
1125 m_aBspWin
.setPageFillAttributes(aPageFillAttributes
);
1128 void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet
& rSet
)
1130 bLandscape
= m_xLandscapeBtn
->get_active();
1131 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_PAGE_SIZE
);
1134 m_aBspWin
.SetSize( static_cast<const SvxSizeItem
*>(pItem
)->GetSize() );
1136 const SvxSetItem
* pSetItem
= nullptr;
1138 // evaluate header attributes
1140 if ( SfxItemState::SET
==
1141 rSet
.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET
),
1142 false, reinterpret_cast<const SfxPoolItem
**>(&pSetItem
) ) )
1144 const SfxItemSet
& rHeaderSet
= pSetItem
->GetItemSet();
1145 const SfxBoolItem
& rHeaderOn
=
1146 static_cast<const SfxBoolItem
&>(rHeaderSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) ));
1148 if ( rHeaderOn
.GetValue() )
1150 const SvxSizeItem
& rSize
= static_cast<const SvxSizeItem
&>(
1151 rHeaderSet
.Get( GetWhich( SID_ATTR_PAGE_SIZE
) ));
1152 const SvxULSpaceItem
& rUL
= static_cast<const SvxULSpaceItem
&>(
1153 rHeaderSet
.Get( GetWhich( SID_ATTR_ULSPACE
) ));
1154 long nDist
= rUL
.GetLower();
1155 m_aBspWin
.SetHdHeight( rSize
.GetSize().Height() - nDist
);
1156 m_aBspWin
.SetHdDist( nDist
);
1157 const SvxLRSpaceItem
& rLR
= static_cast<const SvxLRSpaceItem
&>(
1158 rHeaderSet
.Get( GetWhich( SID_ATTR_LRSPACE
) ));
1159 m_aBspWin
.SetHdLeft( rLR
.GetLeft() );
1160 m_aBspWin
.SetHdRight( rLR
.GetRight() );
1161 m_aBspWin
.SetHeader( true );
1164 m_aBspWin
.SetHeader( false );
1166 // show background and border in the example
1167 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes
;
1169 if(mbEnableDrawingLayerFillStyles
)
1171 // create FillAttributes directly from DrawingLayer FillStyle entries
1172 aHeaderFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet
));
1176 const sal_uInt16
nWhich(GetWhich(SID_ATTR_BRUSH
));
1178 if(rHeaderSet
.GetItemState(nWhich
) >= SfxItemState::DEFAULT
)
1180 // aBspWin.SetHdColor(rItem.GetColor());
1181 const SvxBrushItem
& rItem
= static_cast< const SvxBrushItem
& >(rHeaderSet
.Get(nWhich
));
1182 SfxItemSet
aTempSet(*rHeaderSet
.GetPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{});
1184 setSvxBrushItemAsFillAttributesToTargetSet(rItem
, aTempSet
);
1185 aHeaderFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet
));
1189 m_aBspWin
.setHeaderFillAttributes(aHeaderFillAttributes
);
1192 // evaluate footer attributes
1194 if ( SfxItemState::SET
==
1195 rSet
.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET
),
1196 false, reinterpret_cast<const SfxPoolItem
**>(&pSetItem
) ) )
1198 const SfxItemSet
& rFooterSet
= pSetItem
->GetItemSet();
1199 const SfxBoolItem
& rFooterOn
=
1200 static_cast<const SfxBoolItem
&>(rFooterSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) ));
1202 if ( rFooterOn
.GetValue() )
1204 const SvxSizeItem
& rSize
= static_cast<const SvxSizeItem
&>(
1205 rFooterSet
.Get( GetWhich( SID_ATTR_PAGE_SIZE
) ));
1206 const SvxULSpaceItem
& rUL
= static_cast<const SvxULSpaceItem
&>(
1207 rFooterSet
.Get( GetWhich( SID_ATTR_ULSPACE
) ));
1208 long nDist
= rUL
.GetUpper();
1209 m_aBspWin
.SetFtHeight( rSize
.GetSize().Height() - nDist
);
1210 m_aBspWin
.SetFtDist( nDist
);
1211 const SvxLRSpaceItem
& rLR
= static_cast<const SvxLRSpaceItem
&>(
1212 rFooterSet
.Get( GetWhich( SID_ATTR_LRSPACE
) ));
1213 m_aBspWin
.SetFtLeft( rLR
.GetLeft() );
1214 m_aBspWin
.SetFtRight( rLR
.GetRight() );
1215 m_aBspWin
.SetFooter( true );
1218 m_aBspWin
.SetFooter( false );
1220 // show background and border in the example
1221 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes
;
1223 if(mbEnableDrawingLayerFillStyles
)
1225 // create FillAttributes directly from DrawingLayer FillStyle entries
1226 aFooterFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet
));
1230 const sal_uInt16
nWhich(GetWhich(SID_ATTR_BRUSH
));
1232 if(rFooterSet
.GetItemState(nWhich
) >= SfxItemState::DEFAULT
)
1234 // aBspWin.SetFtColor(rItem.GetColor());
1235 const SvxBrushItem
& rItem
= static_cast<const SvxBrushItem
&>(rFooterSet
.Get(nWhich
));
1236 SfxItemSet
aTempSet(*rFooterSet
.GetPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{});
1238 setSvxBrushItemAsFillAttributesToTargetSet(rItem
, aTempSet
);
1239 aFooterFillAttributes
.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet
));
1243 m_aBspWin
.setFooterFillAttributes(aFooterFillAttributes
);
1247 void SvxPageDescPage::ActivatePage( const SfxItemSet
& rSet
)
1249 InitHeadFoot_Impl( rSet
);
1250 UpdateExample_Impl();
1251 ResetBackground_Impl( rSet
);
1255 DeactivateRC
SvxPageDescPage::DeactivatePage( SfxItemSet
* _pSet
)
1257 // Inquiry whether the page margins are beyond the printing area.
1258 // If not, ask user whether they shall be taken.
1259 // If not, stay on the TabPage.
1260 Paper ePaper
= m_xPaperSizeBox
->GetSelection();
1262 if ( ePaper
!= PAPER_SCREEN_4_3
&& ePaper
!= PAPER_SCREEN_16_9
&& ePaper
!= PAPER_SCREEN_16_10
&& IsMarginOutOfRange() )
1264 std::unique_ptr
<weld::MessageDialog
> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
1265 VclMessageType::Question
, VclButtonsType::YesNo
,
1266 m_xPrintRangeQueryText
->get_label()));
1267 xQueryBox
->set_default_response(RET_NO
);
1268 if (xQueryBox
->run() == RET_NO
)
1270 weld::MetricSpinButton
* pField
= nullptr;
1271 if ( IsPrinterRangeOverflow( *m_xLeftMarginEdit
, nFirstLeftMargin
, nLastLeftMargin
, MARGIN_LEFT
) )
1272 pField
= m_xLeftMarginEdit
.get();
1273 if ( IsPrinterRangeOverflow( *m_xRightMarginEdit
, nFirstRightMargin
, nLastRightMargin
, MARGIN_RIGHT
)
1275 pField
= m_xRightMarginEdit
.get();
1276 if ( IsPrinterRangeOverflow( *m_xTopMarginEdit
, nFirstTopMargin
, nLastTopMargin
, MARGIN_TOP
)
1278 pField
= m_xTopMarginEdit
.get();
1279 if ( IsPrinterRangeOverflow( *m_xBottomMarginEdit
, nFirstBottomMargin
, nLastBottomMargin
, MARGIN_BOTTOM
)
1281 pField
= m_xBottomMarginEdit
.get();
1283 pField
->grab_focus();
1284 UpdateExample_Impl();
1285 return DeactivateRC::KeepPage
;
1288 CheckMarginEdits( false );
1293 FillItemSet( _pSet
);
1295 // put portray/landscape if applicable
1296 sal_uInt16 nWh
= GetWhich( SID_ATTR_PAGE_SIZE
);
1297 MapUnit eUnit
= GetItemSet().GetPool()->GetMetric( nWh
);
1298 Size
aSize( GetCoreValue( *m_xPaperWidthEdit
, eUnit
),
1299 GetCoreValue( *m_xPaperHeightEdit
, eUnit
) );
1301 // put, if current size is different to the value in _pSet
1302 const SvxSizeItem
* pSize
= GetItem( *_pSet
, SID_ATTR_PAGE_SIZE
);
1303 if ( aSize
.Width() && ( !pSize
|| !IsEqualSize_Impl( pSize
, aSize
) ) )
1304 _pSet
->Put( SvxSizeItem( nWh
, aSize
) );
1307 return DeactivateRC::LeavePage
;
1310 void SvxPageDescPage::RangeHdl_Impl()
1313 long nHHeight
= m_aBspWin
.GetHdHeight();
1314 long nHDist
= m_aBspWin
.GetHdDist();
1316 long nFHeight
= m_aBspWin
.GetFtHeight();
1317 long nFDist
= m_aBspWin
.GetFtDist();
1319 long nHFLeft
= std::max(m_aBspWin
.GetHdLeft(), m_aBspWin
.GetFtLeft());
1320 long nHFRight
= std::max(m_aBspWin
.GetHdRight(), m_aBspWin
.GetFtRight());
1322 // current values for page margins
1323 long nBT
= static_cast<long>(m_xTopMarginEdit
->denormalize(m_xTopMarginEdit
->get_value(FieldUnit::TWIP
)));
1324 long nBB
= static_cast<long>(m_xBottomMarginEdit
->denormalize(m_xBottomMarginEdit
->get_value(FieldUnit::TWIP
)));
1325 long nBL
= static_cast<long>(m_xLeftMarginEdit
->denormalize(m_xLeftMarginEdit
->get_value(FieldUnit::TWIP
)));
1326 long nBR
= static_cast<long>(m_xRightMarginEdit
->denormalize(m_xRightMarginEdit
->get_value(FieldUnit::TWIP
)));
1328 // calculate width of page border
1329 const SfxItemSet
* _pSet
= &GetItemSet();
1332 if ( _pSet
->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW
) ) >=
1333 SfxItemState::DEFAULT
&&
1334 _pSet
->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER
) ) >=
1335 SfxItemState::DEFAULT
)
1337 aBorder
= GetMinBorderSpace_Impl(
1338 static_cast<const SvxShadowItem
&>(_pSet
->Get(GetWhich(SID_ATTR_BORDER_SHADOW
))),
1339 static_cast<const SvxBoxItem
&>(_pSet
->Get(GetWhich(SID_ATTR_BORDER_OUTER
))));
1345 long nMin
= nHHeight
+ nHDist
+ nFDist
+ nFHeight
+ nBT
+ nBB
+
1346 MINBODY
+ aBorder
.Height();
1347 m_xPaperHeightEdit
->set_min(m_xPaperHeightEdit
->normalize(nMin
), FieldUnit::TWIP
);
1349 nMin
= MINBODY
+ nBL
+ nBR
+ aBorder
.Width();
1350 m_xPaperWidthEdit
->set_min(m_xPaperWidthEdit
->normalize(nMin
), FieldUnit::TWIP
);
1352 long nH
= static_cast<long>(m_xPaperHeightEdit
->denormalize(m_xPaperHeightEdit
->get_value(FieldUnit::TWIP
)));
1353 long nW
= static_cast<long>(m_xPaperWidthEdit
->denormalize(m_xPaperWidthEdit
->get_value(FieldUnit::TWIP
)));
1356 long nMax
= nH
- nBB
- aBorder
.Height() - MINBODY
-
1357 nFDist
- nFHeight
- nHDist
- nHHeight
;
1359 m_xTopMarginEdit
->set_max(m_xTopMarginEdit
->normalize(nMax
), FieldUnit::TWIP
);
1362 nMax
= nH
- nBT
- aBorder
.Height() - MINBODY
-
1363 nFDist
- nFHeight
- nHDist
- nHHeight
;
1365 m_xBottomMarginEdit
->set_max(m_xTopMarginEdit
->normalize(nMax
), FieldUnit::TWIP
);
1368 nMax
= nW
- nBR
- MINBODY
- aBorder
.Width() - nHFLeft
- nHFRight
;
1369 m_xLeftMarginEdit
->set_max(m_xLeftMarginEdit
->normalize(nMax
), FieldUnit::TWIP
);
1372 nMax
= nW
- nBL
- MINBODY
- aBorder
.Width() - nHFLeft
- nHFRight
;
1373 m_xRightMarginEdit
->set_max(m_xRightMarginEdit
->normalize(nMax
), FieldUnit::TWIP
);
1376 void SvxPageDescPage::CalcMargin_Impl()
1378 // current values for page margins
1379 long nBT
= GetCoreValue( *m_xTopMarginEdit
, MapUnit::MapTwip
);
1380 long nBB
= GetCoreValue( *m_xBottomMarginEdit
, MapUnit::MapTwip
);
1382 long nBL
= GetCoreValue( *m_xLeftMarginEdit
, MapUnit::MapTwip
);
1383 long nBR
= GetCoreValue( *m_xRightMarginEdit
, MapUnit::MapTwip
);
1385 long nH
= GetCoreValue( *m_xPaperHeightEdit
, MapUnit::MapTwip
);
1386 long nW
= GetCoreValue( *m_xPaperWidthEdit
, MapUnit::MapTwip
);
1388 long nWidth
= nBL
+ nBR
+ MINBODY
;
1389 long nHeight
= nBT
+ nBB
+ MINBODY
;
1391 if ( nWidth
> nW
|| nHeight
> nH
)
1395 long nTmp
= nBL
<= nBR
? nBR
: nBL
;
1396 nTmp
-= nWidth
- nW
;
1399 SetMetricValue( *m_xRightMarginEdit
, nTmp
, MapUnit::MapTwip
);
1401 SetMetricValue( *m_xLeftMarginEdit
, nTmp
, MapUnit::MapTwip
);
1406 long nTmp
= nBT
<= nBB
? nBB
: nBT
;
1407 nTmp
-= nHeight
- nH
;
1410 SetMetricValue( *m_xBottomMarginEdit
, nTmp
, MapUnit::MapTwip
);
1412 SetMetricValue( *m_xTopMarginEdit
, nTmp
, MapUnit::MapTwip
);
1417 IMPL_LINK_NOARG(SvxPageDescPage
, CenterHdl_Impl
, weld::ToggleButton
&, void)
1419 m_aBspWin
.SetHorz(m_xHorzBox
->get_active());
1420 m_aBspWin
.SetVert(m_xVertBox
->get_active());
1421 UpdateExample_Impl();
1424 void SvxPageDescPage::SetCollectionList(const std::vector
<OUString
> &aList
)
1426 OSL_ENSURE(!aList
.empty(), "Empty string list");
1428 sStandardRegister
= aList
[0];
1429 m_xRegisterLB
->freeze();
1430 for (size_t i
= 1; i
< aList
.size(); ++i
)
1431 m_xRegisterLB
->append_text(aList
[i
]);
1432 m_xRegisterLB
->thaw();
1434 m_xRegisterCB
->show();
1435 m_xRegisterFT
->show();
1436 m_xRegisterLB
->show();
1437 m_xRegisterCB
->connect_toggled(LINK(this, SvxPageDescPage
, RegisterModify
));
1440 IMPL_LINK(SvxPageDescPage
, RegisterModify
, weld::ToggleButton
&, rBox
, void)
1442 bool bEnable
= false;
1443 if (rBox
.get_active())
1446 if (m_xRegisterLB
->get_active() == -1)
1447 m_xRegisterLB
->set_active_text(sStandardRegister
);
1449 m_xRegisterFT
->set_sensitive(bEnable
);
1450 m_xRegisterLB
->set_sensitive(bEnable
);
1453 void SvxPageDescPage::DisableVerticalPageDir()
1455 m_xTextFlowBox
->remove_id(SvxFrameDirection::Vertical_RL_TB
);
1456 m_xTextFlowBox
->remove_id(SvxFrameDirection::Vertical_LR_TB
);
1457 if (m_xTextFlowBox
->get_count() < 2)
1459 m_xTextFlowLbl
->hide();
1460 m_xTextFlowBox
->hide();
1461 m_aBspWin
.EnableFrameDirection( false );
1465 IMPL_LINK_NOARG(SvxPageDescPage
, FrameDirectionModify_Impl
, weld::ComboBox
&, void)
1467 m_aBspWin
.SetFrameDirection(m_xTextFlowBox
->get_active_id());
1468 m_aBspWin
.Invalidate();
1471 bool SvxPageDescPage::IsPrinterRangeOverflow(
1472 weld::MetricSpinButton
& rField
, long nFirstMargin
, long nLastMargin
, MarginPosition nPos
)
1475 bool bCheck
= ( ( m_nPos
& nPos
) == 0 );
1476 long nValue
= rField
.get_value(FieldUnit::NONE
);
1478 ( nValue
< nFirstMargin
|| nValue
> nLastMargin
) &&
1479 rField
.get_value_changed_from_saved() )
1481 rField
.set_value(nValue
< nFirstMargin
? nFirstMargin
: nLastMargin
, FieldUnit::NONE
);
1488 /** Check if a value of a margin edit is outside the printer paper margins
1489 and save this information.
1491 void SvxPageDescPage::CheckMarginEdits( bool _bClear
)
1496 sal_Int64 nValue
= m_xLeftMarginEdit
->get_value(FieldUnit::NONE
);
1497 if ( nValue
< nFirstLeftMargin
|| nValue
> nLastLeftMargin
)
1498 m_nPos
|= MARGIN_LEFT
;
1499 nValue
= m_xRightMarginEdit
->get_value(FieldUnit::NONE
);
1500 if ( nValue
< nFirstRightMargin
|| nValue
> nLastRightMargin
)
1501 m_nPos
|= MARGIN_RIGHT
;
1502 nValue
= m_xTopMarginEdit
->get_value(FieldUnit::NONE
);
1503 if ( nValue
< nFirstTopMargin
|| nValue
> nLastTopMargin
)
1504 m_nPos
|= MARGIN_TOP
;
1505 nValue
= m_xBottomMarginEdit
->get_value(FieldUnit::NONE
);
1506 if ( nValue
< nFirstBottomMargin
|| nValue
> nLastBottomMargin
)
1507 m_nPos
|= MARGIN_BOTTOM
;
1510 bool SvxPageDescPage::IsMarginOutOfRange()
1512 bool bRet
= ( ( ( !( m_nPos
& MARGIN_LEFT
) &&
1513 m_xLeftMarginEdit
->get_value_changed_from_saved() ) &&
1514 ( m_xLeftMarginEdit
->get_value(FieldUnit::NONE
) < nFirstLeftMargin
||
1515 m_xLeftMarginEdit
->get_value(FieldUnit::NONE
) > nLastLeftMargin
) ) ||
1516 ( ( !( m_nPos
& MARGIN_RIGHT
) &&
1517 m_xRightMarginEdit
->get_value_changed_from_saved() ) &&
1518 ( m_xRightMarginEdit
->get_value(FieldUnit::NONE
) < nFirstRightMargin
||
1519 m_xRightMarginEdit
->get_value(FieldUnit::NONE
) > nLastRightMargin
) ) ||
1520 ( ( !( m_nPos
& MARGIN_TOP
) &&
1521 m_xTopMarginEdit
->get_value_changed_from_saved() ) &&
1522 ( m_xTopMarginEdit
->get_value(FieldUnit::NONE
) < nFirstTopMargin
||
1523 m_xTopMarginEdit
->get_value(FieldUnit::NONE
) > nLastTopMargin
) ) ||
1524 ( ( !( m_nPos
& MARGIN_BOTTOM
) &&
1525 m_xBottomMarginEdit
->get_value_changed_from_saved() ) &&
1526 ( m_xBottomMarginEdit
->get_value(FieldUnit::NONE
) < nFirstBottomMargin
||
1527 m_xBottomMarginEdit
->get_value(FieldUnit::NONE
) > nLastBottomMargin
) ) );
1531 void SvxPageDescPage::PageCreated(const SfxAllItemSet
& aSet
)
1533 const SfxAllEnumItem
* pModeItem
= aSet
.GetItem
<SfxAllEnumItem
>(SID_ENUM_PAGE_MODE
, false);
1534 const SfxAllEnumItem
* pPaperStartItem
= aSet
.GetItem
<SfxAllEnumItem
>(SID_PAPER_START
, false);
1535 const SfxAllEnumItem
* pPaperEndItem
= aSet
.GetItem
<SfxAllEnumItem
>(SID_PAPER_END
, false);
1536 const SfxStringListItem
* pCollectListItem
= aSet
.GetItem
<SfxStringListItem
>(SID_COLLECT_LIST
, false);
1537 const SfxBoolItem
* pSupportDrawingLayerFillStyleItem
= aSet
.GetItem
<SfxBoolItem
>(SID_DRAWINGLAYER_FILLSTYLES
, false);
1541 eMode
= static_cast<SvxModeType
>(pModeItem
->GetEnumValue());
1544 if(pPaperStartItem
&& pPaperEndItem
)
1546 SetPaperFormatRanges(static_cast<Paper
>(pPaperStartItem
->GetEnumValue()));
1549 if(pCollectListItem
)
1551 SetCollectionList(pCollectListItem
->GetList());
1554 if(pSupportDrawingLayerFillStyleItem
)
1556 const bool bNew(pSupportDrawingLayerFillStyleItem
->GetValue());
1558 mbEnableDrawingLayerFillStyles
= bNew
;
1562 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */