LCOV - code coverage report
Current view: top level - sd/source/ui/func - fupage.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 267 0.0 %
Date: 2014-04-14 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include "fupage.hxx"
      21             : 
      22             : #include <sfx2/viewfrm.hxx>
      23             : 
      24             : // arrange Tab-Page
      25             : 
      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>
      44             : 
      45             : #include "glob.hrc"
      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>
      52             : 
      53             : #include "strings.hrc"
      54             : #include "sdpage.hxx"
      55             : #include "View.hxx"
      56             : #include "Window.hxx"
      57             : #include "pres.hxx"
      58             : #include "drawdoc.hxx"
      59             : #include "DrawDocShell.hxx"
      60             : #include "ViewShell.hxx"
      61             : #include "DrawViewShell.hxx"
      62             : #include "app.hrc"
      63             : #include "unchss.hxx"
      64             : #include "undoback.hxx"
      65             : #include "sdabstdlg.hxx"
      66             : #include "sdresid.hxx"
      67             : #include "sdundogr.hxx"
      68             : #include "helpids.h"
      69             : 
      70             : #include <boost/scoped_ptr.hpp>
      71             : 
      72             : namespace sd {
      73             : 
      74             : class Window;
      75             : 
      76             : // 50 cm 28350
      77             : // adapted from writer
      78             : #define MAXHEIGHT 28350
      79             : #define MAXWIDTH  28350
      80             : 
      81             : 
      82           0 : TYPEINIT1( FuPage, FuPoor );
      83             : 
      84           0 : void mergeItemSetsImpl( SfxItemSet& rTarget, const SfxItemSet& rSource )
      85             : {
      86           0 :     const sal_uInt16* pPtr = rSource.GetRanges();
      87             :     sal_uInt16 p1, p2;
      88           0 :     while( *pPtr )
      89             :     {
      90           0 :         p1 = pPtr[0];
      91           0 :         p2 = pPtr[1];
      92             : 
      93             :         // make ranges discret
      94           0 :         while(pPtr[2] && (pPtr[2] - p2 == 1))
      95             :         {
      96           0 :             p2 = pPtr[3];
      97           0 :             pPtr += 2;
      98             :         }
      99           0 :         rTarget.MergeRange( p1, p2 );
     100           0 :         pPtr += 2;
     101             :     }
     102             : 
     103           0 :     rTarget.Put(rSource);
     104           0 : }
     105             : 
     106           0 : FuPage::FuPage( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
     107             :                  SdDrawDocument* pDoc, SfxRequest& rReq )
     108             : :   FuPoor(pViewSh, pWin, pView, pDoc, rReq),
     109             :     mrReq(rReq),
     110           0 :     mpArgs( rReq.GetArgs() ),
     111             :     mpBackgroundObjUndoAction( 0 ),
     112             :     mbPageBckgrdDeleted( false ),
     113             :     mbMasterPage( false ),
     114             :     mbDisplayBackgroundTabPage( true ),
     115             :     mpPage(0),
     116           0 :     mpDrawViewShell(0)
     117             : {
     118           0 : }
     119             : 
     120           0 : rtl::Reference<FuPoor> FuPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
     121             : {
     122           0 :     rtl::Reference<FuPoor> xFunc( new FuPage( pViewSh, pWin, pView, pDoc, rReq ) );
     123           0 :     xFunc->DoExecute(rReq);
     124           0 :     return xFunc;
     125             : }
     126             : 
     127           0 : void FuPage::DoExecute( SfxRequest& )
     128             : {
     129           0 :     mpDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell);
     130             :     DBG_ASSERT( mpDrawViewShell, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
     131           0 :     if( mpDrawViewShell )
     132             :     {
     133           0 :         mbMasterPage = mpDrawViewShell->GetEditMode() == EM_MASTERPAGE;
     134           0 :         mbDisplayBackgroundTabPage = (mpDrawViewShell->GetPageKind() == PK_STANDARD);
     135           0 :         mpPage = mpDrawViewShell->getCurrentPage();
     136             :     }
     137             : 
     138           0 :     if( mpPage )
     139             :     {
     140             :         // if there are no arguments given, open the dialog
     141           0 :         if( !mpArgs )
     142             :         {
     143           0 :             mpView->SdrEndTextEdit();
     144           0 :             mpArgs = ExecuteDialog(mpWindow);
     145             :         }
     146             : 
     147             :         // if we now have arguments, apply them to current page
     148           0 :         if( mpArgs )
     149           0 :             ApplyItemSet( mpArgs );
     150             :     }
     151           0 : }
     152             : 
     153           0 : FuPage::~FuPage()
     154             : {
     155           0 :     delete mpBackgroundObjUndoAction;
     156           0 : }
     157             : 
     158           0 : void FuPage::Activate()
     159             : {
     160           0 : }
     161             : 
     162           0 : void FuPage::Deactivate()
     163             : {
     164           0 : }
     165             : 
     166           0 : const SfxItemSet* FuPage::ExecuteDialog( Window* pParent )
     167             : {
     168           0 :     if (!mpDrawViewShell)
     169           0 :         return NULL;
     170             : 
     171           0 :     PageKind ePageKind = mpDrawViewShell->GetPageKind();
     172             : 
     173           0 :     SfxItemSet aNewAttr(mpDoc->GetPool(),
     174           0 :                         mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
     175           0 :                         mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
     176             :                         SID_ATTR_PAGE, SID_ATTR_PAGE_BSP,
     177             :                         SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
     178             :                         SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
     179             :                         XATTR_FILL_FIRST, XATTR_FILL_LAST,
     180             :                         EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
     181           0 :                         0);
     182             : 
     183             : 
     184             :     // Retrieve additional data for dialog
     185             : 
     186           0 :     SvxShadowItem aShadowItem(SID_ATTR_BORDER_SHADOW);
     187           0 :     aNewAttr.Put( aShadowItem );
     188           0 :     SvxBoxItem aBoxItem( SID_ATTR_BORDER_OUTER );
     189           0 :     aNewAttr.Put( aBoxItem );
     190             : 
     191             :     aNewAttr.Put( SvxFrameDirectionItem(
     192           0 :         mpDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP,
     193           0 :         EE_PARA_WRITINGDIR ) );
     194             : 
     195             : 
     196             :     // Retrieve page-data for dialog
     197             : 
     198           0 :     SvxPageItem aPageItem( SID_ATTR_PAGE );
     199           0 :     aPageItem.SetDescName( mpPage->GetName() );
     200           0 :     aPageItem.SetPageUsage( (SvxPageUsage) SVX_PAGE_ALL );
     201           0 :     aPageItem.SetLandscape( mpPage->GetOrientation() == ORIENTATION_LANDSCAPE ? sal_True: sal_False );
     202           0 :     aPageItem.SetNumType( mpDoc->GetPageNumType() );
     203           0 :     aNewAttr.Put( aPageItem );
     204             : 
     205             :     // size
     206           0 :     maSize = mpPage->GetSize();
     207           0 :     SvxSizeItem aSizeItem( SID_ATTR_PAGE_SIZE, maSize );
     208           0 :     aNewAttr.Put( aSizeItem );
     209             : 
     210             :     // Max size
     211           0 :     SvxSizeItem aMaxSizeItem( SID_ATTR_PAGE_MAXSIZE, Size( MAXWIDTH, MAXHEIGHT ) );
     212           0 :     aNewAttr.Put( aMaxSizeItem );
     213             : 
     214             :     // paperbin
     215           0 :     SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, (const sal_uInt8)mpPage->GetPaperBin() );
     216           0 :     aNewAttr.Put( aPaperBinItem );
     217             : 
     218           0 :     SvxLRSpaceItem aLRSpaceItem( (sal_uInt16)mpPage->GetLftBorder(), (sal_uInt16)mpPage->GetRgtBorder(), 0, 0, mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE));
     219           0 :     aNewAttr.Put( aLRSpaceItem );
     220             : 
     221           0 :     SvxULSpaceItem aULSpaceItem( (sal_uInt16)mpPage->GetUppBorder(), (sal_uInt16)mpPage->GetLwrBorder(), mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
     222           0 :     aNewAttr.Put( aULSpaceItem );
     223             : 
     224             :     // Applikation
     225           0 :     bool bScale = mpDoc->GetDocumentType() != DOCUMENT_TYPE_DRAW;
     226           0 :     aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT1, bScale ? sal_True : sal_False ) );
     227             : 
     228           0 :     sal_Bool bFullSize = mpPage->IsMasterPage() ?
     229           0 :         mpPage->IsBackgroundFullSize() : ((SdPage&)mpPage->TRG_GetMasterPage()).IsBackgroundFullSize();
     230             : 
     231           0 :     aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT2, bFullSize ) );
     232             : 
     233             : 
     234             :     // Merge ItemSet for dialog
     235             : 
     236           0 :     const sal_uInt16* pPtr = aNewAttr.GetRanges();
     237           0 :     sal_uInt16 p1 = pPtr[0], p2 = pPtr[1];
     238           0 :     while(pPtr[2] && (pPtr[2] - p2 == 1))
     239             :     {
     240           0 :         p2 = pPtr[3];
     241           0 :         pPtr += 2;
     242             :     }
     243           0 :     SfxItemSet aMergedAttr( *aNewAttr.GetPool(), p1, p2 );
     244             : 
     245           0 :     mergeItemSetsImpl( aMergedAttr, aNewAttr );
     246             : 
     247           0 :     SdStyleSheet* pStyleSheet = mpPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
     248             : 
     249             :     // merge page background filling to the dialogs input set
     250           0 :     if( mbDisplayBackgroundTabPage )
     251             :     {
     252           0 :         if( mbMasterPage )
     253             :         {
     254           0 :             if(pStyleSheet)
     255           0 :                 mergeItemSetsImpl( aMergedAttr, pStyleSheet->GetItemSet() );
     256             :         }
     257             :         else
     258             :         {
     259             :             // Only this page, get attributes for background fill
     260           0 :             const SfxItemSet& rBackgroundAttributes = mpPage->getSdrPageProperties().GetItemSet();
     261             : 
     262           0 :             if(XFILL_NONE != ((const XFillStyleItem&)rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue())
     263             :             {
     264             :                 // page attributes are used, take them
     265           0 :                 aMergedAttr.Put(rBackgroundAttributes);
     266             :             }
     267             :             else
     268             :             {
     269           0 :                 if(pStyleSheet
     270           0 :                     && XFILL_NONE != ((const XFillStyleItem&)pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
     271             :                 {
     272             :                     // if the page has no fill style, use the settings from the
     273             :                     // background stylesheet (if used)
     274           0 :                     mergeItemSetsImpl(aMergedAttr, pStyleSheet->GetItemSet());
     275             :                 }
     276             :                 else
     277             :                 {
     278             :                     // no fill style from page, start with no fill style
     279           0 :                     aMergedAttr.Put(XFillStyleItem(XFILL_NONE));
     280             :                 }
     281             :             }
     282             :         }
     283             :     }
     284             : 
     285           0 :     boost::scoped_ptr< SfxItemSet > pTempSet;
     286             : 
     287           0 :     if( GetSlotID() == SID_SELECT_BACKGROUND )
     288             :     {
     289           0 :         SvxOpenGraphicDialog    aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
     290             : 
     291           0 :         if( aDlg.Execute() == GRFILTER_OK )
     292             :         {
     293           0 :             Graphic     aGraphic;
     294           0 :             int nError = aDlg.GetGraphic(aGraphic);
     295           0 :             if( nError == GRFILTER_OK )
     296             :             {
     297           0 :                 pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0) );
     298             : 
     299           0 :                 pTempSet->Put( XFillStyleItem( XFILL_BITMAP ) );
     300             : 
     301             :                 // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
     302           0 :                 SfxItemSet aMigrateSet( mpDoc->GetPool(), XATTR_FILLBITMAP, XATTR_FILLBITMAP );
     303           0 :                 aMigrateSet.Put(XFillBitmapItem(OUString("background"), aGraphic));
     304           0 :                 mpDoc->MigrateItemSet( &aMigrateSet, pTempSet.get(), NULL );
     305             : 
     306           0 :                 pTempSet->Put( XFillBmpStretchItem( true ));
     307           0 :                 pTempSet->Put( XFillBmpTileItem( false ));
     308           0 :             }
     309           0 :         }
     310             :     }
     311             :     else
     312             :     {
     313             :         // create the dialog
     314           0 :         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     315           0 :         boost::scoped_ptr<SfxAbstractTabDialog> pDlg( pFact ? pFact->CreateSdTabPageDialog(NULL, &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage ) : 0 );
     316           0 :         if( pDlg.get() && pDlg->Execute() == RET_OK )
     317           0 :             pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) );
     318             :     }
     319             : 
     320           0 :     if (pTempSet.get() && pStyleSheet)
     321             :     {
     322           0 :         pStyleSheet->AdjustToFontHeight(*pTempSet);
     323             : 
     324           0 :         if( mbDisplayBackgroundTabPage )
     325             :         {
     326             :             // if some fillstyle-items are not set in the dialog, then
     327             :             // try to use the items before
     328           0 :             sal_Bool bChanges = sal_False;
     329           0 :             for( sal_uInt16 i=XATTR_FILL_FIRST; i<XATTR_FILL_LAST; i++ )
     330             :             {
     331           0 :                 if( aMergedAttr.GetItemState( i ) != SFX_ITEM_DEFAULT )
     332             :                 {
     333           0 :                     if( pTempSet->GetItemState( i ) == SFX_ITEM_DEFAULT )
     334           0 :                         pTempSet->Put( aMergedAttr.Get( i ) );
     335             :                     else
     336           0 :                         if( aMergedAttr.GetItem( i ) != pTempSet->GetItem( i ) )
     337           0 :                             bChanges = sal_True;
     338             :                 }
     339             :             }
     340             : 
     341             :             // if the background for this page was set to invisible, the background-object has to be deleted, too.
     342           0 :             if( ( ( (XFillStyleItem*) pTempSet->GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ||
     343           0 :                 ( ( pTempSet->GetItemState( XATTR_FILLSTYLE ) == SFX_ITEM_DEFAULT ) &&
     344           0 :                     ( ( (XFillStyleItem*) aMergedAttr.GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ) )
     345           0 :                 mbPageBckgrdDeleted = true;
     346             : 
     347           0 :             bool bSetToAllPages = false;
     348             : 
     349             :             // Ask, whether the setting are for the background-page or for the current page
     350           0 :             if( !mbMasterPage && bChanges )
     351             :             {
     352             :                 // But don't ask in notice-view, because we can't change the background of
     353             :                 // notice-masterpage (at the moment)
     354           0 :                 if( ePageKind != PK_NOTES )
     355             :                 {
     356             :                     MessBox aQuestionBox (
     357             :                         pParent,
     358             :                         WB_YES_NO | WB_DEF_YES,
     359             :                         SD_RESSTR(STR_PAGE_BACKGROUND_TITLE),
     360           0 :                         SD_RESSTR(STR_PAGE_BACKGROUND_TXT) );
     361           0 :                     aQuestionBox.SetImage( QueryBox::GetStandardImage() );
     362           0 :                     bSetToAllPages = ( RET_YES == aQuestionBox.Execute() );
     363             :                 }
     364             : 
     365           0 :                 if( mbPageBckgrdDeleted )
     366             :                 {
     367             :                     mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
     368           0 :                         *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
     369             : 
     370           0 :                     if(!mpPage->IsMasterPage())
     371             :                     {
     372             :                         // on normal pages, switch off fill attribute usage
     373           0 :                         SdrPageProperties& rPageProperties = mpPage->getSdrPageProperties();
     374           0 :                         rPageProperties.ClearItem( XATTR_FILLBITMAP );
     375           0 :                         rPageProperties.ClearItem( XATTR_FILLGRADIENT );
     376           0 :                         rPageProperties.ClearItem( XATTR_FILLHATCH );
     377           0 :                         rPageProperties.PutItem(XFillStyleItem(XFILL_NONE));
     378             :                     }
     379             :                 }
     380             :             }
     381             :             /* Special treatment: reset the INVALIDS to
     382             :                NULL-Pointer (otherwise INVALIDs or pointer point
     383             :                to DefaultItems in the template; both would
     384             :                prevent the attribute inheritance) */
     385           0 :             pTempSet->ClearInvalidItems();
     386             : 
     387           0 :             if( mbMasterPage )
     388             :             {
     389           0 :                 StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyleSheet, &(*pTempSet.get()));
     390           0 :                 mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     391           0 :                 pStyleSheet->GetItemSet().Put( *(pTempSet.get()) );
     392           0 :                 sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() );
     393           0 :                 pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     394             :             }
     395           0 :             else if( bSetToAllPages )
     396             :             {
     397           0 :                 OUString aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
     398           0 :                 ::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
     399           0 :                 pUndoMgr->EnterListAction(aComment, aComment);
     400           0 :                 SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
     401           0 :                 pUndoGroup->SetComment(aComment);
     402             : 
     403             :                 //Set background on all master pages
     404           0 :                 sal_uInt16 nMasterPageCount = mpDoc->GetMasterSdPageCount(ePageKind);
     405           0 :                 for (sal_uInt16 i = 0; i < nMasterPageCount; ++i)
     406             :                 {
     407           0 :                     SdPage *pMasterPage = mpDoc->GetMasterSdPage(i, ePageKind);
     408             :                     SdStyleSheet *pStyle =
     409           0 :                         pMasterPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
     410             :                     StyleSheetUndoAction* pAction =
     411           0 :                         new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyle, &(*pTempSet.get()));
     412           0 :                     pUndoGroup->AddAction(pAction);
     413           0 :                     pStyle->GetItemSet().Put( *(pTempSet.get()) );
     414           0 :                     sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() );
     415           0 :                     pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
     416             :                 }
     417             : 
     418             :                 //Remove background from all pages to reset to the master bg
     419           0 :                 sal_uInt16 nPageCount(mpDoc->GetSdPageCount(ePageKind));
     420           0 :                 for(sal_uInt16 i=0; i<nPageCount; ++i)
     421             :                 {
     422           0 :                     SdPage *pPage = mpDoc->GetSdPage(i, ePageKind);
     423             : 
     424           0 :                     const SfxItemSet& rFillAttributes = pPage->getSdrPageProperties().GetItemSet();
     425           0 :                        if(XFILL_NONE != ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
     426             :                     {
     427           0 :                         SdBackgroundObjUndoAction *pBackgroundObjUndoAction = new SdBackgroundObjUndoAction(*mpDoc, *pPage, rFillAttributes);
     428           0 :                         pUndoGroup->AddAction(pBackgroundObjUndoAction);
     429             : 
     430           0 :                         SdrPageProperties& rPageProperties = pPage->getSdrPageProperties();
     431           0 :                         rPageProperties.ClearItem( XATTR_FILLBITMAP );
     432           0 :                         rPageProperties.ClearItem( XATTR_FILLGRADIENT );
     433           0 :                         rPageProperties.ClearItem( XATTR_FILLHATCH );
     434           0 :                         rPageProperties.PutItem(XFillStyleItem(XFILL_NONE));
     435             : 
     436           0 :                         pPage->ActionChanged();
     437             :                     }
     438             :                 }
     439             : 
     440           0 :                 pUndoMgr->AddUndoAction(pUndoGroup);
     441           0 :                 pUndoMgr->LeaveListAction();
     442             : 
     443             :             }
     444             : 
     445             :             // if background filling is set to master pages then clear from page set
     446           0 :             if( mbMasterPage || bSetToAllPages )
     447             :             {
     448           0 :                 for( sal_uInt16 nWhich = XATTR_FILL_FIRST; nWhich <= XATTR_FILL_LAST; nWhich++ )
     449             :                 {
     450           0 :                     pTempSet->ClearItem( nWhich );
     451             :                 }
     452           0 :                 pTempSet->Put(XFillStyleItem(XFILL_NONE));
     453             :             }
     454             : 
     455             :             const SfxPoolItem *pItem;
     456           0 :             if( SFX_ITEM_SET == pTempSet->GetItemState( EE_PARA_WRITINGDIR, false, &pItem ) )
     457             :             {
     458           0 :                 sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
     459           0 :                 mpDoc->SetDefaultWritingMode( nVal == FRMDIR_HORI_RIGHT_TOP ? ::com::sun::star::text::WritingMode_RL_TB : ::com::sun::star::text::WritingMode_LR_TB );
     460             :             }
     461             : 
     462           0 :             mpDoc->SetChanged(true);
     463             : 
     464             :             // BackgroundFill of Masterpage: no hard attributes allowed
     465           0 :             SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage();
     466             :             OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)");
     467           0 :             rUsedMasterPage.getSdrPageProperties().ClearItem();
     468             :             OSL_ENSURE(0 != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(),
     469             :                 "MasterPage without StyleSheet detected (!)");
     470             :         }
     471             : 
     472           0 :         aNewAttr.Put(*(pTempSet.get()));
     473           0 :         mrReq.Done( aNewAttr );
     474             : 
     475           0 :         return mrReq.GetArgs();
     476             :     }
     477             :     else
     478             :     {
     479           0 :         return 0;
     480           0 :     }
     481             : }
     482             : 
     483           0 : void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
     484             : {
     485           0 :     if( !pArgs )
     486           0 :         return;
     487             : 
     488             : 
     489             :     // Set new page-attributes
     490           0 :     PageKind ePageKind = mpDrawViewShell->GetPageKind();
     491             :     const SfxPoolItem*  pPoolItem;
     492           0 :     sal_Bool                bSetPageSizeAndBorder = sal_False;
     493           0 :     Size                aNewSize(maSize);
     494           0 :     sal_Int32               nLeft  = -1, nRight = -1, nUpper = -1, nLower = -1;
     495           0 :     sal_Bool                bScaleAll = sal_True;
     496           0 :     Orientation         eOrientation = mpPage->GetOrientation();
     497           0 :     SdPage*             pMasterPage = mpPage->IsMasterPage() ? mpPage : &(SdPage&)(mpPage->TRG_GetMasterPage());
     498           0 :     sal_Bool                bFullSize = pMasterPage->IsBackgroundFullSize();
     499           0 :     sal_uInt16              nPaperBin = mpPage->GetPaperBin();
     500             : 
     501           0 :     if( pArgs->GetItemState(SID_ATTR_PAGE, true, &pPoolItem) == SFX_ITEM_SET )
     502             :     {
     503           0 :         mpDoc->SetPageNumType(((const SvxPageItem*) pPoolItem)->GetNumType());
     504             : 
     505           0 :         eOrientation = ((const SvxPageItem*) pPoolItem)->IsLandscape() ?
     506           0 :             ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT;
     507             : 
     508           0 :         if( mpPage->GetOrientation() != eOrientation )
     509           0 :             bSetPageSizeAndBorder = sal_True;
     510             : 
     511           0 :         mpDrawViewShell->ResetActualPage();
     512             :     }
     513             : 
     514           0 :     if( pArgs->GetItemState(SID_ATTR_PAGE_SIZE, true, &pPoolItem) == SFX_ITEM_SET )
     515             :     {
     516           0 :         aNewSize = ((const SvxSizeItem*) pPoolItem)->GetSize();
     517             : 
     518           0 :         if( mpPage->GetSize() != aNewSize )
     519           0 :             bSetPageSizeAndBorder = sal_True;
     520             :     }
     521             : 
     522           0 :     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
     523           0 :                             true, &pPoolItem) == SFX_ITEM_SET )
     524             :     {
     525           0 :         nLeft = ((const SvxLRSpaceItem*) pPoolItem)->GetLeft();
     526           0 :         nRight = ((const SvxLRSpaceItem*) pPoolItem)->GetRight();
     527             : 
     528           0 :         if( mpPage->GetLftBorder() != nLeft || mpPage->GetRgtBorder() != nRight )
     529           0 :             bSetPageSizeAndBorder = sal_True;
     530             : 
     531             :     }
     532             : 
     533           0 :     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
     534           0 :                             true, &pPoolItem) == SFX_ITEM_SET )
     535             :     {
     536           0 :         nUpper = ((const SvxULSpaceItem*) pPoolItem)->GetUpper();
     537           0 :         nLower = ((const SvxULSpaceItem*) pPoolItem)->GetLower();
     538             : 
     539           0 :         if( mpPage->GetUppBorder() != nUpper || mpPage->GetLwrBorder() != nLower )
     540           0 :             bSetPageSizeAndBorder = sal_True;
     541             :     }
     542             : 
     543           0 :     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT1), true, &pPoolItem) == SFX_ITEM_SET )
     544             :     {
     545           0 :         bScaleAll = ((const SfxBoolItem*) pPoolItem)->GetValue();
     546             :     }
     547             : 
     548           0 :     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT2), true, &pPoolItem) == SFX_ITEM_SET )
     549             :     {
     550           0 :         bFullSize = ((const SfxBoolItem*) pPoolItem)->GetValue();
     551             : 
     552           0 :         if(pMasterPage->IsBackgroundFullSize() != bFullSize )
     553           0 :             bSetPageSizeAndBorder = sal_True;
     554             :     }
     555             : 
     556             :     // Paper Bin
     557           0 :     if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_PAPERBIN), true, &pPoolItem) == SFX_ITEM_SET )
     558             :     {
     559           0 :         nPaperBin = ((const SvxPaperBinItem*) pPoolItem)->GetValue();
     560             : 
     561           0 :         if( mpPage->GetPaperBin() != nPaperBin )
     562           0 :             bSetPageSizeAndBorder = sal_True;
     563             :     }
     564             : 
     565           0 :     if (nLeft == -1 && nUpper != -1)
     566             :     {
     567           0 :         bSetPageSizeAndBorder = sal_True;
     568           0 :         nLeft  = mpPage->GetLftBorder();
     569           0 :         nRight = mpPage->GetRgtBorder();
     570             :     }
     571           0 :     else if (nLeft != -1 && nUpper == -1)
     572             :     {
     573           0 :         bSetPageSizeAndBorder = sal_True;
     574           0 :         nUpper = mpPage->GetUppBorder();
     575           0 :         nLower = mpPage->GetLwrBorder();
     576             :     }
     577             : 
     578           0 :     if( bSetPageSizeAndBorder || !mbMasterPage )
     579           0 :         mpDrawViewShell->SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize );
     580             : 
     581             : 
     582             : 
     583             :     // if bMasterPage==sal_False then create a background-object for this page with the
     584             :     // properties set in the dialog before, but if mbPageBckgrdDeleted==sal_True then
     585             :     // the background of this page was set to invisible, so it would be a mistake
     586             :     // to create a new background-object for this page !
     587             : 
     588             : 
     589           0 :     if( mbDisplayBackgroundTabPage )
     590             :     {
     591           0 :         if( !mbMasterPage && !mbPageBckgrdDeleted )
     592             :         {
     593             :             // Only this page
     594           0 :             delete mpBackgroundObjUndoAction;
     595             :             mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
     596           0 :                 *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
     597           0 :             SfxItemSet aSet( *pArgs );
     598           0 :             sdr::properties::CleanupFillProperties(aSet);
     599           0 :             mpPage->getSdrPageProperties().ClearItem();
     600           0 :             mpPage->getSdrPageProperties().PutItemSet(aSet);
     601             :         }
     602             :     }
     603             : 
     604             :     // add undo action for background object
     605           0 :     if( mpBackgroundObjUndoAction )
     606             :     {
     607             :         // set merge flag, because a SdUndoGroupAction could have been inserted before
     608           0 :         mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction, true );
     609           0 :         mpBackgroundObjUndoAction = 0;
     610             :     }
     611             : 
     612             :     // Objects can not be bigger than ViewSize
     613           0 :     Size aPageSize = mpDoc->GetSdPage(0, ePageKind)->GetSize();
     614           0 :     Size aViewSize = Size(aPageSize.Width() * 3, aPageSize.Height() * 2);
     615           0 :     mpDoc->SetMaxObjSize(aViewSize);
     616             : 
     617             :     // if necessary, we tell Preview the new context
     618           0 :     mpDrawViewShell->UpdatePreview( mpDrawViewShell->GetActualPage() );
     619             : }
     620             : 
     621           0 : } // end of namespace sd
     622             : 
     623             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10