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 
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 
135 PageMarginControl::~PageMarginControl(void)
136 {
137     delete mpMarginValueSet;
138 
139     StoreUserCustomValues();
140 }
141 
142 
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 
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 
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 
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             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             }
375 
376             mbCustomValuesUsed = false;
377             mrPagePropPanel.ClosePageMarginPopup();
378         }
379         else
380         {
381             // back to initial selection
382             SelectValueSetItem();
383         }
384     }
385 
386     return 0;
387 }
388 
389 
390 IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG )
391 {
392     mpMarginValueSet->SetNoSelection();
393     mpMarginValueSet->SelectItem(0);
394     mpMarginValueSet->Format();
395     mpMarginValueSet->StartSelection();
396 
397     mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit );
398     mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit );
399     mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
400     mbCustomValuesUsed = true;
401     return 0;
402 }
403 
404 IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG )
405 {
406     mpMarginValueSet->SetNoSelection();
407     mpMarginValueSet->SelectItem(0);
408     mpMarginValueSet->Format();
409     mpMarginValueSet->StartSelection();
410 
411     mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit );
412     mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit );
413     mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
414     mbCustomValuesUsed = true;
415     return 0;
416 }
417 
418 
419 bool PageMarginControl::GetUserCustomValues()
420 {
421     bool bUserCustomValuesAvailable = false;
422 
423     SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
424     if ( aWinOpt.Exists() )
425     {
426         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
427         ::rtl::OUString aTmp;
428         if ( aSeq.getLength())
429             aSeq[0].Value >>= aTmp;
430         String aWinData( aTmp );
431         mnUserCustomPageLeftMargin = aWinData.ToInt32();
432         bUserCustomValuesAvailable = true;
433     }
434 
435     SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
436     if ( aWinOpt2.Exists() )
437     {
438         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
439         ::rtl::OUString aTmp;
440         if ( aSeq.getLength())
441             aSeq[0].Value >>= aTmp;
442         String aWinData( aTmp );
443         mnUserCustomPageRightMargin = aWinData.ToInt32();
444         bUserCustomValuesAvailable = true;
445     }
446 
447     SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
448     if ( aWinOpt3.Exists() )
449     {
450         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt3.GetUserData();
451         ::rtl::OUString aTmp;
452         if ( aSeq.getLength())
453             aSeq[0].Value >>= aTmp;
454         String aWinData( aTmp );
455         mnUserCustomPageTopMargin = aWinData.ToInt32();
456         bUserCustomValuesAvailable = true;
457     }
458 
459     SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
460     if ( aWinOpt4.Exists() )
461     {
462         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt4.GetUserData();
463         ::rtl::OUString aTmp;
464         if ( aSeq.getLength())
465             aSeq[0].Value >>= aTmp;
466         String aWinData( aTmp );
467         mnUserCustomPageBottomMargin = aWinData.ToInt32();
468         bUserCustomValuesAvailable = true;
469     }
470 
471     SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
472     if ( aWinOpt5.Exists() )
473     {
474         ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt5.GetUserData();
475         ::rtl::OUString aTmp;
476         if ( aSeq.getLength())
477             aSeq[0].Value >>= aTmp;
478         String aWinData( aTmp );
479         mbUserCustomMirrored = aWinData.ToInt32() == 0 ? false : true;
480         bUserCustomValuesAvailable = true;
481     }
482 
483     return bUserCustomValuesAvailable;
484 }
485 
486 void PageMarginControl::StoreUserCustomValues()
487 {
488     if ( !mbCustomValuesUsed )
489     {
490         return;
491     }
492 
493     ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
494     SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE );
495 
496     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageLeftMargin") );
497     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageLeftMargin ));
498     aWinOpt.SetUserData( aSeq );
499 
500     SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE );
501     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageRightMargin") );
502     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageRightMargin ));
503     aWinOpt2.SetUserData( aSeq );
504 
505     SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE );
506     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageTopMargin") );
507     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageTopMargin ));
508     aWinOpt3.SetUserData( aSeq );
509 
510     SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE );
511     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageBottomMargin") );
512     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( mnPageBottomMargin ));
513     aWinOpt4.SetUserData( aSeq );
514 
515     SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE );
516     aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mbMirrored") );
517     aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( (mbMirrored ? 1 : 0) ));
518     aWinOpt5.SetUserData( aSeq );
519 }
520 
521 
522 } } // end of namespace sw::sidebar
523 
524