LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - page.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 893 0.1 %
Date: 2012-12-27 Functions: 2 51 3.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <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 "svx/htmlmode.hxx"
      30             : #include <sal/macros.h>
      31             : 
      32             : #define _SVX_PAGE_CXX
      33             : 
      34             : #include <cuires.hrc>
      35             : #include "page.hrc"
      36             : #include "helpid.hrc"
      37             : #include "page.hxx"
      38             : #include <svx/pageitem.hxx>
      39             : #include <editeng/brshitem.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 <dialmgr.hxx>
      50             : #include <sfx2/module.hxx>
      51             : #include <svl/stritem.hxx>
      52             : #include <svx/dialogs.hrc>  // for RID_SVXPAGE_PAGE
      53             : #include <editeng/eerdll.hxx>
      54             : #include <editeng/editrids.hrc> // for RID_SVXSTR_PAPERBIN...,
      55             : #include <svx/svxids.hrc>
      56             : 
      57             : // #i4219#
      58             : #include <svtools/optionsdrawinglayer.hxx>
      59             : #include <svl/slstitm.hxx>
      60             : #include <svl/aeitem.hxx>
      61             : #include <sfx2/request.hxx>
      62             : 
      63             : #include <numpages.hxx>     // for GetI18nNumbering()
      64             : 
      65             : // static ----------------------------------------------------------------
      66             : 
      67             : static const long MINBODY       = 284;  // 0,5 cm rounded up in twips
      68             : //static const long PRINT_OFFSET    = 17;   // 0,03 cm rounded down in twips
      69             : static const long PRINT_OFFSET  = 0;    // why was this ever set to 17 ? it led to wrong right and bottom margins.
      70             : 
      71             : static sal_uInt16 pRanges[] =
      72             : {
      73             :     SID_ATTR_BORDER_OUTER,
      74             :     SID_ATTR_BORDER_SHADOW,
      75             :     SID_ATTR_LRSPACE,
      76             :     SID_ATTR_PAGE_SHARED,
      77             :     SID_SWREGISTER_COLLECTION,
      78             :     SID_SWREGISTER_MODE,
      79             :     0
      80             : };
      81             : // ------- Mapping page layout ------------------------------------------
      82             : 
      83             : sal_uInt16 aArr[] =
      84             : {
      85             :     SVX_PAGE_ALL,
      86             :     SVX_PAGE_MIRROR,
      87             :     SVX_PAGE_RIGHT,
      88             :     SVX_PAGE_LEFT
      89             : };
      90             : 
      91             : // -----------------------------------------------------------------------
      92             : 
      93           0 : sal_uInt16 PageUsageToPos_Impl( sal_uInt16 nUsage )
      94             : {
      95           0 :     for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i )
      96           0 :         if ( aArr[i] == ( nUsage & 0x000f ) )
      97           0 :             return i;
      98           0 :     return SVX_PAGE_ALL;
      99             : }
     100             : 
     101             : // -----------------------------------------------------------------------
     102             : 
     103           0 : sal_uInt16 PosToPageUsage_Impl( sal_uInt16 nPos )
     104             : {
     105           0 :     if ( nPos >= SAL_N_ELEMENTS(aArr) )
     106           0 :         return 0;
     107           0 :     return aArr[nPos];
     108             : }
     109             : 
     110             : // -----------------------------------------------------------------------
     111             : 
     112           0 : Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox )
     113             : {
     114           0 :     Size aSz;
     115           0 :     aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM );
     116           0 :     aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP );
     117           0 :     aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT );
     118           0 :     aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT );
     119           0 :     return aSz;
     120             : }
     121             : 
     122             : // -----------------------------------------------------------------------
     123             : 
     124           0 : long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit )
     125             : {
     126           0 :     return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP );
     127             : }
     128             : 
     129           0 : sal_Bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize )
     130             : {
     131           0 :     if ( pSize )
     132             :     {
     133           0 :         Size aSize = pSize->GetSize();
     134           0 :         long nDiffW = Abs( rSize.Width () - aSize.Width () );
     135           0 :         long nDiffH = Abs( rSize.Height() - aSize.Height() );
     136           0 :         return ( nDiffW < 10 && nDiffH < 10 );
     137             :     }
     138             :     else
     139           0 :         return sal_False;
     140             : }
     141             : 
     142             : // -----------------------------------------------------------------------
     143             : 
     144             : #define MARGIN_LEFT     ( (MarginPosition)0x0001 )
     145             : #define MARGIN_RIGHT    ( (MarginPosition)0x0002 )
     146             : #define MARGIN_TOP      ( (MarginPosition)0x0004 )
     147             : #define MARGIN_BOTTOM   ( (MarginPosition)0x0008 )
     148             : 
     149             : struct SvxPage_Impl
     150             : {
     151             :     MarginPosition  m_nPos;
     152             :     Printer*        mpDefPrinter;
     153             :     bool            mbDelPrinter;
     154             : 
     155           0 :     SvxPage_Impl() :
     156             :         m_nPos( 0 ),
     157             :         mpDefPrinter( 0 ),
     158           0 :         mbDelPrinter( false ) {}
     159             : 
     160           0 :     ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; }
     161             : };
     162             : 
     163             : // class SvxPageDescPage --------------------------------------------------
     164             : 
     165             : // returns the range of the Which values
     166           0 : sal_uInt16* SvxPageDescPage::GetRanges()
     167             : {
     168           0 :     return pRanges;
     169             : }
     170             : 
     171             : // -----------------------------------------------------------------------
     172             : 
     173           0 : SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet )
     174             : {
     175           0 :     return new SvxPageDescPage( pParent, rSet );
     176             : }
     177             : 
     178             : // -----------------------------------------------------------------------
     179             : 
     180           0 : SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) :
     181             : 
     182           0 :     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PAGE ), rAttr ),
     183             : 
     184           0 :     aPaperSizeFl        ( this, CUI_RES( FL_PAPER_SIZE ) ),
     185           0 :     aPaperFormatText    ( this, CUI_RES( FT_PAPER_FORMAT ) ),
     186           0 :     aPaperSizeBox       ( this, CUI_RES( LB_PAPER_SIZE ) ),
     187           0 :     aPaperWidthText     ( this, CUI_RES( FT_PAPER_WIDTH ) ),
     188           0 :     aPaperWidthEdit     ( this, CUI_RES( ED_PAPER_WIDTH ) ),
     189           0 :     aPaperHeightText    ( this, CUI_RES( FT_PAPER_HEIGHT ) ),
     190           0 :     aPaperHeightEdit    ( this, CUI_RES( ED_PAPER_HEIGHT ) ),
     191           0 :     aOrientationFT      ( this, CUI_RES( FT_ORIENTATION ) ),
     192           0 :     aPortraitBtn        ( this, CUI_RES( RB_PORTRAIT ) ),
     193           0 :     aLandscapeBtn       ( this, CUI_RES( RB_LANDSCAPE ) ),
     194           0 :     aBspWin             ( this, CUI_RES( WN_BSP ) ),
     195           0 :     aTextFlowLbl        ( this, CUI_RES( FT_TEXT_FLOW ) ),
     196           0 :     aTextFlowBox        ( this, CUI_RES( LB_TEXT_FLOW ) ),
     197           0 :     aPaperTrayLbl       ( this, CUI_RES( FT_PAPER_TRAY ) ),
     198           0 :     aPaperTrayBox       ( this, CUI_RES( LB_PAPER_TRAY ) ),
     199           0 :     aMarginFl           ( this, CUI_RES( FL_MARGIN ) ),
     200           0 :     aLeftMarginLbl      ( this, CUI_RES( FT_LEFT_MARGIN ) ),
     201           0 :     aLeftMarginEdit     ( this, CUI_RES( ED_LEFT_MARGIN ) ),
     202           0 :     aRightMarginLbl     ( this, CUI_RES( FT_RIGHT_MARGIN ) ),
     203           0 :     aRightMarginEdit    ( this, CUI_RES( ED_RIGHT_MARGIN ) ),
     204           0 :     aTopMarginLbl       ( this, CUI_RES( FT_TOP_MARGIN ) ),
     205           0 :     aTopMarginEdit      ( this, CUI_RES( ED_TOP_MARGIN ) ),
     206           0 :     aBottomMarginLbl    ( this, CUI_RES( FT_BOTTOM_MARGIN ) ),
     207           0 :     aBottomMarginEdit   ( this, CUI_RES( ED_BOTTOM_MARGIN ) ),
     208           0 :     aBottomSeparatorFl  ( this, CUI_RES( FL_BOTTOM_SEP ) ),
     209           0 :     aLayoutFL           ( this, CUI_RES( FL_LAYOUT ) ),
     210           0 :     aPageText           ( this, CUI_RES( FT_PAGELAYOUT ) ),
     211           0 :     aLayoutBox          ( this, CUI_RES( LB_LAYOUT ) ),
     212           0 :     aNumberFormatText   ( this, CUI_RES( FT_NUMBER_FORMAT ) ),
     213           0 :     aNumberFormatBox    ( this, CUI_RES( LB_NUMBER_FORMAT ) ),
     214           0 :     aTblAlignFT         ( this, CUI_RES( FT_TBL_ALIGN ) ),
     215           0 :     aHorzBox            ( this, CUI_RES( CB_HORZ ) ),
     216           0 :     aVertBox            ( this, CUI_RES( CB_VERT ) ),
     217           0 :     aAdaptBox           ( this, CUI_RES( CB_ADAPT ) ),
     218           0 :     aRegisterCB         ( this, CUI_RES( CB_REGISTER ) ),
     219           0 :     aRegisterFT         ( this, CUI_RES( FT_REGISTER ) ),
     220           0 :     aRegisterLB         ( this, CUI_RES( LB_REGISTER ) ),
     221             : 
     222           0 :     aInsideText         (       CUI_RES( STR_INSIDE ) ),
     223           0 :     aOutsideText        (       CUI_RES( STR_OUTSIDE ) ),
     224           0 :     aPrintRangeQueryText(       CUI_RES( STR_QUERY_PRINTRANGE ) ),
     225             : 
     226             :     bLandscape          ( sal_False ),
     227             :     eMode               ( SVX_PAGE_MODE_STANDARD ),
     228             :     ePaperStart         ( PAPER_A3 ),
     229             :     ePaperEnd           ( PAPER_ENV_DL ),
     230           0 :     pImpl               ( new SvxPage_Impl )
     231             : 
     232             : {
     233           0 :     bBorderModified = sal_False;
     234           0 :     FreeResource();
     235           0 :     aBspWin.EnableRTL( sal_False );
     236             : 
     237             :     // this page needs ExchangeSupport
     238           0 :     SetExchangeSupport();
     239             : 
     240           0 :     SvtLanguageOptions aLangOptions;
     241           0 :     sal_Bool bCJK = aLangOptions.IsAsianTypographyEnabled();
     242           0 :     sal_Bool bCTL = aLangOptions.IsCTLFontEnabled();
     243           0 :     sal_Bool bWeb = sal_False;
     244             :     const SfxPoolItem* pItem;
     245             : 
     246             :     SfxObjectShell* pShell;
     247           0 :     if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
     248             :         ( 0 != (pShell = SfxObjectShell::Current()) &&
     249           0 :                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
     250           0 :         bWeb = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
     251             : 
     252             :     //  fill text flow listbox with valid entries
     253           0 :     aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI ), FRMDIR_HORI_LEFT_TOP );
     254           0 :     if( bCTL )
     255           0 :         aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI ), FRMDIR_HORI_RIGHT_TOP );
     256             :     // #109989# do not show vertical directions in Writer/Web
     257           0 :     if( !bWeb )
     258             :     {
     259           0 :         if( bCJK )
     260             :         {
     261           0 :             aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT ), FRMDIR_VERT_TOP_RIGHT );
     262             : //            aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT );
     263             :         }
     264             :     }
     265             : 
     266             :     // #109989# show the text direction box in Writer/Web too
     267           0 :     if( (bCJK || bCTL) &&
     268           0 :         SFX_ITEM_UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION )))
     269             :     {
     270           0 :         aTextFlowLbl.Show();
     271           0 :         aTextFlowBox.Show();
     272           0 :         aTextFlowBox.SetSelectHdl(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl ));
     273             : 
     274           0 :         aBspWin.EnableFrameDirection(sal_True);
     275             :     }
     276           0 :     Init_Impl();
     277             : 
     278           0 :     FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
     279           0 :     SetFieldUnit( aLeftMarginEdit, eFUnit );
     280           0 :     SetFieldUnit( aRightMarginEdit, eFUnit );
     281           0 :     SetFieldUnit( aTopMarginEdit, eFUnit );
     282           0 :     SetFieldUnit( aBottomMarginEdit, eFUnit );
     283           0 :     SetFieldUnit( aPaperWidthEdit, eFUnit );
     284           0 :     SetFieldUnit( aPaperHeightEdit, eFUnit );
     285             : 
     286           0 :     if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() )
     287           0 :         pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter();
     288             :     else
     289             :     {
     290           0 :         pImpl->mpDefPrinter = new Printer;
     291           0 :         pImpl->mbDelPrinter = true;
     292             :     }
     293             : 
     294           0 :     MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
     295           0 :     pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
     296             : 
     297             :     // set first- and last-values for the margins
     298           0 :     Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
     299           0 :     Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
     300             :     /*
     301             :      * To convert a point ( 0,0 ) into logic coordinates
     302             :      * looks like nonsense; but it makes sense when the
     303             :      * coordinate system's origin has been moved.
     304             :      */
     305           0 :     Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
     306           0 :                          pImpl->mpDefPrinter->PixelToLogic( Point() );
     307           0 :     pImpl->mpDefPrinter->SetMapMode( aOldMode );
     308             : 
     309           0 :     long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
     310           0 :     aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP );
     311           0 :     nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst());
     312             :     aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize(
     313           0 :         aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset ), FUNIT_TWIP);
     314           0 :     nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst());
     315           0 :     aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( aPrintOffset.Y() ), FUNIT_TWIP );
     316           0 :     nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst());
     317             :     aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize(
     318           0 :         aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset ), FUNIT_TWIP );
     319           0 :     nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst());
     320             :     aLeftMarginEdit.SetLast( aLeftMarginEdit.Normalize(
     321           0 :         aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP );
     322           0 :     nLastLeftMargin = static_cast<long>(aLeftMarginEdit.GetLast());
     323             :     aRightMarginEdit.SetLast( aRightMarginEdit.Normalize(
     324           0 :         aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP );
     325           0 :     nLastRightMargin = static_cast<long>(aRightMarginEdit.GetLast());
     326             :     aTopMarginEdit.SetLast( aTopMarginEdit.Normalize(
     327           0 :         aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP );
     328           0 :     nLastTopMargin = static_cast<long>(aTopMarginEdit.GetLast());
     329             :     aBottomMarginEdit.SetLast( aBottomMarginEdit.Normalize(
     330           0 :         aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP );
     331           0 :     nLastBottomMargin = static_cast<long>(aBottomMarginEdit.GetLast());
     332             : 
     333             :     // #i4219# get DrawingLayer options
     334           0 :     const SvtOptionsDrawinglayer aDrawinglayerOpt;
     335             : 
     336             :     // #i4219# take Maximum now from configuration (1/100th cm)
     337             :     // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000
     338           0 :     aPaperWidthEdit.SetMax(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM);
     339           0 :     aPaperWidthEdit.SetLast(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM);
     340           0 :     aPaperHeightEdit.SetMax(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM);
     341           0 :     aPaperHeightEdit.SetLast(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM);
     342             : 
     343             :     // #i4219# also for margins (1/100th cm). Was: 9999, keeping.
     344           0 :     aLeftMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperLeftMargin());
     345           0 :     aLeftMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperLeftMargin());
     346           0 :     aRightMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperRightMargin());
     347           0 :     aRightMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperRightMargin());
     348           0 :     aTopMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperTopMargin());
     349           0 :     aTopMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperTopMargin());
     350           0 :     aBottomMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperBottomMargin());
     351           0 :     aBottomMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperBottomMargin());
     352             : 
     353           0 :     aPortraitBtn.SetAccessibleRelationMemberOf(&aOrientationFT);
     354           0 :     aLandscapeBtn.SetAccessibleRelationMemberOf(&aOrientationFT);
     355             : 
     356             :     // Get the i18n framework numberings and add them to the listbox.
     357           0 :     SvxNumOptionsTabPage::GetI18nNumbering( aNumberFormatBox, ::std::numeric_limits<sal_uInt16>::max());
     358           0 : }
     359             : 
     360             : // -----------------------------------------------------------------------
     361             : 
     362           0 : SvxPageDescPage::~SvxPageDescPage()
     363             : {
     364           0 :     delete pImpl;
     365           0 : }
     366             : 
     367             : // -----------------------------------------------------------------------
     368             : 
     369           0 : void SvxPageDescPage::Init_Impl()
     370             : {
     371           0 :     aLeftText = aLeftMarginLbl.GetText();
     372           0 :     aRightText = aRightMarginLbl.GetText();
     373             : 
     374             :         // adjust the handler
     375           0 :     aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) );
     376           0 :     aPaperSizeBox.SetDropDownLineCount(10);
     377             : 
     378             :     aPaperTrayBox.SetGetFocusHdl(
     379           0 :         LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) );
     380             :     aPaperSizeBox.SetSelectHdl(
     381           0 :         LINK( this, SvxPageDescPage, PaperSizeSelect_Impl ) );
     382             :     aPaperWidthEdit.SetModifyHdl(
     383           0 :         LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) );
     384             :     aPaperHeightEdit.SetModifyHdl(
     385           0 :         LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) );
     386             :     aLandscapeBtn.SetClickHdl(
     387           0 :         LINK( this, SvxPageDescPage, SwapOrientation_Impl ) );
     388             :     aPortraitBtn.SetClickHdl(
     389           0 :         LINK( this, SvxPageDescPage, SwapOrientation_Impl ) );
     390             : 
     391           0 :     Link aLink = LINK( this, SvxPageDescPage, BorderModify_Impl );
     392           0 :     aLeftMarginEdit.SetModifyHdl( aLink );
     393           0 :     aRightMarginEdit.SetModifyHdl( aLink );
     394           0 :     aTopMarginEdit.SetModifyHdl( aLink );
     395           0 :     aBottomMarginEdit.SetModifyHdl( aLink );
     396             : 
     397           0 :     aLink = LINK( this, SvxPageDescPage, RangeHdl_Impl );
     398           0 :     aPaperWidthEdit.SetLoseFocusHdl( aLink );
     399           0 :     aPaperHeightEdit.SetLoseFocusHdl( aLink );
     400           0 :     aLeftMarginEdit.SetLoseFocusHdl( aLink );
     401           0 :     aRightMarginEdit.SetLoseFocusHdl( aLink );
     402           0 :     aTopMarginEdit.SetLoseFocusHdl( aLink );
     403           0 :     aBottomMarginEdit.SetLoseFocusHdl( aLink );
     404             : 
     405           0 :     aHorzBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) );
     406           0 :     aVertBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) );
     407             : 
     408           0 : }
     409             : 
     410             : // -----------------------------------------------------------------------
     411             : 
     412           0 : void SvxPageDescPage::Reset( const SfxItemSet& rSet )
     413             : {
     414           0 :     SfxItemPool* pPool = rSet.GetPool();
     415             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     416           0 :     SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) );
     417             : 
     418             :     // adjust margins (right/left)
     419           0 :     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
     420             : 
     421           0 :     if ( pItem )
     422             :     {
     423           0 :         const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
     424           0 :         SetMetricValue( aLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
     425             :         aBspWin.SetLeft(
     426           0 :             (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetLeft(), eUnit ) );
     427           0 :         SetMetricValue( aRightMarginEdit, rLRSpace.GetRight(), eUnit );
     428             :         aBspWin.SetRight(
     429           0 :             (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetRight(), eUnit ) );
     430             :     }
     431             : 
     432             :     // adjust margins (top/bottom)
     433           0 :     pItem = GetItem( rSet, SID_ATTR_ULSPACE );
     434             : 
     435           0 :     if ( pItem )
     436             :     {
     437           0 :         const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
     438           0 :         SetMetricValue( aTopMarginEdit, rULSpace.GetUpper(), eUnit );
     439             :         aBspWin.SetTop(
     440           0 :             (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) );
     441           0 :         SetMetricValue( aBottomMarginEdit, rULSpace.GetLower(), eUnit );
     442             :         aBspWin.SetBottom(
     443           0 :             (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) );
     444             :     }
     445             : 
     446             :     // general page data
     447           0 :     SvxNumType eNumType = SVX_ARABIC;
     448           0 :     bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE );
     449           0 :     sal_uInt16 nUse = (sal_uInt16)SVX_PAGE_ALL;
     450           0 :     pItem = GetItem( rSet, SID_ATTR_PAGE );
     451             : 
     452           0 :     if ( pItem )
     453             :     {
     454           0 :         const SvxPageItem& rItem = (const SvxPageItem&)*pItem;
     455           0 :         eNumType = rItem.GetNumType();
     456           0 :         nUse = rItem.GetPageUsage();
     457           0 :         bLandscape = rItem.IsLandscape();
     458             :     }
     459             : 
     460             :     // alignment
     461           0 :     aLayoutBox.SelectEntryPos( ::PageUsageToPos_Impl( nUse ) );
     462           0 :     aBspWin.SetUsage( nUse );
     463           0 :     LayoutHdl_Impl( 0 );
     464             : 
     465             :     //adjust numeration type of the page style
     466             :     //Get the Position of the saved NumType
     467           0 :     for(int i=0; i<aNumberFormatBox.GetEntryCount(); i++)
     468           0 :         if(eNumType == (sal_uInt16)(sal_uLong)aNumberFormatBox.GetEntryData(i)){
     469           0 :             aNumberFormatBox.SelectEntryPos( i );
     470           0 :             break;
     471             :         }
     472             : 
     473           0 :     aPaperTrayBox.Clear();
     474           0 :     sal_uInt8 nPaperBin = PAPERBIN_PRINTER_SETTINGS;
     475           0 :     pItem = GetItem( rSet, SID_ATTR_PAGE_PAPERBIN );
     476             : 
     477           0 :     if ( pItem )
     478             :     {
     479           0 :         nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue();
     480             : 
     481           0 :         if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() )
     482           0 :             nPaperBin = PAPERBIN_PRINTER_SETTINGS;
     483             :     }
     484             : 
     485           0 :     String aBinName;
     486             : 
     487           0 :     if ( PAPERBIN_PRINTER_SETTINGS  == nPaperBin )
     488           0 :         aBinName = EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS );
     489             :     else
     490           0 :         aBinName = pImpl->mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin );
     491             : 
     492           0 :     sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( aBinName );
     493           0 :     aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)nPaperBin );
     494           0 :     aPaperTrayBox.SelectEntry( aBinName );
     495             : 
     496           0 :     Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter );
     497           0 :     pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
     498             : 
     499           0 :     if ( pItem )
     500           0 :         aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize();
     501             : 
     502             :     bool bOrientationSupport =
     503           0 :         pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION );
     504             : 
     505           0 :     if ( !bOrientationSupport &&
     506           0 :          aPaperSize.Width() > aPaperSize.Height() )
     507           0 :         bLandscape = sal_True;
     508             : 
     509           0 :     aLandscapeBtn.Check( bLandscape );
     510           0 :     aPortraitBtn.Check( !bLandscape );
     511             : 
     512           0 :     aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
     513           0 :                            ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
     514             : 
     515           0 :     aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM);
     516           0 :     if ( bLandscape )
     517           0 :         Swap( aPaperSize );
     518             : 
     519             :     // Actual Paper Format
     520           0 :     Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, sal_True );
     521             : 
     522           0 :     if ( PAPER_USER != ePaper )
     523           0 :         aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
     524             : 
     525           0 :     if ( bLandscape )
     526           0 :         Swap( aPaperSize );
     527             : 
     528             :     // write values into the edits
     529           0 :     SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM );
     530           0 :     SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM );
     531           0 :     aPaperSizeBox.Clear();
     532             : 
     533           0 :     sal_uInt16 nActPos = LISTBOX_ENTRY_NOTFOUND;
     534           0 :     sal_uInt16 nAryId = RID_SVXSTRARY_PAPERSIZE_STD;
     535             : 
     536           0 :     if ( ePaperStart != PAPER_A3 )
     537           0 :         nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW;
     538           0 :     ResStringArray aPaperAry( CUI_RES( nAryId ) );
     539           0 :     sal_uInt32 nCnt = aPaperAry.Count();
     540             : 
     541           0 :     sal_uInt16 nUserPos = LISTBOX_ENTRY_NOTFOUND;
     542           0 :     for ( sal_uInt32 i = 0; i < nCnt; ++i )
     543             :     {
     544           0 :         String aStr = aPaperAry.GetString(i);
     545           0 :         Paper eSize = (Paper)aPaperAry.GetValue(i);
     546           0 :         sal_uInt16 nPos = aPaperSizeBox.InsertEntry( aStr );
     547           0 :         aPaperSizeBox.SetEntryData( nPos, (void*)(sal_uLong)eSize );
     548             : 
     549           0 :         if ( eSize == ePaper )
     550           0 :             nActPos = nPos;
     551           0 :         if( eSize == PAPER_USER )
     552           0 :             nUserPos = nPos;
     553           0 :     }
     554             :     // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead
     555           0 :     aPaperSizeBox.SelectEntryPos( nActPos != LISTBOX_ENTRY_NOTFOUND ? nActPos : nUserPos );
     556             : 
     557             :     // application specific
     558             : 
     559           0 :     switch ( eMode )
     560             :     {
     561             :         case SVX_PAGE_MODE_CENTER:
     562             :         {
     563           0 :             aTblAlignFT.Show();
     564           0 :             aHorzBox.Show();
     565           0 :             aVertBox.Show();
     566           0 :             DisableVerticalPageDir();
     567             : 
     568             :             // horizontal alignment
     569           0 :             pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
     570           0 :             aHorzBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue()
     571           0 :                                   : sal_False );
     572             : 
     573             :             // vertical alignment
     574           0 :             pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
     575           0 :             aVertBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue()
     576           0 :                                   : sal_False );
     577             : 
     578             :             // set example window on the table
     579           0 :             aBspWin.SetTable( sal_True );
     580           0 :             aBspWin.SetHorz( aHorzBox.IsChecked() );
     581           0 :             aBspWin.SetVert( aVertBox.IsChecked() );
     582             : 
     583           0 :             break;
     584             :         }
     585             : 
     586             :         case SVX_PAGE_MODE_PRESENTATION:
     587             :         {
     588           0 :             DisableVerticalPageDir();
     589           0 :             aAdaptBox.Show();
     590           0 :             pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
     591             :             aAdaptBox.Check( pItem ?
     592           0 :                 ( (const SfxBoolItem*)pItem )->GetValue() : sal_False );
     593             : 
     594             :             //!!! hidden, because not implemented by StarDraw
     595           0 :             aLayoutBox.Hide();
     596           0 :             aPageText.Hide();
     597             : 
     598           0 :             break;
     599             :         }
     600             :         default: ;//prevent warning
     601             :     }
     602             : 
     603             : 
     604             :     // display background and border in the example
     605           0 :     ResetBackground_Impl( rSet );
     606             : //! UpdateExample_Impl();
     607           0 :     RangeHdl_Impl( 0 );
     608             : 
     609           0 :     InitHeadFoot_Impl( rSet );
     610             : 
     611           0 :     bBorderModified = sal_False;
     612           0 :     SwapFirstValues_Impl( sal_False );
     613           0 :     UpdateExample_Impl();
     614             : 
     615           0 :     aLeftMarginEdit.SaveValue();
     616           0 :     aRightMarginEdit.SaveValue();
     617           0 :     aTopMarginEdit.SaveValue();
     618           0 :     aBottomMarginEdit.SaveValue();
     619           0 :     aLayoutBox.SaveValue();
     620           0 :     aNumberFormatBox.SaveValue();
     621           0 :     aPaperSizeBox.SaveValue();
     622           0 :     aPaperWidthEdit.SaveValue();
     623           0 :     aPaperHeightEdit.SaveValue();
     624           0 :     aPortraitBtn.SaveValue();
     625           0 :     aLandscapeBtn.SaveValue();
     626           0 :     aPaperTrayBox.SaveValue();
     627           0 :     aVertBox.SaveValue();
     628           0 :     aHorzBox.SaveValue();
     629           0 :     aAdaptBox.SaveValue();
     630             : 
     631           0 :     CheckMarginEdits( true );
     632             : 
     633             : 
     634           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_MODE))
     635             :     {
     636             :         aRegisterCB.Check(((const SfxBoolItem&)rSet.Get(
     637           0 :                                 SID_SWREGISTER_MODE)).GetValue());
     638           0 :         aRegisterCB.SaveValue();
     639           0 :         RegisterModify(&aRegisterCB);
     640             :     }
     641           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_COLLECTION))
     642             :     {
     643             :         aRegisterLB.SelectEntry(
     644           0 :                 ((const SfxStringItem&)rSet.Get(SID_SWREGISTER_COLLECTION)).GetValue());
     645           0 :         aRegisterLB.SaveValue();
     646             :     }
     647             : 
     648           0 :     SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ),
     649           0 :                                                 sal_True, &pItem );
     650           0 :     if( SFX_ITEM_UNKNOWN != eState )
     651             :     {
     652             :         sal_uInt32 nVal  = SFX_ITEM_SET == eState
     653           0 :                                 ? ((SvxFrameDirectionItem*)pItem)->GetValue()
     654           0 :                                 : 0;
     655           0 :         aTextFlowBox.SelectEntryValue( static_cast< SvxFrameDirection >( nVal ) );
     656           0 :         aTextFlowBox.SaveValue();
     657           0 :         aBspWin.SetFrameDirection(nVal);
     658           0 :     }
     659           0 : }
     660             : 
     661             : // -----------------------------------------------------------------------
     662             : 
     663           0 : void SvxPageDescPage::FillUserData()
     664             : {
     665           0 :     if ( SVX_PAGE_MODE_PRESENTATION == eMode )
     666           0 :         SetUserData( OUString::valueOf( (sal_Int32)aAdaptBox.IsChecked() ) );
     667           0 : }
     668             : 
     669             : // -----------------------------------------------------------------------
     670             : 
     671           0 : sal_Bool SvxPageDescPage::FillItemSet( SfxItemSet& rSet )
     672             : {
     673           0 :     sal_Bool bModified = sal_False;
     674           0 :     const SfxItemSet& rOldSet = GetItemSet();
     675           0 :     SfxItemPool* pPool = rOldSet.GetPool();
     676             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     677           0 :     sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
     678           0 :     SfxMapUnit eUnit = pPool->GetMetric( nWhich );
     679           0 :     const SfxPoolItem* pOld = 0;
     680             : 
     681             :     // copy old left and right margins
     682           0 :     SvxLRSpaceItem aMargin( (const SvxLRSpaceItem&)rOldSet.Get( nWhich ) );
     683             : 
     684             :     // copy old top and bottom margins
     685           0 :     nWhich = GetWhich( SID_ATTR_ULSPACE );
     686           0 :     SvxULSpaceItem aTopMargin( (const SvxULSpaceItem&)rOldSet.Get( nWhich ) );
     687             : 
     688           0 :     if ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() )
     689             :     {
     690           0 :         aMargin.SetLeft( (sal_uInt16)GetCoreValue( aLeftMarginEdit, eUnit ) );
     691           0 :         bModified |= sal_True;
     692             :     }
     693             : 
     694           0 :     if ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() )
     695             :     {
     696           0 :         aMargin.SetRight( (sal_uInt16)GetCoreValue( aRightMarginEdit, eUnit ) );
     697           0 :         bModified |= sal_True;
     698             :     }
     699             : 
     700             :     // set left and right margins
     701           0 :     if ( bModified )
     702             :     {
     703           0 :         pOld = GetOldItem( rSet, SID_ATTR_LRSPACE );
     704             : 
     705           0 :         if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) )
     706           0 :             rSet.Put( aMargin );
     707             :         else
     708           0 :             bModified = sal_False;
     709             :     }
     710             : 
     711           0 :     sal_Bool bMod = sal_False;
     712             : 
     713           0 :     if ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() )
     714             :     {
     715           0 :         aTopMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopMarginEdit, eUnit ) );
     716           0 :         bMod |= sal_True;
     717             :     }
     718             : 
     719           0 :     if ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() )
     720             :     {
     721           0 :         aTopMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomMarginEdit, eUnit ) );
     722           0 :         bMod |= sal_True;
     723             :     }
     724             : 
     725             :     // set top and bottom margins
     726             :     //
     727           0 :     if ( bMod )
     728             :     {
     729           0 :         pOld = GetOldItem( rSet, SID_ATTR_ULSPACE );
     730             : 
     731           0 :         if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aTopMargin ) )
     732             :         {
     733           0 :             bModified |= sal_True;
     734           0 :             rSet.Put( aTopMargin );
     735             :         }
     736             :     }
     737             : 
     738             :     // paper tray
     739           0 :     nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN );
     740           0 :     sal_uInt16 nPos = aPaperTrayBox.GetSelectEntryPos();
     741           0 :     sal_uInt16 nBin = (sal_uInt16)(sal_uLong)aPaperTrayBox.GetEntryData( nPos );
     742           0 :     pOld = GetOldItem( rSet, SID_ATTR_PAGE_PAPERBIN );
     743             : 
     744           0 :     if ( !pOld || ( (const SvxPaperBinItem*)pOld )->GetValue() != nBin )
     745             :     {
     746           0 :         rSet.Put( SvxPaperBinItem( nWhich, (sal_uInt8)nBin ) );
     747           0 :         bModified |= sal_True;
     748             :     }
     749             : 
     750           0 :     nPos = aPaperSizeBox.GetSelectEntryPos();
     751           0 :     Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos );
     752           0 :     const sal_uInt16 nOld = aPaperSizeBox.GetSavedValue();
     753           0 :     sal_Bool bChecked = aLandscapeBtn.IsChecked();
     754             : 
     755           0 :     if ( PAPER_USER == ePaper )
     756             :     {
     757           0 :         if ( nOld != nPos                       ||
     758           0 :              aPaperWidthEdit.IsValueModified()  ||
     759           0 :              aPaperHeightEdit.IsValueModified() ||
     760           0 :              bChecked != aLandscapeBtn.GetSavedValue() )
     761             :         {
     762             :             Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
     763           0 :                         GetCoreValue( aPaperHeightEdit, eUnit ) );
     764           0 :             pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE );
     765             : 
     766           0 :             if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize )
     767             :             {
     768           0 :                 rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
     769           0 :                 bModified |= sal_True;
     770             :             }
     771             :         }
     772             :     }
     773             :     else
     774             :     {
     775           0 :         if ( nOld != nPos || bChecked != aLandscapeBtn.GetSavedValue() )
     776             :         {
     777           0 :             Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) );
     778             : 
     779           0 :             if ( bChecked )
     780           0 :                 Swap( aSize );
     781             : 
     782           0 :             pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE );
     783             : 
     784           0 :             if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize )
     785             :             {
     786           0 :                 rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) );
     787           0 :                 bModified |= sal_True;
     788             :             }
     789             :         }
     790             :     }
     791             : 
     792           0 :     nWhich = GetWhich( SID_ATTR_PAGE );
     793           0 :     SvxPageItem aPage( (const SvxPageItem&)rOldSet.Get( nWhich ) );
     794           0 :     bMod =  aLayoutBox.GetSelectEntryPos()  != aLayoutBox.GetSavedValue();
     795             : 
     796           0 :     if ( bMod )
     797             :         aPage.SetPageUsage(
     798           0 :             ::PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) );
     799             : 
     800           0 :     if ( bChecked != aLandscapeBtn.GetSavedValue() )
     801             :     {
     802           0 :         aPage.SetLandscape(bChecked);
     803           0 :         bMod |= sal_True;
     804             :     }
     805             : 
     806             :     //Get the NumType value
     807           0 :     nPos = aNumberFormatBox.GetSelectEntryPos();
     808           0 :     sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aNumberFormatBox.GetEntryData(nPos);
     809           0 :     if ( nPos != aNumberFormatBox.GetSavedValue() )
     810             :     {
     811           0 :         aPage.SetNumType( (SvxNumType)nEntryData );
     812           0 :         bMod |= sal_True;
     813             :     }
     814             : 
     815           0 :     if ( bMod )
     816             :     {
     817           0 :         pOld = GetOldItem( rSet, SID_ATTR_PAGE );
     818             : 
     819           0 :         if ( !pOld || !( *(const SvxPageItem*)pOld == aPage ) )
     820             :         {
     821           0 :             rSet.Put( aPage );
     822           0 :             bModified |= sal_True;
     823             :         }
     824             :     }
     825           0 :     else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich ) )
     826           0 :         rSet.ClearItem( nWhich );
     827             :     else
     828           0 :         rSet.Put( rOldSet.Get( nWhich ) );
     829             : 
     830             :     // evaluate mode specific controls
     831             : 
     832           0 :     switch ( eMode )
     833             :     {
     834             :         case SVX_PAGE_MODE_CENTER:
     835             :         {
     836           0 :             if ( aHorzBox.IsChecked() != aHorzBox.GetSavedValue() )
     837             :             {
     838           0 :                 SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ),
     839           0 :                                    aHorzBox.IsChecked() );
     840           0 :                 rSet.Put( aHorz );
     841           0 :                 bModified |= sal_True;
     842             :             }
     843             : 
     844           0 :             if ( aVertBox.IsChecked() != aVertBox.GetSavedValue() )
     845             :             {
     846           0 :                 SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ),
     847           0 :                                    aVertBox.IsChecked() );
     848           0 :                 rSet.Put( aVert );
     849           0 :                 bModified |= sal_True;
     850             :             }
     851           0 :             break;
     852             :         }
     853             : 
     854             :         case SVX_PAGE_MODE_PRESENTATION:
     855             :         {
     856             :             // always put so that draw can evaluate this
     857           0 :             rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ),
     858           0 :                       aAdaptBox.IsChecked() ) );
     859           0 :             bModified |= sal_True;
     860           0 :             break;
     861             :         }
     862             :         default: ;//prevent warning
     863             : 
     864             :     }
     865             : 
     866           0 :     if(aRegisterCB.IsVisible() &&
     867           0 :         (aRegisterCB.IsChecked() || aRegisterCB.GetSavedValue() != aRegisterCB.IsChecked()))
     868             :     {
     869           0 :         const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE);
     870           0 :         SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone();
     871           0 :         sal_Bool bCheck = aRegisterCB.IsChecked();
     872           0 :         pRegItem->SetValue(bCheck);
     873           0 :         rSet.Put(*pRegItem);
     874           0 :         bModified |= sal_True;
     875           0 :         if(bCheck)
     876             :         {
     877           0 :             bModified |= sal_True;
     878             :             rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
     879           0 :                             aRegisterLB.GetSelectEntry()));
     880             :         }
     881           0 :         delete pRegItem;
     882             :     }
     883             : 
     884           0 :     SvxFrameDirection eDirection = aTextFlowBox.GetSelectEntryValue();
     885           0 :     if( aTextFlowBox.IsVisible() && (eDirection != aTextFlowBox.GetSavedValue()) )
     886             :     {
     887           0 :         rSet.Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
     888           0 :         bModified = sal_True;
     889             :     }
     890             : 
     891           0 :     return bModified;
     892             : }
     893             : 
     894             : // -----------------------------------------------------------------------
     895             : 
     896           0 : IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl)
     897             : {
     898             :     // switch inside outside
     899           0 :     const sal_uInt16 nPos = PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() );
     900             : 
     901           0 :     if ( nPos == SVX_PAGE_MIRROR )
     902             :     {
     903           0 :         if ( aLeftMarginLbl.GetText() != aInsideText )
     904           0 :             aLeftMarginLbl.SetText( aInsideText );
     905             : 
     906           0 :         if ( aRightMarginLbl.GetText() != aOutsideText )
     907           0 :             aRightMarginLbl.SetText( aOutsideText );
     908             :     }
     909             :     else
     910             :     {
     911           0 :         if ( aLeftMarginLbl.GetText() != aLeftText )
     912           0 :             aLeftMarginLbl.SetText( aLeftText );
     913             : 
     914           0 :         if ( aRightMarginLbl.GetText() != aRightText )
     915           0 :             aRightMarginLbl.SetText( aRightText );
     916             :     }
     917           0 :     UpdateExample_Impl( true );
     918           0 :     return 0;
     919             : }
     920             : 
     921             : // -----------------------------------------------------------------------
     922             : 
     923           0 : IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl)
     924             : {
     925           0 :     if ( aPaperTrayBox.GetEntryCount() > 1 )
     926             :         // already filled
     927           0 :         return 0;
     928             : 
     929           0 :     String aOldName = aPaperTrayBox.GetSelectEntry();
     930           0 :     aPaperTrayBox.SetUpdateMode( sal_False );
     931           0 :     aPaperTrayBox.Clear();
     932             :     sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry(
     933           0 :         EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ) );
     934             :     aPaperTrayBox.SetEntryData( nEntryPos,
     935           0 :         (void*)(sal_uLong)PAPERBIN_PRINTER_SETTINGS );
     936           0 :     String aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) );
     937           0 :     sal_uInt16 nBinCount = pImpl->mpDefPrinter->GetPaperBinCount();
     938             : 
     939           0 :     for ( sal_uInt16 i = 0; i < nBinCount; ++i )
     940             :     {
     941           0 :         String aName = pImpl->mpDefPrinter->GetPaperBinName(i);
     942             : 
     943           0 :         if ( !aName.Len() )
     944             :         {
     945           0 :             aName = aPaperBin;
     946           0 :             aName.Append( sal_Unicode(' ') );
     947           0 :             aName.Append( OUString::valueOf( static_cast<sal_Int32>(i+1) ) );
     948             :         }
     949           0 :         nEntryPos = aPaperTrayBox.InsertEntry( aName );
     950           0 :         aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)i );
     951           0 :     }
     952           0 :     aPaperTrayBox.SelectEntry( aOldName );
     953           0 :     aPaperTrayBox.SetUpdateMode( sal_True );
     954             : 
     955           0 :     return 0;
     956             : }
     957             : 
     958             : // -----------------------------------------------------------------------
     959             : 
     960           0 : IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox )
     961             : {
     962           0 :     const sal_uInt16 nPos = pBox->GetSelectEntryPos();
     963           0 :     Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos );
     964             : 
     965           0 :     if ( ePaper != PAPER_USER )
     966             :     {
     967           0 :         Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) );
     968             : 
     969           0 :         if ( aLandscapeBtn.IsChecked() )
     970           0 :             Swap( aSize );
     971             : 
     972           0 :         if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) )
     973             :             aPaperHeightEdit.SetMin(
     974           0 :                 aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM );
     975           0 :         if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) )
     976             :             aPaperWidthEdit.SetMin(
     977           0 :                 aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM );
     978           0 :         SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM );
     979           0 :         SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM );
     980             : 
     981           0 :         CalcMargin_Impl();
     982             : 
     983           0 :         RangeHdl_Impl( 0 );
     984           0 :         UpdateExample_Impl( true );
     985             : 
     986           0 :         if ( eMode == SVX_PAGE_MODE_PRESENTATION )
     987             :         {
     988             :             // Draw: if paper format the margin shall be 1 cm
     989           0 :             long nTmp = 0;
     990           0 :             sal_Bool bScreen = (( PAPER_SCREEN_4_3 == ePaper )||( PAPER_SCREEN_16_9 == ePaper)||( PAPER_SCREEN_16_10 == ePaper));
     991             : 
     992           0 :             if ( !bScreen )
     993             :                 // no margin if screen
     994           0 :                 nTmp = 1; // accordingly 1 cm
     995             : 
     996           0 :             if ( bScreen || aRightMarginEdit.GetValue() == 0 )
     997             :             {
     998           0 :                 SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM );
     999           0 :                 if ( !bScreen &&
    1000           0 :                      aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() )
    1001           0 :                     aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() );
    1002             :             }
    1003           0 :             if ( bScreen || aLeftMarginEdit.GetValue() == 0 )
    1004             :             {
    1005           0 :                 SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM );
    1006           0 :                 if ( !bScreen &&
    1007           0 :                      aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() )
    1008           0 :                     aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() );
    1009             :             }
    1010           0 :             if ( bScreen || aBottomMarginEdit.GetValue() == 0 )
    1011             :             {
    1012           0 :                 SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM );
    1013           0 :                 if ( !bScreen &&
    1014           0 :                      aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() )
    1015           0 :                     aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() );
    1016             :             }
    1017           0 :             if ( bScreen || aTopMarginEdit.GetValue() == 0 )
    1018             :             {
    1019           0 :                 SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM );
    1020           0 :                 if ( !bScreen &&
    1021           0 :                      aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() )
    1022           0 :                     aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() );
    1023             :             }
    1024           0 :             UpdateExample_Impl( true );
    1025             :         }
    1026             :     }
    1027           0 :     return 0;
    1028             : }
    1029             : 
    1030             : // -----------------------------------------------------------------------
    1031             : 
    1032           0 : IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeModify_Impl)
    1033             : {
    1034           0 :     sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
    1035           0 :     SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
    1036             :     Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
    1037           0 :                 GetCoreValue( aPaperHeightEdit, eUnit ) );
    1038           0 :     Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, sal_True );
    1039           0 :     sal_uInt16 nEntryCount = aPaperSizeBox.GetEntryCount();
    1040             : 
    1041           0 :     for ( sal_uInt16 i = 0; i < nEntryCount; ++i )
    1042             :     {
    1043           0 :         Paper eTmp = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData(i);
    1044             : 
    1045           0 :         if ( eTmp == ePaper )
    1046             :         {
    1047           0 :             aPaperSizeBox.SelectEntryPos(i);
    1048           0 :             break;
    1049             :         }
    1050             :     }
    1051           0 :     UpdateExample_Impl( true );
    1052           0 :     return 0;
    1053             : }
    1054             : 
    1055             : // -----------------------------------------------------------------------
    1056             : 
    1057           0 : IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn )
    1058             : {
    1059           0 :     if (
    1060           0 :         (!bLandscape && pBtn == &aLandscapeBtn) ||
    1061             :         (bLandscape  && pBtn == &aPortraitBtn)
    1062             :        )
    1063             :     {
    1064           0 :         bLandscape = aLandscapeBtn.IsChecked();
    1065             : 
    1066           0 :         const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM );
    1067           0 :         const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM );
    1068             : 
    1069             :         // swap with and height
    1070           0 :         SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM );
    1071           0 :         SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM );
    1072             : 
    1073             :         // recalculate margins if necessary
    1074           0 :         CalcMargin_Impl();
    1075             : 
    1076           0 :         PaperSizeSelect_Impl( &aPaperSizeBox );
    1077           0 :         RangeHdl_Impl( 0 );
    1078           0 :         SwapFirstValues_Impl( bBorderModified );
    1079           0 :         UpdateExample_Impl( true );
    1080             :     }
    1081           0 :     return 0;
    1082             : }
    1083             : 
    1084             : // -----------------------------------------------------------------------
    1085             : 
    1086           0 : void SvxPageDescPage::SwapFirstValues_Impl( bool bSet )
    1087             : {
    1088           0 :     MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode();
    1089           0 :     Orientation eOri = ORIENTATION_PORTRAIT;
    1090             : 
    1091           0 :     if ( bLandscape )
    1092           0 :         eOri = ORIENTATION_LANDSCAPE;
    1093           0 :     Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation();
    1094           0 :     pImpl->mpDefPrinter->SetOrientation( eOri );
    1095           0 :     pImpl->mpDefPrinter->SetMapMode( MAP_TWIP );
    1096             : 
    1097             :     // set first- and last-values for margins
    1098           0 :     Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize();
    1099           0 :     Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize();
    1100             :     /*
    1101             :      * To convert a point ( 0,0 ) into logic coordinates
    1102             :      * looks like nonsense; but it makes sense if the
    1103             :      * coordinate system's origin has been moved.
    1104             :      */
    1105           0 :     Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() -
    1106           0 :                          pImpl->mpDefPrinter->PixelToLogic( Point() );
    1107           0 :     pImpl->mpDefPrinter->SetMapMode( aOldMode );
    1108           0 :     pImpl->mpDefPrinter->SetOrientation( eOldOri );
    1109             : 
    1110             :     sal_Int64 nSetL = aLeftMarginEdit.Denormalize(
    1111           0 :                     aLeftMarginEdit.GetValue( FUNIT_TWIP ) );
    1112             :     sal_Int64 nSetR = aRightMarginEdit.Denormalize(
    1113           0 :                     aRightMarginEdit.GetValue( FUNIT_TWIP ) );
    1114             :     sal_Int64 nSetT = aTopMarginEdit.Denormalize(
    1115           0 :                     aTopMarginEdit.GetValue( FUNIT_TWIP ) );
    1116             :     sal_Int64 nSetB = aBottomMarginEdit.Denormalize(
    1117           0 :                     aBottomMarginEdit.GetValue( FUNIT_TWIP ) );
    1118             : 
    1119           0 :     long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
    1120           0 :     long nNewL = aPrintOffset.X();
    1121             :     long nNewR =
    1122           0 :         aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset;
    1123           0 :     long nNewT = aPrintOffset.Y();
    1124             :     long nNewB =
    1125           0 :         aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset;
    1126             : 
    1127           0 :     aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP );
    1128           0 :     nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst());
    1129           0 :     aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP );
    1130           0 :     nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst());
    1131           0 :     aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP );
    1132           0 :     nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst());
    1133           0 :     aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP );
    1134           0 :     nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst());
    1135             : 
    1136           0 :     if ( bSet )
    1137             :     {
    1138           0 :         if ( nSetL < nNewL )
    1139             :             aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ),
    1140           0 :                                       FUNIT_TWIP );
    1141           0 :         if ( nSetR < nNewR )
    1142             :             aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ),
    1143           0 :                                        FUNIT_TWIP );
    1144           0 :         if ( nSetT < nNewT )
    1145             :             aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ),
    1146           0 :                                      FUNIT_TWIP );
    1147           0 :         if ( nSetB < nNewB )
    1148             :             aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ),
    1149           0 :                                         FUNIT_TWIP );
    1150           0 :     }
    1151           0 : }
    1152             : 
    1153             : // -----------------------------------------------------------------------
    1154             : 
    1155           0 : IMPL_LINK_NOARG_INLINE_START(SvxPageDescPage, BorderModify_Impl)
    1156             : {
    1157           0 :     if ( !bBorderModified )
    1158           0 :         bBorderModified = sal_True;
    1159           0 :     UpdateExample_Impl();
    1160           0 :     return 0;
    1161             : }
    1162           0 : IMPL_LINK_NOARG_INLINE_END(SvxPageDescPage, BorderModify_Impl)
    1163             : 
    1164             : // -----------------------------------------------------------------------
    1165             : 
    1166           0 : void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
    1167             : {
    1168             :     // Size
    1169             :     Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ),
    1170           0 :                 GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) );
    1171             : 
    1172           0 :     aBspWin.SetSize( aSize );
    1173             : 
    1174             :     // Margins
    1175           0 :     aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) );
    1176           0 :     aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) );
    1177           0 :     aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) );
    1178           0 :     aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) );
    1179             : 
    1180             :     // Layout
    1181           0 :     aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) );
    1182           0 :     if ( bResetbackground )
    1183           0 :         aBspWin.ResetBackground();
    1184           0 :     aBspWin.Invalidate();
    1185           0 : }
    1186             : 
    1187             : // -----------------------------------------------------------------------
    1188             : 
    1189           0 : void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet )
    1190             : {
    1191           0 :     sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
    1192             : 
    1193           0 :     if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    1194             :     {
    1195             :         const SvxSetItem& rSetItem =
    1196           0 :             (const SvxSetItem&)rSet.Get( nWhich, sal_False );
    1197           0 :         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
    1198             :         const SfxBoolItem& rOn =
    1199           0 :             (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
    1200             : 
    1201           0 :         if ( rOn.GetValue() )
    1202             :         {
    1203           0 :             nWhich = GetWhich( SID_ATTR_BRUSH );
    1204             : 
    1205           0 :             if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
    1206             :             {
    1207             :                 const SvxBrushItem& rItem =
    1208           0 :                     (const SvxBrushItem&)rTmpSet.Get( nWhich );
    1209           0 :                 aBspWin.SetHdColor( rItem.GetColor() );
    1210             :             }
    1211           0 :             nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
    1212             : 
    1213           0 :             if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
    1214             :             {
    1215             :                 const SvxBoxItem& rItem =
    1216           0 :                     (const SvxBoxItem&)rTmpSet.Get( nWhich );
    1217           0 :                 aBspWin.SetHdBorder( rItem );
    1218             :             }
    1219             :         }
    1220             :     }
    1221             : 
    1222           0 :     nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
    1223             : 
    1224           0 :     if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
    1225             :     {
    1226             :         const SvxSetItem& rSetItem =
    1227           0 :             (const SvxSetItem&)rSet.Get( nWhich, sal_False );
    1228           0 :         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
    1229             :         const SfxBoolItem& rOn =
    1230           0 :             (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
    1231             : 
    1232           0 :         if ( rOn.GetValue() )
    1233             :         {
    1234           0 :             nWhich = GetWhich( SID_ATTR_BRUSH );
    1235             : 
    1236           0 :             if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
    1237             :             {
    1238             :                 const SvxBrushItem& rItem =
    1239           0 :                     (const SvxBrushItem&)rTmpSet.Get( nWhich );
    1240           0 :                 aBspWin.SetFtColor( rItem.GetColor() );
    1241             :             }
    1242           0 :             nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
    1243             : 
    1244           0 :             if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
    1245             :             {
    1246             :                 const SvxBoxItem& rItem =
    1247           0 :                     (const SvxBoxItem&)rTmpSet.Get( nWhich );
    1248           0 :                 aBspWin.SetFtBorder( rItem );
    1249             :             }
    1250             :         }
    1251             :     }
    1252             : 
    1253           0 :     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH );
    1254             : 
    1255           0 :     if ( pItem )
    1256             :     {
    1257           0 :         aBspWin.SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
    1258           0 :         const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();
    1259             : 
    1260           0 :         if ( pGrf )
    1261             :         {
    1262           0 :             Bitmap aBitmap = pGrf->GetBitmap();
    1263           0 :             aBspWin.SetBitmap( &aBitmap );
    1264             :         }
    1265             :         else
    1266           0 :             aBspWin.SetBitmap( NULL );
    1267             :     }
    1268             : 
    1269           0 :     pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER );
    1270             : 
    1271           0 :     if ( pItem )
    1272           0 :         aBspWin.SetBorder( (SvxBoxItem&)*pItem );
    1273           0 : }
    1274             : 
    1275             : // -----------------------------------------------------------------------
    1276             : 
    1277           0 : void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
    1278             : {
    1279           0 :     bLandscape = aLandscapeBtn.IsChecked();
    1280           0 :     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
    1281             : 
    1282           0 :     if ( pItem )
    1283           0 :         aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() );
    1284             : 
    1285           0 :     const SvxSetItem* pSetItem = 0;
    1286             : 
    1287             :     // evaluate header attributes
    1288             : 
    1289           0 :     if ( SFX_ITEM_SET ==
    1290           0 :          rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
    1291           0 :                             sal_False, (const SfxPoolItem**)&pSetItem ) )
    1292             :     {
    1293           0 :         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
    1294             :         const SfxBoolItem& rHeaderOn =
    1295           0 :             (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
    1296             : 
    1297           0 :         if ( rHeaderOn.GetValue() )
    1298             :         {
    1299             :             const SvxSizeItem& rSize = (const SvxSizeItem&)
    1300           0 :                 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
    1301             :             const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
    1302           0 :                 rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
    1303           0 :             long nDist = rUL.GetLower();
    1304           0 :             aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
    1305           0 :             aBspWin.SetHdDist( nDist );
    1306             :             const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
    1307           0 :                 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
    1308           0 :             aBspWin.SetHdLeft( rLR.GetLeft() );
    1309           0 :             aBspWin.SetHdRight( rLR.GetRight() );
    1310           0 :             aBspWin.SetHeader( sal_True );
    1311             :         }
    1312             :         else
    1313           0 :             aBspWin.SetHeader( sal_False );
    1314             : 
    1315             :         // show background and border in the example
    1316           0 :         sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
    1317             : 
    1318           0 :         if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    1319             :         {
    1320             :             const SvxBrushItem& rItem =
    1321           0 :                 (const SvxBrushItem&)rHeaderSet.Get( nWhich );
    1322           0 :             aBspWin.SetHdColor( rItem.GetColor() );
    1323             :         }
    1324           0 :         nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
    1325             : 
    1326           0 :         if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    1327             :         {
    1328             :             const SvxBoxItem& rItem =
    1329           0 :                 (const SvxBoxItem&)rHeaderSet.Get( nWhich );
    1330           0 :             aBspWin.SetHdBorder( rItem );
    1331             :         }
    1332             :     }
    1333             : 
    1334             :     // evaluate footer attributes
    1335             : 
    1336           0 :     if ( SFX_ITEM_SET ==
    1337           0 :          rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
    1338           0 :                             sal_False, (const SfxPoolItem**)&pSetItem ) )
    1339             :     {
    1340           0 :         const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
    1341             :         const SfxBoolItem& rFooterOn =
    1342           0 :             (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
    1343             : 
    1344           0 :         if ( rFooterOn.GetValue() )
    1345             :         {
    1346             :             const SvxSizeItem& rSize = (const SvxSizeItem&)
    1347           0 :                 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
    1348             :             const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
    1349           0 :                 rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
    1350           0 :             long nDist = rUL.GetUpper();
    1351           0 :             aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
    1352           0 :             aBspWin.SetFtDist( nDist );
    1353             :             const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
    1354           0 :                 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
    1355           0 :             aBspWin.SetFtLeft( rLR.GetLeft() );
    1356           0 :             aBspWin.SetFtRight( rLR.GetRight() );
    1357           0 :             aBspWin.SetFooter( sal_True );
    1358             :         }
    1359             :         else
    1360           0 :             aBspWin.SetFooter( sal_False );
    1361             : 
    1362             :         // show background and border in the example
    1363           0 :         sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
    1364             : 
    1365           0 :         if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    1366             :         {
    1367             :             const SvxBrushItem& rItem =
    1368           0 :                 (const SvxBrushItem&)rFooterSet.Get( nWhich );
    1369           0 :             aBspWin.SetFtColor( rItem.GetColor() );
    1370             :         }
    1371           0 :         nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
    1372             : 
    1373           0 :         if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
    1374             :         {
    1375             :             const SvxBoxItem& rItem =
    1376           0 :                 (const SvxBoxItem&)rFooterSet.Get( nWhich );
    1377           0 :             aBspWin.SetFtBorder( rItem );
    1378             :         }
    1379             :     }
    1380           0 : }
    1381             : 
    1382             : // -----------------------------------------------------------------------
    1383             : 
    1384           0 : void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet )
    1385             : {
    1386           0 :     InitHeadFoot_Impl( rSet );
    1387           0 :     ResetBackground_Impl( rSet );
    1388           0 :     RangeHdl_Impl( 0 );
    1389           0 : }
    1390             : 
    1391             : // -----------------------------------------------------------------------
    1392             : 
    1393           0 : int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
    1394             : {
    1395             :     // Inquiry whether the page margins are beyond the printing area.
    1396             :     // If not, ask user whether they shall be taken.
    1397             :     // If not, stay on the TabPage.
    1398           0 :     sal_uInt16 nPos = aPaperSizeBox.GetSelectEntryPos();
    1399           0 :     Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos );
    1400             : 
    1401           0 :     if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() )
    1402             :     {
    1403           0 :         if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO )
    1404             :         {
    1405           0 :             MetricField* pField = NULL;
    1406           0 :             if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) )
    1407           0 :                 pField = &aLeftMarginEdit;
    1408           0 :             if (    IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT )
    1409             :                  && !pField )
    1410           0 :                 pField = &aRightMarginEdit;
    1411           0 :             if (    IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP )
    1412             :                  && !pField )
    1413           0 :                 pField = &aTopMarginEdit;
    1414           0 :             if (    IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM )
    1415             :                  && !pField )
    1416           0 :                 pField = &aBottomMarginEdit;
    1417           0 :             if ( pField )
    1418           0 :                 pField->GrabFocus();
    1419           0 :             UpdateExample_Impl();
    1420           0 :             return KEEP_PAGE;
    1421             :         }
    1422             :         else
    1423           0 :             CheckMarginEdits( false );
    1424             :     }
    1425             : 
    1426           0 :     if ( _pSet )
    1427             :     {
    1428           0 :         FillItemSet( *_pSet );
    1429             : 
    1430             :         // put portray/landscape if applicable
    1431           0 :         sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE );
    1432           0 :         SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh );
    1433             :         Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
    1434           0 :                     GetCoreValue( aPaperHeightEdit, eUnit ) );
    1435             : 
    1436             :         // put, if current size is different to the value in _pSet
    1437           0 :         const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE );
    1438           0 :         if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) )
    1439           0 :             _pSet->Put( SvxSizeItem( nWh, aSize ) );
    1440             :     }
    1441             : 
    1442           0 :     return LEAVE_PAGE;
    1443             : }
    1444             : 
    1445             : // -----------------------------------------------------------------------
    1446             : 
    1447           0 : IMPL_LINK_NOARG(SvxPageDescPage, RangeHdl_Impl)
    1448             : {
    1449             :     // example window
    1450           0 :     long nHHeight = aBspWin.GetHdHeight();
    1451           0 :     long nHDist = aBspWin.GetHdDist();
    1452             : 
    1453           0 :     long nFHeight = aBspWin.GetFtHeight();
    1454           0 :     long nFDist = aBspWin.GetFtDist();
    1455             : 
    1456           0 :     long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() );
    1457           0 :     long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() );
    1458             : 
    1459             :     // current values for page margins
    1460           0 :     long nBT = static_cast<long>(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP)));
    1461           0 :     long nBB = static_cast<long>(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP)));
    1462           0 :     long nBL = static_cast<long>(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP)));
    1463           0 :     long nBR = static_cast<long>(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP)));
    1464             : 
    1465             :     // calculate width of page border
    1466           0 :     const SfxItemSet* _pSet = &GetItemSet();
    1467           0 :     Size aBorder;
    1468             : 
    1469           0 :     if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >=
    1470             :             SFX_ITEM_AVAILABLE &&
    1471           0 :          _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER)  ) >=
    1472             :             SFX_ITEM_AVAILABLE )
    1473             :     {
    1474             :         aBorder = ( GetMinBorderSpace_Impl(
    1475           0 :             (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
    1476           0 :             (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
    1477             :     }
    1478             : 
    1479           0 :     long nH  = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
    1480           0 :     long nW  = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
    1481             : 
    1482             :     // limits paper
    1483             :     // maximum is 54 cm
    1484             :     //
    1485             :     long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
    1486           0 :                 MINBODY + aBorder.Height();
    1487           0 :     aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP);
    1488             : 
    1489           0 :     nMin = MINBODY + nBL + nBR + aBorder.Width();
    1490           0 :     aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP);
    1491             : 
    1492             :     // if the paper size has been changed
    1493           0 :     nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
    1494           0 :     nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
    1495             : 
    1496             :     // Top
    1497           0 :     long nMax = nH - nBB - aBorder.Height() - MINBODY -
    1498           0 :                 nFDist - nFHeight - nHDist - nHHeight;
    1499             : 
    1500           0 :     aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
    1501             : 
    1502             :     // Bottom
    1503           0 :     nMax = nH - nBT - aBorder.Height() - MINBODY -
    1504           0 :            nFDist - nFHeight - nHDist - nHHeight;
    1505             : 
    1506           0 :     aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
    1507             : 
    1508             :     // Left
    1509           0 :     nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
    1510           0 :     aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
    1511             : 
    1512             :     // Right
    1513           0 :     nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
    1514           0 :     aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
    1515           0 :     return 0;
    1516             : }
    1517             : 
    1518             : // -----------------------------------------------------------------------
    1519             : 
    1520           0 : void SvxPageDescPage::CalcMargin_Impl()
    1521             : {
    1522             :     // current values for page margins
    1523           0 :     long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP );
    1524           0 :     long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP );
    1525             : 
    1526           0 :     long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP );
    1527           0 :     long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP );
    1528             : 
    1529           0 :     long nH  = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP );
    1530           0 :     long nW  = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP );
    1531             : 
    1532           0 :     long nWidth = nBL + nBR + MINBODY;
    1533           0 :     long nHeight = nBT + nBB + MINBODY;
    1534             : 
    1535           0 :     if ( nWidth > nW || nHeight > nH )
    1536             :     {
    1537           0 :         if ( nWidth > nW )
    1538             :         {
    1539           0 :             long nTmp = nBL <= nBR ? nBR : nBL;
    1540           0 :             nTmp -= nWidth - nW;
    1541             : 
    1542           0 :             if ( nBL <= nBR )
    1543           0 :                 SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
    1544             :             else
    1545           0 :                 SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
    1546             :         }
    1547             : 
    1548           0 :         if ( nHeight > nH )
    1549             :         {
    1550           0 :             long nTmp = nBT <= nBB ? nBB : nBT;
    1551           0 :             nTmp -= nHeight - nH;
    1552             : 
    1553           0 :             if ( nBT <= nBB )
    1554           0 :                 SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
    1555             :             else
    1556           0 :                 SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
    1557             :         }
    1558             :     }
    1559           0 : }
    1560             : 
    1561             : // -----------------------------------------------------------------------
    1562             : 
    1563           0 : IMPL_LINK_NOARG_INLINE_START(SvxPageDescPage, CenterHdl_Impl)
    1564             : {
    1565           0 :     aBspWin.SetHorz( aHorzBox.IsChecked() );
    1566           0 :     aBspWin.SetVert( aVertBox.IsChecked() );
    1567           0 :     UpdateExample_Impl();
    1568           0 :     return 0;
    1569             : }
    1570           0 : IMPL_LINK_NOARG_INLINE_END(SvxPageDescPage, CenterHdl_Impl)
    1571             : 
    1572             : // -----------------------------------------------------------------------
    1573             : 
    1574           0 : void SvxPageDescPage::SetCollectionList(const std::vector<String> &aList)
    1575             : {
    1576             :     OSL_ENSURE(!aList.empty(), "Empty string list");
    1577             : 
    1578           0 :     sStandardRegister = aList[0];
    1579           0 :     for( sal_uInt16 i = 1; i < aList.size(); i++   )
    1580           0 :         aRegisterLB.InsertEntry(aList[i]);
    1581             : 
    1582           0 :     aRegisterCB  .Show();
    1583           0 :     aRegisterFT  .Show();
    1584           0 :     aRegisterLB.Show();
    1585           0 :     aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify));
    1586           0 : }
    1587             : 
    1588             : // -----------------------------------------------------------------------
    1589             : 
    1590           0 : IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox )
    1591             : {
    1592           0 :     sal_Bool bEnable = sal_False;
    1593           0 :     if(pBox->IsChecked())
    1594             :     {
    1595           0 :         bEnable = sal_True;
    1596           0 :         if(USHRT_MAX == aRegisterLB.GetSelectEntryPos())
    1597           0 :             aRegisterLB.SelectEntry(sStandardRegister);
    1598             :     }
    1599           0 :     aRegisterFT.Enable( bEnable );
    1600           0 :     aRegisterLB.Enable( bEnable );
    1601           0 :     return 0;
    1602             : }
    1603             : 
    1604             : // ----------------------------------------------------------------------------
    1605             : 
    1606           0 : void SvxPageDescPage::DisableVerticalPageDir()
    1607             : {
    1608           0 :     aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT );
    1609           0 :     aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT );
    1610           0 :     if( aTextFlowBox.GetEntryCount() < 2 )
    1611             :     {
    1612           0 :         aTextFlowLbl.Hide();
    1613           0 :         aTextFlowBox.Hide();
    1614           0 :         aBspWin.EnableFrameDirection( sal_False );
    1615             :     }
    1616           0 : }
    1617             : 
    1618           0 : IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*,  EMPTYARG)
    1619             : {
    1620           0 :     aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() );
    1621           0 :     aBspWin.Invalidate();
    1622           0 :     return 0;
    1623             : }
    1624             : 
    1625           0 : bool SvxPageDescPage::IsPrinterRangeOverflow(
    1626             :     MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
    1627             : {
    1628           0 :     bool bRet = false;
    1629           0 :     bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 );
    1630           0 :     long nValue = static_cast<long>(rField.GetValue());
    1631           0 :     if ( bCheck &&
    1632             :          (  nValue < nFirstMargin || nValue > nLastMargin ) &&
    1633           0 :          rField.GetText() != rField.GetSavedValue() )
    1634             :     {
    1635           0 :         rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin );
    1636           0 :          bRet = true;
    1637             :     }
    1638             : 
    1639           0 :     return bRet;
    1640             : }
    1641             : 
    1642             : /** Check if a value of a margin edit is outside the printer paper margins
    1643             :     and save this information.
    1644             : */
    1645           0 : void SvxPageDescPage::CheckMarginEdits( bool _bClear )
    1646             : {
    1647           0 :     if ( _bClear )
    1648           0 :         pImpl->m_nPos = 0;
    1649             : 
    1650           0 :     sal_Int64 nValue = aLeftMarginEdit.GetValue();
    1651           0 :     if (  nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
    1652           0 :         pImpl->m_nPos |= MARGIN_LEFT;
    1653           0 :     nValue = aRightMarginEdit.GetValue();
    1654           0 :     if (  nValue < nFirstRightMargin || nValue > nLastRightMargin )
    1655           0 :         pImpl->m_nPos |= MARGIN_RIGHT;
    1656           0 :     nValue = aTopMarginEdit.GetValue();
    1657           0 :     if (  nValue < nFirstTopMargin || nValue > nLastTopMargin )
    1658           0 :         pImpl->m_nPos |= MARGIN_TOP;
    1659           0 :     nValue = aBottomMarginEdit.GetValue();
    1660           0 :     if (  nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
    1661           0 :         pImpl->m_nPos |= MARGIN_BOTTOM;
    1662           0 : }
    1663             : 
    1664           0 : bool SvxPageDescPage::IsMarginOutOfRange()
    1665             : {
    1666           0 :     bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) &&
    1667           0 :                       ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) &&
    1668           0 :                     ( aLeftMarginEdit.GetValue() < nFirstLeftMargin ||
    1669           0 :                       aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) ||
    1670           0 :                   ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) &&
    1671           0 :                       ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) &&
    1672           0 :                     ( aRightMarginEdit.GetValue() < nFirstRightMargin ||
    1673           0 :                       aRightMarginEdit.GetValue() > nLastRightMargin ) ) ||
    1674           0 :                   ( ( !( pImpl->m_nPos & MARGIN_TOP ) &&
    1675           0 :                       ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) &&
    1676           0 :                     ( aTopMarginEdit.GetValue() < nFirstTopMargin ||
    1677           0 :                       aTopMarginEdit.GetValue() > nLastTopMargin ) ) ||
    1678           0 :                   ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) &&
    1679           0 :                       ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) &&
    1680           0 :                     ( aBottomMarginEdit.GetValue() < nFirstBottomMargin ||
    1681           0 :                       aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) );
    1682           0 :     return bRet;
    1683             : }
    1684             : 
    1685           0 : void SvxPageDescPage::PageCreated (SfxAllItemSet aSet)
    1686             : {
    1687           0 :     SFX_ITEMSET_ARG (&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False);
    1688           0 :     SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False);
    1689           0 :     SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False);
    1690           0 :     SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False);
    1691           0 :     if (pModeItem)
    1692           0 :         SetMode((SvxModeType)pModeItem->GetEnumValue());
    1693           0 :     if (pPaperStartItem && pPaperEndItem)
    1694           0 :         SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() );
    1695           0 :     if (pCollectListItem)
    1696           0 :         SetCollectionList(pCollectListItem->GetList());
    1697           3 : }
    1698             : 
    1699             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10