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

Generated by: LCOV version 1.11