12ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 52ee96f1cSAndrew Rist * distributed with this work for additional information 62ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 82ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 92ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 102ee96f1cSAndrew Rist * 112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122ee96f1cSAndrew Rist * 132ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 142ee96f1cSAndrew Rist * software distributed under the License is distributed on an 152ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 172ee96f1cSAndrew Rist * specific language governing permissions and limitations 182ee96f1cSAndrew Rist * under the License. 192ee96f1cSAndrew Rist * 202ee96f1cSAndrew Rist *************************************************************/ 212ee96f1cSAndrew Rist 22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 23cdf0e10cSrcweir #include "precompiled_cui.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir // include --------------------------------------------------------------- 26cdf0e10cSrcweir #include <sfx2/app.hxx> 27cdf0e10cSrcweir #include <sfx2/objsh.hxx> 28cdf0e10cSrcweir #include <tools/resary.hxx> 29cdf0e10cSrcweir #include <vcl/graph.hxx> 30cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 31cdf0e10cSrcweir #include <svl/itemiter.hxx> 32cdf0e10cSrcweir #include <svl/languageoptions.hxx> 33cdf0e10cSrcweir #include <vcl/msgbox.hxx> 34cdf0e10cSrcweir #include <unotools/configitem.hxx> 35cdf0e10cSrcweir #include "svx/htmlmode.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir #define _SVX_PAGE_CXX 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <cuires.hrc> 40cdf0e10cSrcweir #include "page.hrc" 41cdf0e10cSrcweir #include "helpid.hrc" 42cdf0e10cSrcweir #include "page.hxx" 43cdf0e10cSrcweir #include <svx/pageitem.hxx> 44cdf0e10cSrcweir #include <editeng/brshitem.hxx> 45cdf0e10cSrcweir #include <editeng/boxitem.hxx> 46cdf0e10cSrcweir #include <editeng/shaditem.hxx> 47cdf0e10cSrcweir #include <editeng/pbinitem.hxx> 48cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 49cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 50cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 51cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 52cdf0e10cSrcweir #include "svx/dlgutil.hxx" 53cdf0e10cSrcweir #include <dialmgr.hxx> 54cdf0e10cSrcweir #include <editeng/paperinf.hxx> 55cdf0e10cSrcweir #include <dialmgr.hxx> 56cdf0e10cSrcweir #include <sfx2/module.hxx> 57cdf0e10cSrcweir #include <svl/stritem.hxx> 58cdf0e10cSrcweir #include <svx/dialogs.hrc> // for RID_SVXPAGE_PAGE 59cdf0e10cSrcweir #include <editeng/eerdll.hxx> 60cdf0e10cSrcweir #include <editeng/editrids.hrc> // for RID_SVXSTR_PAPERBIN..., 61cdf0e10cSrcweir #include <svx/svxids.hrc> 62cdf0e10cSrcweir #include <svtools/optionsdrawinglayer.hxx> 63cdf0e10cSrcweir #include <svl/slstitm.hxx> //CHINA001 64cdf0e10cSrcweir #include <svl/aeitem.hxx> //CHINA001 65cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001 66*56b35d86SArmin Le Grand 67*56b35d86SArmin Le Grand //UUUU 68*56b35d86SArmin Le Grand #include <svx/xdef.hxx> 69*56b35d86SArmin Le Grand #include <svx/unobrushitemhelper.hxx> 70*56b35d86SArmin Le Grand 71cdf0e10cSrcweir // configuration helper ======================================================= 72cdf0e10cSrcweir 73cdf0e10cSrcweir /** Helper to get a configuration setting. 74cdf0e10cSrcweir @descr This is a HACK to get a configuration item directly. Normally the 75cdf0e10cSrcweir OfaHtmlOptions class from 'offmgr' project would do the job, but we cannot 76cdf0e10cSrcweir use it here. On the other hand, the OfaHtmlOptions cannot be moved to 77cdf0e10cSrcweir 'svtools', because it uses 'svx' itself... 78cdf0e10cSrcweir The correct way would be to move OfaHtmlOptions to 'svtools' anyway, and to 79cdf0e10cSrcweir remove the dependency from 'svx' (a call to the static function 80cdf0e10cSrcweir SvxTextEncodingBox::GetBestMimeEncoding(), which contains low level 81cdf0e10cSrcweir operations that can be moved to lower projects, i.e. 'rtl'). Then this 82cdf0e10cSrcweir class can be removed, and the OfaHtmlOptions can be used instead. */ 83cdf0e10cSrcweir class SvxHtmlExportModeConfigItem_Impl : public utl::ConfigItem 84cdf0e10cSrcweir { 85cdf0e10cSrcweir public: 86cdf0e10cSrcweir explicit SvxHtmlExportModeConfigItem_Impl(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir /** Returns the HTML export mode, as read from the configuration. */ 89cdf0e10cSrcweir inline sal_Int32 GetExportMode() const { return mnExpMode; } 90cdf0e10cSrcweir 91cdf0e10cSrcweir /** Returns true, if the current HTML export mode is set to HTML 3.2. */ 92cdf0e10cSrcweir inline bool IsExportModeHTML32() const { return mnExpMode == 0; } // 0 == HTML_CFG_HTML32, see offmgr/htmlcfg.hxx 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual void Commit(); 95cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); 96cdf0e10cSrcweir 97cdf0e10cSrcweir private: 98cdf0e10cSrcweir sal_Int32 mnExpMode; 99cdf0e10cSrcweir }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir SvxHtmlExportModeConfigItem_Impl::SvxHtmlExportModeConfigItem_Impl() : 102cdf0e10cSrcweir utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/HTML/Export" ) ) ), 103cdf0e10cSrcweir mnExpMode( 3 ) // default to 3 == HTML_CFG_NS40, see offmgr/htmlcfg.hxx 104cdf0e10cSrcweir { 105cdf0e10cSrcweir using com::sun::star::uno::Sequence; 106cdf0e10cSrcweir using com::sun::star::uno::Any; 107cdf0e10cSrcweir 108cdf0e10cSrcweir Sequence< rtl::OUString > aPropNames( 1 ); 109cdf0e10cSrcweir aPropNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Browser" ) ); 110cdf0e10cSrcweir Sequence< Any > aPropValues( GetProperties( aPropNames ) ); 111cdf0e10cSrcweir if( aPropValues.getLength() == 1 ) 112cdf0e10cSrcweir aPropValues[ 0 ] >>= mnExpMode; 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir void SvxHtmlExportModeConfigItem_Impl::Commit() 116cdf0e10cSrcweir { 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir void SvxHtmlExportModeConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir // static ---------------------------------------------------------------- 124cdf0e10cSrcweir 125cdf0e10cSrcweir static const long MINBODY = 284; // 0,5cm in twips aufgerundet 126cdf0e10cSrcweir //static const long PRINT_OFFSET = 17; // 0,03cm in twips abgerundet 127cdf0e10cSrcweir static const long PRINT_OFFSET = 0; // why was this ever set to 17 ? it led to wrong right and bottom margins. 128cdf0e10cSrcweir 129cdf0e10cSrcweir static sal_uInt16 pRanges[] = 130cdf0e10cSrcweir { 131cdf0e10cSrcweir SID_ATTR_BORDER_OUTER, 132cdf0e10cSrcweir SID_ATTR_BORDER_SHADOW, 133cdf0e10cSrcweir SID_ATTR_LRSPACE, 134cdf0e10cSrcweir SID_ATTR_PAGE_SHARED, 135cdf0e10cSrcweir SID_SWREGISTER_COLLECTION, 136cdf0e10cSrcweir SID_SWREGISTER_MODE, 137cdf0e10cSrcweir 0 138cdf0e10cSrcweir }; 139cdf0e10cSrcweir 140cdf0e10cSrcweir // ------- Mapping Seitenlayout ------------------------------------------ 141cdf0e10cSrcweir 142cdf0e10cSrcweir sal_uInt16 aArr[] = 143cdf0e10cSrcweir { 144cdf0e10cSrcweir SVX_PAGE_ALL, 145cdf0e10cSrcweir SVX_PAGE_MIRROR, 146cdf0e10cSrcweir SVX_PAGE_RIGHT, 147cdf0e10cSrcweir SVX_PAGE_LEFT 148cdf0e10cSrcweir }; 149cdf0e10cSrcweir 150cdf0e10cSrcweir // ----------------------------------------------------------------------- 151cdf0e10cSrcweir 152cdf0e10cSrcweir sal_uInt16 PageUsageToPos_Impl( sal_uInt16 nUsage ) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir const sal_uInt16 nCount = sizeof(aArr) / sizeof(sal_uInt16); 155cdf0e10cSrcweir 156cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 157cdf0e10cSrcweir if ( aArr[i] == ( nUsage & 0x000f ) ) 158cdf0e10cSrcweir return i; 159cdf0e10cSrcweir return SVX_PAGE_ALL; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir // ----------------------------------------------------------------------- 163cdf0e10cSrcweir 164cdf0e10cSrcweir sal_uInt16 PosToPageUsage_Impl( sal_uInt16 nPos ) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir const sal_uInt16 nCount = sizeof(aArr) / sizeof(sal_uInt16); 167cdf0e10cSrcweir 168cdf0e10cSrcweir if ( nPos >= nCount ) 169cdf0e10cSrcweir return 0; 170cdf0e10cSrcweir return aArr[nPos]; 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir // ----------------------------------------------------------------------- 174cdf0e10cSrcweir 175cdf0e10cSrcweir Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir Size aSz; 178cdf0e10cSrcweir aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM ); 179cdf0e10cSrcweir aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP ); 180cdf0e10cSrcweir aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT ); 181cdf0e10cSrcweir aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT ); 182cdf0e10cSrcweir return aSz; 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir // ----------------------------------------------------------------------- 186cdf0e10cSrcweir 187cdf0e10cSrcweir long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit ) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP ); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir sal_Bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir if ( pSize ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir Size aSize = pSize->GetSize(); 197cdf0e10cSrcweir long nDiffW = Abs( rSize.Width () - aSize.Width () ); 198cdf0e10cSrcweir long nDiffH = Abs( rSize.Height() - aSize.Height() ); 199cdf0e10cSrcweir return ( nDiffW < 10 && nDiffH < 10 ); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir else 202cdf0e10cSrcweir return sal_False; 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir // ----------------------------------------------------------------------- 206cdf0e10cSrcweir 207cdf0e10cSrcweir #define MARGIN_LEFT ( (MarginPosition)0x0001 ) 208cdf0e10cSrcweir #define MARGIN_RIGHT ( (MarginPosition)0x0002 ) 209cdf0e10cSrcweir #define MARGIN_TOP ( (MarginPosition)0x0004 ) 210cdf0e10cSrcweir #define MARGIN_BOTTOM ( (MarginPosition)0x0008 ) 211cdf0e10cSrcweir 212*56b35d86SArmin Le Grand //UUUU 213*56b35d86SArmin Le Grand //struct SvxPage_Impl 214*56b35d86SArmin Le Grand //{ 215*56b35d86SArmin Le Grand // MarginPosition m_nPos; 216*56b35d86SArmin Le Grand // Printer* mpDefPrinter; 217*56b35d86SArmin Le Grand // bool mbDelPrinter; 218*56b35d86SArmin Le Grand // 219*56b35d86SArmin Le Grand // SvxPage_Impl() : 220*56b35d86SArmin Le Grand // m_nPos( 0 ), 221*56b35d86SArmin Le Grand // mpDefPrinter( 0 ), 222*56b35d86SArmin Le Grand // mbDelPrinter( false ) {} 223*56b35d86SArmin Le Grand // 224*56b35d86SArmin Le Grand // ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; } 225*56b35d86SArmin Le Grand //}; 226cdf0e10cSrcweir 227cdf0e10cSrcweir // class SvxPageDescPage -------------------------------------------------- 228cdf0e10cSrcweir 229cdf0e10cSrcweir // gibt den Bereich der Which-Werte zur"uck 230cdf0e10cSrcweir 231cdf0e10cSrcweir sal_uInt16* SvxPageDescPage::GetRanges() 232cdf0e10cSrcweir { 233cdf0e10cSrcweir return pRanges; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir // ----------------------------------------------------------------------- 237cdf0e10cSrcweir 238cdf0e10cSrcweir SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir return new SvxPageDescPage( pParent, rSet ); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir // ----------------------------------------------------------------------- 244cdf0e10cSrcweir 245*56b35d86SArmin Le Grand SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) 246*56b35d86SArmin Le Grand : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PAGE ), rAttr ), 247cdf0e10cSrcweir aPaperSizeFl ( this, CUI_RES( FL_PAPER_SIZE ) ), 248cdf0e10cSrcweir aPaperFormatText ( this, CUI_RES( FT_PAPER_FORMAT ) ), 249cdf0e10cSrcweir aPaperSizeBox ( this, CUI_RES( LB_PAPER_SIZE ) ), 250cdf0e10cSrcweir aPaperWidthText ( this, CUI_RES( FT_PAPER_WIDTH ) ), 251cdf0e10cSrcweir aPaperWidthEdit ( this, CUI_RES( ED_PAPER_WIDTH ) ), 252cdf0e10cSrcweir aPaperHeightText ( this, CUI_RES( FT_PAPER_HEIGHT ) ), 253cdf0e10cSrcweir aPaperHeightEdit ( this, CUI_RES( ED_PAPER_HEIGHT ) ), 254cdf0e10cSrcweir aOrientationFT ( this, CUI_RES( FT_ORIENTATION ) ), 255cdf0e10cSrcweir aPortraitBtn ( this, CUI_RES( RB_PORTRAIT ) ), 256cdf0e10cSrcweir aLandscapeBtn ( this, CUI_RES( RB_LANDSCAPE ) ), 257cdf0e10cSrcweir aBspWin ( this, CUI_RES( WN_BSP ) ), 258cdf0e10cSrcweir aTextFlowLbl ( this, CUI_RES( FT_TEXT_FLOW ) ), 259cdf0e10cSrcweir aTextFlowBox ( this, CUI_RES( LB_TEXT_FLOW ) ), 260cdf0e10cSrcweir aPaperTrayLbl ( this, CUI_RES( FT_PAPER_TRAY ) ), 261cdf0e10cSrcweir aPaperTrayBox ( this, CUI_RES( LB_PAPER_TRAY ) ), 262cdf0e10cSrcweir aMarginFl ( this, CUI_RES( FL_MARGIN ) ), 263cdf0e10cSrcweir aLeftMarginLbl ( this, CUI_RES( FT_LEFT_MARGIN ) ), 264cdf0e10cSrcweir aLeftMarginEdit ( this, CUI_RES( ED_LEFT_MARGIN ) ), 265cdf0e10cSrcweir aRightMarginLbl ( this, CUI_RES( FT_RIGHT_MARGIN ) ), 266cdf0e10cSrcweir aRightMarginEdit ( this, CUI_RES( ED_RIGHT_MARGIN ) ), 267cdf0e10cSrcweir aTopMarginLbl ( this, CUI_RES( FT_TOP_MARGIN ) ), 268cdf0e10cSrcweir aTopMarginEdit ( this, CUI_RES( ED_TOP_MARGIN ) ), 269cdf0e10cSrcweir aBottomMarginLbl ( this, CUI_RES( FT_BOTTOM_MARGIN ) ), 270cdf0e10cSrcweir aBottomMarginEdit ( this, CUI_RES( ED_BOTTOM_MARGIN ) ), 271cdf0e10cSrcweir aBottomSeparatorFl ( this, CUI_RES( FL_BOTTOM_SEP ) ), 272cdf0e10cSrcweir aLayoutFL ( this, CUI_RES( FL_LAYOUT ) ), 273cdf0e10cSrcweir aPageText ( this, CUI_RES( FT_PAGELAYOUT ) ), 274cdf0e10cSrcweir aLayoutBox ( this, CUI_RES( LB_LAYOUT ) ), 275cdf0e10cSrcweir aNumberFormatText ( this, CUI_RES( FT_NUMBER_FORMAT ) ), 276cdf0e10cSrcweir aNumberFormatBox ( this, CUI_RES( LB_NUMBER_FORMAT ) ), 277cdf0e10cSrcweir aTblAlignFT ( this, CUI_RES( FT_TBL_ALIGN ) ), 278cdf0e10cSrcweir aHorzBox ( this, CUI_RES( CB_HORZ ) ), 279cdf0e10cSrcweir aVertBox ( this, CUI_RES( CB_VERT ) ), 280cdf0e10cSrcweir aAdaptBox ( this, CUI_RES( CB_ADAPT ) ), 281cdf0e10cSrcweir aRegisterCB ( this, CUI_RES( CB_REGISTER ) ), 282cdf0e10cSrcweir aRegisterFT ( this, CUI_RES( FT_REGISTER ) ), 283cdf0e10cSrcweir aRegisterLB ( this, CUI_RES( LB_REGISTER ) ), 284cdf0e10cSrcweir 285cdf0e10cSrcweir aInsideText ( CUI_RES( STR_INSIDE ) ), 286cdf0e10cSrcweir aOutsideText ( CUI_RES( STR_OUTSIDE ) ), 287cdf0e10cSrcweir aPrintRangeQueryText( CUI_RES( STR_QUERY_PRINTRANGE ) ), 288cdf0e10cSrcweir 289cdf0e10cSrcweir bLandscape ( sal_False ), 290cdf0e10cSrcweir eMode ( SVX_PAGE_MODE_STANDARD ), 291cdf0e10cSrcweir ePaperStart ( PAPER_A3 ), 292cdf0e10cSrcweir ePaperEnd ( PAPER_ENV_DL ), 293cdf0e10cSrcweir 294*56b35d86SArmin Le Grand //UUUU 295*56b35d86SArmin Le Grand // pImpl ( new SvxPage_Impl ), 296*56b35d86SArmin Le Grand 297*56b35d86SArmin Le Grand //UUUU 298*56b35d86SArmin Le Grand m_nPos( 0 ), 299*56b35d86SArmin Le Grand mpDefPrinter( 0 ), 300*56b35d86SArmin Le Grand mbDelPrinter( false ), 301*56b35d86SArmin Le Grand 302*56b35d86SArmin Le Grand //UUUU 303*56b35d86SArmin Le Grand mbEnableDrawingLayerFillStyles(false) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir bBorderModified = sal_False; 306cdf0e10cSrcweir FreeResource(); 307cdf0e10cSrcweir aBspWin.EnableRTL( sal_False ); 308cdf0e10cSrcweir 309cdf0e10cSrcweir // diese Page braucht ExchangeSupport 310cdf0e10cSrcweir SetExchangeSupport(); 311cdf0e10cSrcweir 312cdf0e10cSrcweir SvtLanguageOptions aLangOptions; 313cdf0e10cSrcweir sal_Bool bCJK = aLangOptions.IsAsianTypographyEnabled(); 314cdf0e10cSrcweir sal_Bool bCTL = aLangOptions.IsCTLFontEnabled(); 315cdf0e10cSrcweir sal_Bool bWeb = sal_False; 316cdf0e10cSrcweir const SfxPoolItem* pItem; 317cdf0e10cSrcweir 318cdf0e10cSrcweir SfxObjectShell* pShell; 319cdf0e10cSrcweir if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, sal_False, &pItem) || 320cdf0e10cSrcweir ( 0 != (pShell = SfxObjectShell::Current()) && 321cdf0e10cSrcweir 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) 322cdf0e10cSrcweir bWeb = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); 323cdf0e10cSrcweir 324cdf0e10cSrcweir // #109989# get the HTML export setting from configuration. 325cdf0e10cSrcweir // !! This is a hack, see comments in SvxHtmlExportModeConfigItem_Impl class above. 326cdf0e10cSrcweir bool bHTML32 = SvxHtmlExportModeConfigItem_Impl().IsExportModeHTML32(); 327cdf0e10cSrcweir 328cdf0e10cSrcweir // fill text flow listbox with valid entries 329cdf0e10cSrcweir aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI ), FRMDIR_HORI_LEFT_TOP ); 330cdf0e10cSrcweir if( bCTL ) 331cdf0e10cSrcweir aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI ), FRMDIR_HORI_RIGHT_TOP ); 332cdf0e10cSrcweir // #109989# do not show vertical directions in Writer/Web 333cdf0e10cSrcweir if( !bWeb ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir if( bCJK ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT ), FRMDIR_VERT_TOP_RIGHT ); 338cdf0e10cSrcweir // aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT ); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir // #109989# show the text direction box in Writer/Web too, but only, if HTML export mode is not HTML3.2. 343cdf0e10cSrcweir if( !(bWeb && bHTML32) && (bCJK || bCTL) && 344cdf0e10cSrcweir SFX_ITEM_UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION ))) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir aTextFlowLbl.Show(); 347cdf0e10cSrcweir aTextFlowBox.Show(); 348cdf0e10cSrcweir aTextFlowBox.SetSelectHdl(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl )); 349cdf0e10cSrcweir 350cdf0e10cSrcweir aBspWin.EnableFrameDirection(sal_True); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir Init_Impl(); 353cdf0e10cSrcweir 354cdf0e10cSrcweir FieldUnit eFUnit = GetModuleFieldUnit( rAttr ); 355cdf0e10cSrcweir SetFieldUnit( aLeftMarginEdit, eFUnit ); 356cdf0e10cSrcweir SetFieldUnit( aRightMarginEdit, eFUnit ); 357cdf0e10cSrcweir SetFieldUnit( aTopMarginEdit, eFUnit ); 358cdf0e10cSrcweir SetFieldUnit( aBottomMarginEdit, eFUnit ); 359cdf0e10cSrcweir SetFieldUnit( aPaperWidthEdit, eFUnit ); 360cdf0e10cSrcweir SetFieldUnit( aPaperHeightEdit, eFUnit ); 361cdf0e10cSrcweir 362cdf0e10cSrcweir if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() ) 363*56b35d86SArmin Le Grand { 364*56b35d86SArmin Le Grand mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter(); 365*56b35d86SArmin Le Grand } 366cdf0e10cSrcweir else 367cdf0e10cSrcweir { 368*56b35d86SArmin Le Grand mpDefPrinter = new Printer; 369*56b35d86SArmin Le Grand mbDelPrinter = true; 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372*56b35d86SArmin Le Grand MapMode aOldMode = mpDefPrinter->GetMapMode(); 373*56b35d86SArmin Le Grand mpDefPrinter->SetMapMode( MAP_TWIP ); 374cdf0e10cSrcweir 375cdf0e10cSrcweir // First- und Last-Werte f"ur die R"ander setzen 376*56b35d86SArmin Le Grand Size aPaperSize = mpDefPrinter->GetPaperSize(); 377*56b35d86SArmin Le Grand Size aPrintSize = mpDefPrinter->GetOutputSize(); 378cdf0e10cSrcweir /* 379cdf0e10cSrcweir * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, 380cdf0e10cSrcweir * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des 381cdf0e10cSrcweir * Koordinatensystems verschoben ist. 382cdf0e10cSrcweir */ 383*56b35d86SArmin Le Grand Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() ); 384*56b35d86SArmin Le Grand mpDefPrinter->SetMapMode( aOldMode ); 385cdf0e10cSrcweir 386cdf0e10cSrcweir long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; 387cdf0e10cSrcweir aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP ); 388cdf0e10cSrcweir nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst()); 389cdf0e10cSrcweir aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( 390cdf0e10cSrcweir aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset ), FUNIT_TWIP); 391cdf0e10cSrcweir nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst()); 392cdf0e10cSrcweir aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( aPrintOffset.Y() ), FUNIT_TWIP ); 393cdf0e10cSrcweir nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst()); 394cdf0e10cSrcweir aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( 395cdf0e10cSrcweir aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset ), FUNIT_TWIP ); 396cdf0e10cSrcweir nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst()); 397cdf0e10cSrcweir aLeftMarginEdit.SetLast( aLeftMarginEdit.Normalize( 398cdf0e10cSrcweir aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); 399cdf0e10cSrcweir nLastLeftMargin = static_cast<long>(aLeftMarginEdit.GetLast()); 400cdf0e10cSrcweir aRightMarginEdit.SetLast( aRightMarginEdit.Normalize( 401cdf0e10cSrcweir aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); 402cdf0e10cSrcweir nLastRightMargin = static_cast<long>(aRightMarginEdit.GetLast()); 403cdf0e10cSrcweir aTopMarginEdit.SetLast( aTopMarginEdit.Normalize( 404cdf0e10cSrcweir aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); 405cdf0e10cSrcweir nLastTopMargin = static_cast<long>(aTopMarginEdit.GetLast()); 406cdf0e10cSrcweir aBottomMarginEdit.SetLast( aBottomMarginEdit.Normalize( 407cdf0e10cSrcweir aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); 408cdf0e10cSrcweir nLastBottomMargin = static_cast<long>(aBottomMarginEdit.GetLast()); 409cdf0e10cSrcweir 410cdf0e10cSrcweir // #i4219# get DrawingLayer options 411cdf0e10cSrcweir const SvtOptionsDrawinglayer aDrawinglayerOpt; 412cdf0e10cSrcweir 413cdf0e10cSrcweir // #i4219# take Maximum now from configuration (1/100th cm) 414cdf0e10cSrcweir // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000 415cdf0e10cSrcweir aPaperWidthEdit.SetMax(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); 416cdf0e10cSrcweir aPaperWidthEdit.SetLast(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); 417cdf0e10cSrcweir aPaperHeightEdit.SetMax(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); 418cdf0e10cSrcweir aPaperHeightEdit.SetLast(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); 419cdf0e10cSrcweir 420cdf0e10cSrcweir // #i4219# also for margins (1/100th cm). Was: 9999, keeping. 421cdf0e10cSrcweir aLeftMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); 422cdf0e10cSrcweir aLeftMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); 423cdf0e10cSrcweir aRightMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperRightMargin()); 424cdf0e10cSrcweir aRightMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperRightMargin()); 425cdf0e10cSrcweir aTopMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperTopMargin()); 426cdf0e10cSrcweir aTopMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperTopMargin()); 427cdf0e10cSrcweir aBottomMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); 428cdf0e10cSrcweir aBottomMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); 429cdf0e10cSrcweir 430cdf0e10cSrcweir aPortraitBtn.SetAccessibleRelationMemberOf(&aOrientationFT); 431cdf0e10cSrcweir aLandscapeBtn.SetAccessibleRelationMemberOf(&aOrientationFT); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir 434cdf0e10cSrcweir // ----------------------------------------------------------------------- 435cdf0e10cSrcweir 436cdf0e10cSrcweir SvxPageDescPage::~SvxPageDescPage() 437cdf0e10cSrcweir { 438*56b35d86SArmin Le Grand if(mbDelPrinter) 439*56b35d86SArmin Le Grand { 440*56b35d86SArmin Le Grand delete mpDefPrinter; 441*56b35d86SArmin Le Grand } 442cdf0e10cSrcweir } 443cdf0e10cSrcweir 444cdf0e10cSrcweir // ----------------------------------------------------------------------- 445cdf0e10cSrcweir 446cdf0e10cSrcweir void SvxPageDescPage::Init_Impl() 447cdf0e10cSrcweir { 448cdf0e10cSrcweir aLeftText = aLeftMarginLbl.GetText(); 449cdf0e10cSrcweir aRightText = aRightMarginLbl.GetText(); 450cdf0e10cSrcweir 451cdf0e10cSrcweir // Handler einstellen 452cdf0e10cSrcweir aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) ); 453cdf0e10cSrcweir aPaperSizeBox.SetDropDownLineCount(10); 454cdf0e10cSrcweir 455cdf0e10cSrcweir aPaperTrayBox.SetGetFocusHdl( 456cdf0e10cSrcweir LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) ); 457cdf0e10cSrcweir aPaperSizeBox.SetSelectHdl( 458cdf0e10cSrcweir LINK( this, SvxPageDescPage, PaperSizeSelect_Impl ) ); 459cdf0e10cSrcweir aPaperWidthEdit.SetModifyHdl( 460cdf0e10cSrcweir LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); 461cdf0e10cSrcweir aPaperHeightEdit.SetModifyHdl( 462cdf0e10cSrcweir LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); 463cdf0e10cSrcweir aLandscapeBtn.SetClickHdl( 464cdf0e10cSrcweir LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); 465cdf0e10cSrcweir aPortraitBtn.SetClickHdl( 466cdf0e10cSrcweir LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); 467cdf0e10cSrcweir 468cdf0e10cSrcweir Link aLink = LINK( this, SvxPageDescPage, BorderModify_Impl ); 469cdf0e10cSrcweir aLeftMarginEdit.SetModifyHdl( aLink ); 470cdf0e10cSrcweir aRightMarginEdit.SetModifyHdl( aLink ); 471cdf0e10cSrcweir aTopMarginEdit.SetModifyHdl( aLink ); 472cdf0e10cSrcweir aBottomMarginEdit.SetModifyHdl( aLink ); 473cdf0e10cSrcweir 474cdf0e10cSrcweir aLink = LINK( this, SvxPageDescPage, RangeHdl_Impl ); 475cdf0e10cSrcweir aPaperWidthEdit.SetLoseFocusHdl( aLink ); 476cdf0e10cSrcweir aPaperHeightEdit.SetLoseFocusHdl( aLink ); 477cdf0e10cSrcweir aLeftMarginEdit.SetLoseFocusHdl( aLink ); 478cdf0e10cSrcweir aRightMarginEdit.SetLoseFocusHdl( aLink ); 479cdf0e10cSrcweir aTopMarginEdit.SetLoseFocusHdl( aLink ); 480cdf0e10cSrcweir aBottomMarginEdit.SetLoseFocusHdl( aLink ); 481cdf0e10cSrcweir 482cdf0e10cSrcweir aHorzBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); 483cdf0e10cSrcweir aVertBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); 484cdf0e10cSrcweir 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir // ----------------------------------------------------------------------- 488cdf0e10cSrcweir 489cdf0e10cSrcweir void SvxPageDescPage::Reset( const SfxItemSet& rSet ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir SfxItemPool* pPool = rSet.GetPool(); 492cdf0e10cSrcweir DBG_ASSERT( pPool, "Wo ist der Pool" ); 493cdf0e10cSrcweir SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ); 494cdf0e10cSrcweir 495cdf0e10cSrcweir // R"ander (Links/Rechts) einstellen 496cdf0e10cSrcweir const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE ); 497cdf0e10cSrcweir 498cdf0e10cSrcweir if ( pItem ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem; 501cdf0e10cSrcweir SetMetricValue( aLeftMarginEdit, rLRSpace.GetLeft(), eUnit ); 502cdf0e10cSrcweir aBspWin.SetLeft( 503cdf0e10cSrcweir (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetLeft(), eUnit ) ); 504cdf0e10cSrcweir SetMetricValue( aRightMarginEdit, rLRSpace.GetRight(), eUnit ); 505cdf0e10cSrcweir aBspWin.SetRight( 506cdf0e10cSrcweir (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetRight(), eUnit ) ); 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir // R"ander (Oben/Unten) einstellen 510cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_ULSPACE ); 511cdf0e10cSrcweir 512cdf0e10cSrcweir if ( pItem ) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem; 515cdf0e10cSrcweir SetMetricValue( aTopMarginEdit, rULSpace.GetUpper(), eUnit ); 516cdf0e10cSrcweir aBspWin.SetTop( 517cdf0e10cSrcweir (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) ); 518cdf0e10cSrcweir SetMetricValue( aBottomMarginEdit, rULSpace.GetLower(), eUnit ); 519cdf0e10cSrcweir aBspWin.SetBottom( 520cdf0e10cSrcweir (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) ); 521cdf0e10cSrcweir } 522cdf0e10cSrcweir 523cdf0e10cSrcweir // allgemeine Seitendaten 524cdf0e10cSrcweir SvxNumType eNumType = SVX_ARABIC; 525*56b35d86SArmin Le Grand bLandscape = ( mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ); 526cdf0e10cSrcweir sal_uInt16 nUse = (sal_uInt16)SVX_PAGE_ALL; 527cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE ); 528cdf0e10cSrcweir 529cdf0e10cSrcweir if ( pItem ) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir const SvxPageItem& rItem = (const SvxPageItem&)*pItem; 532cdf0e10cSrcweir eNumType = rItem.GetNumType(); 533cdf0e10cSrcweir nUse = rItem.GetPageUsage(); 534cdf0e10cSrcweir bLandscape = rItem.IsLandscape(); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir 537cdf0e10cSrcweir // Ausrichtung 538cdf0e10cSrcweir aLayoutBox.SelectEntryPos( ::PageUsageToPos_Impl( nUse ) ); 539cdf0e10cSrcweir aBspWin.SetUsage( nUse ); 540cdf0e10cSrcweir LayoutHdl_Impl( 0 ); 541cdf0e10cSrcweir 542cdf0e10cSrcweir // Numerierungsart der Seitenvorlage einstellen 543cdf0e10cSrcweir aNumberFormatBox.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(eNumType) ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir // Aktueller Papierschacht 546cdf0e10cSrcweir aPaperTrayBox.Clear(); 547cdf0e10cSrcweir sal_uInt8 nPaperBin = PAPERBIN_PRINTER_SETTINGS; 548cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE_PAPERBIN ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir if ( pItem ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue(); 553cdf0e10cSrcweir 554*56b35d86SArmin Le Grand if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() ) 555cdf0e10cSrcweir nPaperBin = PAPERBIN_PRINTER_SETTINGS; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir 558cdf0e10cSrcweir String aBinName; 559cdf0e10cSrcweir 560cdf0e10cSrcweir if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin ) 561cdf0e10cSrcweir aBinName = EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ); 562cdf0e10cSrcweir else 563*56b35d86SArmin Le Grand aBinName = mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin ); 564cdf0e10cSrcweir 565cdf0e10cSrcweir sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( aBinName ); 566cdf0e10cSrcweir aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)nPaperBin ); 567cdf0e10cSrcweir aPaperTrayBox.SelectEntry( aBinName ); 568cdf0e10cSrcweir 569cdf0e10cSrcweir // Size rausholen 570*56b35d86SArmin Le Grand Size aPaperSize = SvxPaperInfo::GetPaperSize( mpDefPrinter ); 571cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); 572cdf0e10cSrcweir 573cdf0e10cSrcweir if ( pItem ) 574cdf0e10cSrcweir aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize(); 575cdf0e10cSrcweir 576cdf0e10cSrcweir FASTBOOL bOrientationSupport = 577*56b35d86SArmin Le Grand mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION ); 578cdf0e10cSrcweir #ifdef OS2 579cdf0e10cSrcweir // unter OS/2 wird bei HasSupport() immer sal_True returned 580cdf0e10cSrcweir // aber nur als Dummy, deshalb FALSE 581cdf0e10cSrcweir bOrientationSupport = sal_False; 582cdf0e10cSrcweir #endif 583cdf0e10cSrcweir 584cdf0e10cSrcweir if ( !bOrientationSupport && 585cdf0e10cSrcweir aPaperSize.Width() > aPaperSize.Height() ) 586cdf0e10cSrcweir bLandscape = sal_True; 587cdf0e10cSrcweir 588cdf0e10cSrcweir aLandscapeBtn.Check( bLandscape ); 589cdf0e10cSrcweir aPortraitBtn.Check( !bLandscape ); 590cdf0e10cSrcweir 591cdf0e10cSrcweir aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ), 592cdf0e10cSrcweir ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) ); 593cdf0e10cSrcweir 594cdf0e10cSrcweir aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM); 595cdf0e10cSrcweir if ( bLandscape ) 596cdf0e10cSrcweir Swap( aPaperSize ); 597cdf0e10cSrcweir 598cdf0e10cSrcweir // Actual Paper Format 599cdf0e10cSrcweir Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, sal_True ); 600cdf0e10cSrcweir 601cdf0e10cSrcweir if ( PAPER_USER != ePaper ) 602cdf0e10cSrcweir aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ); 603cdf0e10cSrcweir 604cdf0e10cSrcweir if ( bLandscape ) 605cdf0e10cSrcweir Swap( aPaperSize ); 606cdf0e10cSrcweir 607cdf0e10cSrcweir // Werte in die Edits eintragen 608cdf0e10cSrcweir SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM ); 609cdf0e10cSrcweir SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM ); 610cdf0e10cSrcweir aPaperSizeBox.Clear(); 611cdf0e10cSrcweir 612cdf0e10cSrcweir sal_uInt16 nActPos = LISTBOX_ENTRY_NOTFOUND; 613cdf0e10cSrcweir sal_uInt16 nAryId = RID_SVXSTRARY_PAPERSIZE_STD; 614cdf0e10cSrcweir 615cdf0e10cSrcweir if ( ePaperStart != PAPER_A3 ) 616cdf0e10cSrcweir nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW; 617cdf0e10cSrcweir ResStringArray aPaperAry( CUI_RES( nAryId ) ); 618cdf0e10cSrcweir sal_uInt32 nCnt = aPaperAry.Count(); 619cdf0e10cSrcweir 620cdf0e10cSrcweir sal_uInt16 nUserPos = LISTBOX_ENTRY_NOTFOUND; 621cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < nCnt; ++i ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir String aStr = aPaperAry.GetString(i); 624cdf0e10cSrcweir Paper eSize = (Paper)aPaperAry.GetValue(i); 625cdf0e10cSrcweir sal_uInt16 nPos = aPaperSizeBox.InsertEntry( aStr ); 626cdf0e10cSrcweir aPaperSizeBox.SetEntryData( nPos, (void*)(sal_uLong)eSize ); 627cdf0e10cSrcweir 628cdf0e10cSrcweir if ( eSize == ePaper ) 629cdf0e10cSrcweir nActPos = nPos; 630cdf0e10cSrcweir if( eSize == PAPER_USER ) 631cdf0e10cSrcweir nUserPos = nPos; 632cdf0e10cSrcweir } 633cdf0e10cSrcweir // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead 634cdf0e10cSrcweir aPaperSizeBox.SelectEntryPos( nActPos != LISTBOX_ENTRY_NOTFOUND ? nActPos : nUserPos ); 635cdf0e10cSrcweir 636cdf0e10cSrcweir // Applikationsspezifisch 637cdf0e10cSrcweir 638cdf0e10cSrcweir switch ( eMode ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir case SVX_PAGE_MODE_CENTER: 641cdf0e10cSrcweir { 642cdf0e10cSrcweir aTblAlignFT.Show(); 643cdf0e10cSrcweir aHorzBox.Show(); 644cdf0e10cSrcweir aVertBox.Show(); 645cdf0e10cSrcweir DisableVerticalPageDir(); 646cdf0e10cSrcweir 647cdf0e10cSrcweir // Horizontale Ausrichtung 648cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); 649cdf0e10cSrcweir aHorzBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() 650cdf0e10cSrcweir : sal_False ); 651cdf0e10cSrcweir 652cdf0e10cSrcweir // Vertikale Ausrichtung 653cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 ); 654cdf0e10cSrcweir aVertBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() 655cdf0e10cSrcweir : sal_False ); 656cdf0e10cSrcweir 657cdf0e10cSrcweir // Beispiel-Fenster auf Tabelle setzen 658cdf0e10cSrcweir aBspWin.SetTable( sal_True ); 659cdf0e10cSrcweir aBspWin.SetHorz( aHorzBox.IsChecked() ); 660cdf0e10cSrcweir aBspWin.SetVert( aVertBox.IsChecked() ); 661cdf0e10cSrcweir 662cdf0e10cSrcweir break; 663cdf0e10cSrcweir } 664cdf0e10cSrcweir 665cdf0e10cSrcweir case SVX_PAGE_MODE_PRESENTATION: 666cdf0e10cSrcweir { 667cdf0e10cSrcweir DisableVerticalPageDir(); 668cdf0e10cSrcweir aAdaptBox.Show(); 669cdf0e10cSrcweir pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); 670cdf0e10cSrcweir aAdaptBox.Check( pItem ? 671cdf0e10cSrcweir ( (const SfxBoolItem*)pItem )->GetValue() : sal_False ); 672cdf0e10cSrcweir 673cdf0e10cSrcweir //!!! hidden, weil von StarDraw nicht implementiert 674cdf0e10cSrcweir aLayoutBox.Hide(); 675cdf0e10cSrcweir aPageText.Hide(); 676cdf0e10cSrcweir 677cdf0e10cSrcweir break; 678cdf0e10cSrcweir } 679cdf0e10cSrcweir default: ;//prevent warning 680cdf0e10cSrcweir } 681cdf0e10cSrcweir 682cdf0e10cSrcweir 683cdf0e10cSrcweir // im Beispiel Hintergrund und Umrandung anzeigen 684cdf0e10cSrcweir ResetBackground_Impl( rSet ); 685cdf0e10cSrcweir //! UpdateExample_Impl(); 686cdf0e10cSrcweir RangeHdl_Impl( 0 ); 687cdf0e10cSrcweir 688cdf0e10cSrcweir // Header Footer anzeigen 689cdf0e10cSrcweir InitHeadFoot_Impl( rSet ); 690cdf0e10cSrcweir 691cdf0e10cSrcweir // R"ander auf Hoch/Quer updaten, dann Beispiel updaten 692cdf0e10cSrcweir bBorderModified = sal_False; 693cdf0e10cSrcweir SwapFirstValues_Impl( sal_False ); 694cdf0e10cSrcweir UpdateExample_Impl(); 695cdf0e10cSrcweir 696cdf0e10cSrcweir // Alte Werte sichern 697cdf0e10cSrcweir aLeftMarginEdit.SaveValue(); 698cdf0e10cSrcweir aRightMarginEdit.SaveValue(); 699cdf0e10cSrcweir aTopMarginEdit.SaveValue(); 700cdf0e10cSrcweir aBottomMarginEdit.SaveValue(); 701cdf0e10cSrcweir aLayoutBox.SaveValue(); 702cdf0e10cSrcweir aNumberFormatBox.SaveValue(); 703cdf0e10cSrcweir aPaperSizeBox.SaveValue(); 704cdf0e10cSrcweir aPaperWidthEdit.SaveValue(); 705cdf0e10cSrcweir aPaperHeightEdit.SaveValue(); 706cdf0e10cSrcweir aPortraitBtn.SaveValue(); 707cdf0e10cSrcweir aLandscapeBtn.SaveValue(); 708cdf0e10cSrcweir aPaperTrayBox.SaveValue(); 709cdf0e10cSrcweir aVertBox.SaveValue(); 710cdf0e10cSrcweir aHorzBox.SaveValue(); 711cdf0e10cSrcweir aAdaptBox.SaveValue(); 712cdf0e10cSrcweir 713cdf0e10cSrcweir CheckMarginEdits( true ); 714cdf0e10cSrcweir 715cdf0e10cSrcweir // Registerhaltigkeit 716cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_MODE)) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir aRegisterCB.Check(((const SfxBoolItem&)rSet.Get( 719cdf0e10cSrcweir SID_SWREGISTER_MODE)).GetValue()); 720cdf0e10cSrcweir aRegisterCB.SaveValue(); 721cdf0e10cSrcweir RegisterModify(&aRegisterCB); 722cdf0e10cSrcweir } 723cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_COLLECTION)) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir aRegisterLB.SelectEntry( 726cdf0e10cSrcweir ((const SfxStringItem&)rSet.Get(SID_SWREGISTER_COLLECTION)).GetValue()); 727cdf0e10cSrcweir aRegisterLB.SaveValue(); 728cdf0e10cSrcweir } 729cdf0e10cSrcweir 730cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ), 731cdf0e10cSrcweir sal_True, &pItem ); 732cdf0e10cSrcweir if( SFX_ITEM_UNKNOWN != eState ) 733cdf0e10cSrcweir { 734cdf0e10cSrcweir sal_uInt32 nVal = SFX_ITEM_SET == eState 735cdf0e10cSrcweir ? ((SvxFrameDirectionItem*)pItem)->GetValue() 736cdf0e10cSrcweir : 0; 737cdf0e10cSrcweir aTextFlowBox.SelectEntryValue( static_cast< SvxFrameDirection >( nVal ) ); 738cdf0e10cSrcweir aTextFlowBox.SaveValue(); 739cdf0e10cSrcweir aBspWin.SetFrameDirection(nVal); 740cdf0e10cSrcweir } 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir // ----------------------------------------------------------------------- 744cdf0e10cSrcweir 745cdf0e10cSrcweir void SvxPageDescPage::FillUserData() 746cdf0e10cSrcweir { 747cdf0e10cSrcweir if ( SVX_PAGE_MODE_PRESENTATION == eMode ) 748cdf0e10cSrcweir SetUserData( UniString::CreateFromInt32( (sal_Int32)aAdaptBox.IsChecked() ) ); 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir // ----------------------------------------------------------------------- 752cdf0e10cSrcweir 753cdf0e10cSrcweir sal_Bool SvxPageDescPage::FillItemSet( SfxItemSet& rSet ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir sal_Bool bModified = sal_False; 756cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 757cdf0e10cSrcweir SfxItemPool* pPool = rOldSet.GetPool(); 758cdf0e10cSrcweir DBG_ASSERT( pPool, "Wo ist der Pool" ); 759cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE ); 760cdf0e10cSrcweir SfxMapUnit eUnit = pPool->GetMetric( nWhich ); 761cdf0e10cSrcweir const SfxPoolItem* pOld = 0; 762cdf0e10cSrcweir 763cdf0e10cSrcweir // alten linken und rechten Rand kopieren 764cdf0e10cSrcweir SvxLRSpaceItem aMargin( (const SvxLRSpaceItem&)rOldSet.Get( nWhich ) ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir // alten oberen und unteren Rand kopieren 767cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_ULSPACE ); 768cdf0e10cSrcweir SvxULSpaceItem aTopMargin( (const SvxULSpaceItem&)rOldSet.Get( nWhich ) ); 769cdf0e10cSrcweir 770cdf0e10cSrcweir if ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir aMargin.SetLeft( (sal_uInt16)GetCoreValue( aLeftMarginEdit, eUnit ) ); 773cdf0e10cSrcweir bModified |= sal_True; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir if ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir aMargin.SetRight( (sal_uInt16)GetCoreValue( aRightMarginEdit, eUnit ) ); 779cdf0e10cSrcweir bModified |= sal_True; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir // Linken und rechten Rand setzen 783cdf0e10cSrcweir if ( bModified ) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_LRSPACE ); 786cdf0e10cSrcweir 787cdf0e10cSrcweir if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ) 788cdf0e10cSrcweir rSet.Put( aMargin ); 789cdf0e10cSrcweir else 790cdf0e10cSrcweir bModified = sal_False; 791cdf0e10cSrcweir } 792cdf0e10cSrcweir 793cdf0e10cSrcweir sal_Bool bMod = sal_False; 794cdf0e10cSrcweir 795cdf0e10cSrcweir if ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir aTopMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopMarginEdit, eUnit ) ); 798cdf0e10cSrcweir bMod |= sal_True; 799cdf0e10cSrcweir } 800cdf0e10cSrcweir 801cdf0e10cSrcweir if ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) 802cdf0e10cSrcweir { 803cdf0e10cSrcweir aTopMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomMarginEdit, eUnit ) ); 804cdf0e10cSrcweir bMod |= sal_True; 805cdf0e10cSrcweir } 806cdf0e10cSrcweir 807cdf0e10cSrcweir // unteren oberen Rand setzen 808cdf0e10cSrcweir // 809cdf0e10cSrcweir if ( bMod ) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_ULSPACE ); 812cdf0e10cSrcweir 813cdf0e10cSrcweir if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aTopMargin ) ) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir bModified |= sal_True; 816cdf0e10cSrcweir rSet.Put( aTopMargin ); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir } 819cdf0e10cSrcweir 820cdf0e10cSrcweir // Druckerschacht 821cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN ); 822cdf0e10cSrcweir sal_uInt16 nPos = aPaperTrayBox.GetSelectEntryPos(); 823cdf0e10cSrcweir sal_uInt16 nBin = (sal_uInt16)(sal_uLong)aPaperTrayBox.GetEntryData( nPos ); 824cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_PAGE_PAPERBIN ); 825cdf0e10cSrcweir 826cdf0e10cSrcweir if ( !pOld || ( (const SvxPaperBinItem*)pOld )->GetValue() != nBin ) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir rSet.Put( SvxPaperBinItem( nWhich, (sal_uInt8)nBin ) ); 829cdf0e10cSrcweir bModified |= sal_True; 830cdf0e10cSrcweir } 831cdf0e10cSrcweir 832cdf0e10cSrcweir nPos = aPaperSizeBox.GetSelectEntryPos(); 833cdf0e10cSrcweir Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); 834cdf0e10cSrcweir const sal_uInt16 nOld = aPaperSizeBox.GetSavedValue(); 835cdf0e10cSrcweir sal_Bool bChecked = aLandscapeBtn.IsChecked(); 836cdf0e10cSrcweir 837cdf0e10cSrcweir if ( PAPER_USER == ePaper ) 838cdf0e10cSrcweir { 839cdf0e10cSrcweir if ( nOld != nPos || 840cdf0e10cSrcweir aPaperWidthEdit.IsValueModified() || 841cdf0e10cSrcweir aPaperHeightEdit.IsValueModified() || 842cdf0e10cSrcweir bChecked != aLandscapeBtn.GetSavedValue() ) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), 845cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, eUnit ) ); 846cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); 847cdf0e10cSrcweir 848cdf0e10cSrcweir if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) 849cdf0e10cSrcweir { 850cdf0e10cSrcweir rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); 851cdf0e10cSrcweir bModified |= sal_True; 852cdf0e10cSrcweir } 853cdf0e10cSrcweir } 854cdf0e10cSrcweir } 855cdf0e10cSrcweir else 856cdf0e10cSrcweir { 857cdf0e10cSrcweir if ( nOld != nPos || bChecked != aLandscapeBtn.GetSavedValue() ) 858cdf0e10cSrcweir { 859cdf0e10cSrcweir Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) ); 860cdf0e10cSrcweir 861cdf0e10cSrcweir if ( bChecked ) 862cdf0e10cSrcweir Swap( aSize ); 863cdf0e10cSrcweir 864cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); 865cdf0e10cSrcweir 866cdf0e10cSrcweir if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) 867cdf0e10cSrcweir { 868cdf0e10cSrcweir rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); 869cdf0e10cSrcweir bModified |= sal_True; 870cdf0e10cSrcweir } 871cdf0e10cSrcweir } 872cdf0e10cSrcweir } 873cdf0e10cSrcweir 874cdf0e10cSrcweir // sonstiges Zeug der Page 875cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_PAGE ); 876cdf0e10cSrcweir SvxPageItem aPage( (const SvxPageItem&)rOldSet.Get( nWhich ) ); 877cdf0e10cSrcweir bMod = aLayoutBox.GetSelectEntryPos() != aLayoutBox.GetSavedValue(); 878cdf0e10cSrcweir 879cdf0e10cSrcweir if ( bMod ) 880cdf0e10cSrcweir aPage.SetPageUsage( 881cdf0e10cSrcweir ::PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); 882cdf0e10cSrcweir 883cdf0e10cSrcweir if ( bChecked != aLandscapeBtn.GetSavedValue() ) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir aPage.SetLandscape(bChecked); 886cdf0e10cSrcweir bMod |= sal_True; 887cdf0e10cSrcweir } 888cdf0e10cSrcweir 889cdf0e10cSrcweir // Einstellen der Numerierungsart der Seite 890cdf0e10cSrcweir nPos = aNumberFormatBox.GetSelectEntryPos(); 891cdf0e10cSrcweir 892cdf0e10cSrcweir if ( nPos != aNumberFormatBox.GetSavedValue() ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir aPage.SetNumType( (SvxNumType)nPos ); 895cdf0e10cSrcweir bMod |= sal_True; 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir if ( bMod ) 899cdf0e10cSrcweir { 900cdf0e10cSrcweir pOld = GetOldItem( rSet, SID_ATTR_PAGE ); 901cdf0e10cSrcweir 902cdf0e10cSrcweir if ( !pOld || !( *(const SvxPageItem*)pOld == aPage ) ) 903cdf0e10cSrcweir { 904cdf0e10cSrcweir rSet.Put( aPage ); 905cdf0e10cSrcweir bModified |= sal_True; 906cdf0e10cSrcweir } 907cdf0e10cSrcweir } 908cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich ) ) 909cdf0e10cSrcweir rSet.ClearItem( nWhich ); 910cdf0e10cSrcweir else 911cdf0e10cSrcweir rSet.Put( rOldSet.Get( nWhich ) ); 912cdf0e10cSrcweir 913cdf0e10cSrcweir // Modispezifische Controls auswerten 914cdf0e10cSrcweir 915cdf0e10cSrcweir switch ( eMode ) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir case SVX_PAGE_MODE_CENTER: 918cdf0e10cSrcweir { 919cdf0e10cSrcweir if ( aHorzBox.IsChecked() != aHorzBox.GetSavedValue() ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ), 922cdf0e10cSrcweir aHorzBox.IsChecked() ); 923cdf0e10cSrcweir rSet.Put( aHorz ); 924cdf0e10cSrcweir bModified |= sal_True; 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir if ( aVertBox.IsChecked() != aVertBox.GetSavedValue() ) 928cdf0e10cSrcweir { 929cdf0e10cSrcweir SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ), 930cdf0e10cSrcweir aVertBox.IsChecked() ); 931cdf0e10cSrcweir rSet.Put( aVert ); 932cdf0e10cSrcweir bModified |= sal_True; 933cdf0e10cSrcweir } 934cdf0e10cSrcweir break; 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir case SVX_PAGE_MODE_PRESENTATION: 938cdf0e10cSrcweir { 939cdf0e10cSrcweir // immer putten, damit Draw das auswerten kann 940cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ), 941cdf0e10cSrcweir aAdaptBox.IsChecked() ) ); 942cdf0e10cSrcweir bModified |= sal_True; 943cdf0e10cSrcweir break; 944cdf0e10cSrcweir } 945cdf0e10cSrcweir default: ;//prevent warning 946cdf0e10cSrcweir 947cdf0e10cSrcweir } 948cdf0e10cSrcweir 949cdf0e10cSrcweir if(aRegisterCB.IsVisible() && 950cdf0e10cSrcweir (aRegisterCB.IsChecked() || aRegisterCB.GetSavedValue() != aRegisterCB.IsChecked())) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE); 953cdf0e10cSrcweir SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone(); 954cdf0e10cSrcweir sal_Bool bCheck = aRegisterCB.IsChecked(); 955cdf0e10cSrcweir pRegItem->SetValue(bCheck); 956cdf0e10cSrcweir rSet.Put(*pRegItem); 957cdf0e10cSrcweir bModified |= sal_True; 958cdf0e10cSrcweir if(bCheck) 959cdf0e10cSrcweir { 960cdf0e10cSrcweir bModified |= sal_True; 961cdf0e10cSrcweir rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, 962cdf0e10cSrcweir aRegisterLB.GetSelectEntry())); 963cdf0e10cSrcweir } 964cdf0e10cSrcweir delete pRegItem; 965cdf0e10cSrcweir } 966cdf0e10cSrcweir 967cdf0e10cSrcweir SvxFrameDirection eDirection = aTextFlowBox.GetSelectEntryValue(); 968cdf0e10cSrcweir if( aTextFlowBox.IsVisible() && (eDirection != aTextFlowBox.GetSavedValue()) ) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir rSet.Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); 971cdf0e10cSrcweir bModified = sal_True; 972cdf0e10cSrcweir } 973cdf0e10cSrcweir 974cdf0e10cSrcweir return bModified; 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir // ----------------------------------------------------------------------- 978cdf0e10cSrcweir 979cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, LayoutHdl_Impl, ListBox *, EMPTYARG ) 980cdf0e10cSrcweir { 981cdf0e10cSrcweir // innen au\sen umschalten 982cdf0e10cSrcweir const sal_uInt16 nPos = PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ); 983cdf0e10cSrcweir 984cdf0e10cSrcweir if ( nPos == SVX_PAGE_MIRROR ) 985cdf0e10cSrcweir { 986cdf0e10cSrcweir if ( aLeftMarginLbl.GetText() != aInsideText ) 987cdf0e10cSrcweir aLeftMarginLbl.SetText( aInsideText ); 988cdf0e10cSrcweir 989cdf0e10cSrcweir if ( aRightMarginLbl.GetText() != aOutsideText ) 990cdf0e10cSrcweir aRightMarginLbl.SetText( aOutsideText ); 991cdf0e10cSrcweir } 992cdf0e10cSrcweir else 993cdf0e10cSrcweir { 994cdf0e10cSrcweir if ( aLeftMarginLbl.GetText() != aLeftText ) 995cdf0e10cSrcweir aLeftMarginLbl.SetText( aLeftText ); 996cdf0e10cSrcweir 997cdf0e10cSrcweir if ( aRightMarginLbl.GetText() != aRightText ) 998cdf0e10cSrcweir aRightMarginLbl.SetText( aRightText ); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir UpdateExample_Impl( true ); 1001cdf0e10cSrcweir return 0; 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir // ----------------------------------------------------------------------- 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG ) 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir if ( aPaperTrayBox.GetEntryCount() > 1 ) 1009cdf0e10cSrcweir // schon gef"ullt 1010cdf0e10cSrcweir return 0; 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir // Schacht-Box initialisieren 1013cdf0e10cSrcweir String aOldName = aPaperTrayBox.GetSelectEntry(); 1014cdf0e10cSrcweir aPaperTrayBox.SetUpdateMode( sal_False ); 1015cdf0e10cSrcweir aPaperTrayBox.Clear(); 1016cdf0e10cSrcweir sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( 1017cdf0e10cSrcweir EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ) ); 1018cdf0e10cSrcweir aPaperTrayBox.SetEntryData( nEntryPos, 1019cdf0e10cSrcweir (void*)(sal_uLong)PAPERBIN_PRINTER_SETTINGS ); 1020cdf0e10cSrcweir String aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) ); 1021*56b35d86SArmin Le Grand sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount(); 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nBinCount; ++i ) 1024cdf0e10cSrcweir { 1025*56b35d86SArmin Le Grand String aName = mpDefPrinter->GetPaperBinName(i); 1026cdf0e10cSrcweir 1027cdf0e10cSrcweir if ( !aName.Len() ) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir aName = aPaperBin; 1030cdf0e10cSrcweir aName.Append( sal_Unicode(' ') ); 1031cdf0e10cSrcweir aName.Append( UniString::CreateFromInt32( i+1 ) ); 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir nEntryPos = aPaperTrayBox.InsertEntry( aName ); 1034cdf0e10cSrcweir aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)i ); 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir aPaperTrayBox.SelectEntry( aOldName ); 1037cdf0e10cSrcweir aPaperTrayBox.SetUpdateMode( sal_True ); 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir return 0; 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir // ----------------------------------------------------------------------- 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox ) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir const sal_uInt16 nPos = pBox->GetSelectEntryPos(); 1047cdf0e10cSrcweir Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir if ( ePaper != PAPER_USER ) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) ); 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir if ( aLandscapeBtn.IsChecked() ) 1054cdf0e10cSrcweir Swap( aSize ); 1055cdf0e10cSrcweir 1056cdf0e10cSrcweir if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) ) 1057cdf0e10cSrcweir aPaperHeightEdit.SetMin( 1058cdf0e10cSrcweir aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM ); 1059cdf0e10cSrcweir if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) ) 1060cdf0e10cSrcweir aPaperWidthEdit.SetMin( 1061cdf0e10cSrcweir aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM ); 1062cdf0e10cSrcweir SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM ); 1063cdf0e10cSrcweir SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM ); 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir // R"ander ggf. neu berechnen 1066cdf0e10cSrcweir CalcMargin_Impl(); 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir RangeHdl_Impl( 0 ); 1069cdf0e10cSrcweir UpdateExample_Impl( true ); 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir if ( eMode == SVX_PAGE_MODE_PRESENTATION ) 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir // Draw: bei Papierformat soll der Rand 1cm betragen 1074cdf0e10cSrcweir long nTmp = 0; 1075cdf0e10cSrcweir sal_Bool bScreen = ( PAPER_SCREEN == ePaper ); 1076cdf0e10cSrcweir 1077cdf0e10cSrcweir if ( !bScreen ) 1078cdf0e10cSrcweir // bei Bildschirm keinen Rand 1079cdf0e10cSrcweir nTmp = 1; // entspr. 1cm 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir // Abfragen, ob fuer Raender 0 gesetzt ist: 1082cdf0e10cSrcweir if ( bScreen || aRightMarginEdit.GetValue() == 0 ) 1083cdf0e10cSrcweir { 1084cdf0e10cSrcweir SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM ); 1085cdf0e10cSrcweir if ( !bScreen && 1086cdf0e10cSrcweir aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() ) 1087cdf0e10cSrcweir aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() ); 1088cdf0e10cSrcweir } 1089cdf0e10cSrcweir if ( bScreen || aLeftMarginEdit.GetValue() == 0 ) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM ); 1092cdf0e10cSrcweir if ( !bScreen && 1093cdf0e10cSrcweir aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() ) 1094cdf0e10cSrcweir aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() ); 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir if ( bScreen || aBottomMarginEdit.GetValue() == 0 ) 1097cdf0e10cSrcweir { 1098cdf0e10cSrcweir SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM ); 1099cdf0e10cSrcweir if ( !bScreen && 1100cdf0e10cSrcweir aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() ) 1101cdf0e10cSrcweir aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() ); 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir if ( bScreen || aTopMarginEdit.GetValue() == 0 ) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM ); 1106cdf0e10cSrcweir if ( !bScreen && 1107cdf0e10cSrcweir aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() ) 1108cdf0e10cSrcweir aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() ); 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir UpdateExample_Impl( true ); 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir return 0; 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir // ----------------------------------------------------------------------- 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG ) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE ); 1121cdf0e10cSrcweir SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich ); 1122cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), 1123cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, eUnit ) ); 1124cdf0e10cSrcweir Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, sal_True ); 1125cdf0e10cSrcweir sal_uInt16 nEntryCount = aPaperSizeBox.GetEntryCount(); 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nEntryCount; ++i ) 1128cdf0e10cSrcweir { 1129cdf0e10cSrcweir Paper eTmp = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData(i); 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir if ( eTmp == ePaper ) 1132cdf0e10cSrcweir { 1133cdf0e10cSrcweir aPaperSizeBox.SelectEntryPos(i); 1134cdf0e10cSrcweir break; 1135cdf0e10cSrcweir } 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir UpdateExample_Impl( true ); 1138cdf0e10cSrcweir return 0; 1139cdf0e10cSrcweir } 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir // ----------------------------------------------------------------------- 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn ) 1144cdf0e10cSrcweir { 1145cdf0e10cSrcweir if ( 1146cdf0e10cSrcweir (!bLandscape && pBtn == &aLandscapeBtn) || 1147cdf0e10cSrcweir (bLandscape && pBtn == &aPortraitBtn) 1148cdf0e10cSrcweir ) 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir bLandscape = aLandscapeBtn.IsChecked(); 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM ); 1153cdf0e10cSrcweir const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM ); 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir // swap with and height 1156cdf0e10cSrcweir SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM ); 1157cdf0e10cSrcweir SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM ); 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir // recalculate margins if necessary 1160cdf0e10cSrcweir CalcMargin_Impl(); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir PaperSizeSelect_Impl( &aPaperSizeBox ); 1163cdf0e10cSrcweir RangeHdl_Impl( 0 ); 1164cdf0e10cSrcweir SwapFirstValues_Impl( bBorderModified ); 1165cdf0e10cSrcweir UpdateExample_Impl( true ); 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir return 0; 1168cdf0e10cSrcweir } 1169cdf0e10cSrcweir 1170cdf0e10cSrcweir // ----------------------------------------------------------------------- 1171cdf0e10cSrcweir 1172cdf0e10cSrcweir void SvxPageDescPage::SwapFirstValues_Impl( FASTBOOL bSet ) 1173cdf0e10cSrcweir { 1174*56b35d86SArmin Le Grand MapMode aOldMode = mpDefPrinter->GetMapMode(); 1175cdf0e10cSrcweir Orientation eOri = ORIENTATION_PORTRAIT; 1176cdf0e10cSrcweir 1177cdf0e10cSrcweir if ( bLandscape ) 1178cdf0e10cSrcweir eOri = ORIENTATION_LANDSCAPE; 1179*56b35d86SArmin Le Grand Orientation eOldOri = mpDefPrinter->GetOrientation(); 1180*56b35d86SArmin Le Grand mpDefPrinter->SetOrientation( eOri ); 1181*56b35d86SArmin Le Grand mpDefPrinter->SetMapMode( MAP_TWIP ); 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir // First- und Last-Werte f"ur die R"ander setzen 1184*56b35d86SArmin Le Grand Size aPaperSize = mpDefPrinter->GetPaperSize(); 1185*56b35d86SArmin Le Grand Size aPrintSize = mpDefPrinter->GetOutputSize(); 1186cdf0e10cSrcweir /* 1187cdf0e10cSrcweir * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, 1188cdf0e10cSrcweir * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des 1189cdf0e10cSrcweir * Koordinatensystems verschoben ist. 1190cdf0e10cSrcweir */ 1191*56b35d86SArmin Le Grand Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() ); 1192*56b35d86SArmin Le Grand mpDefPrinter->SetMapMode( aOldMode ); 1193*56b35d86SArmin Le Grand mpDefPrinter->SetOrientation( eOldOri ); 1194cdf0e10cSrcweir 1195cdf0e10cSrcweir sal_Int64 nSetL = aLeftMarginEdit.Denormalize( 1196cdf0e10cSrcweir aLeftMarginEdit.GetValue( FUNIT_TWIP ) ); 1197cdf0e10cSrcweir sal_Int64 nSetR = aRightMarginEdit.Denormalize( 1198cdf0e10cSrcweir aRightMarginEdit.GetValue( FUNIT_TWIP ) ); 1199cdf0e10cSrcweir sal_Int64 nSetT = aTopMarginEdit.Denormalize( 1200cdf0e10cSrcweir aTopMarginEdit.GetValue( FUNIT_TWIP ) ); 1201cdf0e10cSrcweir sal_Int64 nSetB = aBottomMarginEdit.Denormalize( 1202cdf0e10cSrcweir aBottomMarginEdit.GetValue( FUNIT_TWIP ) ); 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; 1205cdf0e10cSrcweir long nNewL = aPrintOffset.X(); 1206cdf0e10cSrcweir long nNewR = 1207cdf0e10cSrcweir aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset; 1208cdf0e10cSrcweir long nNewT = aPrintOffset.Y(); 1209cdf0e10cSrcweir long nNewB = 1210cdf0e10cSrcweir aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset; 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP ); 1213cdf0e10cSrcweir nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst()); 1214cdf0e10cSrcweir aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP ); 1215cdf0e10cSrcweir nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst()); 1216cdf0e10cSrcweir aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP ); 1217cdf0e10cSrcweir nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst()); 1218cdf0e10cSrcweir aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP ); 1219cdf0e10cSrcweir nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst()); 1220cdf0e10cSrcweir 1221cdf0e10cSrcweir if ( bSet ) 1222cdf0e10cSrcweir { 1223cdf0e10cSrcweir // ggf. auch die Werte umsetzen, 1224cdf0e10cSrcweir if ( nSetL < nNewL ) 1225cdf0e10cSrcweir aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ), 1226cdf0e10cSrcweir FUNIT_TWIP ); 1227cdf0e10cSrcweir if ( nSetR < nNewR ) 1228cdf0e10cSrcweir aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ), 1229cdf0e10cSrcweir FUNIT_TWIP ); 1230cdf0e10cSrcweir if ( nSetT < nNewT ) 1231cdf0e10cSrcweir aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ), 1232cdf0e10cSrcweir FUNIT_TWIP ); 1233cdf0e10cSrcweir if ( nSetB < nNewB ) 1234cdf0e10cSrcweir aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ), 1235cdf0e10cSrcweir FUNIT_TWIP ); 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir } 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir // ----------------------------------------------------------------------- 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir if ( !bBorderModified ) 1244cdf0e10cSrcweir bBorderModified = sal_True; 1245cdf0e10cSrcweir UpdateExample_Impl(); 1246cdf0e10cSrcweir return 0; 1247cdf0e10cSrcweir } 1248cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir // ----------------------------------------------------------------------- 1251cdf0e10cSrcweir 1252cdf0e10cSrcweir void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground ) 1253cdf0e10cSrcweir { 1254cdf0e10cSrcweir // Size 1255cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ), 1256cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) ); 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir aBspWin.SetSize( aSize ); 1259cdf0e10cSrcweir 1260cdf0e10cSrcweir // R"ander 1261cdf0e10cSrcweir aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) ); 1262cdf0e10cSrcweir aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) ); 1263cdf0e10cSrcweir aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) ); 1264cdf0e10cSrcweir aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) ); 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir // Layout 1267cdf0e10cSrcweir aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); 1268cdf0e10cSrcweir if ( bResetbackground ) 1269cdf0e10cSrcweir aBspWin.ResetBackground(); 1270cdf0e10cSrcweir aBspWin.Invalidate(); 1271cdf0e10cSrcweir } 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir // ----------------------------------------------------------------------- 1274cdf0e10cSrcweir 1275*56b35d86SArmin Le Grand void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet) 1276cdf0e10cSrcweir { 1277*56b35d86SArmin Le Grand sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET)); 1278cdf0e10cSrcweir 1279*56b35d86SArmin Le Grand if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False)) 1280*56b35d86SArmin Le Grand { 1281*56b35d86SArmin Le Grand const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); 1282*56b35d86SArmin Le Grand const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); 1283*56b35d86SArmin Le Grand const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); 1284cdf0e10cSrcweir 1285*56b35d86SArmin Le Grand if(rOn.GetValue()) 1286*56b35d86SArmin Le Grand { 1287*56b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; 1288*56b35d86SArmin Le Grand 1289*56b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles) 1290*56b35d86SArmin Le Grand { 1291*56b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries 1292*56b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); 1293*56b35d86SArmin Le Grand } 1294*56b35d86SArmin Le Grand else 1295*56b35d86SArmin Le Grand { 1296*56b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BRUSH); 1297*56b35d86SArmin Le Grand 1298*56b35d86SArmin Le Grand if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) 1299*56b35d86SArmin Le Grand { 1300*56b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem 1301*56b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); 1302*56b35d86SArmin Le Grand SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 1303*56b35d86SArmin Le Grand 1304*56b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 1305*56b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); 1306*56b35d86SArmin Le Grand } 1307*56b35d86SArmin Le Grand } 1308*56b35d86SArmin Le Grand 1309*56b35d86SArmin Le Grand aBspWin.setHeaderFillAttributes(aHeaderFillAttributes); 1310*56b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BORDER_OUTER); 1311*56b35d86SArmin Le Grand 1312*56b35d86SArmin Le Grand if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) 1313*56b35d86SArmin Le Grand { 1314*56b35d86SArmin Le Grand const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich)); 1315*56b35d86SArmin Le Grand aBspWin.SetHdBorder(rItem); 1316*56b35d86SArmin Le Grand } 1317*56b35d86SArmin Le Grand } 1318*56b35d86SArmin Le Grand } 1319cdf0e10cSrcweir 1320*56b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET); 1321cdf0e10cSrcweir 1322*56b35d86SArmin Le Grand if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False)) 1323*56b35d86SArmin Le Grand { 1324*56b35d86SArmin Le Grand const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,sal_False)); 1325*56b35d86SArmin Le Grand const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); 1326*56b35d86SArmin Le Grand const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); 1327cdf0e10cSrcweir 1328*56b35d86SArmin Le Grand if(rOn.GetValue()) 1329*56b35d86SArmin Le Grand { 1330*56b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; 1331*56b35d86SArmin Le Grand 1332*56b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles) 1333*56b35d86SArmin Le Grand { 1334*56b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries 1335*56b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); 1336*56b35d86SArmin Le Grand } 1337*56b35d86SArmin Le Grand else 1338*56b35d86SArmin Le Grand { 1339*56b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BRUSH); 1340*56b35d86SArmin Le Grand 1341*56b35d86SArmin Le Grand if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) 1342*56b35d86SArmin Le Grand { 1343*56b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem 1344*56b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); 1345*56b35d86SArmin Le Grand SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 1346*56b35d86SArmin Le Grand 1347*56b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 1348*56b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); 1349*56b35d86SArmin Le Grand } 1350*56b35d86SArmin Le Grand } 1351*56b35d86SArmin Le Grand 1352*56b35d86SArmin Le Grand aBspWin.setFooterFillAttributes(aFooterFillAttributes); 1353*56b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BORDER_OUTER); 1354*56b35d86SArmin Le Grand 1355*56b35d86SArmin Le Grand if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) 1356*56b35d86SArmin Le Grand { 1357*56b35d86SArmin Le Grand const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich)); 1358*56b35d86SArmin Le Grand aBspWin.SetFtBorder(rItem); 1359*56b35d86SArmin Le Grand } 1360*56b35d86SArmin Le Grand } 1361*56b35d86SArmin Le Grand } 1362cdf0e10cSrcweir 1363*56b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes; 1364*56b35d86SArmin Le Grand const SfxPoolItem* pItem = 0; 1365cdf0e10cSrcweir 1366*56b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles) 1367*56b35d86SArmin Le Grand { 1368*56b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries 1369*56b35d86SArmin Le Grand aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet)); 1370*56b35d86SArmin Le Grand } 1371*56b35d86SArmin Le Grand else 1372*56b35d86SArmin Le Grand { 1373*56b35d86SArmin Le Grand pItem = GetItem(rSet, SID_ATTR_BRUSH); 1374cdf0e10cSrcweir 1375*56b35d86SArmin Le Grand if(pItem) 1376*56b35d86SArmin Le Grand { 1377*56b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem 1378*56b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); 1379*56b35d86SArmin Le Grand SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 1380cdf0e10cSrcweir 1381*56b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 1382*56b35d86SArmin Le Grand aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); 1383*56b35d86SArmin Le Grand } 1384*56b35d86SArmin Le Grand } 1385cdf0e10cSrcweir 1386*56b35d86SArmin Le Grand aBspWin.setPageFillAttributes(aPageFillAttributes); 1387*56b35d86SArmin Le Grand pItem = GetItem(rSet, SID_ATTR_BORDER_OUTER); 1388cdf0e10cSrcweir 1389*56b35d86SArmin Le Grand if(pItem) 1390*56b35d86SArmin Le Grand { 1391*56b35d86SArmin Le Grand aBspWin.SetBorder(static_cast< const SvxBoxItem& >(*pItem)); 1392*56b35d86SArmin Le Grand } 1393cdf0e10cSrcweir } 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir // ----------------------------------------------------------------------- 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir bLandscape = aLandscapeBtn.IsChecked(); 1400cdf0e10cSrcweir const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); 1401cdf0e10cSrcweir 1402cdf0e10cSrcweir if ( pItem ) 1403cdf0e10cSrcweir aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() ); 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir const SvxSetItem* pSetItem = 0; 1406cdf0e10cSrcweir 1407cdf0e10cSrcweir // Kopfzeilen-Attribute auswerten 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir if ( SFX_ITEM_SET == 1410cdf0e10cSrcweir rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ), 1411cdf0e10cSrcweir sal_False, (const SfxPoolItem**)&pSetItem ) ) 1412cdf0e10cSrcweir { 1413cdf0e10cSrcweir const SfxItemSet& rHeaderSet = pSetItem->GetItemSet(); 1414cdf0e10cSrcweir const SfxBoolItem& rHeaderOn = 1415cdf0e10cSrcweir (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir if ( rHeaderOn.GetValue() ) 1418cdf0e10cSrcweir { 1419cdf0e10cSrcweir const SvxSizeItem& rSize = (const SvxSizeItem&) 1420cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ); 1421cdf0e10cSrcweir const SvxULSpaceItem& rUL = (const SvxULSpaceItem&) 1422cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ); 1423cdf0e10cSrcweir long nDist = rUL.GetLower(); 1424cdf0e10cSrcweir aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist ); 1425cdf0e10cSrcweir aBspWin.SetHdDist( nDist ); 1426cdf0e10cSrcweir const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) 1427cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); 1428cdf0e10cSrcweir aBspWin.SetHdLeft( rLR.GetLeft() ); 1429cdf0e10cSrcweir aBspWin.SetHdRight( rLR.GetRight() ); 1430cdf0e10cSrcweir aBspWin.SetHeader( sal_True ); 1431cdf0e10cSrcweir } 1432cdf0e10cSrcweir else 1433cdf0e10cSrcweir aBspWin.SetHeader( sal_False ); 1434cdf0e10cSrcweir 1435*56b35d86SArmin Le Grand // im Beispiel Hintergrund und Umrandung anzeigen 1436*56b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; 1437cdf0e10cSrcweir 1438*56b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles) 1439*56b35d86SArmin Le Grand { 1440*56b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries 1441*56b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet)); 1442*56b35d86SArmin Le Grand } 1443*56b35d86SArmin Le Grand else 1444*56b35d86SArmin Le Grand { 1445*56b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH)); 1446*56b35d86SArmin Le Grand 1447*56b35d86SArmin Le Grand if(rHeaderSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) 1448*56b35d86SArmin Le Grand { 1449*56b35d86SArmin Le Grand //UUUU aBspWin.SetHdColor(rItem.GetColor()); 1450*56b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich)); 1451*56b35d86SArmin Le Grand SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 1452*56b35d86SArmin Le Grand 1453*56b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 1454*56b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); 1455*56b35d86SArmin Le Grand } 1456*56b35d86SArmin Le Grand } 1457*56b35d86SArmin Le Grand 1458*56b35d86SArmin Le Grand aBspWin.setHeaderFillAttributes(aHeaderFillAttributes); 1459*56b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER)); 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) 1462cdf0e10cSrcweir { 1463cdf0e10cSrcweir const SvxBoxItem& rItem = 1464cdf0e10cSrcweir (const SvxBoxItem&)rHeaderSet.Get( nWhich ); 1465cdf0e10cSrcweir aBspWin.SetHdBorder( rItem ); 1466cdf0e10cSrcweir } 1467cdf0e10cSrcweir } 1468cdf0e10cSrcweir 1469cdf0e10cSrcweir // Fusszeilen-Attribute auswerten 1470cdf0e10cSrcweir 1471cdf0e10cSrcweir if ( SFX_ITEM_SET == 1472cdf0e10cSrcweir rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ), 1473cdf0e10cSrcweir sal_False, (const SfxPoolItem**)&pSetItem ) ) 1474cdf0e10cSrcweir { 1475cdf0e10cSrcweir const SfxItemSet& rFooterSet = pSetItem->GetItemSet(); 1476cdf0e10cSrcweir const SfxBoolItem& rFooterOn = 1477cdf0e10cSrcweir (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir if ( rFooterOn.GetValue() ) 1480cdf0e10cSrcweir { 1481cdf0e10cSrcweir const SvxSizeItem& rSize = (const SvxSizeItem&) 1482cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ); 1483cdf0e10cSrcweir const SvxULSpaceItem& rUL = (const SvxULSpaceItem&) 1484cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ); 1485cdf0e10cSrcweir long nDist = rUL.GetUpper(); 1486cdf0e10cSrcweir aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist ); 1487cdf0e10cSrcweir aBspWin.SetFtDist( nDist ); 1488cdf0e10cSrcweir const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) 1489cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); 1490cdf0e10cSrcweir aBspWin.SetFtLeft( rLR.GetLeft() ); 1491cdf0e10cSrcweir aBspWin.SetFtRight( rLR.GetRight() ); 1492cdf0e10cSrcweir aBspWin.SetFooter( sal_True ); 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir else 1495cdf0e10cSrcweir aBspWin.SetFooter( sal_False ); 1496cdf0e10cSrcweir 1497*56b35d86SArmin Le Grand // im Beispiel Hintergrund und Umrandung anzeigen 1498*56b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; 1499cdf0e10cSrcweir 1500*56b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles) 1501*56b35d86SArmin Le Grand { 1502*56b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries 1503*56b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet)); 1504*56b35d86SArmin Le Grand } 1505*56b35d86SArmin Le Grand else 1506*56b35d86SArmin Le Grand { 1507*56b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH)); 1508*56b35d86SArmin Le Grand 1509*56b35d86SArmin Le Grand if(rFooterSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) 1510*56b35d86SArmin Le Grand { 1511*56b35d86SArmin Le Grand //UUUU aBspWin.SetFtColor(rItem.GetColor()); 1512*56b35d86SArmin Le Grand const SvxBrushItem& rItem = (const SvxBrushItem&)rFooterSet.Get(nWhich); 1513*56b35d86SArmin Le Grand SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 1514*56b35d86SArmin Le Grand 1515*56b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 1516*56b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); 1517*56b35d86SArmin Le Grand } 1518*56b35d86SArmin Le Grand } 1519*56b35d86SArmin Le Grand 1520*56b35d86SArmin Le Grand aBspWin.setFooterFillAttributes(aFooterFillAttributes); 1521*56b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER)); 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) 1524cdf0e10cSrcweir { 1525cdf0e10cSrcweir const SvxBoxItem& rItem = 1526cdf0e10cSrcweir (const SvxBoxItem&)rFooterSet.Get( nWhich ); 1527cdf0e10cSrcweir aBspWin.SetFtBorder( rItem ); 1528cdf0e10cSrcweir } 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir // ----------------------------------------------------------------------- 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet ) 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir InitHeadFoot_Impl( rSet ); 153772febba8STsutomu Uchino UpdateExample_Impl(); 1538cdf0e10cSrcweir ResetBackground_Impl( rSet ); 1539cdf0e10cSrcweir RangeHdl_Impl( 0 ); 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir // ----------------------------------------------------------------------- 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) 1545cdf0e10cSrcweir { 1546cdf0e10cSrcweir // Abfrage, ob die Seitenr"ander ausserhalb des Druckbereichs liegen 1547cdf0e10cSrcweir // Wenn nicht, dann den Anwender fragen, ob sie "ubernommen werden sollen. 1548cdf0e10cSrcweir // Wenn nicht, dann auf der TabPage bleiben. 1549cdf0e10cSrcweir sal_uInt16 nPos = aPaperSizeBox.GetSelectEntryPos(); 1550cdf0e10cSrcweir Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir if ( ePaper != PAPER_SCREEN && IsMarginOutOfRange() ) 1553cdf0e10cSrcweir { 1554cdf0e10cSrcweir if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO ) 1555cdf0e10cSrcweir { 1556cdf0e10cSrcweir MetricField* pField = NULL; 1557cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) ) 1558cdf0e10cSrcweir pField = &aLeftMarginEdit; 1559cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT ) 1560cdf0e10cSrcweir && !pField ) 1561cdf0e10cSrcweir pField = &aRightMarginEdit; 1562cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP ) 1563cdf0e10cSrcweir && !pField ) 1564cdf0e10cSrcweir pField = &aTopMarginEdit; 1565cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM ) 1566cdf0e10cSrcweir && !pField ) 1567cdf0e10cSrcweir pField = &aBottomMarginEdit; 1568cdf0e10cSrcweir if ( pField ) 1569cdf0e10cSrcweir pField->GrabFocus(); 1570cdf0e10cSrcweir UpdateExample_Impl(); 1571cdf0e10cSrcweir return KEEP_PAGE; 1572cdf0e10cSrcweir } 1573cdf0e10cSrcweir else 1574cdf0e10cSrcweir CheckMarginEdits( false ); 1575cdf0e10cSrcweir } 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir if ( _pSet ) 1578cdf0e10cSrcweir { 1579cdf0e10cSrcweir FillItemSet( *_pSet ); 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir // ggf. hoch/quer putten 1582cdf0e10cSrcweir sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE ); 1583cdf0e10cSrcweir SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh ); 1584cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), 1585cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, eUnit ) ); 1586cdf0e10cSrcweir 1587cdf0e10cSrcweir // putten, wenn aktuelle Gr"o/se unterschiedlich zum Wert in _pSet 1588cdf0e10cSrcweir const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE ); 1589cdf0e10cSrcweir if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) ) 1590cdf0e10cSrcweir _pSet->Put( SvxSizeItem( nWh, aSize ) ); 1591cdf0e10cSrcweir } 1592cdf0e10cSrcweir 1593cdf0e10cSrcweir return LEAVE_PAGE; 1594cdf0e10cSrcweir } 1595cdf0e10cSrcweir 1596cdf0e10cSrcweir // ----------------------------------------------------------------------- 1597cdf0e10cSrcweir 1598cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, RangeHdl_Impl, Edit *, EMPTYARG ) 1599cdf0e10cSrcweir { 1600cdf0e10cSrcweir // Aktuelle Header-Breite/H"ohe aus dem Bsp 1601cdf0e10cSrcweir long nHHeight = aBspWin.GetHdHeight(); 1602cdf0e10cSrcweir long nHDist = aBspWin.GetHdDist(); 1603cdf0e10cSrcweir 1604cdf0e10cSrcweir // Aktuelle Footer-Breite/H"ohe aus dem Bsp 1605cdf0e10cSrcweir long nFHeight = aBspWin.GetFtHeight(); 1606cdf0e10cSrcweir long nFDist = aBspWin.GetFtDist(); 1607cdf0e10cSrcweir 1608cdf0e10cSrcweir // Aktuelle Header/Footer-R"ander aus dem Bsp 1609cdf0e10cSrcweir long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() ); 1610cdf0e10cSrcweir long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() ); 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir // Aktuelle Werte der Seitenr"ander 1613cdf0e10cSrcweir long nBT = static_cast<long>(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP))); 1614cdf0e10cSrcweir long nBB = static_cast<long>(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP))); 1615cdf0e10cSrcweir long nBL = static_cast<long>(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP))); 1616cdf0e10cSrcweir long nBR = static_cast<long>(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP))); 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir // Breite Umrandung der Seite berechnen 1619cdf0e10cSrcweir const SfxItemSet* _pSet = &GetItemSet(); 1620cdf0e10cSrcweir Size aBorder; 1621cdf0e10cSrcweir 1622cdf0e10cSrcweir if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >= 1623cdf0e10cSrcweir SFX_ITEM_AVAILABLE && 1624cdf0e10cSrcweir _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >= 1625cdf0e10cSrcweir SFX_ITEM_AVAILABLE ) 1626cdf0e10cSrcweir { 1627cdf0e10cSrcweir aBorder = ( GetMinBorderSpace_Impl( 1628cdf0e10cSrcweir (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)), 1629cdf0e10cSrcweir (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)))); 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir 1632cdf0e10cSrcweir long nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); 1633cdf0e10cSrcweir long nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); 1634cdf0e10cSrcweir 1635cdf0e10cSrcweir // Grenzen Papier 1636cdf0e10cSrcweir // Maximum liegt bei 54cm 1637cdf0e10cSrcweir // 1638cdf0e10cSrcweir long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB + 1639cdf0e10cSrcweir MINBODY + aBorder.Height(); 1640cdf0e10cSrcweir aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP); 1641cdf0e10cSrcweir 1642cdf0e10cSrcweir nMin = MINBODY + nBL + nBR + aBorder.Width(); 1643cdf0e10cSrcweir aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP); 1644cdf0e10cSrcweir 1645cdf0e10cSrcweir // Falls sich die Papiergr"o\se ge"adert hat 1646cdf0e10cSrcweir nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); 1647cdf0e10cSrcweir nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); 1648cdf0e10cSrcweir 1649cdf0e10cSrcweir // Top 1650cdf0e10cSrcweir long nMax = nH - nBB - aBorder.Height() - MINBODY - 1651cdf0e10cSrcweir nFDist - nFHeight - nHDist - nHHeight; 1652cdf0e10cSrcweir 1653cdf0e10cSrcweir aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); 1654cdf0e10cSrcweir 1655cdf0e10cSrcweir // Bottom 1656cdf0e10cSrcweir nMax = nH - nBT - aBorder.Height() - MINBODY - 1657cdf0e10cSrcweir nFDist - nFHeight - nHDist - nHHeight; 1658cdf0e10cSrcweir 1659cdf0e10cSrcweir aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); 1660cdf0e10cSrcweir 1661cdf0e10cSrcweir // Left 1662cdf0e10cSrcweir nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight; 1663cdf0e10cSrcweir aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir // Right 1666cdf0e10cSrcweir nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight; 1667cdf0e10cSrcweir aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP); 1668cdf0e10cSrcweir return 0; 1669cdf0e10cSrcweir } 1670cdf0e10cSrcweir 1671cdf0e10cSrcweir // ----------------------------------------------------------------------- 1672cdf0e10cSrcweir 1673cdf0e10cSrcweir void SvxPageDescPage::CalcMargin_Impl() 1674cdf0e10cSrcweir { 1675cdf0e10cSrcweir // Aktuelle Werte der Seitenr"ander 1676cdf0e10cSrcweir long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ); 1677cdf0e10cSrcweir long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ); 1678cdf0e10cSrcweir 1679cdf0e10cSrcweir long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ); 1680cdf0e10cSrcweir long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ); 1681cdf0e10cSrcweir 1682cdf0e10cSrcweir long nH = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ); 1683cdf0e10cSrcweir long nW = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ); 1684cdf0e10cSrcweir 1685cdf0e10cSrcweir long nWidth = nBL + nBR + MINBODY; 1686cdf0e10cSrcweir long nHeight = nBT + nBB + MINBODY; 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir if ( nWidth > nW || nHeight > nH ) 1689cdf0e10cSrcweir { 1690cdf0e10cSrcweir if ( nWidth > nW ) 1691cdf0e10cSrcweir { 1692cdf0e10cSrcweir long nTmp = nBL <= nBR ? nBR : nBL; 1693cdf0e10cSrcweir nTmp -= nWidth - nW; 1694cdf0e10cSrcweir 1695cdf0e10cSrcweir if ( nBL <= nBR ) 1696cdf0e10cSrcweir SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); 1697cdf0e10cSrcweir else 1698cdf0e10cSrcweir SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir if ( nHeight > nH ) 1702cdf0e10cSrcweir { 1703cdf0e10cSrcweir long nTmp = nBT <= nBB ? nBB : nBT; 1704cdf0e10cSrcweir nTmp -= nHeight - nH; 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir if ( nBT <= nBB ) 1707cdf0e10cSrcweir SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); 1708cdf0e10cSrcweir else 1709cdf0e10cSrcweir SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); 1710cdf0e10cSrcweir } 1711cdf0e10cSrcweir } 1712cdf0e10cSrcweir } 1713cdf0e10cSrcweir 1714cdf0e10cSrcweir // ----------------------------------------------------------------------- 1715cdf0e10cSrcweir 1716cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir aBspWin.SetHorz( aHorzBox.IsChecked() ); 1719cdf0e10cSrcweir aBspWin.SetVert( aVertBox.IsChecked() ); 1720cdf0e10cSrcweir UpdateExample_Impl(); 1721cdf0e10cSrcweir return 0; 1722cdf0e10cSrcweir } 1723cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) 1724cdf0e10cSrcweir 1725cdf0e10cSrcweir // ----------------------------------------------------------------------- 1726cdf0e10cSrcweir 1727cdf0e10cSrcweir void SvxPageDescPage::SetCollectionList(const List* pList) 1728cdf0e10cSrcweir { 1729cdf0e10cSrcweir sStandardRegister = *(String*)pList->GetObject(0); 1730cdf0e10cSrcweir for( sal_uInt16 i = 1; i < pList->Count(); i++ ) 1731cdf0e10cSrcweir { 1732cdf0e10cSrcweir aRegisterLB.InsertEntry(*(String*)pList->GetObject(i)); 1733cdf0e10cSrcweir } 1734cdf0e10cSrcweir 1735cdf0e10cSrcweir aRegisterCB .Show(); 1736cdf0e10cSrcweir aRegisterFT .Show(); 1737cdf0e10cSrcweir aRegisterLB.Show(); 1738cdf0e10cSrcweir aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify)); 1739cdf0e10cSrcweir } 1740cdf0e10cSrcweir 1741cdf0e10cSrcweir // ----------------------------------------------------------------------- 1742cdf0e10cSrcweir 1743cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox ) 1744cdf0e10cSrcweir { 1745cdf0e10cSrcweir sal_Bool bEnable = sal_False; 1746cdf0e10cSrcweir if(pBox->IsChecked()) 1747cdf0e10cSrcweir { 1748cdf0e10cSrcweir bEnable = sal_True; 1749cdf0e10cSrcweir if(USHRT_MAX == aRegisterLB.GetSelectEntryPos()) 1750cdf0e10cSrcweir aRegisterLB.SelectEntry(sStandardRegister); 1751cdf0e10cSrcweir } 1752cdf0e10cSrcweir aRegisterFT.Enable( bEnable ); 1753cdf0e10cSrcweir aRegisterLB.Enable( bEnable ); 1754cdf0e10cSrcweir return 0; 1755cdf0e10cSrcweir } 1756cdf0e10cSrcweir 1757cdf0e10cSrcweir // ---------------------------------------------------------------------------- 1758cdf0e10cSrcweir 1759cdf0e10cSrcweir void SvxPageDescPage::DisableVerticalPageDir() 1760cdf0e10cSrcweir { 1761cdf0e10cSrcweir aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT ); 1762cdf0e10cSrcweir aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT ); 1763cdf0e10cSrcweir if( aTextFlowBox.GetEntryCount() < 2 ) 1764cdf0e10cSrcweir { 1765cdf0e10cSrcweir aTextFlowLbl.Hide(); 1766cdf0e10cSrcweir aTextFlowBox.Hide(); 1767cdf0e10cSrcweir aBspWin.EnableFrameDirection( sal_False ); 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir } 1770cdf0e10cSrcweir 1771cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*, EMPTYARG) 1772cdf0e10cSrcweir { 1773cdf0e10cSrcweir aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() ); 1774cdf0e10cSrcweir aBspWin.Invalidate(); 1775cdf0e10cSrcweir return 0; 1776cdf0e10cSrcweir } 1777cdf0e10cSrcweir 1778cdf0e10cSrcweir bool SvxPageDescPage::IsPrinterRangeOverflow( 1779cdf0e10cSrcweir MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos ) 1780cdf0e10cSrcweir { 1781cdf0e10cSrcweir bool bRet = false; 1782*56b35d86SArmin Le Grand bool bCheck = ( ( m_nPos & nPos ) == 0 ); 1783cdf0e10cSrcweir long nValue = static_cast<long>(rField.GetValue()); 1784cdf0e10cSrcweir if ( bCheck && 1785cdf0e10cSrcweir ( nValue < nFirstMargin || nValue > nLastMargin ) && 1786cdf0e10cSrcweir rField.GetText() != rField.GetSavedValue() ) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin ); 1789cdf0e10cSrcweir bRet = true; 1790cdf0e10cSrcweir } 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir return bRet; 1793cdf0e10cSrcweir } 1794cdf0e10cSrcweir 1795cdf0e10cSrcweir /** Check if a value of a margin edit is outside the printer paper margins 1796cdf0e10cSrcweir and save this information. 1797cdf0e10cSrcweir */ 1798cdf0e10cSrcweir void SvxPageDescPage::CheckMarginEdits( bool _bClear ) 1799cdf0e10cSrcweir { 1800cdf0e10cSrcweir if ( _bClear ) 1801*56b35d86SArmin Le Grand m_nPos = 0; 1802cdf0e10cSrcweir 1803cdf0e10cSrcweir sal_Int64 nValue = aLeftMarginEdit.GetValue(); 1804cdf0e10cSrcweir if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin ) 1805*56b35d86SArmin Le Grand m_nPos |= MARGIN_LEFT; 1806cdf0e10cSrcweir nValue = aRightMarginEdit.GetValue(); 1807cdf0e10cSrcweir if ( nValue < nFirstRightMargin || nValue > nLastRightMargin ) 1808*56b35d86SArmin Le Grand m_nPos |= MARGIN_RIGHT; 1809cdf0e10cSrcweir nValue = aTopMarginEdit.GetValue(); 1810cdf0e10cSrcweir if ( nValue < nFirstTopMargin || nValue > nLastTopMargin ) 1811*56b35d86SArmin Le Grand m_nPos |= MARGIN_TOP; 1812cdf0e10cSrcweir nValue = aBottomMarginEdit.GetValue(); 1813cdf0e10cSrcweir if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin ) 1814*56b35d86SArmin Le Grand m_nPos |= MARGIN_BOTTOM; 1815cdf0e10cSrcweir } 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir bool SvxPageDescPage::IsMarginOutOfRange() 1818cdf0e10cSrcweir { 1819*56b35d86SArmin Le Grand bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) && 1820cdf0e10cSrcweir ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) && 1821cdf0e10cSrcweir ( aLeftMarginEdit.GetValue() < nFirstLeftMargin || 1822cdf0e10cSrcweir aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) || 1823*56b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_RIGHT ) && 1824cdf0e10cSrcweir ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) && 1825cdf0e10cSrcweir ( aRightMarginEdit.GetValue() < nFirstRightMargin || 1826cdf0e10cSrcweir aRightMarginEdit.GetValue() > nLastRightMargin ) ) || 1827*56b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_TOP ) && 1828cdf0e10cSrcweir ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) && 1829cdf0e10cSrcweir ( aTopMarginEdit.GetValue() < nFirstTopMargin || 1830cdf0e10cSrcweir aTopMarginEdit.GetValue() > nLastTopMargin ) ) || 1831*56b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_BOTTOM ) && 1832cdf0e10cSrcweir ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) && 1833cdf0e10cSrcweir ( aBottomMarginEdit.GetValue() < nFirstBottomMargin || 1834cdf0e10cSrcweir aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) ); 1835cdf0e10cSrcweir return bRet; 1836cdf0e10cSrcweir } 1837cdf0e10cSrcweir 1838*56b35d86SArmin Le Grand void SvxPageDescPage::PageCreated(SfxAllItemSet aSet) //add CHINA001 1839cdf0e10cSrcweir { 1840*56b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False); 1841*56b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False); 1842*56b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False); 1843*56b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False); 1844*56b35d86SArmin Le Grand 1845*56b35d86SArmin Le Grand //UUUU 1846*56b35d86SArmin Le Grand SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, sal_False); 1847*56b35d86SArmin Le Grand 1848*56b35d86SArmin Le Grand if(pModeItem) 1849*56b35d86SArmin Le Grand { 1850*56b35d86SArmin Le Grand SetMode((SvxModeType)pModeItem->GetEnumValue()); 1851*56b35d86SArmin Le Grand } 1852*56b35d86SArmin Le Grand 1853*56b35d86SArmin Le Grand if(pPaperStartItem && pPaperEndItem) 1854*56b35d86SArmin Le Grand { 1855*56b35d86SArmin Le Grand SetPaperFormatRanges((Paper)pPaperStartItem->GetEnumValue(),(Paper)pPaperEndItem->GetEnumValue()); 1856*56b35d86SArmin Le Grand } 1857*56b35d86SArmin Le Grand 1858*56b35d86SArmin Le Grand if(pCollectListItem) 1859*56b35d86SArmin Le Grand { 1860*56b35d86SArmin Le Grand SetCollectionList(pCollectListItem->GetList()); 1861*56b35d86SArmin Le Grand } 1862*56b35d86SArmin Le Grand 1863*56b35d86SArmin Le Grand if(pSupportDrawingLayerFillStyleItem) 1864*56b35d86SArmin Le Grand { 1865*56b35d86SArmin Le Grand const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue()); 1866*56b35d86SArmin Le Grand 1867*56b35d86SArmin Le Grand EnableDrawingLayerFillStyles(bNew); 1868*56b35d86SArmin Le Grand } 1869cdf0e10cSrcweir } 1870*56b35d86SArmin Le Grand 1871*56b35d86SArmin Le Grand //eof 1872