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 .
20 #include <sfx2/app.hxx>
21 #include <sfx2/objsh.hxx>
22 #include <tools/resary.hxx>
23 #include <vcl/graph.hxx>
24 #include <sfx2/viewsh.hxx>
25 #include <svl/itemiter.hxx>
26 #include <svl/languageoptions.hxx>
27 #include <vcl/msgbox.hxx>
28 #include <unotools/configitem.hxx>
29 #include <sfx2/htmlmode.hxx>
30 #include <sal/macros.h>
35 #include <svx/pageitem.hxx>
36 #include <editeng/brushitem.hxx>
37 #include <editeng/boxitem.hxx>
38 #include <editeng/shaditem.hxx>
39 #include <editeng/pbinitem.hxx>
40 #include <editeng/lrspitem.hxx>
41 #include <editeng/ulspitem.hxx>
42 #include <editeng/sizeitem.hxx>
43 #include <editeng/frmdiritem.hxx>
44 #include "svx/dlgutil.hxx"
45 #include <editeng/paperinf.hxx>
46 #include <dialmgr.hxx>
47 #include <sfx2/module.hxx>
48 #include <svl/stritem.hxx>
49 #include <svx/dialogs.hrc>
50 #include <editeng/eerdll.hxx>
51 #include <editeng/editrids.hrc>
52 #include <svx/svxids.hrc>
53 #include <svtools/optionsdrawinglayer.hxx>
54 #include <svl/slstitm.hxx>
55 #include <svl/aeitem.hxx>
56 #include <sfx2/request.hxx>
58 #include <numpages.hxx>
60 // static ----------------------------------------------------------------
62 static const long MINBODY
= 284; // 0,5 cm rounded up in twips
63 //static const long PRINT_OFFSET = 17; // 0,03 cm rounded down in twips
64 static const long PRINT_OFFSET
= 0; // why was this ever set to 17 ? it led to wrong right and bottom margins.
66 static const sal_uInt16 pRanges
[] =
68 SID_ATTR_BORDER_OUTER
,
69 SID_ATTR_BORDER_SHADOW
,
72 SID_SWREGISTER_COLLECTION
,
76 // ------- Mapping page layout ------------------------------------------
78 const sal_uInt16 aArr
[] =
88 sal_uInt16
PageUsageToPos_Impl( sal_uInt16 nUsage
)
90 for ( sal_uInt16 i
= 0; i
< SAL_N_ELEMENTS(aArr
); ++i
)
91 if ( aArr
[i
] == ( nUsage
& 0x000f ) )
98 sal_uInt16
PosToPageUsage_Impl( sal_uInt16 nPos
)
100 if ( nPos
>= SAL_N_ELEMENTS(aArr
) )
107 Size
GetMinBorderSpace_Impl( const SvxShadowItem
& rShadow
, const SvxBoxItem
& rBox
)
110 aSz
.Height() = rShadow
.CalcShadowSpace( SHADOW_BOTTOM
) + rBox
.CalcLineSpace( BOX_LINE_BOTTOM
);
111 aSz
.Height() += rShadow
.CalcShadowSpace( SHADOW_TOP
) + rBox
.CalcLineSpace( BOX_LINE_TOP
);
112 aSz
.Width() = rShadow
.CalcShadowSpace( SHADOW_LEFT
) + rBox
.CalcLineSpace( BOX_LINE_LEFT
);
113 aSz
.Width() += rShadow
.CalcShadowSpace( SHADOW_RIGHT
) + rBox
.CalcLineSpace( BOX_LINE_RIGHT
);
119 long ConvertLong_Impl( const long nIn
, SfxMapUnit eUnit
)
121 return OutputDevice::LogicToLogic( nIn
, (MapUnit
)eUnit
, MAP_TWIP
);
124 bool IsEqualSize_Impl( const SvxSizeItem
* pSize
, const Size
& rSize
)
128 Size aSize
= pSize
->GetSize();
129 long nDiffW
= std::abs( rSize
.Width () - aSize
.Width () );
130 long nDiffH
= std::abs( rSize
.Height() - aSize
.Height() );
131 return ( nDiffW
< 10 && nDiffH
< 10 );
139 #define MARGIN_LEFT ( (MarginPosition)0x0001 )
140 #define MARGIN_RIGHT ( (MarginPosition)0x0002 )
141 #define MARGIN_TOP ( (MarginPosition)0x0004 )
142 #define MARGIN_BOTTOM ( (MarginPosition)0x0008 )
146 MarginPosition m_nPos
;
147 Printer
* mpDefPrinter
;
153 mbDelPrinter( false ) {}
155 ~SvxPage_Impl() { if ( mbDelPrinter
) delete mpDefPrinter
; }
158 // class SvxPageDescPage --------------------------------------------------
160 // returns the range of the Which values
161 const sal_uInt16
* SvxPageDescPage::GetRanges()
168 SfxTabPage
* SvxPageDescPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
170 return new SvxPageDescPage( pParent
, rSet
);
175 SvxPageDescPage::SvxPageDescPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
177 SfxTabPage( pParent
, "PageFormatPage", "cui/ui/pageformatpage.ui", rAttr
),
179 bLandscape ( false ),
180 eMode ( SVX_PAGE_MODE_STANDARD
),
181 ePaperStart ( PAPER_A3
),
182 ePaperEnd ( PAPER_ENV_DL
),
183 pImpl ( new SvxPage_Impl
)
186 get(m_pPaperSizeBox
,"comboPageFormat");
187 get(m_pPaperWidthEdit
,"spinWidth");
188 get(m_pPaperHeightEdit
,"spinHeight");
190 get(m_pOrientationFT
,"labelOrientation");
191 get(m_pPortraitBtn
,"radiobuttonPortrait");
192 get(m_pLandscapeBtn
,"radiobuttonLandscape");
194 get(m_pBspWin
,"drawingareaPageDirection");
195 get(m_pTextFlowLbl
,"labelTextFlow");
196 get(m_pTextFlowBox
,"comboTextFlowBox");
197 get(m_pPaperTrayBox
,"comboPaperTray");
199 get(m_pLeftMarginLbl
,"labelLeftMargin");
200 get(m_pLeftMarginEdit
,"spinMargLeft");
201 get(m_pRightMarginLbl
,"labelRightMargin");
202 get(m_pRightMarginEdit
,"spinMargRight");
204 get(m_pTopMarginEdit
,"spinMargTop");
206 get(m_pBottomMarginEdit
,"spinMargBot");
208 get(m_pPageText
,"labelPageLayout");
209 get(m_pLayoutBox
,"comboPageLayout");
210 get(m_pNumberFormatBox
,"comboLayoutFormat");
212 get(m_pRegisterCB
,"checkRegisterTrue");
213 get(m_pRegisterFT
,"labelRegisterStyle");
214 get(m_pRegisterLB
,"comboRegisterStyle");
216 get(m_pTblAlignFT
,"labelTblAlign");
217 get(m_pHorzBox
,"checkbuttonHorz");
218 get(m_pVertBox
,"checkbuttonVert");
220 get(m_pAdaptBox
,"checkAdaptBox");
221 // Strings stored in UI
222 get(m_pInsideLbl
,"labelInner");
223 get(m_pOutsideLbl
,"labelOuter");
224 get(m_pPrintRangeQueryText
,"labelMsg");
226 bBorderModified
= false;
227 m_pBspWin
->EnableRTL( false );
229 // this page needs ExchangeSupport
230 SetExchangeSupport();
232 SvtLanguageOptions aLangOptions
;
233 bool bCJK
= aLangOptions
.IsAsianTypographyEnabled();
234 bool bCTL
= aLangOptions
.IsCTLFontEnabled();
236 const SfxPoolItem
* pItem
;
238 SfxObjectShell
* pShell
;
239 if(SFX_ITEM_SET
== rAttr
.GetItemState(SID_HTML_MODE
, false, &pItem
) ||
240 ( 0 != (pShell
= SfxObjectShell::Current()) &&
241 0 != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
242 bWeb
= 0 != (((const SfxUInt16Item
*)pItem
)->GetValue() & HTMLMODE_ON
);
244 // fill text flow listbox with valid entries
246 m_pTextFlowBox
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI
), FRMDIR_HORI_LEFT_TOP
);
250 m_pTextFlowBox
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI
), FRMDIR_HORI_RIGHT_TOP
);
253 // #109989# do not show vertical directions in Writer/Web
258 m_pTextFlowBox
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT
), FRMDIR_VERT_TOP_RIGHT
);
259 // m_pTextFlowBox->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT );
263 // #109989# show the text direction box in Writer/Web too
264 if( (bCJK
|| bCTL
) &&
265 SFX_ITEM_UNKNOWN
< rAttr
.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION
)))
267 m_pTextFlowLbl
->Show();
268 m_pTextFlowBox
->Show();
269 m_pTextFlowBox
->SetSelectHdl(LINK(this, SvxPageDescPage
, FrameDirectionModify_Impl
));
271 m_pBspWin
->EnableFrameDirection(true);
275 FieldUnit eFUnit
= GetModuleFieldUnit( rAttr
);
276 SetFieldUnit( *m_pLeftMarginEdit
, eFUnit
);
277 SetFieldUnit( *m_pRightMarginEdit
, eFUnit
);
278 SetFieldUnit( *m_pTopMarginEdit
, eFUnit
);
279 SetFieldUnit( *m_pBottomMarginEdit
, eFUnit
);
280 SetFieldUnit( *m_pPaperWidthEdit
, eFUnit
);
281 SetFieldUnit( *m_pPaperHeightEdit
, eFUnit
);
283 if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
284 pImpl
->mpDefPrinter
= (Printer
*)SfxViewShell::Current()->GetPrinter();
287 pImpl
->mpDefPrinter
= new Printer
;
288 pImpl
->mbDelPrinter
= true;
291 MapMode aOldMode
= pImpl
->mpDefPrinter
->GetMapMode();
292 pImpl
->mpDefPrinter
->SetMapMode( MAP_TWIP
);
294 // set first- and last-values for the margins
295 Size aPaperSize
= pImpl
->mpDefPrinter
->GetPaperSize();
296 Size aPrintSize
= pImpl
->mpDefPrinter
->GetOutputSize();
298 * To convert a point ( 0,0 ) into logic coordinates
299 * looks like nonsense; but it makes sense when the
300 * coordinate system's origin has been moved.
302 Point aPrintOffset
= pImpl
->mpDefPrinter
->GetPageOffset() -
303 pImpl
->mpDefPrinter
->PixelToLogic( Point() );
304 pImpl
->mpDefPrinter
->SetMapMode( aOldMode
);
306 long nOffset
= !aPrintOffset
.X() && !aPrintOffset
.Y() ? 0 : PRINT_OFFSET
;
307 m_pLeftMarginEdit
->SetFirst( m_pLeftMarginEdit
->Normalize( aPrintOffset
.X() ), FUNIT_TWIP
);
308 nFirstLeftMargin
= static_cast<long>(m_pLeftMarginEdit
->GetFirst());
310 m_pRightMarginEdit
->SetFirst( m_pRightMarginEdit
->Normalize( aPaperSize
.Width() - aPrintSize
.Width() - aPrintOffset
.X() + nOffset
), FUNIT_TWIP
);
311 nFirstRightMargin
= static_cast<long>(m_pRightMarginEdit
->GetFirst());
313 m_pTopMarginEdit
->SetFirst( m_pTopMarginEdit
->Normalize( aPrintOffset
.Y() ), FUNIT_TWIP
);
314 nFirstTopMargin
= static_cast<long>(m_pTopMarginEdit
->GetFirst());
316 m_pBottomMarginEdit
->SetFirst( m_pBottomMarginEdit
->Normalize( aPaperSize
.Height() - aPrintSize
.Height() - aPrintOffset
.Y() + nOffset
), FUNIT_TWIP
);
317 nFirstBottomMargin
= static_cast<long>(m_pBottomMarginEdit
->GetFirst());
319 m_pLeftMarginEdit
->SetLast( m_pLeftMarginEdit
->Normalize( aPrintOffset
.X() + aPrintSize
.Width() ), FUNIT_TWIP
);
320 nLastLeftMargin
= static_cast<long>(m_pLeftMarginEdit
->GetLast());
322 m_pRightMarginEdit
->SetLast( m_pRightMarginEdit
->Normalize( aPrintOffset
.X() + aPrintSize
.Width() ), FUNIT_TWIP
);
323 nLastRightMargin
= static_cast<long>(m_pRightMarginEdit
->GetLast());
325 m_pTopMarginEdit
->SetLast( m_pTopMarginEdit
->Normalize( aPrintOffset
.Y() + aPrintSize
.Height() ), FUNIT_TWIP
);
326 nLastTopMargin
= static_cast<long>(m_pTopMarginEdit
->GetLast());
328 m_pBottomMarginEdit
->SetLast( m_pBottomMarginEdit
->Normalize( aPrintOffset
.Y() + aPrintSize
.Height() ), FUNIT_TWIP
);
329 nLastBottomMargin
= static_cast<long>(m_pBottomMarginEdit
->GetLast());
331 // #i4219# get DrawingLayer options
332 const SvtOptionsDrawinglayer aDrawinglayerOpt
;
334 // #i4219# take Maximum now from configuration (1/100th cm)
335 // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
336 m_pPaperWidthEdit
->SetMax(m_pPaperWidthEdit
->Normalize(aDrawinglayerOpt
.GetMaximumPaperWidth()), FUNIT_CM
);
337 m_pPaperWidthEdit
->SetLast(m_pPaperWidthEdit
->Normalize(aDrawinglayerOpt
.GetMaximumPaperWidth()), FUNIT_CM
);
338 m_pPaperHeightEdit
->SetMax(m_pPaperHeightEdit
->Normalize(aDrawinglayerOpt
.GetMaximumPaperHeight()), FUNIT_CM
);
339 m_pPaperHeightEdit
->SetLast(m_pPaperHeightEdit
->Normalize(aDrawinglayerOpt
.GetMaximumPaperHeight()), FUNIT_CM
);
341 // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
342 m_pLeftMarginEdit
->SetMax(aDrawinglayerOpt
.GetMaximumPaperLeftMargin());
343 m_pLeftMarginEdit
->SetLast(aDrawinglayerOpt
.GetMaximumPaperLeftMargin());
344 m_pRightMarginEdit
->SetMax(aDrawinglayerOpt
.GetMaximumPaperRightMargin());
345 m_pRightMarginEdit
->SetLast(aDrawinglayerOpt
.GetMaximumPaperRightMargin());
346 m_pTopMarginEdit
->SetMax(aDrawinglayerOpt
.GetMaximumPaperTopMargin());
347 m_pTopMarginEdit
->SetLast(aDrawinglayerOpt
.GetMaximumPaperTopMargin());
348 m_pBottomMarginEdit
->SetMax(aDrawinglayerOpt
.GetMaximumPaperBottomMargin());
349 m_pBottomMarginEdit
->SetLast(aDrawinglayerOpt
.GetMaximumPaperBottomMargin());
351 m_pPortraitBtn
->SetAccessibleRelationMemberOf(m_pOrientationFT
);
352 m_pLandscapeBtn
->SetAccessibleRelationMemberOf(m_pOrientationFT
);
354 // Get the i18n framework numberings and add them to the listbox.
355 SvxNumOptionsTabPage::GetI18nNumbering( *m_pNumberFormatBox
, ::std::numeric_limits
<sal_uInt16
>::max());
360 SvxPageDescPage::~SvxPageDescPage()
367 void SvxPageDescPage::Init_Impl()
369 // adjust the handler
370 m_pLayoutBox
->SetSelectHdl( LINK( this, SvxPageDescPage
, LayoutHdl_Impl
) );
371 m_pPaperSizeBox
->SetDropDownLineCount(10);
373 m_pPaperTrayBox
->SetGetFocusHdl( LINK( this, SvxPageDescPage
, PaperBinHdl_Impl
) );
374 m_pPaperSizeBox
->SetSelectHdl( LINK( this, SvxPageDescPage
, PaperSizeSelect_Impl
) );
375 m_pPaperWidthEdit
->SetModifyHdl( LINK( this, SvxPageDescPage
, PaperSizeModify_Impl
) );
376 m_pPaperHeightEdit
->SetModifyHdl( LINK( this, SvxPageDescPage
, PaperSizeModify_Impl
) );
377 m_pLandscapeBtn
->SetClickHdl( LINK( this, SvxPageDescPage
, SwapOrientation_Impl
) );
378 m_pPortraitBtn
->SetClickHdl( LINK( this, SvxPageDescPage
, SwapOrientation_Impl
) );
380 Link aLink
= LINK( this, SvxPageDescPage
, BorderModify_Impl
);
381 m_pLeftMarginEdit
->SetModifyHdl( aLink
);
382 m_pRightMarginEdit
->SetModifyHdl( aLink
);
383 m_pTopMarginEdit
->SetModifyHdl( aLink
);
384 m_pBottomMarginEdit
->SetModifyHdl( aLink
);
386 aLink
= LINK( this, SvxPageDescPage
, RangeHdl_Impl
);
387 m_pPaperWidthEdit
->SetLoseFocusHdl( aLink
);
388 m_pPaperHeightEdit
->SetLoseFocusHdl( aLink
);
389 m_pLeftMarginEdit
->SetLoseFocusHdl( aLink
);
390 m_pRightMarginEdit
->SetLoseFocusHdl( aLink
);
391 m_pTopMarginEdit
->SetLoseFocusHdl( aLink
);
392 m_pBottomMarginEdit
->SetLoseFocusHdl( aLink
);
394 m_pHorzBox
->SetClickHdl( LINK( this, SvxPageDescPage
, CenterHdl_Impl
) );
395 m_pVertBox
->SetClickHdl( LINK( this, SvxPageDescPage
, CenterHdl_Impl
) );
401 void SvxPageDescPage::Reset( const SfxItemSet
& rSet
)
403 SfxItemPool
* pPool
= rSet
.GetPool();
404 DBG_ASSERT( pPool
, "Wo ist der Pool" );
405 SfxMapUnit eUnit
= pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) );
407 // adjust margins (right/left)
408 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_LRSPACE
);
412 const SvxLRSpaceItem
& rLRSpace
= (const SvxLRSpaceItem
&)*pItem
;
413 SetMetricValue( *m_pLeftMarginEdit
, rLRSpace
.GetLeft(), eUnit
);
415 (sal_uInt16
)ConvertLong_Impl( (long)rLRSpace
.GetLeft(), eUnit
) );
416 SetMetricValue( *m_pRightMarginEdit
, rLRSpace
.GetRight(), eUnit
);
418 (sal_uInt16
)ConvertLong_Impl( (long)rLRSpace
.GetRight(), eUnit
) );
421 // adjust margins (top/bottom)
422 pItem
= GetItem( rSet
, SID_ATTR_ULSPACE
);
426 const SvxULSpaceItem
& rULSpace
= (const SvxULSpaceItem
&)*pItem
;
427 SetMetricValue( *m_pTopMarginEdit
, rULSpace
.GetUpper(), eUnit
);
429 (sal_uInt16
)ConvertLong_Impl( (long)rULSpace
.GetUpper(), eUnit
) );
430 SetMetricValue( *m_pBottomMarginEdit
, rULSpace
.GetLower(), eUnit
);
431 m_pBspWin
->SetBottom(
432 (sal_uInt16
)ConvertLong_Impl( (long)rULSpace
.GetLower(), eUnit
) );
436 SvxNumType eNumType
= SVX_ARABIC
;
437 bLandscape
= ( pImpl
->mpDefPrinter
->GetOrientation() == ORIENTATION_LANDSCAPE
);
438 sal_uInt16 nUse
= (sal_uInt16
)SVX_PAGE_ALL
;
439 pItem
= GetItem( rSet
, SID_ATTR_PAGE
);
443 const SvxPageItem
& rItem
= (const SvxPageItem
&)*pItem
;
444 eNumType
= rItem
.GetNumType();
445 nUse
= rItem
.GetPageUsage();
446 bLandscape
= rItem
.IsLandscape();
450 m_pLayoutBox
->SelectEntryPos( ::PageUsageToPos_Impl( nUse
) );
451 m_pBspWin
->SetUsage( nUse
);
454 //adjust numeration type of the page style
455 //Get the Position of the saved NumType
456 for(int i
=0; i
<m_pNumberFormatBox
->GetEntryCount(); i
++)
457 if(eNumType
== (sal_uInt16
)(sal_uLong
)m_pNumberFormatBox
->GetEntryData(i
)){
458 m_pNumberFormatBox
->SelectEntryPos( i
);
462 m_pPaperTrayBox
->Clear();
463 sal_uInt8 nPaperBin
= PAPERBIN_PRINTER_SETTINGS
;
464 pItem
= GetItem( rSet
, SID_ATTR_PAGE_PAPERBIN
);
468 nPaperBin
= ( (const SvxPaperBinItem
*)pItem
)->GetValue();
470 if ( nPaperBin
>= pImpl
->mpDefPrinter
->GetPaperBinCount() )
471 nPaperBin
= PAPERBIN_PRINTER_SETTINGS
;
476 if ( PAPERBIN_PRINTER_SETTINGS
== nPaperBin
)
477 aBinName
= EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS
);
479 aBinName
= pImpl
->mpDefPrinter
->GetPaperBinName( (sal_uInt16
)nPaperBin
);
481 sal_uInt16 nEntryPos
= m_pPaperTrayBox
->InsertEntry( aBinName
);
482 m_pPaperTrayBox
->SetEntryData( nEntryPos
, (void*)(sal_uLong
)nPaperBin
);
483 m_pPaperTrayBox
->SelectEntry( aBinName
);
485 Size aPaperSize
= SvxPaperInfo::GetPaperSize( pImpl
->mpDefPrinter
);
486 pItem
= GetItem( rSet
, SID_ATTR_PAGE_SIZE
);
489 aPaperSize
= ( (const SvxSizeItem
*)pItem
)->GetSize();
491 bool bOrientationSupport
=
492 pImpl
->mpDefPrinter
->HasSupport( SUPPORT_SET_ORIENTATION
);
494 if ( !bOrientationSupport
&&
495 aPaperSize
.Width() > aPaperSize
.Height() )
498 m_pLandscapeBtn
->Check( bLandscape
);
499 m_pPortraitBtn
->Check( !bLandscape
);
501 m_pBspWin
->SetSize( Size( ConvertLong_Impl( aPaperSize
.Width(), eUnit
),
502 ConvertLong_Impl( aPaperSize
.Height(), eUnit
) ) );
504 aPaperSize
= OutputDevice::LogicToLogic(aPaperSize
, (MapUnit
)eUnit
, MAP_100TH_MM
);
508 // Actual Paper Format
509 Paper ePaper
= SvxPaperInfo::GetSvxPaper( aPaperSize
, MAP_100TH_MM
, true );
511 if ( PAPER_USER
!= ePaper
)
512 aPaperSize
= SvxPaperInfo::GetPaperSize( ePaper
, MAP_100TH_MM
);
517 // write values into the edits
518 SetMetricValue( *m_pPaperHeightEdit
, aPaperSize
.Height(), SFX_MAPUNIT_100TH_MM
);
519 SetMetricValue( *m_pPaperWidthEdit
, aPaperSize
.Width(), SFX_MAPUNIT_100TH_MM
);
520 m_pPaperSizeBox
->Clear();
522 sal_Int32 nActPos
= LISTBOX_ENTRY_NOTFOUND
;
523 sal_uInt16 nAryId
= RID_SVXSTRARY_PAPERSIZE_STD
;
525 if ( ePaperStart
!= PAPER_A3
)
526 nAryId
= RID_SVXSTRARY_PAPERSIZE_DRAW
;
527 ResStringArray
aPaperAry( CUI_RES( nAryId
) );
528 sal_uInt32 nCnt
= aPaperAry
.Count();
530 sal_Int32 nUserPos
= LISTBOX_ENTRY_NOTFOUND
;
531 for ( sal_uInt32 i
= 0; i
< nCnt
; ++i
)
533 OUString aStr
= aPaperAry
.GetString(i
);
534 Paper eSize
= (Paper
)aPaperAry
.GetValue(i
);
535 sal_Int32 nPos
= m_pPaperSizeBox
->InsertEntry( aStr
);
536 m_pPaperSizeBox
->SetEntryData( nPos
, (void*)(sal_uLong
)eSize
);
538 if ( eSize
== ePaper
)
540 if( eSize
== PAPER_USER
)
543 // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead
544 m_pPaperSizeBox
->SelectEntryPos( nActPos
!= LISTBOX_ENTRY_NOTFOUND
? nActPos
: nUserPos
);
546 // application specific
550 case SVX_PAGE_MODE_CENTER
:
552 m_pTblAlignFT
->Show();
555 DisableVerticalPageDir();
557 // horizontal alignment
558 pItem
= GetItem( rSet
, SID_ATTR_PAGE_EXT1
);
559 m_pHorzBox
->Check( pItem
? ( (const SfxBoolItem
*)pItem
)->GetValue()
562 // vertical alignment
563 pItem
= GetItem( rSet
, SID_ATTR_PAGE_EXT2
);
564 m_pVertBox
->Check( pItem
? ( (const SfxBoolItem
*)pItem
)->GetValue()
567 // set example window on the table
568 m_pBspWin
->SetTable( true );
569 m_pBspWin
->SetHorz( m_pHorzBox
->IsChecked() );
570 m_pBspWin
->SetVert( m_pVertBox
->IsChecked() );
575 case SVX_PAGE_MODE_PRESENTATION
:
577 DisableVerticalPageDir();
579 pItem
= GetItem( rSet
, SID_ATTR_PAGE_EXT1
);
580 m_pAdaptBox
->Check( pItem
?
581 ( (const SfxBoolItem
*)pItem
)->GetValue() : sal_False
);
583 //!!! hidden, because not implemented by StarDraw
584 m_pLayoutBox
->Hide();
589 default: ;//prevent warning
593 // display background and border in the example
594 ResetBackground_Impl( rSet
);
595 //! UpdateExample_Impl();
598 InitHeadFoot_Impl( rSet
);
600 bBorderModified
= false;
601 SwapFirstValues_Impl( false );
602 UpdateExample_Impl();
604 m_pLeftMarginEdit
->SaveValue();
605 m_pRightMarginEdit
->SaveValue();
606 m_pTopMarginEdit
->SaveValue();
607 m_pBottomMarginEdit
->SaveValue();
608 m_pLayoutBox
->SaveValue();
609 m_pNumberFormatBox
->SaveValue();
610 m_pPaperSizeBox
->SaveValue();
611 m_pPaperWidthEdit
->SaveValue();
612 m_pPaperHeightEdit
->SaveValue();
613 m_pPortraitBtn
->SaveValue();
614 m_pLandscapeBtn
->SaveValue();
615 m_pPaperTrayBox
->SaveValue();
616 m_pVertBox
->SaveValue();
617 m_pHorzBox
->SaveValue();
618 m_pAdaptBox
->SaveValue();
620 CheckMarginEdits( true );
623 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_SWREGISTER_MODE
))
625 m_pRegisterCB
->Check(((const SfxBoolItem
&)rSet
.Get(
626 SID_SWREGISTER_MODE
)).GetValue());
627 m_pRegisterCB
->SaveValue();
628 RegisterModify(m_pRegisterCB
);
630 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_SWREGISTER_COLLECTION
))
632 m_pRegisterLB
->SelectEntry(
633 ((const SfxStringItem
&)rSet
.Get(SID_SWREGISTER_COLLECTION
)).GetValue());
634 m_pRegisterLB
->SaveValue();
637 SfxItemState eState
= rSet
.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION
),
639 if( SFX_ITEM_UNKNOWN
!= eState
)
641 sal_uInt32 nVal
= SFX_ITEM_SET
== eState
642 ? ((SvxFrameDirectionItem
*)pItem
)->GetValue()
644 m_pTextFlowBox
->SelectEntryValue( static_cast< SvxFrameDirection
>( nVal
) );
646 m_pTextFlowBox
->SaveValue();
647 m_pBspWin
->SetFrameDirection(nVal
);
653 void SvxPageDescPage::FillUserData()
655 if ( SVX_PAGE_MODE_PRESENTATION
== eMode
)
656 SetUserData( m_pAdaptBox
->IsChecked() ? OUString("1") : OUString("0") ) ;
662 bool SvxPageDescPage::FillItemSet( SfxItemSet
& rSet
)
664 bool bModified
= false;
665 const SfxItemSet
& rOldSet
= GetItemSet();
666 SfxItemPool
* pPool
= rOldSet
.GetPool();
667 DBG_ASSERT( pPool
, "Wo ist der Pool" );
668 sal_uInt16 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
669 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
670 const SfxPoolItem
* pOld
= 0;
672 // copy old left and right margins
673 SvxLRSpaceItem
aMargin( (const SvxLRSpaceItem
&)rOldSet
.Get( nWhich
) );
675 // copy old top and bottom margins
676 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
677 SvxULSpaceItem
aTopMargin( (const SvxULSpaceItem
&)rOldSet
.Get( nWhich
) );
679 if ( m_pLeftMarginEdit
->IsValueChangedFromSaved() )
681 aMargin
.SetLeft( (sal_uInt16
)GetCoreValue( *m_pLeftMarginEdit
, eUnit
) );
685 if ( m_pRightMarginEdit
->IsValueChangedFromSaved() )
687 aMargin
.SetRight( (sal_uInt16
)GetCoreValue( *m_pRightMarginEdit
, eUnit
) );
691 // set left and right margins
694 pOld
= GetOldItem( rSet
, SID_ATTR_LRSPACE
);
696 if ( !pOld
|| !( *(const SvxLRSpaceItem
*)pOld
== aMargin
) )
704 if ( m_pTopMarginEdit
->IsValueChangedFromSaved() )
706 aTopMargin
.SetUpper( (sal_uInt16
)GetCoreValue( *m_pTopMarginEdit
, eUnit
) );
710 if ( m_pBottomMarginEdit
->IsValueChangedFromSaved() )
712 aTopMargin
.SetLower( (sal_uInt16
)GetCoreValue( *m_pBottomMarginEdit
, eUnit
) );
716 // set top and bottom margins
720 pOld
= GetOldItem( rSet
, SID_ATTR_ULSPACE
);
722 if ( !pOld
|| !( *(const SvxULSpaceItem
*)pOld
== aTopMargin
) )
725 rSet
.Put( aTopMargin
);
730 nWhich
= GetWhich( SID_ATTR_PAGE_PAPERBIN
);
731 sal_Int32 nPos
= m_pPaperTrayBox
->GetSelectEntryPos();
732 sal_uInt16 nBin
= (sal_uInt16
)(sal_uLong
)m_pPaperTrayBox
->GetEntryData( nPos
);
733 pOld
= GetOldItem( rSet
, SID_ATTR_PAGE_PAPERBIN
);
735 if ( !pOld
|| ( (const SvxPaperBinItem
*)pOld
)->GetValue() != nBin
)
737 rSet
.Put( SvxPaperBinItem( nWhich
, (sal_uInt8
)nBin
) );
741 nPos
= m_pPaperSizeBox
->GetSelectEntryPos();
742 Paper ePaper
= (Paper
)(sal_uLong
)m_pPaperSizeBox
->GetEntryData( nPos
);
743 const sal_Int32 nOld
= m_pPaperSizeBox
->GetSavedValue();
744 bool bChecked
= m_pLandscapeBtn
->IsChecked();
746 if ( PAPER_USER
== ePaper
)
749 m_pPaperWidthEdit
->IsValueModified() ||
750 m_pPaperHeightEdit
->IsValueModified() ||
751 m_pLandscapeBtn
->IsValueChangedFromSaved() )
753 Size
aSize( GetCoreValue( *m_pPaperWidthEdit
, eUnit
),
754 GetCoreValue( *m_pPaperHeightEdit
, eUnit
) );
755 pOld
= GetOldItem( rSet
, SID_ATTR_PAGE_SIZE
);
757 if ( !pOld
|| ( (const SvxSizeItem
*)pOld
)->GetSize() != aSize
)
759 rSet
.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE
), aSize
) );
766 if ( nOld
!= nPos
|| m_pLandscapeBtn
->IsValueChangedFromSaved() )
768 Size
aSize( SvxPaperInfo::GetPaperSize( ePaper
, (MapUnit
)eUnit
) );
773 pOld
= GetOldItem( rSet
, SID_ATTR_PAGE_SIZE
);
775 if ( !pOld
|| ( (const SvxSizeItem
*)pOld
)->GetSize() != aSize
)
777 rSet
.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE
), aSize
) );
783 nWhich
= GetWhich( SID_ATTR_PAGE
);
784 SvxPageItem
aPage( (const SvxPageItem
&)rOldSet
.Get( nWhich
) );
785 bMod
= m_pLayoutBox
->IsValueChangedFromSaved();
789 ::PosToPageUsage_Impl( m_pLayoutBox
->GetSelectEntryPos() ) );
791 if ( m_pLandscapeBtn
->IsValueChangedFromSaved() )
793 aPage
.SetLandscape(bChecked
);
797 //Get the NumType value
798 nPos
= m_pNumberFormatBox
->GetSelectEntryPos();
799 sal_uInt16 nEntryData
= (sal_uInt16
)(sal_uLong
)m_pNumberFormatBox
->GetEntryData(nPos
);
800 if ( m_pNumberFormatBox
->IsValueChangedFromSaved() )
802 aPage
.SetNumType( (SvxNumType
)nEntryData
);
808 pOld
= GetOldItem( rSet
, SID_ATTR_PAGE
);
810 if ( !pOld
|| !( *(const SvxPageItem
*)pOld
== aPage
) )
816 else if ( SFX_ITEM_DEFAULT
== rOldSet
.GetItemState( nWhich
) )
817 rSet
.ClearItem( nWhich
);
819 rSet
.Put( rOldSet
.Get( nWhich
) );
821 // evaluate mode specific controls
825 case SVX_PAGE_MODE_CENTER
:
827 if ( m_pHorzBox
->IsValueChangedFromSaved() )
829 SfxBoolItem
aHorz( GetWhich( SID_ATTR_PAGE_EXT1
),
830 m_pHorzBox
->IsChecked() );
835 if ( m_pVertBox
->IsValueChangedFromSaved() )
837 SfxBoolItem
aVert( GetWhich( SID_ATTR_PAGE_EXT2
),
838 m_pVertBox
->IsChecked() );
845 case SVX_PAGE_MODE_PRESENTATION
:
847 // always put so that draw can evaluate this
848 rSet
.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1
),
849 m_pAdaptBox
->IsChecked() ) );
853 default: ;//prevent warning
857 if(m_pRegisterCB
->IsVisible() &&
858 (m_pRegisterCB
->IsChecked() || m_pRegisterCB
->IsValueChangedFromSaved()))
860 const SfxBoolItem
& rRegItem
= (const SfxBoolItem
&)rOldSet
.Get(SID_SWREGISTER_MODE
);
861 SfxBoolItem
* pRegItem
= (SfxBoolItem
*)rRegItem
.Clone();
862 bool bCheck
= m_pRegisterCB
->IsChecked();
863 pRegItem
->SetValue(bCheck
);
869 rSet
.Put(SfxStringItem(SID_SWREGISTER_COLLECTION
,
870 m_pRegisterLB
->GetSelectEntry()));
875 SvxFrameDirection eDirection
= m_pTextFlowBox
->GetSelectEntryValue();
876 if( m_pTextFlowBox
->IsVisible() && m_pTextFlowBox
->IsValueChangedFromSaved() )
878 rSet
.Put( SvxFrameDirectionItem( eDirection
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
887 IMPL_LINK_NOARG(SvxPageDescPage
, LayoutHdl_Impl
)
889 // switch inside outside
890 const sal_uInt16 nPos
= PosToPageUsage_Impl( m_pLayoutBox
->GetSelectEntryPos() );
892 if ( nPos
== SVX_PAGE_MIRROR
)
894 m_pLeftMarginLbl
->Hide();
895 m_pRightMarginLbl
->Hide();
896 m_pInsideLbl
->Show();
897 m_pOutsideLbl
->Show();
901 m_pLeftMarginLbl
->Show();
902 m_pRightMarginLbl
->Show();
903 m_pInsideLbl
->Hide();
904 m_pOutsideLbl
->Hide();
906 UpdateExample_Impl( true );
912 IMPL_LINK_NOARG(SvxPageDescPage
, PaperBinHdl_Impl
)
914 if ( m_pPaperTrayBox
->GetEntryCount() > 1 )
918 OUString aOldName
= m_pPaperTrayBox
->GetSelectEntry();
919 m_pPaperTrayBox
->SetUpdateMode( false );
920 m_pPaperTrayBox
->Clear();
921 sal_Int32 nEntryPos
= m_pPaperTrayBox
->InsertEntry(
922 EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS
) );
923 m_pPaperTrayBox
->SetEntryData( nEntryPos
,
924 (void*)(sal_uLong
)PAPERBIN_PRINTER_SETTINGS
);
925 OUString
aPaperBin( EditResId( RID_SVXSTR_PAPERBIN
) );
926 sal_uInt16 nBinCount
= pImpl
->mpDefPrinter
->GetPaperBinCount();
928 for ( sal_uInt16 i
= 0; i
< nBinCount
; ++i
)
930 OUString aName
= pImpl
->mpDefPrinter
->GetPaperBinName(i
);
932 if ( aName
.isEmpty() )
936 aName
+= OUString::number( i
+1 );
938 nEntryPos
= m_pPaperTrayBox
->InsertEntry( aName
);
939 m_pPaperTrayBox
->SetEntryData( nEntryPos
, (void*)(sal_uLong
)i
);
941 m_pPaperTrayBox
->SelectEntry( aOldName
);
942 m_pPaperTrayBox
->SetUpdateMode( true );
949 IMPL_LINK( SvxPageDescPage
, PaperSizeSelect_Impl
, ListBox
*, pBox
)
951 const sal_Int32 nPos
= pBox
->GetSelectEntryPos();
952 Paper ePaper
= (Paper
)(sal_uLong
)m_pPaperSizeBox
->GetEntryData( nPos
);
954 if ( ePaper
!= PAPER_USER
)
956 Size
aSize( SvxPaperInfo::GetPaperSize( ePaper
, MAP_100TH_MM
) );
958 if ( m_pLandscapeBtn
->IsChecked() )
961 if ( aSize
.Height() < m_pPaperHeightEdit
->GetMin( FUNIT_100TH_MM
) )
962 m_pPaperHeightEdit
->SetMin(
963 m_pPaperHeightEdit
->Normalize( aSize
.Height() ), FUNIT_100TH_MM
);
964 if ( aSize
.Width() < m_pPaperWidthEdit
->GetMin( FUNIT_100TH_MM
) )
965 m_pPaperWidthEdit
->SetMin(
966 m_pPaperWidthEdit
->Normalize( aSize
.Width() ), FUNIT_100TH_MM
);
967 SetMetricValue( *m_pPaperHeightEdit
, aSize
.Height(), SFX_MAPUNIT_100TH_MM
);
968 SetMetricValue( *m_pPaperWidthEdit
, aSize
.Width(), SFX_MAPUNIT_100TH_MM
);
973 UpdateExample_Impl( true );
975 if ( eMode
== SVX_PAGE_MODE_PRESENTATION
)
977 // Draw: if paper format the margin shall be 1 cm
979 bool bScreen
= (( PAPER_SCREEN_4_3
== ePaper
)||( PAPER_SCREEN_16_9
== ePaper
)||( PAPER_SCREEN_16_10
== ePaper
));
982 // no margin if screen
983 nTmp
= 1; // accordingly 1 cm
985 if ( bScreen
|| m_pRightMarginEdit
->GetValue() == 0 )
987 SetMetricValue( *m_pRightMarginEdit
, nTmp
, SFX_MAPUNIT_CM
);
989 m_pRightMarginEdit
->GetFirst() > m_pRightMarginEdit
->GetValue() )
990 m_pRightMarginEdit
->SetValue( m_pRightMarginEdit
->GetFirst() );
992 if ( bScreen
|| m_pLeftMarginEdit
->GetValue() == 0 )
994 SetMetricValue( *m_pLeftMarginEdit
, nTmp
, SFX_MAPUNIT_CM
);
996 m_pLeftMarginEdit
->GetFirst() > m_pLeftMarginEdit
->GetValue() )
997 m_pLeftMarginEdit
->SetValue( m_pLeftMarginEdit
->GetFirst() );
999 if ( bScreen
|| m_pBottomMarginEdit
->GetValue() == 0 )
1001 SetMetricValue( *m_pBottomMarginEdit
, nTmp
, SFX_MAPUNIT_CM
);
1003 m_pBottomMarginEdit
->GetFirst() > m_pBottomMarginEdit
->GetValue() )
1004 m_pBottomMarginEdit
->SetValue( m_pBottomMarginEdit
->GetFirst() );
1006 if ( bScreen
|| m_pTopMarginEdit
->GetValue() == 0 )
1008 SetMetricValue( *m_pTopMarginEdit
, nTmp
, SFX_MAPUNIT_CM
);
1010 m_pTopMarginEdit
->GetFirst() > m_pTopMarginEdit
->GetValue() )
1011 m_pTopMarginEdit
->SetValue( m_pTopMarginEdit
->GetFirst() );
1013 UpdateExample_Impl( true );
1021 IMPL_LINK_NOARG(SvxPageDescPage
, PaperSizeModify_Impl
)
1023 sal_uInt16 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
1024 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( nWhich
);
1025 Size
aSize( GetCoreValue( *m_pPaperWidthEdit
, eUnit
),
1026 GetCoreValue( *m_pPaperHeightEdit
, eUnit
) );
1027 Paper ePaper
= SvxPaperInfo::GetSvxPaper( aSize
, (MapUnit
)eUnit
, true );
1028 sal_Int32 nEntryCount
= m_pPaperSizeBox
->GetEntryCount();
1030 for ( sal_Int32 i
= 0; i
< nEntryCount
; ++i
)
1032 Paper eTmp
= (Paper
)(sal_uLong
)m_pPaperSizeBox
->GetEntryData(i
);
1034 if ( eTmp
== ePaper
)
1036 m_pPaperSizeBox
->SelectEntryPos(i
);
1040 UpdateExample_Impl( true );
1046 IMPL_LINK( SvxPageDescPage
, SwapOrientation_Impl
, RadioButton
*, pBtn
)
1049 (!bLandscape
&& pBtn
== m_pLandscapeBtn
) ||
1050 (bLandscape
&& pBtn
== m_pPortraitBtn
)
1053 bLandscape
= m_pLandscapeBtn
->IsChecked();
1055 const long lWidth
= GetCoreValue( *m_pPaperWidthEdit
, SFX_MAPUNIT_100TH_MM
);
1056 const long lHeight
= GetCoreValue( *m_pPaperHeightEdit
, SFX_MAPUNIT_100TH_MM
);
1058 // swap with and height
1059 SetMetricValue( *m_pPaperWidthEdit
, lHeight
, SFX_MAPUNIT_100TH_MM
);
1060 SetMetricValue( *m_pPaperHeightEdit
, lWidth
, SFX_MAPUNIT_100TH_MM
);
1062 // recalculate margins if necessary
1065 PaperSizeSelect_Impl( m_pPaperSizeBox
);
1067 SwapFirstValues_Impl( bBorderModified
);
1068 UpdateExample_Impl( true );
1075 void SvxPageDescPage::SwapFirstValues_Impl( bool bSet
)
1077 MapMode aOldMode
= pImpl
->mpDefPrinter
->GetMapMode();
1078 Orientation eOri
= ORIENTATION_PORTRAIT
;
1081 eOri
= ORIENTATION_LANDSCAPE
;
1082 Orientation eOldOri
= pImpl
->mpDefPrinter
->GetOrientation();
1083 pImpl
->mpDefPrinter
->SetOrientation( eOri
);
1084 pImpl
->mpDefPrinter
->SetMapMode( MAP_TWIP
);
1086 // set first- and last-values for margins
1087 Size aPaperSize
= pImpl
->mpDefPrinter
->GetPaperSize();
1088 Size aPrintSize
= pImpl
->mpDefPrinter
->GetOutputSize();
1090 * To convert a point ( 0,0 ) into logic coordinates
1091 * looks like nonsense; but it makes sense if the
1092 * coordinate system's origin has been moved.
1094 Point aPrintOffset
= pImpl
->mpDefPrinter
->GetPageOffset() -
1095 pImpl
->mpDefPrinter
->PixelToLogic( Point() );
1096 pImpl
->mpDefPrinter
->SetMapMode( aOldMode
);
1097 pImpl
->mpDefPrinter
->SetOrientation( eOldOri
);
1099 sal_Int64 nSetL
= m_pLeftMarginEdit
->Denormalize(
1100 m_pLeftMarginEdit
->GetValue( FUNIT_TWIP
) );
1101 sal_Int64 nSetR
= m_pRightMarginEdit
->Denormalize(
1102 m_pRightMarginEdit
->GetValue( FUNIT_TWIP
) );
1103 sal_Int64 nSetT
= m_pTopMarginEdit
->Denormalize(
1104 m_pTopMarginEdit
->GetValue( FUNIT_TWIP
) );
1105 sal_Int64 nSetB
= m_pBottomMarginEdit
->Denormalize(
1106 m_pBottomMarginEdit
->GetValue( FUNIT_TWIP
) );
1108 long nOffset
= !aPrintOffset
.X() && !aPrintOffset
.Y() ? 0 : PRINT_OFFSET
;
1109 long nNewL
= aPrintOffset
.X();
1111 aPaperSize
.Width() - aPrintSize
.Width() - aPrintOffset
.X() + nOffset
;
1112 long nNewT
= aPrintOffset
.Y();
1114 aPaperSize
.Height() - aPrintSize
.Height() - aPrintOffset
.Y() + nOffset
;
1116 m_pLeftMarginEdit
->SetFirst( m_pLeftMarginEdit
->Normalize( nNewL
), FUNIT_TWIP
);
1117 nFirstLeftMargin
= static_cast<long>(m_pLeftMarginEdit
->GetFirst());
1118 m_pRightMarginEdit
->SetFirst( m_pRightMarginEdit
->Normalize( nNewR
), FUNIT_TWIP
);
1119 nFirstRightMargin
= static_cast<long>(m_pRightMarginEdit
->GetFirst());
1120 m_pTopMarginEdit
->SetFirst( m_pTopMarginEdit
->Normalize( nNewT
), FUNIT_TWIP
);
1121 nFirstTopMargin
= static_cast<long>(m_pTopMarginEdit
->GetFirst());
1122 m_pBottomMarginEdit
->SetFirst( m_pBottomMarginEdit
->Normalize( nNewB
), FUNIT_TWIP
);
1123 nFirstBottomMargin
= static_cast<long>(m_pBottomMarginEdit
->GetFirst());
1127 if ( nSetL
< nNewL
)
1128 m_pLeftMarginEdit
->SetValue( m_pLeftMarginEdit
->Normalize( nNewL
),
1130 if ( nSetR
< nNewR
)
1131 m_pRightMarginEdit
->SetValue( m_pRightMarginEdit
->Normalize( nNewR
),
1133 if ( nSetT
< nNewT
)
1134 m_pTopMarginEdit
->SetValue( m_pTopMarginEdit
->Normalize( nNewT
),
1136 if ( nSetB
< nNewB
)
1137 m_pBottomMarginEdit
->SetValue( m_pBottomMarginEdit
->Normalize( nNewB
),
1144 IMPL_LINK_NOARG_INLINE_START(SvxPageDescPage
, BorderModify_Impl
)
1146 if ( !bBorderModified
)
1147 bBorderModified
= true;
1148 UpdateExample_Impl();
1151 IMPL_LINK_NOARG_INLINE_END(SvxPageDescPage
, BorderModify_Impl
)
1155 void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground
)
1158 Size
aSize( GetCoreValue( *m_pPaperWidthEdit
, SFX_MAPUNIT_TWIP
),
1159 GetCoreValue( *m_pPaperHeightEdit
, SFX_MAPUNIT_TWIP
) );
1161 m_pBspWin
->SetSize( aSize
);
1164 m_pBspWin
->SetTop( GetCoreValue( *m_pTopMarginEdit
, SFX_MAPUNIT_TWIP
) );
1165 m_pBspWin
->SetBottom( GetCoreValue( *m_pBottomMarginEdit
, SFX_MAPUNIT_TWIP
) );
1166 m_pBspWin
->SetLeft( GetCoreValue( *m_pLeftMarginEdit
, SFX_MAPUNIT_TWIP
) );
1167 m_pBspWin
->SetRight( GetCoreValue( *m_pRightMarginEdit
, SFX_MAPUNIT_TWIP
) );
1170 m_pBspWin
->SetUsage( PosToPageUsage_Impl( m_pLayoutBox
->GetSelectEntryPos() ) );
1171 if ( bResetbackground
)
1172 m_pBspWin
->ResetBackground();
1173 m_pBspWin
->Invalidate();
1178 void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet
& rSet
)
1180 sal_uInt16 nWhich
= GetWhich( SID_ATTR_PAGE_HEADERSET
);
1182 if ( rSet
.GetItemState( nWhich
, false ) == SFX_ITEM_SET
)
1184 const SvxSetItem
& rSetItem
=
1185 (const SvxSetItem
&)rSet
.Get( nWhich
, false );
1186 const SfxItemSet
& rTmpSet
= rSetItem
.GetItemSet();
1187 const SfxBoolItem
& rOn
=
1188 (const SfxBoolItem
&)rTmpSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) );
1190 if ( rOn
.GetValue() )
1192 nWhich
= GetWhich( SID_ATTR_BRUSH
);
1194 if ( rTmpSet
.GetItemState( nWhich
) == SFX_ITEM_SET
)
1196 const SvxBrushItem
& rItem
=
1197 (const SvxBrushItem
&)rTmpSet
.Get( nWhich
);
1198 m_pBspWin
->SetHdColor( rItem
.GetColor() );
1200 nWhich
= GetWhich( SID_ATTR_BORDER_OUTER
);
1202 if ( rTmpSet
.GetItemState( nWhich
) == SFX_ITEM_SET
)
1204 const SvxBoxItem
& rItem
=
1205 (const SvxBoxItem
&)rTmpSet
.Get( nWhich
);
1206 m_pBspWin
->SetHdBorder( rItem
);
1211 nWhich
= GetWhich( SID_ATTR_PAGE_FOOTERSET
);
1213 if ( rSet
.GetItemState( nWhich
, false ) == SFX_ITEM_SET
)
1215 const SvxSetItem
& rSetItem
=
1216 (const SvxSetItem
&)rSet
.Get( nWhich
, false );
1217 const SfxItemSet
& rTmpSet
= rSetItem
.GetItemSet();
1218 const SfxBoolItem
& rOn
=
1219 (const SfxBoolItem
&)rTmpSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) );
1221 if ( rOn
.GetValue() )
1223 nWhich
= GetWhich( SID_ATTR_BRUSH
);
1225 if ( rTmpSet
.GetItemState( nWhich
) == SFX_ITEM_SET
)
1227 const SvxBrushItem
& rItem
=
1228 (const SvxBrushItem
&)rTmpSet
.Get( nWhich
);
1229 m_pBspWin
->SetFtColor( rItem
.GetColor() );
1231 nWhich
= GetWhich( SID_ATTR_BORDER_OUTER
);
1233 if ( rTmpSet
.GetItemState( nWhich
) == SFX_ITEM_SET
)
1235 const SvxBoxItem
& rItem
=
1236 (const SvxBoxItem
&)rTmpSet
.Get( nWhich
);
1237 m_pBspWin
->SetFtBorder( rItem
);
1242 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_BRUSH
);
1246 m_pBspWin
->SetColor( ( (const SvxBrushItem
*)pItem
)->GetColor() );
1247 const Graphic
* pGrf
= ( (const SvxBrushItem
*)pItem
)->GetGraphic();
1251 Bitmap aBitmap
= pGrf
->GetBitmap();
1252 m_pBspWin
->SetBitmap( &aBitmap
);
1255 m_pBspWin
->SetBitmap( NULL
);
1258 pItem
= GetItem( rSet
, SID_ATTR_BORDER_OUTER
);
1261 m_pBspWin
->SetBorder( (SvxBoxItem
&)*pItem
);
1266 void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet
& rSet
)
1268 bLandscape
= m_pLandscapeBtn
->IsChecked();
1269 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_PAGE_SIZE
);
1272 m_pBspWin
->SetSize( ( (const SvxSizeItem
*)pItem
)->GetSize() );
1274 const SvxSetItem
* pSetItem
= 0;
1276 // evaluate header attributes
1278 if ( SFX_ITEM_SET
==
1279 rSet
.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET
),
1280 false, (const SfxPoolItem
**)&pSetItem
) )
1282 const SfxItemSet
& rHeaderSet
= pSetItem
->GetItemSet();
1283 const SfxBoolItem
& rHeaderOn
=
1284 (const SfxBoolItem
&)rHeaderSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) );
1286 if ( rHeaderOn
.GetValue() )
1288 const SvxSizeItem
& rSize
= (const SvxSizeItem
&)
1289 rHeaderSet
.Get( GetWhich( SID_ATTR_PAGE_SIZE
) );
1290 const SvxULSpaceItem
& rUL
= (const SvxULSpaceItem
&)
1291 rHeaderSet
.Get( GetWhich( SID_ATTR_ULSPACE
) );
1292 long nDist
= rUL
.GetLower();
1293 m_pBspWin
->SetHdHeight( rSize
.GetSize().Height() - nDist
);
1294 m_pBspWin
->SetHdDist( nDist
);
1295 const SvxLRSpaceItem
& rLR
= (const SvxLRSpaceItem
&)
1296 rHeaderSet
.Get( GetWhich( SID_ATTR_LRSPACE
) );
1297 m_pBspWin
->SetHdLeft( rLR
.GetLeft() );
1298 m_pBspWin
->SetHdRight( rLR
.GetRight() );
1299 m_pBspWin
->SetHeader( true );
1302 m_pBspWin
->SetHeader( false );
1304 // show background and border in the example
1305 sal_uInt16 nWhich
= GetWhich( SID_ATTR_BRUSH
);
1307 if ( rHeaderSet
.GetItemState( nWhich
) >= SFX_ITEM_AVAILABLE
)
1309 const SvxBrushItem
& rItem
=
1310 (const SvxBrushItem
&)rHeaderSet
.Get( nWhich
);
1311 m_pBspWin
->SetHdColor( rItem
.GetColor() );
1313 nWhich
= GetWhich( SID_ATTR_BORDER_OUTER
);
1315 if ( rHeaderSet
.GetItemState( nWhich
) >= SFX_ITEM_AVAILABLE
)
1317 const SvxBoxItem
& rItem
=
1318 (const SvxBoxItem
&)rHeaderSet
.Get( nWhich
);
1319 m_pBspWin
->SetHdBorder( rItem
);
1323 // evaluate footer attributes
1325 if ( SFX_ITEM_SET
==
1326 rSet
.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET
),
1327 false, (const SfxPoolItem
**)&pSetItem
) )
1329 const SfxItemSet
& rFooterSet
= pSetItem
->GetItemSet();
1330 const SfxBoolItem
& rFooterOn
=
1331 (const SfxBoolItem
&)rFooterSet
.Get( GetWhich( SID_ATTR_PAGE_ON
) );
1333 if ( rFooterOn
.GetValue() )
1335 const SvxSizeItem
& rSize
= (const SvxSizeItem
&)
1336 rFooterSet
.Get( GetWhich( SID_ATTR_PAGE_SIZE
) );
1337 const SvxULSpaceItem
& rUL
= (const SvxULSpaceItem
&)
1338 rFooterSet
.Get( GetWhich( SID_ATTR_ULSPACE
) );
1339 long nDist
= rUL
.GetUpper();
1340 m_pBspWin
->SetFtHeight( rSize
.GetSize().Height() - nDist
);
1341 m_pBspWin
->SetFtDist( nDist
);
1342 const SvxLRSpaceItem
& rLR
= (const SvxLRSpaceItem
&)
1343 rFooterSet
.Get( GetWhich( SID_ATTR_LRSPACE
) );
1344 m_pBspWin
->SetFtLeft( rLR
.GetLeft() );
1345 m_pBspWin
->SetFtRight( rLR
.GetRight() );
1346 m_pBspWin
->SetFooter( true );
1349 m_pBspWin
->SetFooter( false );
1351 // show background and border in the example
1352 sal_uInt16 nWhich
= GetWhich( SID_ATTR_BRUSH
);
1354 if ( rFooterSet
.GetItemState( nWhich
) >= SFX_ITEM_AVAILABLE
)
1356 const SvxBrushItem
& rItem
=
1357 (const SvxBrushItem
&)rFooterSet
.Get( nWhich
);
1358 m_pBspWin
->SetFtColor( rItem
.GetColor() );
1360 nWhich
= GetWhich( SID_ATTR_BORDER_OUTER
);
1362 if ( rFooterSet
.GetItemState( nWhich
) >= SFX_ITEM_AVAILABLE
)
1364 const SvxBoxItem
& rItem
=
1365 (const SvxBoxItem
&)rFooterSet
.Get( nWhich
);
1366 m_pBspWin
->SetFtBorder( rItem
);
1373 void SvxPageDescPage::ActivatePage( const SfxItemSet
& rSet
)
1375 InitHeadFoot_Impl( rSet
);
1376 UpdateExample_Impl();
1377 ResetBackground_Impl( rSet
);
1383 int SvxPageDescPage::DeactivatePage( SfxItemSet
* _pSet
)
1385 // Inquiry whether the page margins are beyond the printing area.
1386 // If not, ask user whether they shall be taken.
1387 // If not, stay on the TabPage.
1388 sal_Int32 nPos
= m_pPaperSizeBox
->GetSelectEntryPos();
1389 Paper ePaper
= (Paper
)(sal_uLong
)m_pPaperSizeBox
->GetEntryData( nPos
);
1391 if ( ePaper
!= PAPER_SCREEN_4_3
&& ePaper
!= PAPER_SCREEN_16_9
&& ePaper
!= PAPER_SCREEN_16_10
&& IsMarginOutOfRange() )
1393 if ( QueryBox( this, WB_YES_NO
| WB_DEF_NO
, m_pPrintRangeQueryText
->GetText() ).Execute() == RET_NO
)
1395 MetricField
* pField
= NULL
;
1396 if ( IsPrinterRangeOverflow( *m_pLeftMarginEdit
, nFirstLeftMargin
, nLastLeftMargin
, MARGIN_LEFT
) )
1397 pField
= m_pLeftMarginEdit
;
1398 if ( IsPrinterRangeOverflow( *m_pRightMarginEdit
, nFirstRightMargin
, nLastRightMargin
, MARGIN_RIGHT
)
1400 pField
= m_pRightMarginEdit
;
1401 if ( IsPrinterRangeOverflow( *m_pTopMarginEdit
, nFirstTopMargin
, nLastTopMargin
, MARGIN_TOP
)
1403 pField
= m_pTopMarginEdit
;
1404 if ( IsPrinterRangeOverflow( *m_pBottomMarginEdit
, nFirstBottomMargin
, nLastBottomMargin
, MARGIN_BOTTOM
)
1406 pField
= m_pBottomMarginEdit
;
1408 pField
->GrabFocus();
1409 UpdateExample_Impl();
1413 CheckMarginEdits( false );
1418 FillItemSet( *_pSet
);
1420 // put portray/landscape if applicable
1421 sal_uInt16 nWh
= GetWhich( SID_ATTR_PAGE_SIZE
);
1422 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( nWh
);
1423 Size
aSize( GetCoreValue( *m_pPaperWidthEdit
, eUnit
),
1424 GetCoreValue( *m_pPaperHeightEdit
, eUnit
) );
1426 // put, if current size is different to the value in _pSet
1427 const SvxSizeItem
* pSize
= (const SvxSizeItem
*)GetItem( *_pSet
, SID_ATTR_PAGE_SIZE
);
1428 if ( aSize
.Width() && ( !pSize
|| !IsEqualSize_Impl( pSize
, aSize
) ) )
1429 _pSet
->Put( SvxSizeItem( nWh
, aSize
) );
1437 IMPL_LINK_NOARG(SvxPageDescPage
, RangeHdl_Impl
)
1440 long nHHeight
= m_pBspWin
->GetHdHeight();
1441 long nHDist
= m_pBspWin
->GetHdDist();
1443 long nFHeight
= m_pBspWin
->GetFtHeight();
1444 long nFDist
= m_pBspWin
->GetFtDist();
1446 long nHFLeft
= std::max( m_pBspWin
->GetHdLeft(), m_pBspWin
->GetFtLeft() );
1447 long nHFRight
= std::max( m_pBspWin
->GetHdRight(), m_pBspWin
->GetFtRight() );
1449 // current values for page margins
1450 long nBT
= static_cast<long>(m_pTopMarginEdit
->Denormalize(m_pTopMarginEdit
->GetValue(FUNIT_TWIP
)));
1451 long nBB
= static_cast<long>(m_pBottomMarginEdit
->Denormalize(m_pBottomMarginEdit
->GetValue(FUNIT_TWIP
)));
1452 long nBL
= static_cast<long>(m_pLeftMarginEdit
->Denormalize(m_pLeftMarginEdit
->GetValue(FUNIT_TWIP
)));
1453 long nBR
= static_cast<long>(m_pRightMarginEdit
->Denormalize(m_pRightMarginEdit
->GetValue(FUNIT_TWIP
)));
1455 // calculate width of page border
1456 const SfxItemSet
* _pSet
= &GetItemSet();
1459 if ( _pSet
->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW
) ) >=
1460 SFX_ITEM_AVAILABLE
&&
1461 _pSet
->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER
) ) >=
1462 SFX_ITEM_AVAILABLE
)
1464 aBorder
= ( GetMinBorderSpace_Impl(
1465 (const SvxShadowItem
&)_pSet
->Get(GetWhich(SID_ATTR_BORDER_SHADOW
)),
1466 (const SvxBoxItem
&)_pSet
->Get(GetWhich(SID_ATTR_BORDER_OUTER
))));
1469 long nH
= static_cast<long>(m_pPaperHeightEdit
->Denormalize(m_pPaperHeightEdit
->GetValue(FUNIT_TWIP
)));
1470 long nW
= static_cast<long>(m_pPaperWidthEdit
->Denormalize(m_pPaperWidthEdit
->GetValue(FUNIT_TWIP
)));
1475 long nMin
= nHHeight
+ nHDist
+ nFDist
+ nFHeight
+ nBT
+ nBB
+
1476 MINBODY
+ aBorder
.Height();
1477 m_pPaperHeightEdit
->SetMin(m_pPaperHeightEdit
->Normalize(nMin
), FUNIT_TWIP
);
1479 nMin
= MINBODY
+ nBL
+ nBR
+ aBorder
.Width();
1480 m_pPaperWidthEdit
->SetMin(m_pPaperWidthEdit
->Normalize(nMin
), FUNIT_TWIP
);
1482 // if the paper size has been changed
1483 nH
= static_cast<long>(m_pPaperHeightEdit
->Denormalize(m_pPaperHeightEdit
->GetValue(FUNIT_TWIP
)));
1484 nW
= static_cast<long>(m_pPaperWidthEdit
->Denormalize(m_pPaperWidthEdit
->GetValue(FUNIT_TWIP
)));
1487 long nMax
= nH
- nBB
- aBorder
.Height() - MINBODY
-
1488 nFDist
- nFHeight
- nHDist
- nHHeight
;
1490 m_pTopMarginEdit
->SetMax(m_pTopMarginEdit
->Normalize(nMax
), FUNIT_TWIP
);
1493 nMax
= nH
- nBT
- aBorder
.Height() - MINBODY
-
1494 nFDist
- nFHeight
- nHDist
- nHHeight
;
1496 m_pBottomMarginEdit
->SetMax(m_pTopMarginEdit
->Normalize(nMax
), FUNIT_TWIP
);
1499 nMax
= nW
- nBR
- MINBODY
- aBorder
.Width() - nHFLeft
- nHFRight
;
1500 m_pLeftMarginEdit
->SetMax(m_pLeftMarginEdit
->Normalize(nMax
), FUNIT_TWIP
);
1503 nMax
= nW
- nBL
- MINBODY
- aBorder
.Width() - nHFLeft
- nHFRight
;
1504 m_pRightMarginEdit
->SetMax(m_pRightMarginEdit
->Normalize(nMax
), FUNIT_TWIP
);
1510 void SvxPageDescPage::CalcMargin_Impl()
1512 // current values for page margins
1513 long nBT
= GetCoreValue( *m_pTopMarginEdit
, SFX_MAPUNIT_TWIP
);
1514 long nBB
= GetCoreValue( *m_pBottomMarginEdit
, SFX_MAPUNIT_TWIP
);
1516 long nBL
= GetCoreValue( *m_pLeftMarginEdit
, SFX_MAPUNIT_TWIP
);
1517 long nBR
= GetCoreValue( *m_pRightMarginEdit
, SFX_MAPUNIT_TWIP
);
1519 long nH
= GetCoreValue( *m_pPaperHeightEdit
, SFX_MAPUNIT_TWIP
);
1520 long nW
= GetCoreValue( *m_pPaperWidthEdit
, SFX_MAPUNIT_TWIP
);
1522 long nWidth
= nBL
+ nBR
+ MINBODY
;
1523 long nHeight
= nBT
+ nBB
+ MINBODY
;
1525 if ( nWidth
> nW
|| nHeight
> nH
)
1529 long nTmp
= nBL
<= nBR
? nBR
: nBL
;
1530 nTmp
-= nWidth
- nW
;
1533 SetMetricValue( *m_pRightMarginEdit
, nTmp
, SFX_MAPUNIT_TWIP
);
1535 SetMetricValue( *m_pLeftMarginEdit
, nTmp
, SFX_MAPUNIT_TWIP
);
1540 long nTmp
= nBT
<= nBB
? nBB
: nBT
;
1541 nTmp
-= nHeight
- nH
;
1544 SetMetricValue( *m_pBottomMarginEdit
, nTmp
, SFX_MAPUNIT_TWIP
);
1546 SetMetricValue( *m_pTopMarginEdit
, nTmp
, SFX_MAPUNIT_TWIP
);
1553 IMPL_LINK_NOARG_INLINE_START(SvxPageDescPage
, CenterHdl_Impl
)
1555 m_pBspWin
->SetHorz( m_pHorzBox
->IsChecked() );
1556 m_pBspWin
->SetVert( m_pVertBox
->IsChecked() );
1557 UpdateExample_Impl();
1560 IMPL_LINK_NOARG_INLINE_END(SvxPageDescPage
, CenterHdl_Impl
)
1564 void SvxPageDescPage::SetCollectionList(const std::vector
<OUString
> &aList
)
1566 OSL_ENSURE(!aList
.empty(), "Empty string list");
1568 sStandardRegister
= aList
[0];
1569 for( size_t i
= 1; i
< aList
.size(); i
++ )
1570 m_pRegisterLB
->InsertEntry(aList
[i
]);
1572 m_pRegisterCB
->Show();
1573 m_pRegisterFT
->Show();
1574 m_pRegisterLB
->Show();
1575 m_pRegisterCB
->SetClickHdl(LINK(this, SvxPageDescPage
, RegisterModify
));
1580 IMPL_LINK( SvxPageDescPage
, RegisterModify
, CheckBox
*, pBox
)
1582 bool bEnable
= false;
1583 if(pBox
->IsChecked())
1586 if(USHRT_MAX
== m_pRegisterLB
->GetSelectEntryPos())
1587 m_pRegisterLB
->SelectEntry(sStandardRegister
);
1589 m_pRegisterFT
->Enable( bEnable
);
1590 m_pRegisterLB
->Enable( bEnable
);
1596 void SvxPageDescPage::DisableVerticalPageDir()
1598 m_pTextFlowBox
->RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT
);
1599 m_pTextFlowBox
->RemoveEntryValue( FRMDIR_VERT_TOP_LEFT
);
1600 if( m_pTextFlowBox
->GetEntryCount() < 2 )
1602 m_pTextFlowLbl
->Hide();
1603 m_pTextFlowBox
->Hide();
1604 m_pBspWin
->EnableFrameDirection( false );
1608 IMPL_LINK( SvxPageDescPage
, FrameDirectionModify_Impl
, ListBox
*, EMPTYARG
)
1610 m_pBspWin
->SetFrameDirection( (sal_uInt32
) m_pTextFlowBox
->GetSelectEntryValue() );
1611 m_pBspWin
->Invalidate();
1615 bool SvxPageDescPage::IsPrinterRangeOverflow(
1616 MetricField
& rField
, long nFirstMargin
, long nLastMargin
, MarginPosition nPos
)
1619 bool bCheck
= ( ( pImpl
->m_nPos
& nPos
) == 0 );
1620 long nValue
= static_cast<long>(rField
.GetValue());
1622 ( nValue
< nFirstMargin
|| nValue
> nLastMargin
) &&
1623 rField
.IsValueChangedFromSaved() )
1625 rField
.SetValue( nValue
< nFirstMargin
? nFirstMargin
: nLastMargin
);
1632 /** Check if a value of a margin edit is outside the printer paper margins
1633 and save this information.
1635 void SvxPageDescPage::CheckMarginEdits( bool _bClear
)
1640 sal_Int64 nValue
= m_pLeftMarginEdit
->GetValue();
1641 if ( nValue
< nFirstLeftMargin
|| nValue
> nLastLeftMargin
)
1642 pImpl
->m_nPos
|= MARGIN_LEFT
;
1643 nValue
= m_pRightMarginEdit
->GetValue();
1644 if ( nValue
< nFirstRightMargin
|| nValue
> nLastRightMargin
)
1645 pImpl
->m_nPos
|= MARGIN_RIGHT
;
1646 nValue
= m_pTopMarginEdit
->GetValue();
1647 if ( nValue
< nFirstTopMargin
|| nValue
> nLastTopMargin
)
1648 pImpl
->m_nPos
|= MARGIN_TOP
;
1649 nValue
= m_pBottomMarginEdit
->GetValue();
1650 if ( nValue
< nFirstBottomMargin
|| nValue
> nLastBottomMargin
)
1651 pImpl
->m_nPos
|= MARGIN_BOTTOM
;
1654 bool SvxPageDescPage::IsMarginOutOfRange()
1656 bool bRet
= ( ( ( !( pImpl
->m_nPos
& MARGIN_LEFT
) &&
1657 m_pLeftMarginEdit
->IsValueChangedFromSaved() ) &&
1658 ( m_pLeftMarginEdit
->GetValue() < nFirstLeftMargin
||
1659 m_pLeftMarginEdit
->GetValue() > nLastLeftMargin
) ) ||
1660 ( ( !( pImpl
->m_nPos
& MARGIN_RIGHT
) &&
1661 m_pRightMarginEdit
->IsValueChangedFromSaved() ) &&
1662 ( m_pRightMarginEdit
->GetValue() < nFirstRightMargin
||
1663 m_pRightMarginEdit
->GetValue() > nLastRightMargin
) ) ||
1664 ( ( !( pImpl
->m_nPos
& MARGIN_TOP
) &&
1665 m_pTopMarginEdit
->IsValueChangedFromSaved() ) &&
1666 ( m_pTopMarginEdit
->GetValue() < nFirstTopMargin
||
1667 m_pTopMarginEdit
->GetValue() > nLastTopMargin
) ) ||
1668 ( ( !( pImpl
->m_nPos
& MARGIN_BOTTOM
) &&
1669 m_pBottomMarginEdit
->IsValueChangedFromSaved() ) &&
1670 ( m_pBottomMarginEdit
->GetValue() < nFirstBottomMargin
||
1671 m_pBottomMarginEdit
->GetValue() > nLastBottomMargin
) ) );
1675 void SvxPageDescPage::PageCreated(const SfxAllItemSet
& aSet
)
1677 SFX_ITEMSET_ARG (&aSet
,pModeItem
,SfxAllEnumItem
,SID_ENUM_PAGE_MODE
,false);
1678 SFX_ITEMSET_ARG (&aSet
,pPaperStartItem
,SfxAllEnumItem
,SID_PAPER_START
,false);
1679 SFX_ITEMSET_ARG (&aSet
,pPaperEndItem
,SfxAllEnumItem
,SID_PAPER_END
,false);
1680 SFX_ITEMSET_ARG (&aSet
,pCollectListItem
,SfxStringListItem
,SID_COLLECT_LIST
,false);
1682 SetMode((SvxModeType
)pModeItem
->GetEnumValue());
1683 if (pPaperStartItem
&& pPaperEndItem
)
1684 SetPaperFormatRanges( (Paper
)pPaperStartItem
->GetEnumValue(), (Paper
)pPaperEndItem
->GetEnumValue() );
1685 if (pCollectListItem
)
1686 SetCollectionList(pCollectListItem
->GetList());
1689 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */