12ee96f1cSAndrew Rist /**************************************************************
2635e0213SMatthias Seidel *
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
10635e0213SMatthias Seidel *
112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12635e0213SMatthias Seidel *
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.
19635e0213SMatthias Seidel *
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
6656b35d86SArmin Le Grand
6756b35d86SArmin Le Grand //UUUU
6856b35d86SArmin Le Grand #include <svx/xdef.hxx>
6956b35d86SArmin Le Grand #include <svx/unobrushitemhelper.hxx>
7056b35d86SArmin 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. */
GetExportMode() const89cdf0e10cSrcweir inline sal_Int32 GetExportMode() const { return mnExpMode; }
90cdf0e10cSrcweir
91cdf0e10cSrcweir /** Returns true, if the current HTML export mode is set to HTML 3.2. */
IsExportModeHTML32() const92cdf0e10cSrcweir 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
SvxHtmlExportModeConfigItem_Impl()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
Commit()115cdf0e10cSrcweir void SvxHtmlExportModeConfigItem_Impl::Commit()
116cdf0e10cSrcweir {
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
Notify(const com::sun::star::uno::Sequence<rtl::OUString> &)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
PageUsageToPos_Impl(sal_uInt16 nUsage)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
PosToPageUsage_Impl(sal_uInt16 nPos)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
GetMinBorderSpace_Impl(const SvxShadowItem & rShadow,const SvxBoxItem & rBox)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
ConvertLong_Impl(const long nIn,SfxMapUnit eUnit)187cdf0e10cSrcweir long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP );
190cdf0e10cSrcweir }
191cdf0e10cSrcweir
IsEqualSize_Impl(const SvxSizeItem * pSize,const Size & rSize)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
21256b35d86SArmin Le Grand //UUUU
21356b35d86SArmin Le Grand //struct SvxPage_Impl
21456b35d86SArmin Le Grand //{
21556b35d86SArmin Le Grand // MarginPosition m_nPos;
21656b35d86SArmin Le Grand // Printer* mpDefPrinter;
21756b35d86SArmin Le Grand // bool mbDelPrinter;
21856b35d86SArmin Le Grand //
21956b35d86SArmin Le Grand // SvxPage_Impl() :
22056b35d86SArmin Le Grand // m_nPos( 0 ),
22156b35d86SArmin Le Grand // mpDefPrinter( 0 ),
22256b35d86SArmin Le Grand // mbDelPrinter( false ) {}
22356b35d86SArmin Le Grand //
22456b35d86SArmin Le Grand // ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; }
22556b35d86SArmin Le Grand //};
226cdf0e10cSrcweir
227cdf0e10cSrcweir // class SvxPageDescPage --------------------------------------------------
228cdf0e10cSrcweir
2292e03cc80SMatthias Seidel // gibt den Bereich der Which-Werte zurück
230cdf0e10cSrcweir
GetRanges()231cdf0e10cSrcweir sal_uInt16* SvxPageDescPage::GetRanges()
232cdf0e10cSrcweir {
233cdf0e10cSrcweir return pRanges;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
236cdf0e10cSrcweir // -----------------------------------------------------------------------
237cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rSet)238cdf0e10cSrcweir SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir return new SvxPageDescPage( pParent, rSet );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir
243cdf0e10cSrcweir // -----------------------------------------------------------------------
244cdf0e10cSrcweir
SvxPageDescPage(Window * pParent,const SfxItemSet & rAttr)2452e03cc80SMatthias Seidel SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr )
24656b35d86SArmin 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
29456b35d86SArmin Le Grand //UUUU
29556b35d86SArmin Le Grand // pImpl ( new SvxPage_Impl ),
29656b35d86SArmin Le Grand
29756b35d86SArmin Le Grand //UUUU
29856b35d86SArmin Le Grand m_nPos( 0 ),
29956b35d86SArmin Le Grand mpDefPrinter( 0 ),
30056b35d86SArmin Le Grand mbDelPrinter( false ),
30156b35d86SArmin Le Grand
30256b35d86SArmin Le Grand //UUUU
30356b35d86SArmin 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() )
36356b35d86SArmin Le Grand {
36456b35d86SArmin Le Grand mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter();
36556b35d86SArmin Le Grand }
366cdf0e10cSrcweir else
367cdf0e10cSrcweir {
36856b35d86SArmin Le Grand mpDefPrinter = new Printer;
36956b35d86SArmin Le Grand mbDelPrinter = true;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir
37256b35d86SArmin Le Grand MapMode aOldMode = mpDefPrinter->GetMapMode();
37356b35d86SArmin Le Grand mpDefPrinter->SetMapMode( MAP_TWIP );
374cdf0e10cSrcweir
3752e03cc80SMatthias Seidel // First- und Last-Werte für die Ränder setzen
37656b35d86SArmin Le Grand Size aPaperSize = mpDefPrinter->GetPaperSize();
37756b35d86SArmin 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 */
38356b35d86SArmin Le Grand Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
38456b35d86SArmin 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);
431635e0213SMatthias Seidel aLandscapeBtn.SetAccessibleRelationMemberOf(&aOrientationFT);
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
434cdf0e10cSrcweir // -----------------------------------------------------------------------
435cdf0e10cSrcweir
~SvxPageDescPage()436cdf0e10cSrcweir SvxPageDescPage::~SvxPageDescPage()
437cdf0e10cSrcweir {
4382e03cc80SMatthias Seidel if(mbDelPrinter)
43956b35d86SArmin Le Grand {
44056b35d86SArmin Le Grand delete mpDefPrinter;
44156b35d86SArmin Le Grand }
442cdf0e10cSrcweir }
443cdf0e10cSrcweir
444cdf0e10cSrcweir // -----------------------------------------------------------------------
445cdf0e10cSrcweir
Init_Impl()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
Reset(const SfxItemSet & rSet)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
4952e03cc80SMatthias Seidel // Ränder (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
5092e03cc80SMatthias Seidel // Ränder (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;
52556b35d86SArmin 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
55456b35d86SArmin 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
56356b35d86SArmin 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
57056b35d86SArmin 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 =
57756b35d86SArmin 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
6912e03cc80SMatthias Seidel // Ränder 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
FillUserData()745cdf0e10cSrcweir void SvxPageDescPage::FillUserData()
746cdf0e10cSrcweir {
747cdf0e10cSrcweir if ( SVX_PAGE_MODE_PRESENTATION == eMode )
748cdf0e10cSrcweir SetUserData( UniString::CreateFromInt32( (sal_Int32)aAdaptBox.IsChecked() ) );
749cdf0e10cSrcweir }
750cdf0e10cSrcweir
751cdf0e10cSrcweir // -----------------------------------------------------------------------
752cdf0e10cSrcweir
FillItemSet(SfxItemSet & rSet)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
7662e03cc80SMatthias Seidel // 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
IMPL_LINK(SvxPageDescPage,LayoutHdl_Impl,ListBox *,EMPTYARG)979cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, LayoutHdl_Impl, ListBox *, EMPTYARG )
980cdf0e10cSrcweir {
9812e03cc80SMatthias Seidel // Innen/Außen 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
IMPL_LINK(SvxPageDescPage,PaperBinHdl_Impl,ListBox *,EMPTYARG)1006cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG )
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir if ( aPaperTrayBox.GetEntryCount() > 1 )
10092e03cc80SMatthias Seidel // schon gefüllt
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 ) );
102156b35d86SArmin Le Grand sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount();
1022cdf0e10cSrcweir
1023cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nBinCount; ++i )
1024cdf0e10cSrcweir {
102556b35d86SArmin 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
IMPL_LINK(SvxPageDescPage,PaperSizeSelect_Impl,ListBox *,pBox)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
10652e03cc80SMatthias Seidel // Ränder 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;
1075635e0213SMatthias Seidel sal_Bool bScreen = ( PAPER_SCREEN_4_BY_3 == ePaper ) ||
1076635e0213SMatthias Seidel ( PAPER_SCREEN_16_BY_9 == ePaper ) ||
1077635e0213SMatthias Seidel ( PAPER_SCREEN_16_BY_10 == ePaper );
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir if ( !bScreen )
1080cdf0e10cSrcweir // bei Bildschirm keinen Rand
1081cdf0e10cSrcweir nTmp = 1; // entspr. 1cm
1082cdf0e10cSrcweir
10832e03cc80SMatthias Seidel // Abfragen, ob für Ränder 0 gesetzt ist:
1084cdf0e10cSrcweir if ( bScreen || aRightMarginEdit.GetValue() == 0 )
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM );
1087cdf0e10cSrcweir if ( !bScreen &&
1088cdf0e10cSrcweir aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() )
1089cdf0e10cSrcweir aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() );
1090cdf0e10cSrcweir }
1091cdf0e10cSrcweir if ( bScreen || aLeftMarginEdit.GetValue() == 0 )
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM );
1094cdf0e10cSrcweir if ( !bScreen &&
1095cdf0e10cSrcweir aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() )
1096cdf0e10cSrcweir aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() );
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir if ( bScreen || aBottomMarginEdit.GetValue() == 0 )
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM );
1101cdf0e10cSrcweir if ( !bScreen &&
1102cdf0e10cSrcweir aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() )
1103cdf0e10cSrcweir aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() );
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir if ( bScreen || aTopMarginEdit.GetValue() == 0 )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM );
1108cdf0e10cSrcweir if ( !bScreen &&
1109cdf0e10cSrcweir aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() )
1110cdf0e10cSrcweir aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() );
1111cdf0e10cSrcweir }
1112cdf0e10cSrcweir UpdateExample_Impl( true );
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir return 0;
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir
1118cdf0e10cSrcweir // -----------------------------------------------------------------------
1119cdf0e10cSrcweir
IMPL_LINK(SvxPageDescPage,PaperSizeModify_Impl,Edit *,EMPTYARG)1120cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG )
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE );
1123cdf0e10cSrcweir SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
1124cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
1125cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, eUnit ) );
1126cdf0e10cSrcweir Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, sal_True );
1127cdf0e10cSrcweir sal_uInt16 nEntryCount = aPaperSizeBox.GetEntryCount();
1128cdf0e10cSrcweir
1129cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nEntryCount; ++i )
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir Paper eTmp = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData(i);
1132cdf0e10cSrcweir
1133cdf0e10cSrcweir if ( eTmp == ePaper )
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir aPaperSizeBox.SelectEntryPos(i);
1136cdf0e10cSrcweir break;
1137cdf0e10cSrcweir }
1138cdf0e10cSrcweir }
1139cdf0e10cSrcweir UpdateExample_Impl( true );
1140cdf0e10cSrcweir return 0;
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir // -----------------------------------------------------------------------
1144cdf0e10cSrcweir
IMPL_LINK(SvxPageDescPage,SwapOrientation_Impl,RadioButton *,pBtn)1145cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn )
1146cdf0e10cSrcweir {
1147cdf0e10cSrcweir if (
1148cdf0e10cSrcweir (!bLandscape && pBtn == &aLandscapeBtn) ||
1149cdf0e10cSrcweir (bLandscape && pBtn == &aPortraitBtn)
1150cdf0e10cSrcweir )
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir bLandscape = aLandscapeBtn.IsChecked();
1153cdf0e10cSrcweir
1154cdf0e10cSrcweir const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM );
1155cdf0e10cSrcweir const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM );
1156cdf0e10cSrcweir
1157*32698fccSmseidel // swap width and height
1158cdf0e10cSrcweir SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM );
1159cdf0e10cSrcweir SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM );
1160cdf0e10cSrcweir
1161cdf0e10cSrcweir // recalculate margins if necessary
1162cdf0e10cSrcweir CalcMargin_Impl();
1163cdf0e10cSrcweir
1164cdf0e10cSrcweir PaperSizeSelect_Impl( &aPaperSizeBox );
1165cdf0e10cSrcweir RangeHdl_Impl( 0 );
1166cdf0e10cSrcweir SwapFirstValues_Impl( bBorderModified );
1167cdf0e10cSrcweir UpdateExample_Impl( true );
1168cdf0e10cSrcweir }
1169cdf0e10cSrcweir return 0;
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir // -----------------------------------------------------------------------
1173cdf0e10cSrcweir
SwapFirstValues_Impl(FASTBOOL bSet)1174cdf0e10cSrcweir void SvxPageDescPage::SwapFirstValues_Impl( FASTBOOL bSet )
1175cdf0e10cSrcweir {
117656b35d86SArmin Le Grand MapMode aOldMode = mpDefPrinter->GetMapMode();
1177cdf0e10cSrcweir Orientation eOri = ORIENTATION_PORTRAIT;
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir if ( bLandscape )
1180cdf0e10cSrcweir eOri = ORIENTATION_LANDSCAPE;
118156b35d86SArmin Le Grand Orientation eOldOri = mpDefPrinter->GetOrientation();
118256b35d86SArmin Le Grand mpDefPrinter->SetOrientation( eOri );
118356b35d86SArmin Le Grand mpDefPrinter->SetMapMode( MAP_TWIP );
1184cdf0e10cSrcweir
11852e03cc80SMatthias Seidel // First- und Last-Werte für die Ränder setzen
118656b35d86SArmin Le Grand Size aPaperSize = mpDefPrinter->GetPaperSize();
118756b35d86SArmin Le Grand Size aPrintSize = mpDefPrinter->GetOutputSize();
1188cdf0e10cSrcweir /*
1189cdf0e10cSrcweir * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren,
1190cdf0e10cSrcweir * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des
1191cdf0e10cSrcweir * Koordinatensystems verschoben ist.
1192cdf0e10cSrcweir */
119356b35d86SArmin Le Grand Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() );
119456b35d86SArmin Le Grand mpDefPrinter->SetMapMode( aOldMode );
119556b35d86SArmin Le Grand mpDefPrinter->SetOrientation( eOldOri );
1196cdf0e10cSrcweir
1197cdf0e10cSrcweir sal_Int64 nSetL = aLeftMarginEdit.Denormalize(
1198cdf0e10cSrcweir aLeftMarginEdit.GetValue( FUNIT_TWIP ) );
1199cdf0e10cSrcweir sal_Int64 nSetR = aRightMarginEdit.Denormalize(
1200cdf0e10cSrcweir aRightMarginEdit.GetValue( FUNIT_TWIP ) );
1201cdf0e10cSrcweir sal_Int64 nSetT = aTopMarginEdit.Denormalize(
1202cdf0e10cSrcweir aTopMarginEdit.GetValue( FUNIT_TWIP ) );
1203cdf0e10cSrcweir sal_Int64 nSetB = aBottomMarginEdit.Denormalize(
1204cdf0e10cSrcweir aBottomMarginEdit.GetValue( FUNIT_TWIP ) );
1205cdf0e10cSrcweir
1206cdf0e10cSrcweir long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET;
1207cdf0e10cSrcweir long nNewL = aPrintOffset.X();
1208cdf0e10cSrcweir long nNewR =
1209cdf0e10cSrcweir aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset;
1210cdf0e10cSrcweir long nNewT = aPrintOffset.Y();
1211cdf0e10cSrcweir long nNewB =
1212cdf0e10cSrcweir aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset;
1213cdf0e10cSrcweir
1214cdf0e10cSrcweir aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP );
1215cdf0e10cSrcweir nFirstLeftMargin = static_cast<long>(aLeftMarginEdit.GetFirst());
1216cdf0e10cSrcweir aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP );
1217cdf0e10cSrcweir nFirstRightMargin = static_cast<long>(aRightMarginEdit.GetFirst());
1218cdf0e10cSrcweir aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP );
1219cdf0e10cSrcweir nFirstTopMargin = static_cast<long>(aTopMarginEdit.GetFirst());
1220cdf0e10cSrcweir aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP );
1221cdf0e10cSrcweir nFirstBottomMargin = static_cast<long>(aBottomMarginEdit.GetFirst());
1222cdf0e10cSrcweir
1223cdf0e10cSrcweir if ( bSet )
1224cdf0e10cSrcweir {
1225cdf0e10cSrcweir // ggf. auch die Werte umsetzen,
1226cdf0e10cSrcweir if ( nSetL < nNewL )
1227cdf0e10cSrcweir aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ),
1228cdf0e10cSrcweir FUNIT_TWIP );
1229cdf0e10cSrcweir if ( nSetR < nNewR )
1230cdf0e10cSrcweir aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ),
1231cdf0e10cSrcweir FUNIT_TWIP );
1232cdf0e10cSrcweir if ( nSetT < nNewT )
1233cdf0e10cSrcweir aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ),
1234cdf0e10cSrcweir FUNIT_TWIP );
1235cdf0e10cSrcweir if ( nSetB < nNewB )
1236cdf0e10cSrcweir aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ),
1237cdf0e10cSrcweir FUNIT_TWIP );
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir }
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir // -----------------------------------------------------------------------
1242cdf0e10cSrcweir
IMPL_LINK_INLINE_START(SvxPageDescPage,BorderModify_Impl,MetricField *,EMPTYARG)1243cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG )
1244cdf0e10cSrcweir {
1245cdf0e10cSrcweir if ( !bBorderModified )
1246cdf0e10cSrcweir bBorderModified = sal_True;
1247cdf0e10cSrcweir UpdateExample_Impl();
1248cdf0e10cSrcweir return 0;
1249cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxPageDescPage,BorderModify_Impl,MetricField *,EMPTYARG)1250cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG )
1251cdf0e10cSrcweir
1252cdf0e10cSrcweir // -----------------------------------------------------------------------
1253cdf0e10cSrcweir
1254cdf0e10cSrcweir void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground )
1255cdf0e10cSrcweir {
1256cdf0e10cSrcweir // Size
1257cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ),
1258cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) );
1259cdf0e10cSrcweir
1260cdf0e10cSrcweir aBspWin.SetSize( aSize );
1261cdf0e10cSrcweir
12622e03cc80SMatthias Seidel // Ränder
1263cdf0e10cSrcweir aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) );
1264cdf0e10cSrcweir aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) );
1265cdf0e10cSrcweir aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) );
1266cdf0e10cSrcweir aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) );
1267cdf0e10cSrcweir
1268cdf0e10cSrcweir // Layout
1269cdf0e10cSrcweir aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) );
1270cdf0e10cSrcweir if ( bResetbackground )
1271cdf0e10cSrcweir aBspWin.ResetBackground();
1272cdf0e10cSrcweir aBspWin.Invalidate();
1273cdf0e10cSrcweir }
1274cdf0e10cSrcweir
1275cdf0e10cSrcweir // -----------------------------------------------------------------------
1276cdf0e10cSrcweir
ResetBackground_Impl(const SfxItemSet & rSet)127756b35d86SArmin Le Grand void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet)
1278cdf0e10cSrcweir {
127956b35d86SArmin Le Grand sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
1280cdf0e10cSrcweir
128156b35d86SArmin Le Grand if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
128256b35d86SArmin Le Grand {
128356b35d86SArmin Le Grand const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
128456b35d86SArmin Le Grand const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
128556b35d86SArmin Le Grand const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1286cdf0e10cSrcweir
128756b35d86SArmin Le Grand if(rOn.GetValue())
128856b35d86SArmin Le Grand {
128956b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;
129056b35d86SArmin Le Grand
129156b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles)
129256b35d86SArmin Le Grand {
129356b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
129456b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
129556b35d86SArmin Le Grand }
129656b35d86SArmin Le Grand else
129756b35d86SArmin Le Grand {
129856b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BRUSH);
129956b35d86SArmin Le Grand
130056b35d86SArmin Le Grand if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
130156b35d86SArmin Le Grand {
130256b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem
130356b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
130456b35d86SArmin Le Grand SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
130556b35d86SArmin Le Grand
130656b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
130756b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
130856b35d86SArmin Le Grand }
130956b35d86SArmin Le Grand }
131056b35d86SArmin Le Grand
131156b35d86SArmin Le Grand aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
131256b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
131356b35d86SArmin Le Grand
131456b35d86SArmin Le Grand if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
131556b35d86SArmin Le Grand {
131656b35d86SArmin Le Grand const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
131756b35d86SArmin Le Grand aBspWin.SetHdBorder(rItem);
131856b35d86SArmin Le Grand }
131956b35d86SArmin Le Grand }
132056b35d86SArmin Le Grand }
1321cdf0e10cSrcweir
132256b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
1323cdf0e10cSrcweir
132456b35d86SArmin Le Grand if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
132556b35d86SArmin Le Grand {
132656b35d86SArmin Le Grand const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,sal_False));
132756b35d86SArmin Le Grand const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
132856b35d86SArmin Le Grand const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
1329cdf0e10cSrcweir
133056b35d86SArmin Le Grand if(rOn.GetValue())
133156b35d86SArmin Le Grand {
133256b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;
133356b35d86SArmin Le Grand
133456b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles)
133556b35d86SArmin Le Grand {
133656b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
133756b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
133856b35d86SArmin Le Grand }
133956b35d86SArmin Le Grand else
134056b35d86SArmin Le Grand {
134156b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BRUSH);
134256b35d86SArmin Le Grand
134356b35d86SArmin Le Grand if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
134456b35d86SArmin Le Grand {
134556b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem
134656b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
134756b35d86SArmin Le Grand SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
134856b35d86SArmin Le Grand
134956b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
135056b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
135156b35d86SArmin Le Grand }
135256b35d86SArmin Le Grand }
135356b35d86SArmin Le Grand
135456b35d86SArmin Le Grand aBspWin.setFooterFillAttributes(aFooterFillAttributes);
135556b35d86SArmin Le Grand nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
135656b35d86SArmin Le Grand
135756b35d86SArmin Le Grand if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
135856b35d86SArmin Le Grand {
135956b35d86SArmin Le Grand const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
136056b35d86SArmin Le Grand aBspWin.SetFtBorder(rItem);
136156b35d86SArmin Le Grand }
136256b35d86SArmin Le Grand }
136356b35d86SArmin Le Grand }
1364cdf0e10cSrcweir
136556b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
136656b35d86SArmin Le Grand const SfxPoolItem* pItem = 0;
1367cdf0e10cSrcweir
136856b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles)
136956b35d86SArmin Le Grand {
137056b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
137156b35d86SArmin Le Grand aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
137256b35d86SArmin Le Grand }
137356b35d86SArmin Le Grand else
137456b35d86SArmin Le Grand {
137556b35d86SArmin Le Grand pItem = GetItem(rSet, SID_ATTR_BRUSH);
1376cdf0e10cSrcweir
137756b35d86SArmin Le Grand if(pItem)
137856b35d86SArmin Le Grand {
137956b35d86SArmin Le Grand //UUUU create FillAttributes from SvxBrushItem
138056b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem);
138156b35d86SArmin Le Grand SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
1382cdf0e10cSrcweir
138356b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
138456b35d86SArmin Le Grand aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
138556b35d86SArmin Le Grand }
138656b35d86SArmin Le Grand }
1387cdf0e10cSrcweir
138856b35d86SArmin Le Grand aBspWin.setPageFillAttributes(aPageFillAttributes);
138956b35d86SArmin Le Grand pItem = GetItem(rSet, SID_ATTR_BORDER_OUTER);
1390cdf0e10cSrcweir
139156b35d86SArmin Le Grand if(pItem)
139256b35d86SArmin Le Grand {
139356b35d86SArmin Le Grand aBspWin.SetBorder(static_cast< const SvxBoxItem& >(*pItem));
139456b35d86SArmin Le Grand }
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir
1397cdf0e10cSrcweir // -----------------------------------------------------------------------
1398cdf0e10cSrcweir
InitHeadFoot_Impl(const SfxItemSet & rSet)1399cdf0e10cSrcweir void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
1400cdf0e10cSrcweir {
1401cdf0e10cSrcweir bLandscape = aLandscapeBtn.IsChecked();
1402cdf0e10cSrcweir const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
1403cdf0e10cSrcweir
1404cdf0e10cSrcweir if ( pItem )
1405cdf0e10cSrcweir aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() );
1406cdf0e10cSrcweir
1407cdf0e10cSrcweir const SvxSetItem* pSetItem = 0;
1408cdf0e10cSrcweir
1409cdf0e10cSrcweir // Kopfzeilen-Attribute auswerten
1410cdf0e10cSrcweir
1411cdf0e10cSrcweir if ( SFX_ITEM_SET ==
1412cdf0e10cSrcweir rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
1413cdf0e10cSrcweir sal_False, (const SfxPoolItem**)&pSetItem ) )
1414cdf0e10cSrcweir {
1415cdf0e10cSrcweir const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
1416cdf0e10cSrcweir const SfxBoolItem& rHeaderOn =
1417cdf0e10cSrcweir (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir if ( rHeaderOn.GetValue() )
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir const SvxSizeItem& rSize = (const SvxSizeItem&)
1422cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
1423cdf0e10cSrcweir const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
1424cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
1425cdf0e10cSrcweir long nDist = rUL.GetLower();
1426cdf0e10cSrcweir aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
1427cdf0e10cSrcweir aBspWin.SetHdDist( nDist );
1428cdf0e10cSrcweir const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
1429cdf0e10cSrcweir rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
1430cdf0e10cSrcweir aBspWin.SetHdLeft( rLR.GetLeft() );
1431cdf0e10cSrcweir aBspWin.SetHdRight( rLR.GetRight() );
1432cdf0e10cSrcweir aBspWin.SetHeader( sal_True );
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir else
1435cdf0e10cSrcweir aBspWin.SetHeader( sal_False );
1436cdf0e10cSrcweir
143756b35d86SArmin Le Grand // im Beispiel Hintergrund und Umrandung anzeigen
143856b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;
1439cdf0e10cSrcweir
144056b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles)
144156b35d86SArmin Le Grand {
144256b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
144356b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet));
144456b35d86SArmin Le Grand }
144556b35d86SArmin Le Grand else
144656b35d86SArmin Le Grand {
144756b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
144856b35d86SArmin Le Grand
144956b35d86SArmin Le Grand if(rHeaderSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
145056b35d86SArmin Le Grand {
145156b35d86SArmin Le Grand //UUUU aBspWin.SetHdColor(rItem.GetColor());
145256b35d86SArmin Le Grand const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich));
145356b35d86SArmin Le Grand SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
145456b35d86SArmin Le Grand
145556b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
145656b35d86SArmin Le Grand aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
145756b35d86SArmin Le Grand }
145856b35d86SArmin Le Grand }
145956b35d86SArmin Le Grand
146056b35d86SArmin Le Grand aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
146156b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER));
1462cdf0e10cSrcweir
1463cdf0e10cSrcweir if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
1464cdf0e10cSrcweir {
1465cdf0e10cSrcweir const SvxBoxItem& rItem =
1466cdf0e10cSrcweir (const SvxBoxItem&)rHeaderSet.Get( nWhich );
1467cdf0e10cSrcweir aBspWin.SetHdBorder( rItem );
1468cdf0e10cSrcweir }
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir
1471cdf0e10cSrcweir // Fusszeilen-Attribute auswerten
1472cdf0e10cSrcweir
1473cdf0e10cSrcweir if ( SFX_ITEM_SET ==
1474cdf0e10cSrcweir rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
1475cdf0e10cSrcweir sal_False, (const SfxPoolItem**)&pSetItem ) )
1476cdf0e10cSrcweir {
1477cdf0e10cSrcweir const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
1478cdf0e10cSrcweir const SfxBoolItem& rFooterOn =
1479cdf0e10cSrcweir (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
1480cdf0e10cSrcweir
1481cdf0e10cSrcweir if ( rFooterOn.GetValue() )
1482cdf0e10cSrcweir {
1483cdf0e10cSrcweir const SvxSizeItem& rSize = (const SvxSizeItem&)
1484cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
1485cdf0e10cSrcweir const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
1486cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
1487cdf0e10cSrcweir long nDist = rUL.GetUpper();
1488cdf0e10cSrcweir aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
1489cdf0e10cSrcweir aBspWin.SetFtDist( nDist );
1490cdf0e10cSrcweir const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
1491cdf0e10cSrcweir rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
1492cdf0e10cSrcweir aBspWin.SetFtLeft( rLR.GetLeft() );
1493cdf0e10cSrcweir aBspWin.SetFtRight( rLR.GetRight() );
1494cdf0e10cSrcweir aBspWin.SetFooter( sal_True );
1495cdf0e10cSrcweir }
1496cdf0e10cSrcweir else
1497cdf0e10cSrcweir aBspWin.SetFooter( sal_False );
1498cdf0e10cSrcweir
149956b35d86SArmin Le Grand // im Beispiel Hintergrund und Umrandung anzeigen
150056b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;
1501cdf0e10cSrcweir
150256b35d86SArmin Le Grand if(mbEnableDrawingLayerFillStyles)
150356b35d86SArmin Le Grand {
150456b35d86SArmin Le Grand //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
150556b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet));
150656b35d86SArmin Le Grand }
150756b35d86SArmin Le Grand else
150856b35d86SArmin Le Grand {
150956b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH));
151056b35d86SArmin Le Grand
151156b35d86SArmin Le Grand if(rFooterSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
151256b35d86SArmin Le Grand {
151356b35d86SArmin Le Grand //UUUU aBspWin.SetFtColor(rItem.GetColor());
151456b35d86SArmin Le Grand const SvxBrushItem& rItem = (const SvxBrushItem&)rFooterSet.Get(nWhich);
151556b35d86SArmin Le Grand SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
151656b35d86SArmin Le Grand
151756b35d86SArmin Le Grand setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
151856b35d86SArmin Le Grand aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
151956b35d86SArmin Le Grand }
152056b35d86SArmin Le Grand }
152156b35d86SArmin Le Grand
152256b35d86SArmin Le Grand aBspWin.setFooterFillAttributes(aFooterFillAttributes);
152356b35d86SArmin Le Grand const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER));
1524cdf0e10cSrcweir
1525cdf0e10cSrcweir if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
1526cdf0e10cSrcweir {
1527cdf0e10cSrcweir const SvxBoxItem& rItem =
1528cdf0e10cSrcweir (const SvxBoxItem&)rFooterSet.Get( nWhich );
1529cdf0e10cSrcweir aBspWin.SetFtBorder( rItem );
1530cdf0e10cSrcweir }
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir }
1533cdf0e10cSrcweir
1534cdf0e10cSrcweir // -----------------------------------------------------------------------
1535cdf0e10cSrcweir
ActivatePage(const SfxItemSet & rSet)1536cdf0e10cSrcweir void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet )
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir InitHeadFoot_Impl( rSet );
153972febba8STsutomu Uchino UpdateExample_Impl();
1540cdf0e10cSrcweir ResetBackground_Impl( rSet );
1541cdf0e10cSrcweir RangeHdl_Impl( 0 );
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir
1544cdf0e10cSrcweir // -----------------------------------------------------------------------
1545cdf0e10cSrcweir
DeactivatePage(SfxItemSet * _pSet)1546cdf0e10cSrcweir int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet )
1547cdf0e10cSrcweir {
15482e03cc80SMatthias Seidel // Abfrage, ob die Seitenränder ausserhalb des Druckbereichs liegen
15492e03cc80SMatthias Seidel // Wenn nicht, dann den Anwender fragen, ob sie übernommen werden sollen.
1550cdf0e10cSrcweir // Wenn nicht, dann auf der TabPage bleiben.
1551cdf0e10cSrcweir sal_uInt16 nPos = aPaperSizeBox.GetSelectEntryPos();
1552cdf0e10cSrcweir Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos );
1553cdf0e10cSrcweir
1554635e0213SMatthias Seidel if ( ePaper != PAPER_SCREEN_4_BY_3 && IsMarginOutOfRange() ||
1555635e0213SMatthias Seidel ePaper != PAPER_SCREEN_16_BY_9 && IsMarginOutOfRange() ||
1556635e0213SMatthias Seidel ePaper != PAPER_SCREEN_16_BY_10 && IsMarginOutOfRange() )
1557cdf0e10cSrcweir {
1558cdf0e10cSrcweir if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO )
1559cdf0e10cSrcweir {
1560cdf0e10cSrcweir MetricField* pField = NULL;
1561cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) )
1562cdf0e10cSrcweir pField = &aLeftMarginEdit;
1563cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT )
1564cdf0e10cSrcweir && !pField )
1565cdf0e10cSrcweir pField = &aRightMarginEdit;
1566cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP )
1567cdf0e10cSrcweir && !pField )
1568cdf0e10cSrcweir pField = &aTopMarginEdit;
1569cdf0e10cSrcweir if ( IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM )
1570cdf0e10cSrcweir && !pField )
1571cdf0e10cSrcweir pField = &aBottomMarginEdit;
1572cdf0e10cSrcweir if ( pField )
1573cdf0e10cSrcweir pField->GrabFocus();
1574cdf0e10cSrcweir UpdateExample_Impl();
1575cdf0e10cSrcweir return KEEP_PAGE;
1576cdf0e10cSrcweir }
1577cdf0e10cSrcweir else
1578cdf0e10cSrcweir CheckMarginEdits( false );
1579cdf0e10cSrcweir }
1580cdf0e10cSrcweir
1581cdf0e10cSrcweir if ( _pSet )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir FillItemSet( *_pSet );
1584cdf0e10cSrcweir
1585cdf0e10cSrcweir // ggf. hoch/quer putten
1586cdf0e10cSrcweir sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE );
1587cdf0e10cSrcweir SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh );
1588cdf0e10cSrcweir Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ),
1589cdf0e10cSrcweir GetCoreValue( aPaperHeightEdit, eUnit ) );
1590cdf0e10cSrcweir
15912e03cc80SMatthias Seidel // putten, wenn aktuelle Größe unterschiedlich zum Wert in _pSet
1592cdf0e10cSrcweir const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE );
1593cdf0e10cSrcweir if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) )
1594cdf0e10cSrcweir _pSet->Put( SvxSizeItem( nWh, aSize ) );
1595cdf0e10cSrcweir }
1596cdf0e10cSrcweir
1597cdf0e10cSrcweir return LEAVE_PAGE;
1598cdf0e10cSrcweir }
1599cdf0e10cSrcweir
1600cdf0e10cSrcweir // -----------------------------------------------------------------------
1601cdf0e10cSrcweir
IMPL_LINK(SvxPageDescPage,RangeHdl_Impl,Edit *,EMPTYARG)1602cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, RangeHdl_Impl, Edit *, EMPTYARG )
1603cdf0e10cSrcweir {
16042e03cc80SMatthias Seidel // Aktuelle Header-Breite/Höhe aus dem Bsp
1605cdf0e10cSrcweir long nHHeight = aBspWin.GetHdHeight();
1606cdf0e10cSrcweir long nHDist = aBspWin.GetHdDist();
1607cdf0e10cSrcweir
16082e03cc80SMatthias Seidel // Aktuelle Footer-Breite/Höhe aus dem Bsp
1609cdf0e10cSrcweir long nFHeight = aBspWin.GetFtHeight();
1610cdf0e10cSrcweir long nFDist = aBspWin.GetFtDist();
1611cdf0e10cSrcweir
16122e03cc80SMatthias Seidel // Aktuelle Header/Footer-Ränder aus dem Bsp
1613cdf0e10cSrcweir long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() );
1614cdf0e10cSrcweir long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() );
1615cdf0e10cSrcweir
16162e03cc80SMatthias Seidel // Aktuelle Werte der Seitenränder
1617cdf0e10cSrcweir long nBT = static_cast<long>(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP)));
1618cdf0e10cSrcweir long nBB = static_cast<long>(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP)));
1619cdf0e10cSrcweir long nBL = static_cast<long>(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP)));
1620cdf0e10cSrcweir long nBR = static_cast<long>(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP)));
1621cdf0e10cSrcweir
1622cdf0e10cSrcweir // Breite Umrandung der Seite berechnen
1623cdf0e10cSrcweir const SfxItemSet* _pSet = &GetItemSet();
1624cdf0e10cSrcweir Size aBorder;
1625cdf0e10cSrcweir
1626cdf0e10cSrcweir if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >=
1627cdf0e10cSrcweir SFX_ITEM_AVAILABLE &&
1628cdf0e10cSrcweir _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >=
1629cdf0e10cSrcweir SFX_ITEM_AVAILABLE )
1630cdf0e10cSrcweir {
1631cdf0e10cSrcweir aBorder = ( GetMinBorderSpace_Impl(
1632cdf0e10cSrcweir (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
1633cdf0e10cSrcweir (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
1634cdf0e10cSrcweir }
1635cdf0e10cSrcweir
1636cdf0e10cSrcweir long nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
1637cdf0e10cSrcweir long nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
1638cdf0e10cSrcweir
1639cdf0e10cSrcweir // Grenzen Papier
1640cdf0e10cSrcweir // Maximum liegt bei 54cm
1641cdf0e10cSrcweir //
1642cdf0e10cSrcweir long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB +
1643cdf0e10cSrcweir MINBODY + aBorder.Height();
1644cdf0e10cSrcweir aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP);
1645cdf0e10cSrcweir
1646cdf0e10cSrcweir nMin = MINBODY + nBL + nBR + aBorder.Width();
1647cdf0e10cSrcweir aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP);
1648cdf0e10cSrcweir
16492e03cc80SMatthias Seidel // Falls sich die Papiergröße geändert hat
1650cdf0e10cSrcweir nH = static_cast<long>(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP)));
1651cdf0e10cSrcweir nW = static_cast<long>(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP)));
1652cdf0e10cSrcweir
1653cdf0e10cSrcweir // Top
1654cdf0e10cSrcweir long nMax = nH - nBB - aBorder.Height() - MINBODY -
1655cdf0e10cSrcweir nFDist - nFHeight - nHDist - nHHeight;
1656cdf0e10cSrcweir
1657cdf0e10cSrcweir aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
1658cdf0e10cSrcweir
1659cdf0e10cSrcweir // Bottom
1660cdf0e10cSrcweir nMax = nH - nBT - aBorder.Height() - MINBODY -
1661cdf0e10cSrcweir nFDist - nFHeight - nHDist - nHHeight;
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
1664cdf0e10cSrcweir
1665cdf0e10cSrcweir // Left
1666cdf0e10cSrcweir nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1667cdf0e10cSrcweir aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
1668cdf0e10cSrcweir
1669cdf0e10cSrcweir // Right
1670cdf0e10cSrcweir nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight;
1671cdf0e10cSrcweir aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
1672cdf0e10cSrcweir return 0;
1673cdf0e10cSrcweir }
1674cdf0e10cSrcweir
1675cdf0e10cSrcweir // -----------------------------------------------------------------------
1676cdf0e10cSrcweir
CalcMargin_Impl()1677cdf0e10cSrcweir void SvxPageDescPage::CalcMargin_Impl()
1678cdf0e10cSrcweir {
16792e03cc80SMatthias Seidel // Aktuelle Werte der Seitenränder
1680cdf0e10cSrcweir long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP );
1681cdf0e10cSrcweir long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP );
1682cdf0e10cSrcweir
1683cdf0e10cSrcweir long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP );
1684cdf0e10cSrcweir long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP );
1685cdf0e10cSrcweir
1686cdf0e10cSrcweir long nH = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP );
1687cdf0e10cSrcweir long nW = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP );
1688cdf0e10cSrcweir
1689cdf0e10cSrcweir long nWidth = nBL + nBR + MINBODY;
1690cdf0e10cSrcweir long nHeight = nBT + nBB + MINBODY;
1691cdf0e10cSrcweir
1692cdf0e10cSrcweir if ( nWidth > nW || nHeight > nH )
1693cdf0e10cSrcweir {
1694cdf0e10cSrcweir if ( nWidth > nW )
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir long nTmp = nBL <= nBR ? nBR : nBL;
1697cdf0e10cSrcweir nTmp -= nWidth - nW;
1698cdf0e10cSrcweir
1699cdf0e10cSrcweir if ( nBL <= nBR )
1700cdf0e10cSrcweir SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
1701cdf0e10cSrcweir else
1702cdf0e10cSrcweir SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir if ( nHeight > nH )
1706cdf0e10cSrcweir {
1707cdf0e10cSrcweir long nTmp = nBT <= nBB ? nBB : nBT;
1708cdf0e10cSrcweir nTmp -= nHeight - nH;
1709cdf0e10cSrcweir
1710cdf0e10cSrcweir if ( nBT <= nBB )
1711cdf0e10cSrcweir SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
1712cdf0e10cSrcweir else
1713cdf0e10cSrcweir SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP );
1714cdf0e10cSrcweir }
1715cdf0e10cSrcweir }
1716cdf0e10cSrcweir }
1717cdf0e10cSrcweir
1718cdf0e10cSrcweir // -----------------------------------------------------------------------
1719cdf0e10cSrcweir
IMPL_LINK_INLINE_START(SvxPageDescPage,CenterHdl_Impl,CheckBox *,EMPTYARG)1720cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG )
1721cdf0e10cSrcweir {
1722cdf0e10cSrcweir aBspWin.SetHorz( aHorzBox.IsChecked() );
1723cdf0e10cSrcweir aBspWin.SetVert( aVertBox.IsChecked() );
1724cdf0e10cSrcweir UpdateExample_Impl();
1725cdf0e10cSrcweir return 0;
1726cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxPageDescPage,CenterHdl_Impl,CheckBox *,EMPTYARG)1727cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG )
1728cdf0e10cSrcweir
1729cdf0e10cSrcweir // -----------------------------------------------------------------------
1730cdf0e10cSrcweir
1731cdf0e10cSrcweir void SvxPageDescPage::SetCollectionList(const List* pList)
1732cdf0e10cSrcweir {
1733cdf0e10cSrcweir sStandardRegister = *(String*)pList->GetObject(0);
1734cdf0e10cSrcweir for( sal_uInt16 i = 1; i < pList->Count(); i++ )
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir aRegisterLB.InsertEntry(*(String*)pList->GetObject(i));
1737cdf0e10cSrcweir }
1738cdf0e10cSrcweir
1739cdf0e10cSrcweir aRegisterCB .Show();
1740cdf0e10cSrcweir aRegisterFT .Show();
1741cdf0e10cSrcweir aRegisterLB.Show();
1742cdf0e10cSrcweir aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify));
1743cdf0e10cSrcweir }
1744cdf0e10cSrcweir
1745cdf0e10cSrcweir // -----------------------------------------------------------------------
1746cdf0e10cSrcweir
IMPL_LINK(SvxPageDescPage,RegisterModify,CheckBox *,pBox)1747cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox )
1748cdf0e10cSrcweir {
1749cdf0e10cSrcweir sal_Bool bEnable = sal_False;
1750cdf0e10cSrcweir if(pBox->IsChecked())
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir bEnable = sal_True;
1753cdf0e10cSrcweir if(USHRT_MAX == aRegisterLB.GetSelectEntryPos())
1754cdf0e10cSrcweir aRegisterLB.SelectEntry(sStandardRegister);
1755cdf0e10cSrcweir }
1756cdf0e10cSrcweir aRegisterFT.Enable( bEnable );
1757cdf0e10cSrcweir aRegisterLB.Enable( bEnable );
1758cdf0e10cSrcweir return 0;
1759cdf0e10cSrcweir }
1760cdf0e10cSrcweir
1761cdf0e10cSrcweir // ----------------------------------------------------------------------------
1762cdf0e10cSrcweir
DisableVerticalPageDir()1763cdf0e10cSrcweir void SvxPageDescPage::DisableVerticalPageDir()
1764cdf0e10cSrcweir {
1765cdf0e10cSrcweir aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT );
1766cdf0e10cSrcweir aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT );
1767cdf0e10cSrcweir if( aTextFlowBox.GetEntryCount() < 2 )
1768cdf0e10cSrcweir {
1769cdf0e10cSrcweir aTextFlowLbl.Hide();
1770cdf0e10cSrcweir aTextFlowBox.Hide();
1771cdf0e10cSrcweir aBspWin.EnableFrameDirection( sal_False );
1772cdf0e10cSrcweir }
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir
IMPL_LINK(SvxPageDescPage,FrameDirectionModify_Impl,ListBox *,EMPTYARG)1775cdf0e10cSrcweir IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*, EMPTYARG)
1776cdf0e10cSrcweir {
1777cdf0e10cSrcweir aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() );
1778cdf0e10cSrcweir aBspWin.Invalidate();
1779cdf0e10cSrcweir return 0;
1780cdf0e10cSrcweir }
1781cdf0e10cSrcweir
IsPrinterRangeOverflow(MetricField & rField,long nFirstMargin,long nLastMargin,MarginPosition nPos)1782cdf0e10cSrcweir bool SvxPageDescPage::IsPrinterRangeOverflow(
1783cdf0e10cSrcweir MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos )
1784cdf0e10cSrcweir {
1785cdf0e10cSrcweir bool bRet = false;
178656b35d86SArmin Le Grand bool bCheck = ( ( m_nPos & nPos ) == 0 );
1787cdf0e10cSrcweir long nValue = static_cast<long>(rField.GetValue());
1788cdf0e10cSrcweir if ( bCheck &&
1789cdf0e10cSrcweir ( nValue < nFirstMargin || nValue > nLastMargin ) &&
1790cdf0e10cSrcweir rField.GetText() != rField.GetSavedValue() )
1791cdf0e10cSrcweir {
1792cdf0e10cSrcweir rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin );
1793cdf0e10cSrcweir bRet = true;
1794cdf0e10cSrcweir }
1795cdf0e10cSrcweir
1796cdf0e10cSrcweir return bRet;
1797cdf0e10cSrcweir }
1798cdf0e10cSrcweir
1799cdf0e10cSrcweir /** Check if a value of a margin edit is outside the printer paper margins
1800cdf0e10cSrcweir and save this information.
1801cdf0e10cSrcweir */
CheckMarginEdits(bool _bClear)1802cdf0e10cSrcweir void SvxPageDescPage::CheckMarginEdits( bool _bClear )
1803cdf0e10cSrcweir {
1804cdf0e10cSrcweir if ( _bClear )
180556b35d86SArmin Le Grand m_nPos = 0;
1806cdf0e10cSrcweir
1807cdf0e10cSrcweir sal_Int64 nValue = aLeftMarginEdit.GetValue();
1808cdf0e10cSrcweir if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin )
180956b35d86SArmin Le Grand m_nPos |= MARGIN_LEFT;
1810cdf0e10cSrcweir nValue = aRightMarginEdit.GetValue();
1811cdf0e10cSrcweir if ( nValue < nFirstRightMargin || nValue > nLastRightMargin )
181256b35d86SArmin Le Grand m_nPos |= MARGIN_RIGHT;
1813cdf0e10cSrcweir nValue = aTopMarginEdit.GetValue();
1814cdf0e10cSrcweir if ( nValue < nFirstTopMargin || nValue > nLastTopMargin )
181556b35d86SArmin Le Grand m_nPos |= MARGIN_TOP;
1816cdf0e10cSrcweir nValue = aBottomMarginEdit.GetValue();
1817cdf0e10cSrcweir if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin )
181856b35d86SArmin Le Grand m_nPos |= MARGIN_BOTTOM;
1819cdf0e10cSrcweir }
1820cdf0e10cSrcweir
IsMarginOutOfRange()1821cdf0e10cSrcweir bool SvxPageDescPage::IsMarginOutOfRange()
1822cdf0e10cSrcweir {
182356b35d86SArmin Le Grand bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) &&
1824cdf0e10cSrcweir ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) &&
1825cdf0e10cSrcweir ( aLeftMarginEdit.GetValue() < nFirstLeftMargin ||
1826cdf0e10cSrcweir aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) ||
182756b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_RIGHT ) &&
1828cdf0e10cSrcweir ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) &&
1829cdf0e10cSrcweir ( aRightMarginEdit.GetValue() < nFirstRightMargin ||
1830cdf0e10cSrcweir aRightMarginEdit.GetValue() > nLastRightMargin ) ) ||
183156b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_TOP ) &&
1832cdf0e10cSrcweir ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) &&
1833cdf0e10cSrcweir ( aTopMarginEdit.GetValue() < nFirstTopMargin ||
1834cdf0e10cSrcweir aTopMarginEdit.GetValue() > nLastTopMargin ) ) ||
183556b35d86SArmin Le Grand ( ( !( m_nPos & MARGIN_BOTTOM ) &&
1836cdf0e10cSrcweir ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) &&
1837cdf0e10cSrcweir ( aBottomMarginEdit.GetValue() < nFirstBottomMargin ||
1838cdf0e10cSrcweir aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) );
1839cdf0e10cSrcweir return bRet;
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir
PageCreated(SfxAllItemSet aSet)184256b35d86SArmin Le Grand void SvxPageDescPage::PageCreated(SfxAllItemSet aSet) //add CHINA001
1843cdf0e10cSrcweir {
184456b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False);
184556b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False);
184656b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False);
184756b35d86SArmin Le Grand SFX_ITEMSET_ARG(&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False);
184856b35d86SArmin Le Grand
184956b35d86SArmin Le Grand //UUUU
185056b35d86SArmin Le Grand SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, sal_False);
185156b35d86SArmin Le Grand
185256b35d86SArmin Le Grand if(pModeItem)
185356b35d86SArmin Le Grand {
185456b35d86SArmin Le Grand SetMode((SvxModeType)pModeItem->GetEnumValue());
185556b35d86SArmin Le Grand }
185656b35d86SArmin Le Grand
185756b35d86SArmin Le Grand if(pPaperStartItem && pPaperEndItem)
185856b35d86SArmin Le Grand {
185956b35d86SArmin Le Grand SetPaperFormatRanges((Paper)pPaperStartItem->GetEnumValue(),(Paper)pPaperEndItem->GetEnumValue());
186056b35d86SArmin Le Grand }
186156b35d86SArmin Le Grand
186256b35d86SArmin Le Grand if(pCollectListItem)
186356b35d86SArmin Le Grand {
186456b35d86SArmin Le Grand SetCollectionList(pCollectListItem->GetList());
186556b35d86SArmin Le Grand }
186656b35d86SArmin Le Grand
186756b35d86SArmin Le Grand if(pSupportDrawingLayerFillStyleItem)
186856b35d86SArmin Le Grand {
186956b35d86SArmin Le Grand const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
187056b35d86SArmin Le Grand
187156b35d86SArmin Le Grand EnableDrawingLayerFillStyles(bNew);
187256b35d86SArmin Le Grand }
1873cdf0e10cSrcweir }
187456b35d86SArmin Le Grand
187556b35d86SArmin Le Grand //eof
1876