LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - drviews3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 53 485 10.9 %
Date: 2013-07-09 Functions: 4 9 44.4 %
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             : 
      21             : #include "DrawViewShell.hxx"
      22             : 
      23             : #include <sfx2/viewfrm.hxx>
      24             : #include <editeng/eeitem.hxx>
      25             : #include <editeng/tstpitem.hxx>
      26             : #include <editeng/lrspitem.hxx>
      27             : #include <editeng/protitem.hxx>
      28             : #include <editeng/frmdiritem.hxx>
      29             : #include <editeng/adjustitem.hxx>
      30             : #include <svx/ruler.hxx>
      31             : #include <editeng/numitem.hxx>
      32             : #include <svx/rulritem.hxx>
      33             : #include <sfx2/zoomitem.hxx>
      34             : #include <svx/svxids.hrc>
      35             : #include <svx/svdpagv.hxx>
      36             : #include <sfx2/request.hxx>
      37             : #include <sfx2/dispatch.hxx>
      38             : #include <tools/urlobj.hxx>
      39             : #include <svl/aeitem.hxx>
      40             : #include <svl/eitem.hxx>
      41             : #include <svl/rectitem.hxx>
      42             : #include <svl/stritem.hxx>
      43             : #include <svx/svdoole2.hxx>
      44             : #include <svl/itempool.hxx>
      45             : #include <svl/ptitem.hxx>
      46             : #include <basic/sbstar.hxx>
      47             : #include <basic/sberrors.hxx>
      48             : #include <svx/fmshell.hxx>
      49             : #include <svx/f3dchild.hxx>
      50             : #include <svx/float3d.hxx>
      51             : #include "optsitem.hxx"
      52             : 
      53             : #include "app.hrc"
      54             : #include "glob.hrc"
      55             : #include "strings.hrc"
      56             : #include "res_bmp.hrc"
      57             : 
      58             : #include "sdundogr.hxx"
      59             : #include "undopage.hxx"
      60             : #include "glob.hxx"
      61             : #include "sdmod.hxx"
      62             : #include "fupoor.hxx"
      63             : #include "slideshow.hxx"
      64             : #ifndef SD_FRAME_VIEW
      65             : #include "FrameView.hxx"
      66             : #endif
      67             : #include "sdpage.hxx"
      68             : #include "Window.hxx"
      69             : #include "sdresid.hxx"
      70             : #include "drawview.hxx"
      71             : #include "drawdoc.hxx"
      72             : #include "Ruler.hxx"
      73             : #include "DrawDocShell.hxx"
      74             : #include "headerfooterdlg.hxx"
      75             : #include "masterlayoutdlg.hxx"
      76             : #include "sdabstdlg.hxx"
      77             : #include <sfx2/ipclient.hxx>
      78             : #include <tools/diagnose_ex.h>
      79             : #include "ViewShellBase.hxx"
      80             : #include "FormShellManager.hxx"
      81             : #include "LayerTabBar.hxx"
      82             : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      83             : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      84             : #include <com/sun/star/drawing/framework/XConfiguration.hpp>
      85             : #include <com/sun/star/frame/XFrame.hpp>
      86             : #include <editeng/lspcitem.hxx>
      87             : #include <editeng/ulspitem.hxx>
      88             : using namespace ::com::sun::star::uno;
      89             : using namespace ::com::sun::star::drawing::framework;
      90             : using ::com::sun::star::frame::XFrame;
      91             : using ::com::sun::star::frame::XController;
      92             : 
      93             : namespace sd {
      94             : 
      95             : /**
      96             :  * handle SfxRequests for controller
      97             :  */
      98          66 : void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
      99             : {
     100             :     // except a page switch and jumps to bookmarks, nothing is executed during
     101             :     // a slide show
     102         132 :     if( HasCurrentFunction(SID_PRESENTATION) &&
     103          66 :         rReq.GetSlot() != SID_SWITCHPAGE &&
     104           0 :         rReq.GetSlot() != SID_JUMPTOMARK)
     105           0 :         return;
     106             : 
     107          66 :     CheckLineTo (rReq);
     108             : 
     109             :     // End text edit mode for some requests.
     110          66 :     sal_uInt16 nSlot = rReq.GetSlot();
     111          66 :     switch (nSlot)
     112             :     {
     113             :         case SID_OUTPUT_QUALITY_COLOR:
     114             :         case SID_OUTPUT_QUALITY_GRAYSCALE:
     115             :         case SID_OUTPUT_QUALITY_BLACKWHITE:
     116             :         case SID_OUTPUT_QUALITY_CONTRAST:
     117             :             // Do nothing.
     118           0 :             break;
     119             :         default:
     120          66 :             if ( mpDrawView->IsTextEdit() )
     121             :             {
     122           0 :                 mpDrawView->SdrEndTextEdit();
     123             :             }
     124             :     }
     125             : 
     126             :     //  sal_uInt16 nSlot = rReq.GetSlot();
     127          66 :     switch (nSlot)
     128             :     {
     129             :         case SID_SWITCHPAGE:  // BASIC
     130             :         {
     131             :             // switch page in running slide show
     132          66 :             if(SlideShow::IsRunning(GetViewShellBase()) && rReq.GetArgs())
     133             :             {
     134           0 :                 SFX_REQUEST_ARG(rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
     135           0 :                 SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32)((pWhatPage->GetValue()-1)>>1));
     136             :             }
     137             :             else
     138             :             {
     139          66 :                 const SfxItemSet *pArgs = rReq.GetArgs ();
     140          66 :                 sal_uInt16 nSelectedPage = 0;
     141             : 
     142          66 :                 if (! pArgs)
     143             :                 {
     144          66 :                     nSelectedPage = maTabControl.GetCurPageId() - 1;
     145             :                 }
     146           0 :                 else if (pArgs->Count () == 2)
     147             :                 {
     148           0 :                     SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, sal_False);
     149           0 :                     SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
     150             : 
     151           0 :                     sal_Int32 nWhatPage = (sal_Int32)pWhatPage->GetValue ();
     152           0 :                     sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
     153           0 :                     if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
     154             :                     {
     155             : #ifndef DISABLE_SCRIPTING
     156           0 :                         StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
     157             : #endif
     158           0 :                         rReq.Ignore ();
     159           0 :                         break;
     160             :                     }
     161           0 :                     else if (meEditMode != EM_MASTERPAGE)
     162             :                     {
     163           0 :                         if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind)))
     164             :                         {
     165             : #ifndef DISABLE_SCRIPTING
     166           0 :                             StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
     167             : #endif
     168           0 :                             rReq.Ignore ();
     169           0 :                             break;
     170             :                         }
     171             : 
     172           0 :                         nSelectedPage = (short) nWhatPage;
     173           0 :                         mePageKind    = (PageKind) nWhatKind;
     174             :                     }
     175             :                 }
     176             :                 else
     177             :                 {
     178             : #ifndef DISABLE_SCRIPTING
     179           0 :                     StarBASIC::FatalError (SbERR_WRONG_ARGS);
     180             : #endif
     181           0 :                     rReq.Ignore ();
     182           0 :                     break;
     183             :                 }
     184             : 
     185             : 
     186          66 :                 if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED))
     187           0 :                     GetDocSh()->SetModified();
     188             : 
     189          66 :                 SwitchPage(nSelectedPage);
     190             : 
     191          66 :                 if(HasCurrentFunction(SID_BEZIER_EDIT))
     192           0 :                     GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
     193             : 
     194          66 :                 Invalidate();
     195          66 :                 InvalidateWindows();
     196          66 :                 rReq.Done ();
     197             :             }
     198          66 :             break;
     199             :         }
     200             : 
     201             :         case SID_SWITCHLAYER:  // BASIC
     202             :         {
     203           0 :             const SfxItemSet *pArgs = rReq.GetArgs ();
     204           0 :             sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
     205             : 
     206           0 :             if( pArgs && pArgs->Count () == 1)
     207             :             {
     208           0 :                 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
     209           0 :                 if( pWhatLayer )
     210           0 :                     nCurPage = (short) pWhatLayer->GetValue ();
     211             :             }
     212             : 
     213           0 :             mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
     214           0 :             Invalidate();
     215           0 :             rReq.Done ();
     216             : 
     217           0 :             break;
     218             :         }
     219             : 
     220             :         case SID_PAGEMODE:  // BASIC
     221             :         {
     222             : 
     223           0 :             const SfxItemSet *pArgs = rReq.GetArgs ();
     224             : 
     225           0 :             if ( pArgs && pArgs->Count () == 2)
     226             :             {
     227           0 :                 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
     228           0 :                 SFX_REQUEST_ARG (rReq, pWhatKind, SfxUInt32Item, ID_VAL_WHATKIND, sal_False);
     229             : 
     230           0 :                 sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue ();
     231           0 :                 if (CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT))
     232             :                 {
     233           0 :                     mbIsLayerModeActive = pIsActive->GetValue ();
     234           0 :                     mePageKind = (PageKind) nWhatKind;
     235             :                 }
     236             :             }
     237             : 
     238             :             // turn on default layer of page
     239           0 :             mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT) ) );
     240             : 
     241           0 :             ChangeEditMode(EM_PAGE, mbIsLayerModeActive);
     242             : 
     243           0 :             Invalidate();
     244           0 :             rReq.Done ();
     245             : 
     246           0 :             break;
     247             :         }
     248             : 
     249             :         case SID_LAYERMODE:  // BASIC
     250             :         {
     251           0 :             const SfxItemSet *pArgs = rReq.GetArgs ();
     252             : 
     253           0 :             if ( pArgs && pArgs->Count () == 2)
     254             :             {
     255           0 :                 SFX_REQUEST_ARG (rReq, pWhatLayerMode, SfxBoolItem, ID_VAL_ISACTIVE, sal_False);
     256           0 :                 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
     257             : 
     258           0 :                 sal_Int32 nWhatLayer = (sal_Int32)pWhatLayer->GetValue ();
     259           0 :                 if (CHECK_RANGE (EM_PAGE, nWhatLayer, EM_MASTERPAGE))
     260             :                 {
     261           0 :                     mbIsLayerModeActive = pWhatLayerMode->GetValue ();
     262           0 :                     meEditMode = (EditMode) nWhatLayer;
     263             :                 }
     264             :             }
     265             : 
     266           0 :             ChangeEditMode(meEditMode, !mbIsLayerModeActive);
     267             : 
     268           0 :             Invalidate();
     269           0 :             rReq.Done ();
     270             : 
     271           0 :             break;
     272             :         }
     273             : 
     274             :         case SID_HEADER_AND_FOOTER:
     275             :         case SID_INSERT_PAGE_NUMBER:
     276             :         case SID_INSERT_DATE_TIME:
     277             :         {
     278           0 :             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     279           0 :             AbstractHeaderFooterDialog* pDlg = pFact ? pFact->CreateHeaderFooterDialog( (::ViewShell*)this, GetActiveWindow(), GetDoc(), mpActualPage ) : 0;
     280           0 :             if( pDlg )
     281             :             {
     282           0 :                 pDlg->Execute();
     283           0 :                 delete pDlg;
     284             : 
     285           0 :                 GetActiveWindow()->Invalidate();
     286           0 :                 UpdatePreview( mpActualPage );
     287             :             }
     288             : 
     289           0 :             Invalidate();
     290           0 :             rReq.Done ();
     291             : 
     292           0 :             break;
     293             :         }
     294             : 
     295             :         case SID_MASTER_LAYOUTS:
     296             :         {
     297           0 :             SdPage* pPage = GetActualPage();
     298           0 :             if (meEditMode == EM_MASTERPAGE)
     299             :                 // Use the master page of the current page.
     300           0 :                 pPage = static_cast<SdPage*>(&pPage->TRG_GetMasterPage());
     301             : 
     302           0 :             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     303           0 :             VclAbstractDialog* pDlg = pFact ? pFact->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage ) : 0;
     304           0 :             if( pDlg )
     305             :             {
     306           0 :                 pDlg->Execute();
     307           0 :                 delete pDlg;
     308           0 :                 Invalidate();
     309             :             }
     310           0 :             rReq.Done ();
     311           0 :             break;
     312             :         }
     313             :         case SID_OBJECTRESIZE:
     314             :         {
     315             :             // The server likes to change the client size
     316             :             OSL_ASSERT (GetViewShell()!=NULL);
     317           0 :             SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient();
     318             : 
     319           0 :             if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
     320             :             {
     321             :                 const SfxRectangleItem& rRect =
     322           0 :                     (SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE);
     323           0 :                 Rectangle aRect( GetActiveWindow()->PixelToLogic( rRect.GetValue() ) );
     324             : 
     325           0 :                 if ( mpDrawView->AreObjectsMarked() )
     326             :                 {
     327           0 :                     const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
     328             : 
     329           0 :                     if (rMarkList.GetMarkCount() == 1)
     330             :                     {
     331           0 :                         SdrMark* pMark = rMarkList.GetMark(0);
     332           0 :                         SdrObject* pObj = pMark->GetMarkedSdrObj();
     333             : 
     334           0 :                         SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( pObj );
     335           0 :                         if(pOle2Obj)
     336             :                         {
     337           0 :                             if( pOle2Obj->GetObjRef().is() )
     338             :                             {
     339           0 :                                 pOle2Obj->SetLogicRect(aRect);
     340             :                             }
     341             :                         }
     342             :                     }
     343             :                 }
     344             :             }
     345           0 :             rReq.Ignore ();
     346           0 :             break;
     347             :         }
     348             : 
     349             :         case SID_RELOAD:
     350             :         {
     351           0 :             sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
     352           0 :             SfxViewFrame* pFrame = GetViewFrame();
     353             : 
     354             :             try
     355             :             {
     356           0 :                 Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW );
     357             : 
     358             :                 // Save the current configuration of panes and views.
     359             :                 Reference<XControllerManager> xControllerManager (
     360           0 :                     GetViewShellBase().GetController(), UNO_QUERY_THROW);
     361             :                 Reference<XConfigurationController> xConfigurationController (
     362           0 :                     xControllerManager->getConfigurationController(), UNO_QUERY_THROW );
     363             :                 Reference<XConfiguration> xConfiguration (
     364           0 :                     xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW );
     365             : 
     366           0 :                 SfxChildWindow* pWindow = pFrame->GetChildWindow(nId);
     367           0 :                 if(pWindow)
     368             :                 {
     369           0 :                     Svx3DWin* p3DWin = (Svx3DWin*)(pWindow->GetWindow());
     370           0 :                     if(p3DWin)
     371           0 :                         p3DWin->DocumentReload();
     372             :                 }
     373             : 
     374             :                 // normal forwarding to ViewFrame for execution
     375           0 :                 GetViewFrame()->ExecuteSlot(rReq);
     376             : 
     377             :                 // From here on we must cope with this object and the frame already being
     378             :                 // deleted.  Do not call any methods or use data members.
     379           0 :                 Reference<XController> xController( xFrame->getController(), UNO_SET_THROW );
     380             : 
     381             :                 // Restore the configuration.
     382           0 :                 xControllerManager = Reference<XControllerManager>( xController, UNO_QUERY_THROW);
     383           0 :                 xConfigurationController = Reference<XConfigurationController>(
     384           0 :                     xControllerManager->getConfigurationController());
     385           0 :                 if ( ! xConfigurationController.is())
     386           0 :                     throw RuntimeException();
     387           0 :                 xConfigurationController->restoreConfiguration(xConfiguration);
     388             :             }
     389           0 :             catch (RuntimeException&)
     390             :             {
     391             :                 DBG_UNHANDLED_EXCEPTION();
     392             :             }
     393             : 
     394             :             // We have to return immediately to avoid accessing this object.
     395           0 :             return;
     396             :         }
     397             : 
     398             :         case SID_JUMPTOMARK:
     399             :         {
     400           0 :             if( rReq.GetArgs() )
     401             :             {
     402           0 :                 SFX_REQUEST_ARG(rReq, pBookmark, SfxStringItem, SID_JUMPTOMARK, sal_False);
     403             : 
     404           0 :                 if (pBookmark)
     405             :                 {
     406           0 :                     OUString sBookmark(INetURLObject::decode(pBookmark->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET));
     407             : 
     408           0 :                     rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     409           0 :                     if(xSlideshow.is() && xSlideshow->isRunning())
     410             :                     {
     411           0 :                         xSlideshow->jumpToBookmark(sBookmark);
     412             :                     }
     413             :                     else
     414             :                     {
     415           0 :                         GotoBookmark(sBookmark);
     416           0 :                     }
     417             :                 }
     418             :             }
     419           0 :             rReq.Done();
     420           0 :             break;
     421             :         }
     422             : 
     423             :         case SID_OUTPUT_QUALITY_COLOR:
     424             :         case SID_OUTPUT_QUALITY_GRAYSCALE:
     425             :         case SID_OUTPUT_QUALITY_BLACKWHITE:
     426             :         case SID_OUTPUT_QUALITY_CONTRAST:
     427             :         {
     428           0 :             ExecReq( rReq );
     429           0 :             break;
     430             :         }
     431             : 
     432             :         case SID_MAIL_SCROLLBODY_PAGEDOWN:
     433             :         {
     434           0 :             ExecReq( rReq );
     435           0 :             break;
     436             :         }
     437             : 
     438             :         case SID_ATTR_YEAR2000:
     439             :         {
     440           0 :             FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     441           0 :             if (pFormShell != NULL)
     442             :             {
     443             :                 const SfxPoolItem* pItem;
     444           0 :                 if (rReq.GetArgs()->GetItemState(
     445           0 :                     SID_ATTR_YEAR2000, sal_True, &pItem) == SFX_ITEM_SET)
     446             :                     pFormShell->SetY2KState (
     447           0 :                         static_cast<const SfxUInt16Item*>(pItem)->GetValue());
     448             :             }
     449             : 
     450           0 :             rReq.Done();
     451             :         }
     452           0 :         break;
     453             : 
     454             :         case SID_OPT_LOCALE_CHANGED:
     455             :         {
     456           0 :             GetActiveWindow()->Invalidate();
     457           0 :             UpdatePreview( mpActualPage );
     458           0 :             rReq.Done();
     459             :         }
     460             : 
     461             :         default:
     462           0 :         break;
     463             :     }
     464             : }
     465             : 
     466             : 
     467           0 : void  DrawViewShell::ExecRuler(SfxRequest& rReq)
     468             : {
     469             :     // nothing is executed during a slide show!
     470           0 :     if(HasCurrentFunction(SID_PRESENTATION))
     471           0 :         return;
     472             : 
     473           0 :     CheckLineTo (rReq);
     474             : 
     475           0 :     const SfxItemSet* pArgs = rReq.GetArgs();
     476           0 :     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
     477           0 :     Size aPageSize = mpActualPage->GetSize();
     478           0 :     Size aViewSize = GetActiveWindow()->GetViewSize();
     479           0 :     SdUndoGroup* pUndoGroup = NULL;
     480             : 
     481           0 :     if ( rReq.GetSlot() == SID_ATTR_LONG_LRSPACE ||
     482           0 :          rReq.GetSlot() == SID_ATTR_LONG_ULSPACE )
     483             :     {
     484           0 :         pUndoGroup = new SdUndoGroup(GetDoc());
     485           0 :         String aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
     486           0 :         pUndoGroup->SetComment(aString);
     487             :     }
     488             : 
     489           0 :     switch ( rReq.GetSlot() )
     490             :     {
     491             :         case SID_ATTR_LONG_LRSPACE:
     492             :         {
     493             :             const SvxLongLRSpaceItem& rLRSpace = (const SvxLongLRSpaceItem&)
     494           0 :                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
     495             : 
     496           0 :             if( mpDrawView->IsTextEdit() )
     497             :             {
     498           0 :                 Rectangle aRect = maMarkRect;
     499           0 :                 aRect.SetPos(aRect.TopLeft() + aPagePos);
     500           0 :                 aRect.Left()  = rLRSpace.GetLeft();
     501           0 :                 aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
     502           0 :                 aRect.SetPos(aRect.TopLeft() - aPagePos);
     503           0 :                 if ( aRect != maMarkRect)
     504             :                 {
     505           0 :                     mpDrawView->SetAllMarkedRect(aRect);
     506           0 :                     maMarkRect = mpDrawView->GetAllMarkedRect();
     507           0 :                     Invalidate( SID_RULER_OBJECT );
     508             :                 }
     509             :             }
     510             :             else
     511             :             {
     512           0 :                 long nLeft = std::max(0L, rLRSpace.GetLeft() - aPagePos.X());
     513           0 :                 long nRight = std::max(0L, rLRSpace.GetRight() + aPagePos.X() +
     514           0 :                                       aPageSize.Width() - aViewSize.Width());
     515             : 
     516           0 :                 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
     517             :                 sal_uInt16 i;
     518           0 :                 for ( i = 0; i < nPageCnt; i++)
     519             :                 {
     520           0 :                     SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
     521           0 :                     SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
     522             :                                             pPage,
     523           0 :                                             pPage->GetLftBorder(),
     524           0 :                                             pPage->GetRgtBorder(),
     525           0 :                                             nLeft, nRight);
     526           0 :                     pUndoGroup->AddAction(pUndo);
     527           0 :                     pPage->SetLftBorder(nLeft);
     528           0 :                     pPage->SetRgtBorder(nRight);
     529             :                 }
     530           0 :                 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
     531             : 
     532           0 :                 for (i = 0; i < nPageCnt; i++)
     533             :                 {
     534           0 :                     SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
     535           0 :                     SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
     536             :                                             pPage,
     537           0 :                                             pPage->GetLftBorder(),
     538           0 :                                             pPage->GetRgtBorder(),
     539           0 :                                             nLeft, nRight);
     540           0 :                     pUndoGroup->AddAction(pUndo);
     541           0 :                     pPage->SetLftBorder(nLeft);
     542           0 :                     pPage->SetRgtBorder(nRight);
     543             :                 }
     544           0 :                 InvalidateWindows();
     545             :             }
     546           0 :             break;
     547             :         }
     548             :         case SID_ATTR_LONG_ULSPACE:
     549             :         {
     550             :             const SvxLongULSpaceItem& rULSpace = (const SvxLongULSpaceItem&)
     551           0 :                     pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
     552             : 
     553           0 :             if( mpDrawView->IsTextEdit() )
     554             :             {
     555           0 :                 Rectangle aRect = maMarkRect;
     556           0 :                 aRect.SetPos(aRect.TopLeft() + aPagePos);
     557           0 :                 aRect.Top()  = rULSpace.GetUpper();
     558           0 :                 aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
     559           0 :                 aRect.SetPos(aRect.TopLeft() - aPagePos);
     560             : 
     561           0 :                 if ( aRect != maMarkRect)
     562             :                 {
     563           0 :                     mpDrawView->SetAllMarkedRect(aRect);
     564           0 :                     maMarkRect = mpDrawView->GetAllMarkedRect();
     565           0 :                     Invalidate( SID_RULER_OBJECT );
     566             :                 }
     567             :             }
     568             :             else
     569             :             {
     570           0 :                 long nUpper = std::max(0L, rULSpace.GetUpper() - aPagePos.Y());
     571           0 :                 long nLower = std::max(0L, rULSpace.GetLower() + aPagePos.Y() +
     572           0 :                                       aPageSize.Height() - aViewSize.Height());
     573             : 
     574           0 :                 sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
     575             :                 sal_uInt16 i;
     576           0 :                 for ( i = 0; i < nPageCnt; i++)
     577             :                 {
     578           0 :                     SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
     579           0 :                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
     580             :                                             pPage,
     581           0 :                                             pPage->GetUppBorder(),
     582           0 :                                             pPage->GetLwrBorder(),
     583           0 :                                             nUpper, nLower);
     584           0 :                     pUndoGroup->AddAction(pUndo);
     585           0 :                     pPage->SetUppBorder(nUpper);
     586           0 :                     pPage->SetLwrBorder(nLower);
     587             :                 }
     588           0 :                 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
     589             : 
     590           0 :                 for (i = 0; i < nPageCnt; i++)
     591             :                 {
     592           0 :                     SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
     593           0 :                     SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
     594             :                                             pPage,
     595           0 :                                             pPage->GetUppBorder(),
     596           0 :                                             pPage->GetLwrBorder(),
     597           0 :                                             nUpper, nLower);
     598           0 :                     pUndoGroup->AddAction(pUndo);
     599           0 :                     pPage->SetUppBorder(nUpper);
     600           0 :                     pPage->SetLwrBorder(nLower);
     601             :                 }
     602           0 :                 InvalidateWindows();
     603             :             }
     604           0 :             break;
     605             :         }
     606             : 
     607             :         case SID_RULER_OBJECT:
     608             :         {
     609           0 :             Rectangle aRect = maMarkRect;
     610           0 :             aRect.SetPos(aRect.TopLeft() + aPagePos);
     611             : 
     612             :             const SvxObjectItem& rOI = (const SvxObjectItem&)
     613           0 :                     pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT));
     614             : 
     615           0 :             if ( rOI.GetStartX() != rOI.GetEndX() )
     616             :             {
     617           0 :                 aRect.Left()  = rOI.GetStartX();
     618           0 :                 aRect.Right() = rOI.GetEndX();
     619             :             }
     620           0 :             if ( rOI.GetStartY() != rOI.GetEndY() )
     621             :             {
     622           0 :                 aRect.Top()    = rOI.GetStartY();
     623           0 :                 aRect.Bottom() = rOI.GetEndY();
     624             :             }
     625           0 :             aRect.SetPos(aRect.TopLeft() - aPagePos);
     626           0 :             if ( aRect != maMarkRect)
     627             :             {
     628           0 :                 mpDrawView->SetAllMarkedRect(aRect);
     629           0 :                 maMarkRect = mpDrawView->GetAllMarkedRect();
     630           0 :                 Invalidate( SID_RULER_OBJECT );
     631             :             }
     632           0 :             break;
     633             :         }
     634             : 
     635             :         case SID_ATTR_TABSTOP:
     636             :         {
     637           0 :             if( mpDrawView->IsTextEdit() )
     638             :             {
     639             :                 const SvxTabStopItem& rItem = (const SvxTabStopItem&)
     640           0 :                             pArgs->Get( EE_PARA_TABS );
     641             : 
     642           0 :                 SfxItemSet aEditAttr( GetPool(), EE_PARA_TABS, EE_PARA_TABS );
     643             : 
     644           0 :                 aEditAttr.Put( rItem );
     645           0 :                 mpDrawView->SetAttributes( aEditAttr );
     646             : 
     647           0 :                 Invalidate(SID_ATTR_TABSTOP);
     648             :             }
     649           0 :             break;
     650             :         }
     651             : 
     652             :         case SID_ATTR_PARA_LINESPACE:
     653             :         {
     654           0 :             sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE;
     655             :             SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get(
     656           0 :                 GetPool().GetWhich(nSlot));
     657             : 
     658           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
     659           0 :             aParaLineSP.SetWhich( EE_PARA_SBL );
     660             : 
     661           0 :             aEditAttr.Put( aParaLineSP );
     662           0 :             mpDrawView->SetAttributes( aEditAttr );
     663             : 
     664           0 :             Invalidate(SID_ATTR_PARA_LINESPACE);
     665             :         }
     666           0 :         break;
     667             :         case SID_ATTR_PARA_ADJUST_LEFT:
     668             :         {
     669           0 :             SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
     670           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
     671             : 
     672           0 :             aEditAttr.Put( aItem );
     673           0 :             mpDrawView->SetAttributes( aEditAttr );
     674             : 
     675           0 :             Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
     676             :         }
     677           0 :         break;
     678             :         case SID_ATTR_PARA_ADJUST_CENTER:
     679             :         {
     680           0 :             SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST );
     681           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
     682             : 
     683           0 :             aEditAttr.Put( aItem );
     684           0 :             mpDrawView->SetAttributes( aEditAttr );
     685             : 
     686           0 :             Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
     687             :         }
     688           0 :         break;
     689             :         case SID_ATTR_PARA_ADJUST_RIGHT:
     690             :         {
     691           0 :             SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST );
     692           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
     693             : 
     694           0 :             aEditAttr.Put( aItem );
     695           0 :             mpDrawView->SetAttributes( aEditAttr );
     696             : 
     697           0 :             Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
     698             :         }
     699           0 :         break;
     700             :         case SID_ATTR_PARA_ADJUST_BLOCK:
     701             :         {
     702           0 :             SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST );
     703           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST );
     704             : 
     705           0 :             aEditAttr.Put( aItem );
     706           0 :             mpDrawView->SetAttributes( aEditAttr );
     707             : 
     708           0 :             Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
     709             :         }
     710           0 :         break;
     711             :         case SID_ATTR_PARA_ULSPACE:
     712             :         {
     713           0 :             sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE;
     714             :             SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get(
     715           0 :                 GetPool().GetWhich(nSlot));
     716           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
     717           0 :             aULSP.SetWhich( EE_PARA_ULSPACE );
     718             : 
     719           0 :             aEditAttr.Put( aULSP );
     720           0 :             mpDrawView->SetAttributes( aEditAttr );
     721             : 
     722           0 :             Invalidate(SID_ATTR_PARA_ULSPACE);
     723             :         }
     724           0 :         break;
     725             : 
     726             :         case SID_ATTR_PARA_LRSPACE:
     727             :         {
     728           0 :             sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
     729             :             SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
     730           0 :                 GetPool().GetWhich(nSlot));
     731             : 
     732           0 :             SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
     733           0 :             aLRSpace.SetWhich( EE_PARA_LRSPACE );
     734             : 
     735           0 :             aEditAttr.Put( aLRSpace );
     736           0 :             mpDrawView->SetAttributes( aEditAttr );
     737             : 
     738           0 :             Invalidate(SID_ATTR_PARA_LRSPACE);
     739           0 :             break;
     740             :         }
     741             :         case SID_ATTR_LRSPACE:
     742             :         {
     743           0 :             if( mpDrawView->IsTextEdit() )
     744             :             {
     745           0 :                 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
     746             :                 const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
     747           0 :                             pArgs->Get( nId );
     748             : 
     749             :                 static const sal_uInt16 aWhichTable[]=
     750             :                 {
     751             :                     EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL,
     752             :                     EE_PARA_LRSPACE, EE_PARA_LRSPACE,
     753             :                     EE_PARA_NUMBULLET, EE_PARA_NUMBULLET,
     754             :                     0, 0
     755             :                 };
     756             : 
     757           0 :                 SfxItemSet aEditAttr( GetDoc()->GetPool(),
     758           0 :                                       aWhichTable );
     759           0 :                 mpDrawView->GetAttributes( aEditAttr );
     760             : 
     761           0 :                 nId = EE_PARA_LRSPACE;
     762             :                 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
     763             :                         rItem.GetRight(), rItem.GetTxtLeft(),
     764           0 :                         rItem.GetTxtFirstLineOfst(), nId );
     765             : 
     766           0 :                 const sal_Int16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
     767           0 :                 const SvxLRSpaceItem& rOrigLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
     768           0 :                 const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
     769           0 :                 if( nOutlineLevel != -1 &&
     770           0 :                     rNumBulletItem.GetNumRule() &&
     771           0 :                     rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
     772             :                 {
     773           0 :                     const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
     774           0 :                     SvxNumberFormat aFormat(rFormat);
     775             : 
     776             :                     // left margin gets distributed onto LRSpace item
     777             :                     // and number format AbsLSpace - this fixes
     778             :                     // n#707779 (previously, LRSpace left indent could
     779             :                     // become negative - EditEngine really does not
     780             :                     // like that.
     781           0 :                     const short nAbsLSpace=aFormat.GetAbsLSpace();
     782           0 :                     const long  nTxtLeft=rItem.GetTxtLeft();
     783           0 :                     const long  nLeftIndent=std::max(0L,nTxtLeft - nAbsLSpace);
     784           0 :                     aLRSpaceItem.SetTxtLeft(nLeftIndent);
     785             :                     // control for clipped left indent - remainder
     786             :                     // reduces number format first line indent
     787           0 :                     aFormat.SetAbsLSpace(nTxtLeft - nLeftIndent);
     788             : 
     789             :                     // negative first line indent goes to the number
     790             :                     // format, positive to the lrSpace item
     791           0 :                     if( rItem.GetTxtFirstLineOfst() < 0 )
     792             :                     {
     793             :                         aFormat.SetFirstLineOffset(
     794           0 :                             rItem.GetTxtFirstLineOfst()
     795           0 :                             - rOrigLRSpaceItem.GetTxtFirstLineOfst()
     796           0 :                             + aFormat.GetCharTextDistance());
     797           0 :                         aLRSpaceItem.SetTxtFirstLineOfst(0);
     798             :                     }
     799             :                     else
     800             :                     {
     801           0 :                         aFormat.SetFirstLineOffset(0);
     802             :                         aLRSpaceItem.SetTxtFirstLineOfst(
     803           0 :                             rItem.GetTxtFirstLineOfst()
     804           0 :                             - aFormat.GetFirstLineOffset()
     805           0 :                             + aFormat.GetCharTextDistance());
     806             :                     }
     807             : 
     808           0 :                     if( rFormat != aFormat )
     809             :                     {
     810             :                         // put all items
     811           0 :                         SvxNumBulletItem aNumBulletItem(rNumBulletItem);
     812           0 :                         aNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat);
     813           0 :                         aEditAttr.Put( aNumBulletItem );
     814           0 :                         aEditAttr.Put( aLRSpaceItem );
     815           0 :                         mpDrawView->SetAttributes( aEditAttr );
     816             : 
     817           0 :                         Invalidate(SID_ATTR_PARA_LRSPACE);
     818           0 :                         break;
     819           0 :                     }
     820             :                 }
     821             : 
     822             :                 // only put lrSpace item
     823           0 :                 SfxItemSet aEditAttrReduced( GetDoc()->GetPool(),
     824           0 :                                              EE_PARA_LRSPACE, EE_PARA_LRSPACE );
     825           0 :                 aEditAttrReduced.Put( aLRSpaceItem );
     826           0 :                 mpDrawView->SetAttributes( aEditAttrReduced );
     827             : 
     828           0 :                 Invalidate(SID_ATTR_PARA_LRSPACE);
     829             :             }
     830           0 :             break;
     831             :         }
     832             :     }
     833           0 :     if ( pUndoGroup )
     834             :         // give the undo group to the undo manager
     835           0 :         GetViewFrame()->GetObjectShell()->GetUndoManager()->
     836           0 :                                             AddUndoAction(pUndoGroup);
     837             : }
     838             : 
     839             : 
     840          47 : void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
     841             : {
     842          47 :     Point aOrigin;
     843             : 
     844          47 :     if (mpDrawView->GetSdrPageView())
     845             :     {
     846          47 :         aOrigin = mpDrawView->GetSdrPageView()->GetPageOrigin();
     847             :     }
     848             : 
     849          47 :     Size aViewSize = GetActiveWindow()->GetViewSize();
     850             : 
     851          47 :     const Point aPagePos( GetActiveWindow()->GetViewOrigin() );
     852          47 :     Size aPageSize = mpActualPage->GetSize();
     853             : 
     854          94 :     Rectangle aRect(aPagePos, Point( aViewSize.Width() - (aPagePos.X() + aPageSize.Width()),
     855         141 :                                      aViewSize.Height() - (aPagePos.Y() + aPageSize.Height())));
     856             : 
     857          47 :     if( mpDrawView->IsTextEdit() )
     858             :     {
     859           0 :         Point aPnt1 = GetActiveWindow()->GetWinViewPos();
     860           0 :         Rectangle aMinMaxRect = Rectangle( aPnt1, Size(ULONG_MAX, ULONG_MAX) );
     861           0 :         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aMinMaxRect) );
     862             :     }
     863             :     else
     864             :     {
     865          47 :         rSet.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX, aRect) );
     866             :     }
     867             : 
     868          47 :     SvxLongLRSpaceItem aLRSpace(aPagePos.X() + mpActualPage->GetLftBorder(),
     869          94 :                                 aRect.Right() + mpActualPage->GetRgtBorder(),
     870         188 :                                 GetPool().GetWhich(SID_ATTR_LONG_LRSPACE));
     871          47 :     SvxLongULSpaceItem aULSpace(aPagePos.Y() + mpActualPage->GetUppBorder(),
     872          94 :                                 aRect.Bottom() + mpActualPage->GetLwrBorder(),
     873         235 :                                 GetPool().GetWhich(SID_ATTR_LONG_ULSPACE));
     874         141 :     rSet.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos, aViewSize.Width(),
     875         141 :                                                        aViewSize.Height()));
     876          94 :     SfxPointItem aPointItem( SID_RULER_NULL_OFFSET, aPagePos + aOrigin );
     877             : 
     878          94 :     SvxProtectItem aProtect( SID_RULER_PROTECT );
     879             : 
     880          47 :     maMarkRect = mpDrawView->GetAllMarkedRect();
     881             : 
     882          47 :     const sal_Bool bRTL = GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB;
     883          47 :     rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, bRTL));
     884             : 
     885          47 :     if( mpDrawView->AreObjectsMarked() )
     886             :     {
     887           0 :         if( mpDrawView->IsTextEdit() )
     888             :         {
     889           0 :             SdrObject* pObj = mpDrawView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj();
     890           0 :             if( pObj->GetObjInventor() == SdrInventor)
     891             :             {
     892           0 :                 SfxItemSet aEditAttr( GetDoc()->GetPool() );
     893           0 :                 mpDrawView->GetAttributes( aEditAttr );
     894           0 :                 if( aEditAttr.GetItemState( EE_PARA_TABS ) >= SFX_ITEM_AVAILABLE )
     895             :                 {
     896           0 :                     const SvxTabStopItem& rItem = (const SvxTabStopItem&) aEditAttr.Get( EE_PARA_TABS );
     897           0 :                     rSet.Put( rItem );
     898             : 
     899           0 :                     const SvxLRSpaceItem& rLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
     900           0 :                     sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
     901             :                     SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
     902             :                             rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(),
     903           0 :                             rLRSpaceItem.GetTxtFirstLineOfst(), nId );
     904             : 
     905           0 :                     const sal_Int16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
     906           0 :                     const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
     907           0 :                     if( nOutlineLevel != -1 &&
     908           0 :                         rNumBulletItem.GetNumRule() &&
     909           0 :                         rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
     910             :                     {
     911           0 :                         const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
     912           0 :                         aLRSpaceItem.SetTxtLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTxtLeft());
     913             :                         aLRSpaceItem.SetTxtFirstLineOfst(
     914           0 :                             rLRSpaceItem.GetTxtFirstLineOfst() + rFormat.GetFirstLineOffset()
     915           0 :                             - rFormat.GetCharTextDistance());
     916             :                     }
     917             : 
     918           0 :                     rSet.Put( aLRSpaceItem );
     919             : 
     920           0 :                     Point aPos( aPagePos + maMarkRect.TopLeft() );
     921             : 
     922           0 :                     if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
     923             :                     {
     924             :                         const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
     925           0 :                                                               aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
     926           0 :                         long nLD = rTLDItem.GetValue();
     927           0 :                         aPos.X() += nLD;
     928             :                     }
     929             : 
     930           0 :                     aPointItem.SetValue( aPos );
     931             : 
     932           0 :                     aLRSpace.SetLeft( aPagePos.X() + maMarkRect.Left() );
     933             : 
     934           0 :                     if ( aEditAttr.GetItemState( SDRATTR_TEXT_LEFTDIST ) == SFX_ITEM_ON )
     935             :                     {
     936             :                         const SdrTextLeftDistItem& rTLDItem = (const SdrTextLeftDistItem&)
     937           0 :                                                               aEditAttr.Get( SDRATTR_TEXT_LEFTDIST );
     938           0 :                         long nLD = rTLDItem.GetValue();
     939           0 :                         aLRSpace.SetLeft( aLRSpace.GetLeft() + nLD );
     940             :                     }
     941             : 
     942           0 :                     aLRSpace.SetRight( aRect.Right() + aPageSize.Width() - maMarkRect.Right() );
     943           0 :                     aULSpace.SetUpper( aPagePos.Y() + maMarkRect.Top() );
     944           0 :                     aULSpace.SetLower( aRect.Bottom() + aPageSize.Height() - maMarkRect.Bottom() );
     945             : 
     946           0 :                     rSet.DisableItem( SID_RULER_OBJECT );
     947             : 
     948             :                     // lock page margins
     949           0 :                     aProtect.SetSizeProtect( sal_True );
     950           0 :                     aProtect.SetPosProtect( sal_True );
     951             :                 }
     952             : 
     953           0 :                 if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SFX_ITEM_AVAILABLE )
     954             :                 {
     955           0 :                     const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR );
     956           0 :                     rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == ::com::sun::star::text::WritingMode_RL_TB));
     957           0 :                 }
     958             :             }
     959             :         }
     960             :         else
     961             :         {
     962           0 :             rSet.DisableItem( EE_PARA_TABS );
     963           0 :             rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
     964             : 
     965           0 :             if( mpDrawView->IsResizeAllowed(sal_True) )
     966             :             {
     967           0 :                 Rectangle aResizeRect( maMarkRect );
     968             : 
     969           0 :                 aResizeRect.SetPos(aResizeRect.TopLeft() + aPagePos);
     970           0 :                 SvxObjectItem aObjItem(aResizeRect.Left(), aResizeRect.Right(),
     971           0 :                                        aResizeRect.Top(), aResizeRect.Bottom());
     972           0 :                 rSet.Put(aObjItem);
     973           0 :                 rSet.DisableItem( EE_PARA_TABS );
     974             :             }
     975             :             else
     976             :             {
     977           0 :                 rSet.DisableItem( SID_RULER_OBJECT );
     978             :             }
     979             :         }
     980             :     }
     981             :     else
     982             :     {
     983          47 :         rSet.DisableItem( SID_RULER_OBJECT );
     984          47 :         rSet.DisableItem( EE_PARA_TABS );
     985             :     }
     986             : 
     987          47 :     rSet.Put( aLRSpace );
     988          47 :     rSet.Put( aULSpace );
     989             : 
     990          47 :     rSet.Put( aPointItem );
     991          94 :     rSet.Put( aProtect );
     992          47 : }
     993             : 
     994             : 
     995           0 : void  DrawViewShell::ExecStatusBar(SfxRequest& rReq)
     996             : {
     997             :     // nothing is executed during a slide show!
     998           0 :     if(HasCurrentFunction(SID_PRESENTATION))
     999           0 :         return;
    1000             : 
    1001           0 :     CheckLineTo (rReq);
    1002             : 
    1003           0 :     switch ( rReq.GetSlot() )
    1004             :     {
    1005             :         case SID_ATTR_SIZE:
    1006             :         {
    1007           0 :             GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON );
    1008             :         }
    1009           0 :         break;
    1010             : 
    1011             :         case SID_STATUS_LAYOUT:
    1012             :         {
    1013           0 :             GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SFX_CALLMODE_ASYNCHRON );
    1014             :         }
    1015           0 :         break;
    1016             :     }
    1017             : }
    1018             : 
    1019             : /**
    1020             :  * set state of snap object entries in popup
    1021             :  */
    1022           0 : void  DrawViewShell::GetSnapItemState( SfxItemSet &rSet )
    1023             : {
    1024             :     SdrPageView* pPV;
    1025           0 :     Point   aMPos = GetActiveWindow()->PixelToLogic(maMousePos);
    1026           0 :     sal_uInt16  nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic(
    1027           0 :         Size(FuPoor::HITPIX,0)).Width();
    1028             :     sal_uInt16  nHelpLine;
    1029             : 
    1030           0 :     if ( mpDrawView->PickHelpLine(aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
    1031             :     {
    1032           0 :         const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
    1033             : 
    1034           0 :         if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
    1035             :         {
    1036             :             rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
    1037           0 :                                 String( SdResId( STR_POPUP_EDIT_SNAPPOINT))) );
    1038             :             rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
    1039           0 :                                 String( SdResId( STR_POPUP_DELETE_SNAPPOINT))) );
    1040             :         }
    1041             :         else
    1042             :         {
    1043             :             rSet.Put( SfxStringItem( SID_SET_SNAPITEM,
    1044           0 :                                 String( SdResId( STR_POPUP_EDIT_SNAPLINE))) );
    1045             :             rSet.Put( SfxStringItem( SID_DELETE_SNAPITEM,
    1046           0 :                                 String( SdResId( STR_POPUP_DELETE_SNAPLINE))) );
    1047             :         }
    1048             :     }
    1049           0 : }
    1050             : 
    1051           0 : void DrawViewShell::AddWindow (::sd::Window* pWin)
    1052             : {
    1053           0 :     mpDrawView->AddWindowToPaintView(pWin);
    1054           0 : }
    1055             : 
    1056           0 : void DrawViewShell::RemoveWindow(::sd::Window* pWin)
    1057             : {
    1058           0 :     mpDrawView->DeleteWindowFromPaintView(pWin);
    1059           0 : }
    1060             : 
    1061          33 : } // end of namespace sd
    1062             : 
    1063             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10