LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - drwbassh.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 469 0.0 %
Date: 2014-04-14 Functions: 0 22 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/shl.hxx>
      21             : #include <hintids.hxx>
      22             : #include <helpid.h>
      23             : #include <swtypes.hxx>
      24             : #include <sfx2/objface.hxx>
      25             : #include <sfx2/request.hxx>
      26             : #include <sfx2/bindings.hxx>
      27             : #include <svl/aeitem.hxx>
      28             : #include <svx/svdview.hxx>
      29             : #include <vcl/msgbox.hxx>
      30             : #include <svl/srchitem.hxx>
      31             : #include <svl/whiter.hxx>
      32             : #include <svx/swframevalidation.hxx>
      33             : #include <svx/anchorid.hxx>
      34             : #include <sfx2/htmlmode.hxx>
      35             : #include <uitool.hxx>
      36             : #include <fmtornt.hxx>
      37             : #include <cmdid.h>
      38             : #include <swmodule.hxx>
      39             : #include <wrtsh.hxx>
      40             : #include <wview.hxx>
      41             : #include <edtwin.hxx>
      42             : #include <viewopt.hxx>
      43             : #include <dcontact.hxx>
      44             : #include <frmfmt.hxx>
      45             : #include <wrap.hxx>
      46             : #include <drawbase.hxx>
      47             : #include <drwbassh.hxx>
      48             : #include <swdtflvr.hxx>
      49             : #include <svx/svdogrp.hxx>
      50             : #include <svx/svdpage.hxx>
      51             : #include <svx/svditer.hxx>
      52             : 
      53             : #include <shells.hrc>
      54             : #define SwDrawBaseShell
      55             : #include <sfx2/msg.hxx>
      56             : #include <swslots.hxx>
      57             : #include <svx/svxdlg.hxx>
      58             : #include <svx/dialogs.hrc>
      59             : #include "swabstdlg.hxx"
      60             : #include "dialog.hrc"
      61             : #include <swundo.hxx>
      62             : #include <com/sun/star/text/HoriOrientation.hpp>
      63             : #include <com/sun/star/text/VertOrientation.hpp>
      64             : #include <com/sun/star/text/RelOrientation.hpp>
      65             : 
      66             : #include <IDocumentDrawModelAccess.hxx>
      67             : 
      68             : using namespace ::com::sun::star;
      69             : 
      70           0 : SFX_IMPL_INTERFACE(SwDrawBaseShell, SwBaseShell, SW_RES(0))
      71             : {
      72           0 : }
      73             : 
      74           0 : TYPEINIT1(SwDrawBaseShell,SwBaseShell)
      75             : 
      76           0 : SwDrawBaseShell::SwDrawBaseShell(SwView &_rView)
      77             :     : SwBaseShell(_rView)
      78             :     , pDrawActual(0)
      79           0 :     , eDrawMode(0)
      80             : {
      81           0 :     GetShell().NoEdit(true);
      82             : 
      83           0 :     SwEditWin& rWin = GetView().GetEditWin();
      84             : 
      85           0 :     rWin.SetBezierMode(SID_BEZIER_MOVE);
      86             : 
      87           0 :     if ( !_rView.GetDrawFuncPtr() )
      88           0 :         _rView.GetEditWin().StdDrawMode( OBJ_NONE, sal_True );
      89             : 
      90           0 :     SwTransferable::CreateSelection( GetShell() );
      91           0 : }
      92             : 
      93           0 : SwDrawBaseShell::~SwDrawBaseShell()
      94             : {
      95           0 :     GetView().ExitDraw();
      96           0 :     GetShell().Edit();
      97           0 :     SwTransferable::ClearSelection( GetShell() );
      98           0 : }
      99             : 
     100           0 : void SwDrawBaseShell::Execute(SfxRequest &rReq)
     101             : {
     102           0 :     SwWrtShell *pSh = &GetShell();
     103           0 :     SdrView*    pSdrView = pSh->GetDrawView();
     104           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
     105           0 :     sal_uInt16      nSlotId = rReq.GetSlot();
     106           0 :     sal_Bool        bChanged = pSdrView->GetModel()->IsChanged();
     107           0 :     pSdrView->GetModel()->SetChanged(false);
     108           0 :     const SfxPoolItem* pItem = 0;
     109           0 :     if(pArgs)
     110           0 :         pArgs->GetItemState(nSlotId, false, &pItem);
     111             : 
     112             :     //Special case align by menu
     113           0 :     if(pItem && nSlotId == SID_OBJECT_ALIGN)
     114             :     {
     115             :         OSL_ENSURE(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem expected");
     116           0 :         nSlotId = nSlotId + ((const SfxEnumItem*)pItem)->GetValue();
     117           0 :         nSlotId++;
     118             :     }
     119             : 
     120           0 :     sal_Bool bAlignPossible = pSh->IsAlignPossible();
     121             : 
     122           0 :     sal_Bool bTopParam = sal_True, bBottomParam = sal_True;
     123           0 :     bool bDone = false;
     124           0 :     SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
     125             : 
     126           0 :     switch (nSlotId)
     127             :     {
     128             :         case FN_DRAW_WRAP_DLG:
     129             :         {
     130           0 :             if(pSdrView->AreObjectsMarked())
     131             :             {
     132           0 :                 if(!pArgs)
     133             :                 {
     134           0 :                     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     135           0 :                     if( rMarkList.GetMark(0) != 0 )
     136             :                     {
     137           0 :                         SfxItemSet aSet(GetPool(),  RES_SURROUND, RES_SURROUND,
     138             :                                                     RES_ANCHOR, RES_ANCHOR,
     139             :                                                     RES_LR_SPACE, RES_UL_SPACE,
     140             :                                                     SID_HTML_MODE, SID_HTML_MODE,
     141             :                                                     FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG,
     142           0 :                                                     0);
     143             : 
     144             :                         aSet.Put(SfxBoolItem(SID_HTML_MODE,
     145           0 :                             0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
     146             : 
     147           0 :                         aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId()));
     148             : 
     149           0 :                         pSh->GetObjAttr(aSet);
     150           0 :                         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     151             :                         OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     152             : 
     153           0 :                         SfxAbstractDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, sal_True, RC_DLG_SWWRAPDLG );
     154             :                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
     155             : 
     156           0 :                         if (pDlg->Execute() == RET_OK)
     157             :                         {
     158             :                             const SfxPoolItem* pWrapItem;
     159           0 :                             const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     160           0 :                             if(SFX_ITEM_SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, false, &pWrapItem))
     161             :                             {
     162           0 :                                 short nLayer = ((const SfxInt16Item*)pWrapItem)->GetValue();
     163           0 :                                 if (nLayer == 1)
     164           0 :                                     pSh->SelectionToHeaven();
     165             :                                 else
     166           0 :                                     pSh->SelectionToHell();
     167             :                             }
     168             : 
     169           0 :                             pSh->SetObjAttr(*pOutSet);
     170             :                         }
     171           0 :                     delete pDlg;
     172             :                     }
     173             :                 }
     174             :             }
     175             :         }
     176           0 :         break;
     177             : 
     178             :         case SID_ATTR_TRANSFORM:
     179             :         {
     180           0 :             if(pSdrView->AreObjectsMarked())
     181             :             {
     182           0 :                 if(!pArgs)
     183             :                 {
     184           0 :                     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     185           0 :                     if( rMarkList.GetMark(0) != 0 )
     186             :                     {
     187           0 :                         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     188           0 :                         SfxAbstractTabDialog *pDlg=NULL;
     189           0 :                         bool bCaption = false;
     190             : 
     191             :                         // Allowed anchorages:
     192           0 :                         short nAnchor = pSh->GetAnchorId();
     193           0 :                         sal_uInt16 nAllowedAnchors = SVX_OBJ_AT_CNTNT | SVX_OBJ_IN_CNTNT | SVX_OBJ_PAGE;
     194           0 :                         sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
     195             : 
     196           0 :                         if ( pSh->IsFlyInFly() )
     197           0 :                             nAllowedAnchors |= SVX_OBJ_AT_FLY;
     198             : 
     199           0 :                         if (pObj->GetObjIdentifier() == OBJ_CAPTION )
     200           0 :                             bCaption = true;
     201             : 
     202           0 :                         if (bCaption)
     203             :                         {
     204           0 :                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     205             :                             AbstractSvxCaptionDialog* pCaptionDlg =
     206           0 :                                     pFact->CreateCaptionDialog( NULL, pSdrView, nAllowedAnchors );
     207           0 :                             pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
     208           0 :                             pDlg = pCaptionDlg;
     209             :                         }
     210             :                         else
     211             :                         {
     212           0 :                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     213             :                             AbstractSvxTransformTabDialog* pTransform =
     214           0 :                                         pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, nAllowedAnchors );
     215           0 :                             pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
     216           0 :                             pDlg = pTransform;
     217             :                         }
     218           0 :                         SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
     219             : 
     220           0 :                         const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
     221           0 :                         SfxItemSet aSet( *aNewAttr.GetPool(), pRange );
     222           0 :                         FieldUnit eMetric = ::GetDfltMetric(0 != dynamic_cast<SwWebView*>(&GetView()));
     223           0 :                         SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
     224             : 
     225           0 :                         aSet.Put( aNewAttr, false );
     226             : 
     227           0 :                         if (bCaption)
     228           0 :                             pSdrView->GetAttributes( aSet );
     229             : 
     230           0 :                         aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor));
     231             :                         sal_Bool bRTL;
     232             :                         sal_Bool bVertL2R;
     233           0 :                         aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrmVertical(sal_True, bRTL, bVertL2R)));
     234           0 :                         aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL));
     235             : 
     236           0 :                         SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
     237             : 
     238           0 :                         aSet.Put( pFrmFmt->GetFmtAttr(RES_FOLLOW_TEXT_FLOW) );
     239             : 
     240           0 :                         SwFmtVertOrient aVOrient((const SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
     241           0 :                         aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient()));
     242           0 :                         aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() ));
     243           0 :                         aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos()));
     244             : 
     245           0 :                         SwFmtHoriOrient aHOrient((const SwFmtHoriOrient&)pFrmFmt->GetFmtAttr(RES_HORI_ORIENT));
     246           0 :                         aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient()));
     247           0 :                         aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() ));
     248           0 :                         aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle()));
     249           0 :                         aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, aHOrient.GetPos()));
     250             : 
     251           0 :                         aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
     252             : 
     253           0 :                         pDlg->SetInputSet( &aSet );
     254             : 
     255           0 :                         if (pDlg->Execute() == RET_OK)
     256             :                         {
     257           0 :                             const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     258           0 :                             pSh->StartAllAction();
     259             : 
     260             :                             // #i30451#
     261           0 :                             pSh->StartUndo(UNDO_INSFMTATTR);
     262             : 
     263           0 :                             pSdrView->SetGeoAttrToMarked(*pOutSet);
     264             : 
     265           0 :                             if (bCaption)
     266           0 :                                 pSdrView->SetAttributes(*pOutSet);
     267             : 
     268             :                             bool bPosCorr =
     269             :                                 SFX_ITEM_SET != pOutSet->GetItemState(
     270           0 :                                     SID_ATTR_TRANSFORM_POS_X, false ) &&
     271             :                                 SFX_ITEM_SET != pOutSet->GetItemState(
     272           0 :                                     SID_ATTR_TRANSFORM_POS_Y, false );
     273             : 
     274           0 :                             SfxItemSet aFrmAttrSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1);
     275             : 
     276           0 :                             bool bSingleSelection = rMarkList.GetMarkCount() == 1;
     277             : 
     278             :                             const SfxPoolItem* pAnchorItem;
     279           0 :                             if(SFX_ITEM_SET == pOutSet->GetItemState(
     280           0 :                                 SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem))
     281             :                             {
     282           0 :                                 if(!bSingleSelection)
     283             :                                     pSh->ChgAnchor(((const SfxInt16Item*)pAnchorItem)
     284           0 :                                             ->GetValue(), false, bPosCorr );
     285             :                                 else
     286             :                                 {
     287           0 :                                     SwFmtAnchor aAnchor(pFrmFmt->GetAnchor());
     288           0 :                                     aAnchor.SetType((RndStdIds)((const SfxInt16Item*)pAnchorItem)->GetValue());
     289           0 :                                     aFrmAttrSet.Put( aAnchor );
     290             :                                 }
     291             :                             }
     292           0 :                             const SfxPoolItem* pHoriOrient = 0;
     293           0 :                             const SfxPoolItem* pHoriRelation = 0;
     294           0 :                             const SfxPoolItem* pHoriPosition = 0;
     295           0 :                             const SfxPoolItem* pHoriMirror = 0;
     296           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, false, &pHoriOrient);
     297           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, false, &pHoriRelation);
     298           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, false, &pHoriPosition);
     299           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, false, &pHoriMirror);
     300           0 :                             if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
     301             :                             {
     302           0 :                                 if(pHoriOrient)
     303             :                                     aHOrient.SetHoriOrient(
     304           0 :                                           static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue());
     305           0 :                                 if(pHoriRelation)
     306             :                                     aHOrient.SetRelationOrient(
     307           0 :                                               static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue());
     308           0 :                                 if(pHoriPosition)
     309           0 :                                     aHOrient.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue());
     310           0 :                                 if(pHoriMirror)
     311           0 :                                     aHOrient.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue());
     312           0 :                                 aFrmAttrSet.Put(aHOrient);
     313             :                             }
     314             : 
     315           0 :                             const SfxPoolItem* pVertOrient = 0;
     316           0 :                             const SfxPoolItem* pVertRelation = 0;
     317           0 :                             const SfxPoolItem* pVertPosition = 0;
     318           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, false, &pVertOrient);
     319           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, false, &pVertRelation);
     320           0 :                             pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, false, &pVertPosition);
     321           0 :                             if(pVertOrient || pVertRelation || pVertPosition )
     322             :                             {
     323           0 :                                 if(pVertOrient)
     324             :                                     aVOrient.SetVertOrient(
     325           0 :                                         static_cast<const SfxInt16Item*>(pVertOrient)->GetValue());
     326           0 :                                 if(pVertRelation)
     327             :                                     aVOrient.SetRelationOrient(
     328           0 :                                         static_cast<const SfxInt16Item*>(pVertRelation)->GetValue());
     329           0 :                                 if(pVertPosition)
     330           0 :                                     aVOrient.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue());
     331           0 :                                 aFrmAttrSet.Put( aVOrient );
     332             :                             }
     333           0 :                             const SfxPoolItem* pFollowItem = 0;
     334           0 :                             pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, false, &pFollowItem);
     335           0 :                             if(pFollowItem)
     336           0 :                                 aFrmAttrSet.Put(*pFollowItem);
     337             : 
     338           0 :                             if(aFrmAttrSet.Count())
     339           0 :                                 pSh->SetDrawingAttr(aFrmAttrSet);
     340             : 
     341           0 :                             rBind.InvalidateAll(false);
     342             : 
     343             :                             // #i30451#
     344           0 :                             pSh->EndUndo( UNDO_INSFMTATTR );
     345             : 
     346           0 :                             pSh->EndAllAction();
     347             :                         }
     348           0 :                         delete pDlg;
     349             : 
     350             :                     }
     351             :                 }
     352             :                 else
     353             :                 {
     354           0 :                     pSdrView->SetGeoAttrToMarked( *pArgs );
     355             :                 }
     356             :             }
     357             :         }
     358           0 :         break;
     359             : 
     360             :         case SID_DELETE:
     361             :         case FN_BACKSPACE:
     362           0 :             if (pSh->IsObjSelected() && !pSdrView->IsTextEdit())
     363             :             {
     364           0 :                 bDone = true;
     365             : 
     366           0 :                 if( GetView().IsDrawRotate() )
     367             :                 {
     368           0 :                     pSh->SetDragMode( SDRDRAG_MOVE );
     369           0 :                     GetView().FlipDrawRotate();
     370             :                 }
     371             : 
     372           0 :                 pSh->SetModified();
     373           0 :                 pSh->DelSelectedObj();
     374             : 
     375           0 :                 if (rReq.IsAPI() ||
     376           0 :                     GetView().GetEditWin().IsObjectSelect() )
     377             :                 {
     378             :                     // If basic call, then back to the text shell, because the
     379             :                     // Basic otherwise has no possibility to return.
     380           0 :                     if (GetView().GetDrawFuncPtr())
     381             :                     {
     382           0 :                         GetView().GetDrawFuncPtr()->Deactivate();
     383           0 :                         GetView().SetDrawFuncPtr(NULL);
     384             :                     }
     385           0 :                     GetView().LeaveDrawCreate();    // Switch to selection mode
     386             :                 }
     387             : 
     388           0 :                 if (pSh->IsSelFrmMode())
     389             :                 {
     390           0 :                     pSh->LeaveSelFrmMode();
     391             :                     // #105852# FME
     392             :                 }
     393             :             }
     394           0 :             break;
     395             : 
     396             :         case SID_GROUP:
     397           0 :             if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed())
     398             :             {
     399           0 :                 pSh->GroupSelection();
     400           0 :                 rBind.Invalidate(SID_UNGROUP);
     401             :             }
     402           0 :             break;
     403             : 
     404             :         case SID_UNGROUP:
     405           0 :             if (pSh->IsGroupSelected())
     406             :             {
     407           0 :                 pSh->UnGroupSelection();
     408           0 :                 rBind.Invalidate(SID_GROUP);
     409             :             }
     410           0 :             break;
     411             : 
     412             :         case SID_ENTER_GROUP:
     413           0 :             if (pSh->IsGroupSelected())
     414             :             {
     415           0 :                 pSdrView->EnterMarkedGroup();
     416           0 :                 rBind.InvalidateAll(false);
     417             :             }
     418           0 :             break;
     419             : 
     420             :         case SID_LEAVE_GROUP:
     421           0 :             if (pSdrView->IsGroupEntered())
     422             :             {
     423           0 :                 pSdrView->LeaveOneGroup();
     424           0 :                 rBind.Invalidate(SID_ENTER_GROUP);
     425           0 :                 rBind.Invalidate(SID_UNGROUP);
     426             :             }
     427           0 :             break;
     428             : 
     429             :         case SID_OBJECT_ALIGN_LEFT:
     430             :         case SID_OBJECT_ALIGN_CENTER:
     431             :         case SID_OBJECT_ALIGN_RIGHT:
     432             :         case SID_OBJECT_ALIGN_UP:
     433             :         case SID_OBJECT_ALIGN_MIDDLE:
     434             :         case SID_OBJECT_ALIGN_DOWN:
     435             :         {
     436           0 :             if ( bAlignPossible )
     437             :             {
     438           0 :                 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     439           0 :                 if( rMarkList.GetMarkCount() == 1 && bAlignPossible )
     440             :                 {   // Do not align objects to each other
     441           0 :                     sal_uInt16 nAnchor = pSh->GetAnchorId();
     442           0 :                     if (nAnchor == FLY_AS_CHAR)
     443             :                     {
     444           0 :                         sal_Int16 nVertOrient = -1;
     445             : 
     446           0 :                         switch (nSlotId)
     447             :                         {
     448             :                             case SID_OBJECT_ALIGN_UP:
     449           0 :                                 nVertOrient = text::VertOrientation::TOP;
     450           0 :                                 break;
     451             :                             case SID_OBJECT_ALIGN_MIDDLE:
     452           0 :                                 nVertOrient = text::VertOrientation::CENTER;
     453           0 :                                 break;
     454             :                             case SID_OBJECT_ALIGN_DOWN:
     455           0 :                                 nVertOrient = text::VertOrientation::BOTTOM;
     456           0 :                                 break;
     457             :                             default:
     458           0 :                                 break;
     459             :                         }
     460           0 :                         if (nVertOrient != -1)
     461             :                         {
     462           0 :                             pSh->StartAction();
     463           0 :                             SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     464           0 :                             SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
     465           0 :                             SwFmtVertOrient aVOrient((SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
     466           0 :                             aVOrient.SetVertOrient( nVertOrient );
     467           0 :                             pFrmFmt->SetFmtAttr(aVOrient);
     468           0 :                             pSh->EndAction();
     469             :                         }
     470           0 :                         break;
     471             :                     }
     472           0 :                     if (nAnchor == FLY_AT_PARA)
     473           0 :                         break;  // Do not align frames of an anchored paragraph
     474             :                 }
     475             : 
     476           0 :                 pSh->StartAction();
     477           0 :                 switch (nSlotId)
     478             :                 {
     479             :                     case SID_OBJECT_ALIGN_LEFT:
     480           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
     481           0 :                         break;
     482             :                     case SID_OBJECT_ALIGN_CENTER:
     483           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
     484           0 :                         break;
     485             :                     case SID_OBJECT_ALIGN_RIGHT:
     486           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
     487           0 :                         break;
     488             :                     case SID_OBJECT_ALIGN_UP:
     489           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
     490           0 :                         break;
     491             :                     case SID_OBJECT_ALIGN_MIDDLE:
     492           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
     493           0 :                         break;
     494             :                     case SID_OBJECT_ALIGN_DOWN:
     495           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
     496           0 :                         break;
     497             :                 }
     498           0 :                 pSh->EndAction();
     499             :             }
     500             :         }
     501           0 :         break;
     502             : 
     503             :         case FN_FRAME_UP:
     504           0 :             bTopParam = sal_False;
     505             :             /* no break */
     506             :         case SID_FRAME_TO_TOP:
     507           0 :             pSh->SelectionToTop( bTopParam );
     508           0 :             break;
     509             : 
     510             :         case FN_FRAME_DOWN:
     511           0 :             bBottomParam = sal_False;
     512             :             /* no break */
     513             :         case SID_FRAME_TO_BOTTOM:
     514           0 :             pSh->SelectionToBottom( bBottomParam );
     515           0 :             break;
     516             : 
     517             :         case FN_NAME_SHAPE:
     518             :         {
     519           0 :             bDone = true;
     520             : 
     521           0 :             if(1L == pSdrView->GetMarkedObjectCount())
     522             :             {
     523             :                 // #i68101#
     524           0 :                 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
     525             :                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
     526           0 :                 OUString aName(pSelected->GetName());
     527             : 
     528           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     529             :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
     530           0 :                 AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
     531             :                 OSL_ENSURE(pDlg, "Dialogdiet fail!");
     532             : 
     533           0 :                 pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
     534             : 
     535           0 :                 if(RET_OK == pDlg->Execute())
     536             :                 {
     537           0 :                     pDlg->GetName(aName);
     538           0 :                     pSelected->SetName(aName);
     539           0 :                     pSh->SetModified();
     540             :                 }
     541             : 
     542           0 :                 delete pDlg;
     543             :             }
     544             : 
     545           0 :             break;
     546             :         }
     547             : 
     548             :         // #i68101#
     549             :         case FN_TITLE_DESCRIPTION_SHAPE:
     550             :         {
     551           0 :             bDone = true;
     552             : 
     553           0 :             if(1L == pSdrView->GetMarkedObjectCount())
     554             :             {
     555           0 :                 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
     556             :                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
     557           0 :                 OUString aTitle(pSelected->GetTitle());
     558           0 :                 OUString aDescription(pSelected->GetDescription());
     559             : 
     560           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     561             :                 OSL_ENSURE(pFact, "Dialogdiet fail!");
     562           0 :                 AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
     563             :                 OSL_ENSURE(pDlg, "Dialogdiet fail!");
     564             : 
     565           0 :                 if(RET_OK == pDlg->Execute())
     566             :                 {
     567           0 :                     pDlg->GetTitle(aTitle);
     568           0 :                     pDlg->GetDescription(aDescription);
     569             : 
     570           0 :                     pSelected->SetTitle(aTitle);
     571           0 :                     pSelected->SetDescription(aDescription);
     572             : 
     573           0 :                     pSh->SetModified();
     574             :                 }
     575             : 
     576           0 :                 delete pDlg;
     577             :             }
     578             : 
     579           0 :             break;
     580             :         }
     581             : 
     582             :         default:
     583             :             OSL_ENSURE(!this, "wrong Dispatcher");
     584           0 :             return;
     585             :     }
     586           0 :     if(!bDone)
     587             :     {
     588           0 :         if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN)
     589           0 :             rBind.Invalidate(SID_ATTR_LONG_LRSPACE);
     590           0 :         if (pSdrView->GetModel()->IsChanged())
     591           0 :             pSh->SetModified();
     592           0 :         else if (bChanged)
     593           0 :             pSdrView->GetModel()->SetChanged(true);
     594             :     }
     595             : }
     596             : 
     597             : // Checks whether a given name is allowed for a group shape
     598             : 
     599           0 : IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNameDialog )
     600             : {
     601           0 :     SwWrtShell          &rSh = GetShell();
     602           0 :     SdrView *pSdrView = rSh.GetDrawView();
     603           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     604             :     OSL_ENSURE(rMarkList.GetMarkCount() == 1, "wrong draw selection");
     605           0 :     SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     606           0 :     const OUString sCurrentName = pObj->GetName();
     607           0 :     OUString sNewName;
     608           0 :     pNameDialog->GetName(sNewName);
     609           0 :     long nRet = 0;
     610           0 :     if (sNewName.isEmpty() || sCurrentName == sNewName)
     611           0 :         nRet = 1;
     612             :     else
     613             :     {
     614           0 :         nRet = 1;
     615           0 :         SdrModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
     616           0 :         SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS );
     617           0 :         while( aIter.IsMore() )
     618             :         {
     619           0 :             SdrObject* pTempObj = aIter.Next();
     620           0 :             if ( pObj != pTempObj && pTempObj->GetName().equals(sNewName) )
     621             :             {
     622           0 :                 nRet = 0;
     623           0 :                 break;
     624             :             }
     625           0 :         }
     626             :     }
     627           0 :     return nRet;
     628             : }
     629             : 
     630           0 : void SwDrawBaseShell::GetState(SfxItemSet& rSet)
     631             : {
     632           0 :     SwWrtShell &rSh = GetShell();
     633           0 :     SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
     634           0 :     SfxWhichIter aIter( rSet );
     635           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     636           0 :     bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
     637             : 
     638           0 :     if (!bProtected)    // Look in the parent
     639           0 :         bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
     640             : 
     641           0 :     while( nWhich )
     642             :     {
     643           0 :         switch( nWhich )
     644             :         {
     645             :             case FN_DRAW_WRAP_DLG:
     646             :             case SID_ATTR_TRANSFORM:
     647             :             case SID_FRAME_TO_TOP:
     648             :             case SID_FRAME_TO_BOTTOM:
     649             :             case FN_FRAME_UP:
     650             :             case FN_FRAME_DOWN:
     651             :             case SID_DELETE:
     652             :             case FN_BACKSPACE:
     653           0 :                 if( bProtected || !rSh.IsObjSelected() )
     654           0 :                     rSet.DisableItem( nWhich );
     655           0 :                 break;
     656             :             case SID_GROUP:
     657           0 :                 if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() )
     658           0 :                     rSet.DisableItem( nWhich );
     659           0 :                 break;
     660             :             case SID_UNGROUP:
     661           0 :                 if ( !rSh.IsGroupSelected() || bProtected )
     662           0 :                     rSet.DisableItem( nWhich );
     663           0 :                 break;
     664             :             case SID_ENTER_GROUP:
     665           0 :                 if ( !rSh.IsGroupSelected() )
     666           0 :                     rSet.DisableItem( nWhich );
     667           0 :                 break;
     668             :             case SID_LEAVE_GROUP:
     669           0 :                 if ( !pSdrView->IsGroupEntered() )
     670           0 :                     rSet.DisableItem( nWhich );
     671           0 :                 break;
     672             :             case SID_OBJECT_ALIGN_LEFT:
     673             :             case SID_OBJECT_ALIGN_CENTER:
     674             :             case SID_OBJECT_ALIGN_RIGHT:
     675             :             case SID_OBJECT_ALIGN_UP:
     676             :             case SID_OBJECT_ALIGN_MIDDLE:
     677             :             case SID_OBJECT_ALIGN_DOWN:
     678             :             case SID_OBJECT_ALIGN:
     679           0 :                 if ( !rSh.IsAlignPossible() || bProtected )
     680           0 :                     rSet.DisableItem( nWhich );
     681             :                 else
     682             :                 {
     683           0 :                     SfxAllEnumItem aEnumItem(nWhich, USHRT_MAX);
     684           0 :                     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     685             :                     //if only one object is selected it can only be vertically
     686             :                     // aligned because it is character bound
     687           0 :                     if( rMarkList.GetMarkCount() == 1 )
     688             :                     {
     689           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_LEFT);
     690           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_CENTER);
     691           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_RIGHT);
     692             :                     }
     693           0 :                     rSet.Put(aEnumItem);
     694             :                 }
     695           0 :                 break;
     696             : 
     697             :             case FN_NAME_SHAPE :
     698             :                 {
     699           0 :                     if(1L != pSdrView->GetMarkedObjectCount())
     700             :                     {
     701           0 :                         rSet.DisableItem( nWhich );
     702             :                     }
     703             :                 }
     704           0 :                 break;
     705             : 
     706             :             // #i68101#
     707             :             case FN_TITLE_DESCRIPTION_SHAPE:
     708             :                 {
     709           0 :                     const bool bIsWebView(NULL != dynamic_cast<SwWebView*>(&GetView()));
     710             : 
     711           0 :                     if(!bIsWebView && 1L != pSdrView->GetMarkedObjectCount())
     712             :                     {
     713           0 :                         rSet.DisableItem( nWhich );
     714             :                     }
     715             :                 }
     716           0 :                 break;
     717             :         }
     718           0 :         nWhich = aIter.NextWhich();
     719           0 :     }
     720           0 : }
     721             : 
     722           0 : void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
     723             : {
     724           0 :     SwWrtShell *pSh = &GetShell();
     725           0 :     SdrView*    pSdrView = pSh->GetDrawView();
     726           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     727           0 :     if( rMarkList.GetMark(0) != 0 )
     728             :     {
     729           0 :         SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
     730           0 :         rSet.Put(aNewAttr,false);
     731             :     }
     732           0 : }
     733             : 
     734           0 : sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
     735             : {
     736           0 :     sal_Bool bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT);
     737             : 
     738           0 :     if (bDisable)
     739             :     {
     740           0 :         if (nWhich)
     741           0 :             rSet.DisableItem( nWhich );
     742             :         else
     743             :         {
     744           0 :             SfxWhichIter aIter( rSet );
     745           0 :             nWhich = aIter.FirstWhich();
     746           0 :             while (nWhich)
     747             :             {
     748           0 :                 rSet.DisableItem( nWhich );
     749           0 :                 nWhich = aIter.NextWhich();
     750           0 :             }
     751             :         }
     752             :     }
     753             : 
     754           0 :     return bDisable;
     755             : }
     756             : 
     757             : // Validate of drawing positions
     758             : 
     759           0 : IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation )
     760             : {
     761           0 :     SwWrtShell *pSh = &GetShell();
     762           0 :     pValidation->nMinHeight = MINFLY;
     763           0 :     pValidation->nMinWidth =  MINFLY;
     764             : 
     765           0 :     SwRect aBoundRect;
     766             : 
     767             :     // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
     768             :     //      aligned to page for fly frame anchored to paragraph or to character.
     769           0 :     const RndStdIds eAnchorType = static_cast<RndStdIds >(pValidation->nAnchorType);
     770           0 :     const SwPosition* pCntntPos = 0;
     771           0 :     SdrView*  pSdrView = pSh->GetDrawView();
     772           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     773           0 :     if( rMarkList.GetMarkCount() == 1 )
     774             :     {
     775           0 :         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     776           0 :         SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
     777           0 :         pCntntPos = pFrmFmt->GetAnchor().GetCntntAnchor();
     778             :     }
     779             : 
     780             :     pSh->CalcBoundRect( aBoundRect, eAnchorType,
     781             :                            pValidation->nHRelOrient,
     782             :                            pValidation->nVRelOrient,
     783             :                            pCntntPos,
     784             :                            pValidation->bFollowTextFlow,
     785           0 :                            pValidation->bMirror, NULL, &pValidation->aPercentSize);
     786             : 
     787           0 :     sal_Bool bIsInVertical( sal_False );
     788             :     {
     789             :         sal_Bool bRTL;
     790             :         sal_Bool bVertL2R;
     791           0 :         bIsInVertical = pSh->IsFrmVertical(sal_True, bRTL, bVertL2R);
     792             :     }
     793           0 :     if(bIsInVertical)
     794             :     {
     795           0 :         Point aPos(aBoundRect.Pos());
     796           0 :         long nTmp = aPos.X();
     797           0 :         aPos.X() = aPos.Y();
     798           0 :         aPos.Y() = nTmp;
     799           0 :         Size aSize(aBoundRect.SSize());
     800           0 :         nTmp = aSize.Width();
     801           0 :         aSize.Width() = aSize.Height();
     802           0 :         aSize.Height() = nTmp;
     803           0 :         aBoundRect.Chg( aPos, aSize );
     804             :         //exchange width/height to enable correct values
     805           0 :         nTmp = pValidation->nWidth;
     806           0 :         pValidation->nWidth = pValidation->nHeight;
     807           0 :         pValidation->nHeight = nTmp;
     808             :     }
     809           0 :     if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
     810             :     {
     811             :         // MinimalPosition
     812           0 :         pValidation->nMinHPos = aBoundRect.Left();
     813           0 :         pValidation->nMinVPos = aBoundRect.Top();
     814           0 :         SwTwips nH = pValidation->nHPos;
     815           0 :         SwTwips nV = pValidation->nVPos;
     816             : 
     817           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     818             :         {
     819           0 :             if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
     820             :             {
     821           0 :                 pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
     822           0 :                 nH = pValidation->nHPos;
     823             :             }
     824             :             else
     825           0 :                 pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     826             :         }
     827             : 
     828           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     829           0 :             pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     830             : 
     831           0 :         if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
     832             :         {
     833           0 :             if (pValidation->nVertOrient == text::VertOrientation::NONE)
     834             :             {
     835           0 :                 pValidation->nVPos -= ((pValidation->nVPos + pValidation->nHeight) - aBoundRect.Bottom());
     836           0 :                 nV = pValidation->nVPos;
     837             :             }
     838             :             else
     839           0 :                 pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
     840             :         }
     841             : 
     842           0 :         if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
     843           0 :             pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
     844             : 
     845           0 :         if ( pValidation->nVertOrient != text::VertOrientation::NONE )
     846           0 :             nV = aBoundRect.Top();
     847             : 
     848           0 :         if ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
     849           0 :             nH = aBoundRect.Left();
     850             : 
     851           0 :         pValidation->nMaxHPos   = aBoundRect.Right()  - pValidation->nWidth;
     852           0 :         pValidation->nMaxHeight = aBoundRect.Bottom() - nV;
     853             : 
     854           0 :         pValidation->nMaxVPos   = aBoundRect.Bottom() - pValidation->nHeight;
     855           0 :         pValidation->nMaxWidth  = aBoundRect.Right()  - nH;
     856             :     }
     857           0 :     else if ((eAnchorType == FLY_AT_PARA) || (eAnchorType == FLY_AT_CHAR))
     858             :     {
     859           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     860             :         {
     861           0 :             if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
     862             :             {
     863           0 :                 pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
     864             :             }
     865             :             else
     866           0 :                 pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     867             :         }
     868             : 
     869             :         // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
     870             :         // and alignment at page areas.
     871           0 :         const bool bMaxVPosAtBottom = !pValidation->bFollowTextFlow ||
     872           0 :                                       pValidation->nVRelOrient == text::RelOrientation::PAGE_FRAME ||
     873           0 :                                       pValidation->nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
     874             :         {
     875             :             SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
     876             :                                     ? aBoundRect.Bottom()
     877           0 :                                     : aBoundRect.Height() ) -
     878           0 :                                   pValidation->nHeight;
     879           0 :             if ( pValidation->nVPos > nTmpMaxVPos )
     880             :             {
     881           0 :                 if (pValidation->nVertOrient == text::VertOrientation::NONE)
     882             :                 {
     883           0 :                     pValidation->nVPos = nTmpMaxVPos;
     884             :                 }
     885             :                 else
     886             :                 {
     887             :                     pValidation->nHeight = ( bMaxVPosAtBottom
     888             :                                      ? aBoundRect.Bottom()
     889           0 :                                      : aBoundRect.Height() ) - pValidation->nVPos;
     890             :                 }
     891             :             }
     892             :         }
     893             : 
     894           0 :         pValidation->nMinHPos  = aBoundRect.Left();
     895           0 :         pValidation->nMaxHPos  = aBoundRect.Right() - pValidation->nWidth;
     896             : 
     897           0 :         pValidation->nMinVPos  = aBoundRect.Top();
     898             :         // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
     899           0 :         if ( bMaxVPosAtBottom )
     900             :         {
     901           0 :             pValidation->nMaxVPos  = aBoundRect.Bottom() - pValidation->nHeight;
     902             :         }
     903             :         else
     904             :         {
     905           0 :             pValidation->nMaxVPos  = aBoundRect.Height() - pValidation->nHeight;
     906             :         }
     907             : 
     908             :         // Maximum width height
     909           0 :         const SwTwips nH = ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
     910             :                            ? aBoundRect.Left()
     911           0 :                            : pValidation->nHPos;
     912           0 :         const SwTwips nV = ( pValidation->nVertOrient != text::VertOrientation::NONE )
     913             :                            ? aBoundRect.Top()
     914           0 :                            : pValidation->nVPos;
     915           0 :         pValidation->nMaxHeight  = pValidation->nMaxVPos + pValidation->nHeight - nV;
     916           0 :         pValidation->nMaxWidth   = pValidation->nMaxHPos + pValidation->nWidth - nH;
     917             :     }
     918           0 :     else if (eAnchorType == FLY_AS_CHAR)
     919             :     {
     920           0 :         pValidation->nMinHPos = 0;
     921           0 :         pValidation->nMaxHPos = 0;
     922             : 
     923           0 :         pValidation->nMaxHeight = aBoundRect.Height();
     924           0 :         pValidation->nMaxWidth  = aBoundRect.Width();
     925             : 
     926           0 :         pValidation->nMaxVPos   = aBoundRect.Height();
     927           0 :         pValidation->nMinVPos   = -aBoundRect.Height() + pValidation->nHeight;
     928           0 :         if (pValidation->nMaxVPos < pValidation->nMinVPos)
     929             :         {
     930           0 :             pValidation->nMinVPos = pValidation->nMaxVPos;
     931           0 :             pValidation->nMaxVPos = -aBoundRect.Height();
     932             :         }
     933             :     }
     934           0 :     if(bIsInVertical)
     935             :     {
     936             :         //restore width/height exchange
     937           0 :         long nTmp = pValidation->nWidth;
     938           0 :         pValidation->nWidth = pValidation->nHeight;
     939           0 :         pValidation->nHeight = nTmp;
     940             :     }
     941             : 
     942           0 :     if (pValidation->nMaxWidth < pValidation->nWidth)
     943           0 :         pValidation->nWidth = pValidation->nMaxWidth;
     944           0 :     if (pValidation->nMaxHeight < pValidation->nHeight)
     945           0 :         pValidation->nHeight = pValidation->nMaxHeight;
     946           0 :     return 0;
     947           0 : }
     948             : 
     949             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10