1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sfx2/viewfrm.hxx>
26 #include <svx/svxids.hrc>
27 #include <svx/dialogs.hrc>
28 #include <svl/itempool.hxx>
29 #include <vcl/msgbox.hxx>
30 #include <sfx2/request.hxx>
31 #include <svl/stritem.hxx>
32 #include <vcl/prntypes.hxx>
33 #include <svl/style.hxx>
34 #include <stlsheet.hxx>
35 #include <svx/svdorect.hxx>
36 #include <svx/svdundo.hxx>
37 #include <editeng/eeitem.hxx>
38 #include <editeng/frmdiritem.hxx>
39 #include <svx/xbtmpit.hxx>
40 #include <svx/xsetit.hxx>
41 #include <editeng/ulspitem.hxx>
42 #include <editeng/lrspitem.hxx>
43 #include <svx/sdr/properties/properties.hxx>
46 #include <editeng/shaditem.hxx>
47 #include <editeng/boxitem.hxx>
48 #include <editeng/sizeitem.hxx>
49 #include <editeng/pbinitem.hxx>
50 #include <sfx2/app.hxx>
51 #include <sfx2/opengrf.hxx>
53 #include "strings.hrc"
58 #include "drawdoc.hxx"
59 #include "DrawDocShell.hxx"
60 #include "ViewShell.hxx"
61 #include "DrawViewShell.hxx"
64 #include "undoback.hxx"
65 #include "sdabstdlg.hxx"
66 #include "sdresid.hxx"
67 #include "sdundogr.hxx"
70 #include <boost/scoped_ptr.hpp>
72 using namespace com::sun::star
;
74 namespace vcl
{ class Window
; }
79 // adapted from writer
80 #define MAXHEIGHT 28350
81 #define MAXWIDTH 28350
83 TYPEINIT1( FuPage
, FuPoor
);
85 void mergeItemSetsImpl( SfxItemSet
& rTarget
, const SfxItemSet
& rSource
)
87 const sal_uInt16
* pPtr
= rSource
.GetRanges();
94 // make ranges discrete
95 while(pPtr
[2] && (pPtr
[2] - p2
== 1))
100 rTarget
.MergeRange( p1
, p2
);
104 rTarget
.Put(rSource
);
107 FuPage::FuPage( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
,
108 SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
109 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
),
111 mpArgs( rReq
.GetArgs() ),
112 mpBackgroundObjUndoAction( 0 ),
113 mbPageBckgrdDeleted( false ),
114 mbMasterPage( false ),
115 mbDisplayBackgroundTabPage( true ),
121 rtl::Reference
<FuPoor
> FuPage::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
123 rtl::Reference
<FuPoor
> xFunc( new FuPage( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
124 xFunc
->DoExecute(rReq
);
128 void FuPage::DoExecute( SfxRequest
& )
130 mpDrawViewShell
= dynamic_cast<DrawViewShell
*>(mpViewShell
);
131 DBG_ASSERT( mpDrawViewShell
, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
132 if( mpDrawViewShell
)
134 mbMasterPage
= mpDrawViewShell
->GetEditMode() == EM_MASTERPAGE
;
135 mbDisplayBackgroundTabPage
= (mpDrawViewShell
->GetPageKind() == PK_STANDARD
);
136 mpPage
= mpDrawViewShell
->getCurrentPage();
141 // if there are no arguments given, open the dialog
144 mpView
->SdrEndTextEdit();
145 mpArgs
= ExecuteDialog(mpWindow
);
148 // if we now have arguments, apply them to current page
150 ApplyItemSet( mpArgs
);
156 delete mpBackgroundObjUndoAction
;
159 void FuPage::Activate()
163 void FuPage::Deactivate()
167 const SfxItemSet
* FuPage::ExecuteDialog( vcl::Window
* pParent
)
169 if (!mpDrawViewShell
)
172 PageKind ePageKind
= mpDrawViewShell
->GetPageKind();
174 SfxItemSet
aNewAttr(mpDoc
->GetPool(),
175 mpDoc
->GetPool().GetWhich(SID_ATTR_LRSPACE
),
176 mpDoc
->GetPool().GetWhich(SID_ATTR_ULSPACE
),
177 SID_ATTR_PAGE
, SID_ATTR_PAGE_BSP
,
178 SID_ATTR_BORDER_OUTER
, SID_ATTR_BORDER_OUTER
,
179 SID_ATTR_BORDER_SHADOW
, SID_ATTR_BORDER_SHADOW
,
180 XATTR_FILL_FIRST
, XATTR_FILL_LAST
,
181 EE_PARA_WRITINGDIR
, EE_PARA_WRITINGDIR
,
184 // Retrieve additional data for dialog
186 SvxShadowItem
aShadowItem(SID_ATTR_BORDER_SHADOW
);
187 aNewAttr
.Put( aShadowItem
);
188 SvxBoxItem
aBoxItem( SID_ATTR_BORDER_OUTER
);
189 aNewAttr
.Put( aBoxItem
);
191 aNewAttr
.Put( SvxFrameDirectionItem(
192 mpDoc
->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB
? FRMDIR_HORI_RIGHT_TOP
: FRMDIR_HORI_LEFT_TOP
,
193 EE_PARA_WRITINGDIR
) );
195 // Retrieve page-data for dialog
197 SvxPageItem
aPageItem( SID_ATTR_PAGE
);
198 aPageItem
.SetDescName( mpPage
->GetName() );
199 aPageItem
.SetPageUsage( (SvxPageUsage
) SVX_PAGE_ALL
);
200 aPageItem
.SetLandscape( mpPage
->GetOrientation() == ORIENTATION_LANDSCAPE
);
201 aPageItem
.SetNumType( mpDoc
->GetPageNumType() );
202 aNewAttr
.Put( aPageItem
);
205 maSize
= mpPage
->GetSize();
206 SvxSizeItem
aSizeItem( SID_ATTR_PAGE_SIZE
, maSize
);
207 aNewAttr
.Put( aSizeItem
);
210 SvxSizeItem
aMaxSizeItem( SID_ATTR_PAGE_MAXSIZE
, Size( MAXWIDTH
, MAXHEIGHT
) );
211 aNewAttr
.Put( aMaxSizeItem
);
214 SvxPaperBinItem
aPaperBinItem( SID_ATTR_PAGE_PAPERBIN
, (const sal_uInt8
)mpPage
->GetPaperBin() );
215 aNewAttr
.Put( aPaperBinItem
);
217 SvxLRSpaceItem
aLRSpaceItem( (sal_uInt16
)mpPage
->GetLftBorder(), (sal_uInt16
)mpPage
->GetRgtBorder(), 0, 0, mpDoc
->GetPool().GetWhich(SID_ATTR_LRSPACE
));
218 aNewAttr
.Put( aLRSpaceItem
);
220 SvxULSpaceItem
aULSpaceItem( (sal_uInt16
)mpPage
->GetUppBorder(), (sal_uInt16
)mpPage
->GetLwrBorder(), mpDoc
->GetPool().GetWhich(SID_ATTR_ULSPACE
));
221 aNewAttr
.Put( aULSpaceItem
);
224 bool bScale
= mpDoc
->GetDocumentType() != DOCUMENT_TYPE_DRAW
;
225 aNewAttr
.Put( SfxBoolItem( SID_ATTR_PAGE_EXT1
, bScale
) );
227 bool bFullSize
= mpPage
->IsMasterPage() ?
228 mpPage
->IsBackgroundFullSize() : static_cast<SdPage
&>(mpPage
->TRG_GetMasterPage()).IsBackgroundFullSize();
230 aNewAttr
.Put( SfxBoolItem( SID_ATTR_PAGE_EXT2
, bFullSize
) );
232 // Merge ItemSet for dialog
234 const sal_uInt16
* pPtr
= aNewAttr
.GetRanges();
235 sal_uInt16 p1
= pPtr
[0], p2
= pPtr
[1];
236 while(pPtr
[2] && (pPtr
[2] - p2
== 1))
241 SfxItemSet
aMergedAttr( *aNewAttr
.GetPool(), p1
, p2
);
243 mergeItemSetsImpl( aMergedAttr
, aNewAttr
);
245 SdStyleSheet
* pStyleSheet
= mpPage
->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND
);
247 // merge page background filling to the dialogs input set
248 if( mbDisplayBackgroundTabPage
)
253 mergeItemSetsImpl( aMergedAttr
, pStyleSheet
->GetItemSet() );
257 // Only this page, get attributes for background fill
258 const SfxItemSet
& rBackgroundAttributes
= mpPage
->getSdrPageProperties().GetItemSet();
260 if(drawing::FillStyle_NONE
!= static_cast<const XFillStyleItem
&>(rBackgroundAttributes
.Get(XATTR_FILLSTYLE
)).GetValue())
262 // page attributes are used, take them
263 aMergedAttr
.Put(rBackgroundAttributes
);
268 && drawing::FillStyle_NONE
!= static_cast<const XFillStyleItem
&>(pStyleSheet
->GetItemSet().Get(XATTR_FILLSTYLE
)).GetValue())
270 // if the page has no fill style, use the settings from the
271 // background stylesheet (if used)
272 mergeItemSetsImpl(aMergedAttr
, pStyleSheet
->GetItemSet());
276 // no fill style from page, start with no fill style
277 aMergedAttr
.Put(XFillStyleItem(drawing::FillStyle_NONE
));
283 boost::scoped_ptr
< SfxItemSet
> pTempSet
;
285 if( GetSlotID() == SID_SELECT_BACKGROUND
)
287 SvxOpenGraphicDialog
aDlg(SdResId(STR_SET_BACKGROUND_PICTURE
));
289 if( aDlg
.Execute() == GRFILTER_OK
)
292 int nError
= aDlg
.GetGraphic(aGraphic
);
293 if( nError
== GRFILTER_OK
)
295 pTempSet
.reset( new SfxItemSet( mpDoc
->GetPool(), XATTR_FILL_FIRST
, XATTR_FILL_LAST
, 0) );
297 pTempSet
->Put( XFillStyleItem( drawing::FillStyle_BITMAP
) );
299 // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
300 SfxItemSet
aMigrateSet( mpDoc
->GetPool(), XATTR_FILLBITMAP
, XATTR_FILLBITMAP
);
301 aMigrateSet
.Put(XFillBitmapItem(OUString("background"), aGraphic
));
302 SdrModel::MigrateItemSet( &aMigrateSet
, pTempSet
.get(), mpDoc
);
304 pTempSet
->Put( XFillBmpStretchItem( true ));
305 pTempSet
->Put( XFillBmpTileItem( false ));
312 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
313 boost::scoped_ptr
<SfxAbstractTabDialog
> pDlg( pFact
? pFact
->CreateSdTabPageDialog(NULL
, &aMergedAttr
, mpDocSh
, mbDisplayBackgroundTabPage
) : 0 );
314 if( pDlg
.get() && pDlg
->Execute() == RET_OK
)
315 pTempSet
.reset( new SfxItemSet(*pDlg
->GetOutputItemSet()) );
318 if (pTempSet
.get() && pStyleSheet
)
320 pStyleSheet
->AdjustToFontHeight(*pTempSet
);
322 if( mbDisplayBackgroundTabPage
)
324 // if some fillstyle-items are not set in the dialog, then
325 // try to use the items before
326 bool bChanges
= false;
327 for( sal_uInt16 i
=XATTR_FILL_FIRST
; i
<XATTR_FILL_LAST
; i
++ )
329 if( aMergedAttr
.GetItemState( i
) != SfxItemState::DEFAULT
)
331 if( pTempSet
->GetItemState( i
) == SfxItemState::DEFAULT
)
332 pTempSet
->Put( aMergedAttr
.Get( i
) );
334 if( aMergedAttr
.GetItem( i
) != pTempSet
->GetItem( i
) )
339 // if the background for this page was set to invisible, the background-object has to be deleted, too.
340 if( ( static_cast<const XFillStyleItem
*>( pTempSet
->GetItem( XATTR_FILLSTYLE
) )->GetValue() == drawing::FillStyle_NONE
) ||
341 ( ( pTempSet
->GetItemState( XATTR_FILLSTYLE
) == SfxItemState::DEFAULT
) &&
342 ( static_cast<const XFillStyleItem
*>( aMergedAttr
.GetItem( XATTR_FILLSTYLE
) )->GetValue() == drawing::FillStyle_NONE
) ) )
343 mbPageBckgrdDeleted
= true;
345 bool bSetToAllPages
= false;
347 // Ask, whether the setting are for the background-page or for the current page
348 if( !mbMasterPage
&& bChanges
)
350 // But don't ask in notice-view, because we can't change the background of
351 // notice-masterpage (at the moment)
352 if( ePageKind
!= PK_NOTES
)
354 ScopedVclPtrInstance
<MessBox
> aQuestionBox (
356 WB_YES_NO
| WB_DEF_YES
,
357 SD_RESSTR(STR_PAGE_BACKGROUND_TITLE
),
358 SD_RESSTR(STR_PAGE_BACKGROUND_TXT
) );
359 aQuestionBox
->SetImage( QueryBox::GetStandardImage() );
360 bSetToAllPages
= ( RET_YES
== aQuestionBox
->Execute() );
363 if( mbPageBckgrdDeleted
)
365 mpBackgroundObjUndoAction
= new SdBackgroundObjUndoAction(
366 *mpDoc
, *mpPage
, mpPage
->getSdrPageProperties().GetItemSet());
368 if(!mpPage
->IsMasterPage())
370 // on normal pages, switch off fill attribute usage
371 SdrPageProperties
& rPageProperties
= mpPage
->getSdrPageProperties();
372 rPageProperties
.ClearItem( XATTR_FILLBITMAP
);
373 rPageProperties
.ClearItem( XATTR_FILLGRADIENT
);
374 rPageProperties
.ClearItem( XATTR_FILLHATCH
);
375 rPageProperties
.PutItem(XFillStyleItem(drawing::FillStyle_NONE
));
379 /* Special treatment: reset the INVALIDS to
380 NULL-Pointer (otherwise INVALIDs or pointer point
381 to DefaultItems in the template; both would
382 prevent the attribute inheritance) */
383 pTempSet
->ClearInvalidItems();
387 StyleSheetUndoAction
* pAction
= new StyleSheetUndoAction(mpDoc
, (SfxStyleSheet
*)pStyleSheet
, &(*pTempSet
.get()));
388 mpDocSh
->GetUndoManager()->AddUndoAction(pAction
);
389 pStyleSheet
->GetItemSet().Put( *(pTempSet
.get()) );
390 sdr::properties::CleanupFillProperties( pStyleSheet
->GetItemSet() );
391 pStyleSheet
->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED
));
393 else if( bSetToAllPages
)
395 OUString
aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT
));
396 ::svl::IUndoManager
* pUndoMgr
= mpDocSh
->GetUndoManager();
397 pUndoMgr
->EnterListAction(aComment
, aComment
);
398 SdUndoGroup
* pUndoGroup
= new SdUndoGroup(mpDoc
);
399 pUndoGroup
->SetComment(aComment
);
401 //Set background on all master pages
402 sal_uInt16 nMasterPageCount
= mpDoc
->GetMasterSdPageCount(ePageKind
);
403 for (sal_uInt16 i
= 0; i
< nMasterPageCount
; ++i
)
405 SdPage
*pMasterPage
= mpDoc
->GetMasterSdPage(i
, ePageKind
);
406 SdStyleSheet
*pStyle
=
407 pMasterPage
->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND
);
408 StyleSheetUndoAction
* pAction
=
409 new StyleSheetUndoAction(mpDoc
, (SfxStyleSheet
*)pStyle
, &(*pTempSet
.get()));
410 pUndoGroup
->AddAction(pAction
);
411 pStyle
->GetItemSet().Put( *(pTempSet
.get()) );
412 sdr::properties::CleanupFillProperties( pStyleSheet
->GetItemSet() );
413 pStyle
->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED
));
416 //Remove background from all pages to reset to the master bg
417 sal_uInt16
nPageCount(mpDoc
->GetSdPageCount(ePageKind
));
418 for(sal_uInt16 i
=0; i
<nPageCount
; ++i
)
420 SdPage
*pPage
= mpDoc
->GetSdPage(i
, ePageKind
);
422 const SfxItemSet
& rFillAttributes
= pPage
->getSdrPageProperties().GetItemSet();
423 if(drawing::FillStyle_NONE
!= static_cast<const XFillStyleItem
&>(rFillAttributes
.Get(XATTR_FILLSTYLE
)).GetValue())
425 SdBackgroundObjUndoAction
*pBackgroundObjUndoAction
= new SdBackgroundObjUndoAction(*mpDoc
, *pPage
, rFillAttributes
);
426 pUndoGroup
->AddAction(pBackgroundObjUndoAction
);
428 SdrPageProperties
& rPageProperties
= pPage
->getSdrPageProperties();
429 rPageProperties
.ClearItem( XATTR_FILLBITMAP
);
430 rPageProperties
.ClearItem( XATTR_FILLGRADIENT
);
431 rPageProperties
.ClearItem( XATTR_FILLHATCH
);
432 rPageProperties
.PutItem(XFillStyleItem(drawing::FillStyle_NONE
));
434 pPage
->ActionChanged();
438 pUndoMgr
->AddUndoAction(pUndoGroup
);
439 pUndoMgr
->LeaveListAction();
443 // if background filling is set to master pages then clear from page set
444 if( mbMasterPage
|| bSetToAllPages
)
446 for( sal_uInt16 nWhich
= XATTR_FILL_FIRST
; nWhich
<= XATTR_FILL_LAST
; nWhich
++ )
448 pTempSet
->ClearItem( nWhich
);
450 pTempSet
->Put(XFillStyleItem(drawing::FillStyle_NONE
));
453 const SfxPoolItem
*pItem
;
454 if( SfxItemState::SET
== pTempSet
->GetItemState( EE_PARA_WRITINGDIR
, false, &pItem
) )
456 sal_uInt32 nVal
= static_cast<const SvxFrameDirectionItem
*>(pItem
)->GetValue();
457 mpDoc
->SetDefaultWritingMode( nVal
== FRMDIR_HORI_RIGHT_TOP
? ::com::sun::star::text::WritingMode_RL_TB
: ::com::sun::star::text::WritingMode_LR_TB
);
460 mpDoc
->SetChanged(true);
462 // BackgroundFill of Masterpage: no hard attributes allowed
463 SdrPage
& rUsedMasterPage
= mpPage
->IsMasterPage() ? *mpPage
: mpPage
->TRG_GetMasterPage();
464 OSL_ENSURE(rUsedMasterPage
.IsMasterPage(), "No MasterPage (!)");
465 rUsedMasterPage
.getSdrPageProperties().ClearItem();
466 OSL_ENSURE(0 != rUsedMasterPage
.getSdrPageProperties().GetStyleSheet(),
467 "MasterPage without StyleSheet detected (!)");
470 aNewAttr
.Put(*(pTempSet
.get()));
471 mrReq
.Done( aNewAttr
);
473 return mrReq
.GetArgs();
481 void FuPage::ApplyItemSet( const SfxItemSet
* pArgs
)
483 if (!pArgs
|| !mpDrawViewShell
)
486 // Set new page-attributes
487 PageKind ePageKind
= mpDrawViewShell
->GetPageKind();
488 const SfxPoolItem
* pPoolItem
;
489 bool bSetPageSizeAndBorder
= false;
490 Size
aNewSize(maSize
);
491 sal_Int32 nLeft
= -1, nRight
= -1, nUpper
= -1, nLower
= -1;
492 bool bScaleAll
= true;
493 Orientation eOrientation
= mpPage
->GetOrientation();
494 SdPage
* pMasterPage
= mpPage
->IsMasterPage() ? mpPage
: &static_cast<SdPage
&>(mpPage
->TRG_GetMasterPage());
495 bool bFullSize
= pMasterPage
->IsBackgroundFullSize();
496 sal_uInt16 nPaperBin
= mpPage
->GetPaperBin();
498 if( pArgs
->GetItemState(SID_ATTR_PAGE
, true, &pPoolItem
) == SfxItemState::SET
)
500 mpDoc
->SetPageNumType(static_cast<const SvxPageItem
*>(pPoolItem
)->GetNumType());
502 eOrientation
= static_cast<const SvxPageItem
*>(pPoolItem
)->IsLandscape() ?
503 ORIENTATION_LANDSCAPE
: ORIENTATION_PORTRAIT
;
505 if( mpPage
->GetOrientation() != eOrientation
)
506 bSetPageSizeAndBorder
= true;
508 mpDrawViewShell
->ResetActualPage();
511 if( pArgs
->GetItemState(SID_ATTR_PAGE_SIZE
, true, &pPoolItem
) == SfxItemState::SET
)
513 aNewSize
= static_cast<const SvxSizeItem
*>(pPoolItem
)->GetSize();
515 if( mpPage
->GetSize() != aNewSize
)
516 bSetPageSizeAndBorder
= true;
519 if( pArgs
->GetItemState(mpDoc
->GetPool().GetWhich(SID_ATTR_LRSPACE
),
520 true, &pPoolItem
) == SfxItemState::SET
)
522 nLeft
= static_cast<const SvxLRSpaceItem
*>(pPoolItem
)->GetLeft();
523 nRight
= static_cast<const SvxLRSpaceItem
*>(pPoolItem
)->GetRight();
525 if( mpPage
->GetLftBorder() != nLeft
|| mpPage
->GetRgtBorder() != nRight
)
526 bSetPageSizeAndBorder
= true;
530 if( pArgs
->GetItemState(mpDoc
->GetPool().GetWhich(SID_ATTR_ULSPACE
),
531 true, &pPoolItem
) == SfxItemState::SET
)
533 nUpper
= static_cast<const SvxULSpaceItem
*>(pPoolItem
)->GetUpper();
534 nLower
= static_cast<const SvxULSpaceItem
*>(pPoolItem
)->GetLower();
536 if( mpPage
->GetUppBorder() != nUpper
|| mpPage
->GetLwrBorder() != nLower
)
537 bSetPageSizeAndBorder
= true;
540 if( pArgs
->GetItemState(mpDoc
->GetPool().GetWhich(SID_ATTR_PAGE_EXT1
), true, &pPoolItem
) == SfxItemState::SET
)
542 bScaleAll
= static_cast<const SfxBoolItem
*>(pPoolItem
)->GetValue();
545 if( pArgs
->GetItemState(mpDoc
->GetPool().GetWhich(SID_ATTR_PAGE_EXT2
), true, &pPoolItem
) == SfxItemState::SET
)
547 bFullSize
= static_cast<const SfxBoolItem
*>(pPoolItem
)->GetValue();
549 if(pMasterPage
->IsBackgroundFullSize() != bFullSize
)
550 bSetPageSizeAndBorder
= true;
554 if( pArgs
->GetItemState(mpDoc
->GetPool().GetWhich(SID_ATTR_PAGE_PAPERBIN
), true, &pPoolItem
) == SfxItemState::SET
)
556 nPaperBin
= static_cast<const SvxPaperBinItem
*>(pPoolItem
)->GetValue();
558 if( mpPage
->GetPaperBin() != nPaperBin
)
559 bSetPageSizeAndBorder
= true;
562 if (nLeft
== -1 && nUpper
!= -1)
564 bSetPageSizeAndBorder
= true;
565 nLeft
= mpPage
->GetLftBorder();
566 nRight
= mpPage
->GetRgtBorder();
568 else if (nLeft
!= -1 && nUpper
== -1)
570 bSetPageSizeAndBorder
= true;
571 nUpper
= mpPage
->GetUppBorder();
572 nLower
= mpPage
->GetLwrBorder();
575 if( bSetPageSizeAndBorder
|| !mbMasterPage
)
576 mpDrawViewShell
->SetPageSizeAndBorder(ePageKind
, aNewSize
, nLeft
, nRight
, nUpper
, nLower
, bScaleAll
, eOrientation
, nPaperBin
, bFullSize
);
578 // if bMasterPage==sal_False then create a background-object for this page with the
579 // properties set in the dialog before, but if mbPageBckgrdDeleted==sal_True then
580 // the background of this page was set to invisible, so it would be a mistake
581 // to create a new background-object for this page !
583 if( mbDisplayBackgroundTabPage
)
585 if( !mbMasterPage
&& !mbPageBckgrdDeleted
)
588 delete mpBackgroundObjUndoAction
;
589 mpBackgroundObjUndoAction
= new SdBackgroundObjUndoAction(
590 *mpDoc
, *mpPage
, mpPage
->getSdrPageProperties().GetItemSet());
591 SfxItemSet
aSet( *pArgs
);
592 sdr::properties::CleanupFillProperties(aSet
);
593 mpPage
->getSdrPageProperties().ClearItem();
594 mpPage
->getSdrPageProperties().PutItemSet(aSet
);
598 // add undo action for background object
599 if( mpBackgroundObjUndoAction
)
601 // set merge flag, because a SdUndoGroupAction could have been inserted before
602 mpDocSh
->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction
, true );
603 mpBackgroundObjUndoAction
= 0;
606 // Objects can not be bigger than ViewSize
607 Size aPageSize
= mpDoc
->GetSdPage(0, ePageKind
)->GetSize();
608 Size aViewSize
= Size(aPageSize
.Width() * 3, aPageSize
.Height() * 2);
609 mpDoc
->SetMaxObjSize(aViewSize
);
611 // if necessary, we tell Preview the new context
612 mpDrawViewShell
->UpdatePreview( mpDrawViewShell
->GetActualPage() );
615 } // end of namespace sd
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */