PageMarginControl.cxx (ff0525f2) PageMarginControl.cxx (2924af3d)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 54 unchanged lines hidden (view full) ---

63 , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN))
64 , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
65 , mnPageLeftMargin( aPageLRMargin.GetLeft() )
66 , mnPageRightMargin( aPageLRMargin.GetRight() )
67 , mnPageTopMargin( aPageULMargin.GetUpper() )
68 , mnPageBottomMargin( aPageULMargin.GetLower() )
69 , mbMirrored( bMirrored )
70 , meUnit( eUnit )
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 54 unchanged lines hidden (view full) ---

63 , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN))
64 , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) )
65 , mnPageLeftMargin( aPageLRMargin.GetLeft() )
66 , mnPageRightMargin( aPageLRMargin.GetRight() )
67 , mnPageTopMargin( aPageULMargin.GetUpper() )
68 , mnPageBottomMargin( aPageULMargin.GetLower() )
69 , mbMirrored( bMirrored )
70 , meUnit( eUnit )
71 , mbUserCustomValuesAvailable(false)
71 , mnUserCustomPageLeftMargin(0)
72 , mnUserCustomPageRightMargin(0)
73 , mnUserCustomPageTopMargin(0)
74 , mnUserCustomPageBottomMargin(0)
75 , mbUserCustomMirrored(false)
76 , mbCustomValuesUsed( false )
77 , mrPagePropPanel(rPanel)
78{
79 maWidthHeightField.Hide();
80 SetFieldUnit( maWidthHeightField, eFUnit );
81
72 , mnUserCustomPageLeftMargin(0)
73 , mnUserCustomPageRightMargin(0)
74 , mnUserCustomPageTopMargin(0)
75 , mnUserCustomPageBottomMargin(0)
76 , mbUserCustomMirrored(false)
77 , mbCustomValuesUsed( false )
78 , mrPagePropPanel(rPanel)
79{
80 maWidthHeightField.Hide();
81 SetFieldUnit( maWidthHeightField, eFUnit );
82
82 const bool bCustomValuesAvailable = GetUserCustomValues();
83 mbUserCustomValuesAvailable = GetUserCustomValues();
83
84 mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
85 mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
86
84
85 mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
86 mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
87
87 FillValueSet( bLandscape, bCustomValuesAvailable );
88 FillValueSet( bLandscape, mbUserCustomValuesAvailable );
88
89 mpMarginValueSet->SetNoSelection();
90 mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) );
91 mpMarginValueSet->Show();
92
93 SelectValueSetItem();
89
90 mpMarginValueSet->SetNoSelection();
91 mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) );
92 mpMarginValueSet->Show();
93
94 SelectValueSetItem();
94 mpMarginValueSet->Format();
95 mpMarginValueSet->StartSelection();
96
97 SetFieldUnit( maLeftMarginEdit, eFUnit );
98 Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
99 maLeftMarginEdit.SetModifyHdl( aLinkLR );
100 SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit );
101
102 SetFieldUnit( maRightMarginEdit, eFUnit );
103 maRightMarginEdit.SetModifyHdl( aLinkLR );

--- 195 unchanged lines hidden (view full) ---

299 mbMirrored )
300 {
301 mpMarginValueSet->SelectItem(4);
302 }
303 else
304 {
305 mpMarginValueSet->SelectItem(0);
306 }
95
96 SetFieldUnit( maLeftMarginEdit, eFUnit );
97 Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
98 maLeftMarginEdit.SetModifyHdl( aLinkLR );
99 SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit );
100
101 SetFieldUnit( maRightMarginEdit, eFUnit );
102 maRightMarginEdit.SetModifyHdl( aLinkLR );

--- 195 unchanged lines hidden (view full) ---

298 mbMirrored )
299 {
300 mpMarginValueSet->SelectItem(4);
301 }
302 else
303 {
304 mpMarginValueSet->SelectItem(0);
305 }
306
307 mpMarginValueSet->Format();
308 mpMarginValueSet->StartSelection();
307};
308
309
310IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl)
311{
309};
310
311
312IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl)
313{
312 mpMarginValueSet->SetNoSelection();
313 if ( pControl == mpMarginValueSet )
314 {
315 const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId();
316 bool bMirrored = false;
314 if ( pControl == mpMarginValueSet )
315 {
316 const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId();
317 bool bMirrored = false;
318 bool bApplyNewPageMargins = true;
317 switch ( iPos )
318 {
319 case 1:
320 mnPageLeftMargin = SWPAGE_NARROW_VALUE;
321 mnPageRightMargin = SWPAGE_NARROW_VALUE;
322 mnPageTopMargin = SWPAGE_NARROW_VALUE;
323 mnPageBottomMargin = SWPAGE_NARROW_VALUE;
324 bMirrored = false;

--- 15 unchanged lines hidden (view full) ---

340 case 4:
341 mnPageLeftMargin = SWPAGE_WIDE_VALUE3;
342 mnPageRightMargin = SWPAGE_WIDE_VALUE1;
343 mnPageTopMargin = SWPAGE_WIDE_VALUE1;
344 mnPageBottomMargin = SWPAGE_WIDE_VALUE1;
345 bMirrored = true;
346 break;
347 case 5:
319 switch ( iPos )
320 {
321 case 1:
322 mnPageLeftMargin = SWPAGE_NARROW_VALUE;
323 mnPageRightMargin = SWPAGE_NARROW_VALUE;
324 mnPageTopMargin = SWPAGE_NARROW_VALUE;
325 mnPageBottomMargin = SWPAGE_NARROW_VALUE;
326 bMirrored = false;

--- 15 unchanged lines hidden (view full) ---

342 case 4:
343 mnPageLeftMargin = SWPAGE_WIDE_VALUE3;
344 mnPageRightMargin = SWPAGE_WIDE_VALUE1;
345 mnPageTopMargin = SWPAGE_WIDE_VALUE1;
346 mnPageBottomMargin = SWPAGE_WIDE_VALUE1;
347 bMirrored = true;
348 break;
349 case 5:
348 mnPageLeftMargin = mnUserCustomPageLeftMargin;
349 mnPageRightMargin = mnUserCustomPageRightMargin;
350 mnPageTopMargin = mnUserCustomPageTopMargin;
351 mnPageBottomMargin = mnUserCustomPageBottomMargin;
352 bMirrored = mbUserCustomMirrored;
350 if ( mbUserCustomValuesAvailable )
351 {
352 mnPageLeftMargin = mnUserCustomPageLeftMargin;
353 mnPageRightMargin = mnUserCustomPageRightMargin;
354 mnPageTopMargin = mnUserCustomPageTopMargin;
355 mnPageBottomMargin = mnUserCustomPageBottomMargin;
356 bMirrored = mbUserCustomMirrored;
357 }
358 else
359 {
360 bApplyNewPageMargins = false;
361 }
353 break;
354 }
355
362 break;
363 }
364
356 mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
357 mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
358 if ( mbMirrored != bMirrored )
365 if ( bApplyNewPageMargins )
359 {
366 {
360 mbMirrored = bMirrored;
361 mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
362 }
367 mpMarginValueSet->SetNoSelection();
368 mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
369 mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
370 if ( mbMirrored != bMirrored )
371 {
372 mbMirrored = bMirrored;
373 mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
374 }
363
375
364 mbCustomValuesUsed = false;
376 mbCustomValuesUsed = false;
377 mrPagePropPanel.ClosePageMarginPopup();
378 }
379 else
380 {
381 // back to initial selection
382 SelectValueSetItem();
383 }
365 }
366
384 }
385
367 mrPagePropPanel.ClosePageMarginPopup();
368 return 0;
369}
370
371
372IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
373{
374 mpMarginValueSet->SetNoSelection();
375 mpMarginValueSet->SelectItem(0);

--- 130 unchanged lines hidden ---
386 return 0;
387}
388
389
390IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
391{
392 mpMarginValueSet->SetNoSelection();
393 mpMarginValueSet->SelectItem(0);

--- 130 unchanged lines hidden ---