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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include "precompiled_sw.hxx"
23 
24 #include "PageMarginControl.hxx"
25 #include "PagePropertyPanel.hxx"
26 #include "PagePropertyPanel.hrc"
27 
28 #include <swtypes.hxx>
29 
30 #include <svx/sidebar/ValueSetWithTextControl.hxx>
31 
32 #define SWPAGE_LEFT_GVALUE      String("Sw_Page_Left", 12, RTL_TEXTENCODING_ASCII_US)
33 #define SWPAGE_RIGHT_GVALUE     String("Sw_Page_Right", 13, RTL_TEXTENCODING_ASCII_US)
34 #define SWPAGE_TOP_GVALUE       String("Sw_Page_Top", 11, RTL_TEXTENCODING_ASCII_US)
35 #define SWPAGE_DOWN_GVALUE      String("Sw_Page_Down", 12, RTL_TEXTENCODING_ASCII_US)
36 #define SWPAGE_MIRROR_GVALUE    String("Sw_Page_Mirrored", 16, RTL_TEXTENCODING_ASCII_US)
37 
38 
39 namespace sw { namespace sidebar {
40 
PageMarginControl(Window * pParent,PagePropertyPanel & rPanel,const SvxLongLRSpaceItem & aPageLRMargin,const SvxLongULSpaceItem & aPageULMargin,const bool bMirrored,const Size aPageSize,const sal_Bool bLandscape,const FieldUnit eFUnit,const SfxMapUnit eUnit)41 PageMarginControl::PageMarginControl(
42     Window* pParent,
43     PagePropertyPanel& rPanel,
44     const SvxLongLRSpaceItem& aPageLRMargin,
45     const SvxLongULSpaceItem& aPageULMargin,
46     const bool bMirrored,
47     const Size aPageSize,
48     const sal_Bool bLandscape,
49     const FieldUnit eFUnit,
50     const SfxMapUnit eUnit )
51     : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) )
52     , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) )
53     , maCustom(this, SW_RES(FT_CUSTOM))
54     , maLeft(this, SW_RES(FT_LEFT))
55     , maInner(this, SW_RES(FT_INNER))
56     , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN))
57     , maRight(this, SW_RES(FT_RIGHT))
58     , maOuter(this, SW_RES(FT_OUTER))
59     , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN))
60     , maTop(this, SW_RES(FT_TOP))
61     , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN))
62     , maBottom(this, SW_RES(FT_BOTTOM))
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)
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 
83     mbUserCustomValuesAvailable = GetUserCustomValues();
84 
85     mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
86     mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
87 
88     FillValueSet( bLandscape, mbUserCustomValuesAvailable );
89 
90     mpMarginValueSet->SetNoSelection();
91     mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) );
92     mpMarginValueSet->Show();
93 
94     SelectValueSetItem();
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 );
103     SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit );
104 
105     Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl );
106     SetFieldUnit( maTopMarginEdit, eFUnit );
107     maTopMarginEdit.SetModifyHdl( aLinkUL );
108     SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit );
109 
110     SetFieldUnit( maBottomMarginEdit, eFUnit );
111     maBottomMarginEdit.SetModifyHdl( aLinkUL );
112     SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit );
113 
114     SetMetricFieldMaxValues( aPageSize );
115 
116     if ( mbMirrored )
117     {
118         maLeft.Hide();
119         maRight.Hide();
120         maInner.Show();
121         maOuter.Show();
122     }
123     else
124     {
125         maLeft.Show();
126         maRight.Show();
127         maInner.Hide();
128         maOuter.Hide();
129     }
130 
131     FreeResource();
132 }
133 
134 
~PageMarginControl(void)135 PageMarginControl::~PageMarginControl(void)
136 {
137     delete mpMarginValueSet;
138 
139     StoreUserCustomValues();
140 }
141 
142 
SetMetricFieldMaxValues(const Size aPageSize)143 void PageMarginControl::SetMetricFieldMaxValues( const Size aPageSize )
144 {
145     const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) );
146     const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) );
147     const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) );
148     const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) );
149 
150     const long nPH  = LogicToLogic( aPageSize.Height(), (MapUnit)meUnit, MAP_TWIP );
151     const long nPW  = LogicToLogic( aPageSize.Width(),  (MapUnit)meUnit, MAP_TWIP );
152 
153     // Left
154     long nMax = nPW - nMR - MINBODY;
155     maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP);
156 
157     // Right
158     nMax = nPW - nML - MINBODY;
159     maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP);
160 
161     //Top
162     nMax = nPH - nMB - MINBODY;
163     maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
164 
165     //Bottom
166     nMax = nPH - nMT -  MINBODY;
167     maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP);
168 }
169 
170 
FillValueSet(const bool bLandscape,const bool bUserCustomValuesAvailable)171 void PageMarginControl::FillValueSet(
172     const bool bLandscape,
173     const bool bUserCustomValuesAvailable )
174 {
175     const XubString aLeft = SW_RES(STR_MARGIN_TOOLTIP_LEFT);
176     const XubString aRight = SW_RES(STR_MARGIN_TOOLTIP_RIGHT);
177     const XubString aTop = SW_RES(STR_MARGIN_TOOLTIP_TOP);
178     const XubString aBottom = SW_RES(STR_MARGIN_TOOLTIP_BOT);
179 
180     SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit );
181     const XubString aNarrowValText = maWidthHeightField.GetText();
182     XubString aHelpText = aLeft;
183     aHelpText += aNarrowValText;
184     aHelpText += aRight;
185     aHelpText += aNarrowValText;
186     aHelpText += aTop;
187     aHelpText += aNarrowValText;
188     aHelpText += aBottom;
189     aHelpText += aNarrowValText;
190     mpMarginValueSet->AddItem(
191         (bLandscape ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW) ), 0,
192         SW_RES(STR_NARROW), &aHelpText );
193 
194     SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit );
195     const XubString aNormalValText = maWidthHeightField.GetText();
196     aHelpText = aLeft;
197     aHelpText += aNormalValText;
198     aHelpText += aRight;
199     aHelpText += aNormalValText;
200     aHelpText += aTop;
201     aHelpText += aNormalValText;
202     aHelpText += aBottom;
203     aHelpText += aNormalValText;
204     mpMarginValueSet->AddItem(
205         (bLandscape ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL) ), 0,
206         SW_RES(STR_NORMAL), &aHelpText );
207 
208     SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit );
209     const XubString aWide1ValText = maWidthHeightField.GetText();
210     SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit );
211     const XubString aWide2ValText = maWidthHeightField.GetText();
212     aHelpText = aLeft;
213     aHelpText += aWide2ValText;
214     aHelpText += aRight;
215     aHelpText += aWide2ValText;
216     aHelpText += aTop;
217     aHelpText += aWide1ValText;
218     aHelpText += aBottom;
219     aHelpText += aWide1ValText;
220     mpMarginValueSet->AddItem(
221         (bLandscape ? SW_RES(IMG_WIDE_L) : SW_RES(IMG_WIDE) ), 0,
222         SW_RES(STR_WIDE), &aHelpText );
223 
224     const XubString aInner = SW_RES(STR_MARGIN_TOOLTIP_INNER);
225     const XubString aOuter = SW_RES(STR_MARGIN_TOOLTIP_OUTER);
226 
227     SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit );
228     const XubString aWide3ValText = maWidthHeightField.GetText();
229     aHelpText = aInner;
230     aHelpText += aWide3ValText;
231     aHelpText += aOuter;
232     aHelpText += aWide3ValText;
233     aHelpText += aTop;
234     aHelpText += aWide1ValText;
235     aHelpText += aBottom;
236     aHelpText += aWide1ValText;
237     mpMarginValueSet->AddItem(
238         (bLandscape ? SW_RES(IMG_MIRRORED_L) : SW_RES(IMG_MIRRORED) ), 0,
239         SW_RES(STR_MIRRORED), &aHelpText );
240 
241     if ( bUserCustomValuesAvailable )
242     {
243         aHelpText = mbUserCustomMirrored ? aInner : aLeft;
244         SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit );
245         aHelpText += maWidthHeightField.GetText();
246         aHelpText += mbUserCustomMirrored ? aOuter : aRight;
247         SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit );
248         aHelpText += maWidthHeightField.GetText();
249         aHelpText += aTop;
250         SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit );
251         aHelpText += maWidthHeightField.GetText();
252         aHelpText += aBottom;
253         SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit );
254         aHelpText += maWidthHeightField.GetText();
255     }
256     else
257     {
258         aHelpText = XubString();
259     }
260     mpMarginValueSet->AddItem(
261         (bUserCustomValuesAvailable ? SW_RES(IMG_CUSTOM) : SW_RES(IMG_CUSTOM_DIS) ), 0,
262         SW_RES(STR_LCVALUE), &aHelpText );
263 }
264 
265 
SelectValueSetItem()266 void PageMarginControl::SelectValueSetItem()
267 {
268     const long cTolerance = 5;
269 
270     if( abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
271         abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
272         abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
273         abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance &&
274         !mbMirrored )
275     {
276         mpMarginValueSet->SelectItem(1);
277     }
278     else if( abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
279         abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
280         abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
281         abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance &&
282         !mbMirrored )
283     {
284         mpMarginValueSet->SelectItem(2);
285     }
286     else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance &&
287         abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance &&
288         abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
289         abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
290         !mbMirrored )
291     {
292         mpMarginValueSet->SelectItem(3);
293     }
294     else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance &&
295         abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
296         abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
297         abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance &&
298         mbMirrored )
299     {
300         mpMarginValueSet->SelectItem(4);
301     }
302     else
303     {
304         mpMarginValueSet->SelectItem(0);
305     }
306 
307     mpMarginValueSet->Format();
308     mpMarginValueSet->StartSelection();
309 };
310 
311 
IMPL_LINK(PageMarginControl,ImplMarginHdl,void *,pControl)312 IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl)
313 {
314     if ( pControl == mpMarginValueSet )
315     {
316         const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId();
317         bool bMirrored = false;
318         bool bApplyNewPageMargins = true;
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;
327             break;
328         case 2:
329             mnPageLeftMargin = SWPAGE_NORMAL_VALUE;
330             mnPageRightMargin = SWPAGE_NORMAL_VALUE;
331             mnPageTopMargin = SWPAGE_NORMAL_VALUE;
332             mnPageBottomMargin = SWPAGE_NORMAL_VALUE;
333             bMirrored = false;
334             break;
335         case 3:
336             mnPageLeftMargin = SWPAGE_WIDE_VALUE2;
337             mnPageRightMargin = SWPAGE_WIDE_VALUE2;
338             mnPageTopMargin = SWPAGE_WIDE_VALUE1;
339             mnPageBottomMargin = SWPAGE_WIDE_VALUE1;
340             bMirrored = false;
341             break;
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:
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             }
362             break;
363         }
364 
365         if ( bApplyNewPageMargins )
366         {
367             mrPagePropPanel.StartUndo();
368             mpMarginValueSet->SetNoSelection();
369             mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
370             mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
371             if ( mbMirrored != bMirrored )
372             {
373                 mbMirrored = bMirrored;
374                 mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
375             }
376             mrPagePropPanel.EndUndo();
377 
378             mbCustomValuesUsed = false;
379             mrPagePropPanel.ClosePageMarginPopup();
380         }
381         else
382         {
383             // back to initial selection
384             SelectValueSetItem();
385         }
386     }
387 
388     return 0;
389 }
390 
391 
IMPL_LINK(PageMarginControl,ModifyLRMarginHdl,MetricField *,EMPTYARG)392 IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
393 {
394     mpMarginValueSet->SetNoSelection();
395     mpMarginValueSet->SelectItem(0);
396     mpMarginValueSet->Format();
397     mpMarginValueSet->StartSelection();
398 
399     mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit );
400     mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit );
401     mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
402     mbCustomValuesUsed = true;
403     return 0;
404 }
405 
IMPL_LINK(PageMarginControl,ModifyULMarginHdl,MetricField *,EMPTYARG)406 IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG )
407 {
408     mpMarginValueSet->SetNoSelection();
409     mpMarginValueSet->SelectItem(0);
410     mpMarginValueSet->Format();
411     mpMarginValueSet->StartSelection();
412 
413     mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit );
414     mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit );
415     mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
416     mbCustomValuesUsed = true;
417     return 0;
418 }
419 
420 
GetUserCustomValues()421 bool PageMarginControl::GetUserCustomValues()
422 {
423     bool bUserCustomValuesAvailable = false;
424 
425     SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
426     if ( aWinOpt.Exists() )
427     {
428         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
429         ::rtl::OUString aTmp;
430         if ( aSeq.getLength())
431             aSeq[0].Value >>= aTmp;
432         String aWinData( aTmp );
433         mnUserCustomPageLeftMargin = aWinData.ToInt32();
434         bUserCustomValuesAvailable = true;
435     }
436 
437     SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
438     if ( aWinOpt2.Exists() )
439     {
440         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
441         ::rtl::OUString aTmp;
442         if ( aSeq.getLength())
443             aSeq[0].Value >>= aTmp;
444         String aWinData( aTmp );
445         mnUserCustomPageRightMargin = aWinData.ToInt32();
446         bUserCustomValuesAvailable = true;
447     }
448 
449     SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
450     if ( aWinOpt3.Exists() )
451     {
452         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
453         ::rtl::OUString aTmp;
454         if ( aSeq.getLength())
455             aSeq[0].Value >>= aTmp;
456         String aWinData( aTmp );
457         mnUserCustomPageTopMargin = aWinData.ToInt32();
458         bUserCustomValuesAvailable = true;
459     }
460 
461     SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
462     if ( aWinOpt4.Exists() )
463     {
464         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
465         ::rtl::OUString aTmp;
466         if ( aSeq.getLength())
467             aSeq[0].Value >>= aTmp;
468         String aWinData( aTmp );
469         mnUserCustomPageBottomMargin = aWinData.ToInt32();
470         bUserCustomValuesAvailable = true;
471     }
472 
473     SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
474     if ( aWinOpt5.Exists() )
475     {
476         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
477         ::rtl::OUString aTmp;
478         if ( aSeq.getLength())
479             aSeq[0].Value >>= aTmp;
480         String aWinData( aTmp );
481         mbUserCustomMirrored = aWinData.ToInt32() == 0 ? false : true;
482         bUserCustomValuesAvailable = true;
483     }
484 
485     return bUserCustomValuesAvailable;
486 }
487 
StoreUserCustomValues()488 void PageMarginControl::StoreUserCustomValues()
489 {
490     if ( !mbCustomValuesUsed )
491     {
492         return;
493     }
494 
495     ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
496     SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
497 
498     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageLeftMargin") );
499     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageLeftMargin ));
500     aWinOpt.SetUserData( aSeq );
501 
502     SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
503     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageRightMargin") );
504     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageRightMargin ));
505     aWinOpt2.SetUserData( aSeq );
506 
507     SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
508     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageTopMargin") );
509     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageTopMargin ));
510     aWinOpt3.SetUserData( aSeq );
511 
512     SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
513     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageBottomMargin") );
514     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageBottomMargin ));
515     aWinOpt4.SetUserData( aSeq );
516 
517     SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
518     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mbMirrored") );
519     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( (mbMirrored ? 1 : 0) ));
520     aWinOpt5.SetUserData( aSeq );
521 }
522 
523 
524 } } // end of namespace sw::sidebar
525 
526