LCOV - code coverage report
Current view: top level - sw/source/uibase/shells - drwbassh.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 471 0.8 %
Date: 2015-06-13 12:38:46 Functions: 5 22 22.7 %
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 <hintids.hxx>
      21             : #include <helpid.h>
      22             : #include <swtypes.hxx>
      23             : #include <sfx2/objface.hxx>
      24             : #include <sfx2/request.hxx>
      25             : #include <sfx2/bindings.hxx>
      26             : #include <svl/aeitem.hxx>
      27             : #include <svx/svdview.hxx>
      28             : #include <vcl/msgbox.hxx>
      29             : #include <svl/srchitem.hxx>
      30             : #include <svl/whiter.hxx>
      31             : #include <svx/swframevalidation.hxx>
      32             : #include <svx/anchorid.hxx>
      33             : #include <sfx2/htmlmode.hxx>
      34             : #include <drawdoc.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             : #include <shells.hrc>
      53             : #define SwDrawBaseShell
      54             : #include <sfx2/msg.hxx>
      55             : #include <swslots.hxx>
      56             : #include <svx/svxdlg.hxx>
      57             : #include <svx/dialogs.hrc>
      58             : #include "swabstdlg.hxx"
      59             : #include "dialog.hrc"
      60             : #include <swundo.hxx>
      61             : #include <com/sun/star/text/HoriOrientation.hpp>
      62             : #include <com/sun/star/text/VertOrientation.hpp>
      63             : #include <com/sun/star/text/RelOrientation.hpp>
      64             : #include <IDocumentDrawModelAccess.hxx>
      65             : #include <boost/scoped_ptr.hpp>
      66             : 
      67             : using namespace ::com::sun::star;
      68             : 
      69         236 : SFX_IMPL_SUPERCLASS_INTERFACE(SwDrawBaseShell, SwBaseShell)
      70             : 
      71          59 : void SwDrawBaseShell::InitInterface_Impl()
      72             : {
      73          59 : }
      74             : 
      75           0 : TYPEINIT1(SwDrawBaseShell,SwBaseShell)
      76             : 
      77           0 : SwDrawBaseShell::SwDrawBaseShell(SwView &_rView)
      78             :     : SwBaseShell(_rView)
      79             :     , pDrawActual(0)
      80           0 :     , eDrawMode(0)
      81             : {
      82           0 :     GetShell().NoEdit(true);
      83             : 
      84           0 :     SwEditWin& rWin = GetView().GetEditWin();
      85             : 
      86           0 :     rWin.SetBezierMode(SID_BEZIER_MOVE);
      87             : 
      88           0 :     if ( !_rView.GetDrawFuncPtr() )
      89           0 :         _rView.GetEditWin().StdDrawMode( OBJ_NONE, true );
      90             : 
      91           0 :     SwTransferable::CreateSelection( GetShell() );
      92           0 : }
      93             : 
      94           0 : SwDrawBaseShell::~SwDrawBaseShell()
      95             : {
      96           0 :     GetView().ExitDraw();
      97           0 :     GetShell().Edit();
      98           0 :     SwTransferable::ClearSelection( GetShell() );
      99           0 : }
     100             : 
     101           0 : void SwDrawBaseShell::Execute(SfxRequest &rReq)
     102             : {
     103           0 :     SwWrtShell *pSh = &GetShell();
     104           0 :     SdrView*    pSdrView = pSh->GetDrawView();
     105           0 :     const SfxItemSet *pArgs = rReq.GetArgs();
     106           0 :     sal_uInt16      nSlotId = rReq.GetSlot();
     107           0 :     bool        bChanged = pSdrView->GetModel()->IsChanged();
     108           0 :     pSdrView->GetModel()->SetChanged(false);
     109           0 :     const SfxPoolItem* pItem = 0;
     110           0 :     if(pArgs)
     111           0 :         pArgs->GetItemState(nSlotId, false, &pItem);
     112             : 
     113             :     //Special case align by menu
     114           0 :     if(pItem && nSlotId == SID_OBJECT_ALIGN)
     115             :     {
     116             :         OSL_ENSURE(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem expected");
     117           0 :         nSlotId = nSlotId + static_cast<const SfxEnumItem*>(pItem)->GetValue();
     118           0 :         nSlotId++;
     119             :     }
     120             : 
     121           0 :     bool bAlignPossible = pSh->IsAlignPossible();
     122             : 
     123           0 :     bool bTopParam = true, bBottomParam = true;
     124           0 :     bool bDone = false;
     125           0 :     SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
     126             : 
     127           0 :     switch (nSlotId)
     128             :     {
     129             :         case FN_DRAW_WRAP_DLG:
     130             :         {
     131           0 :             if(pSdrView->AreObjectsMarked())
     132             :             {
     133           0 :                 if(!pArgs)
     134             :                 {
     135           0 :                     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     136           0 :                     if( rMarkList.GetMark(0) != 0 )
     137             :                     {
     138           0 :                         SfxItemSet aSet(GetPool(),  RES_SURROUND, RES_SURROUND,
     139             :                                                     RES_ANCHOR, RES_ANCHOR,
     140             :                                                     RES_LR_SPACE, RES_UL_SPACE,
     141             :                                                     SID_HTML_MODE, SID_HTML_MODE,
     142             :                                                     FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG,
     143           0 :                                                     0);
     144             : 
     145             :                         aSet.Put(SfxBoolItem(SID_HTML_MODE,
     146           0 :                             0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
     147             : 
     148           0 :                         aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId()));
     149             : 
     150           0 :                         pSh->GetObjAttr(aSet);
     151           0 :                         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     152             :                         OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     153             : 
     154           0 :                         boost::scoped_ptr<SfxAbstractDialog> pDlg(pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, true, RC_DLG_SWWRAPDLG ));
     155             :                         OSL_ENSURE(pDlg, "Dialog creation failed!");
     156             : 
     157           0 :                         if (pDlg->Execute() == RET_OK)
     158             :                         {
     159             :                             const SfxPoolItem* pWrapItem;
     160           0 :                             const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     161           0 :                             if(SfxItemState::SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, false, &pWrapItem))
     162             :                             {
     163           0 :                                 short nLayer = static_cast<const SfxInt16Item*>(pWrapItem)->GetValue();
     164           0 :                                 if (nLayer == 1)
     165           0 :                                     pSh->SelectionToHeaven();
     166             :                                 else
     167           0 :                                     pSh->SelectionToHell();
     168             :                             }
     169             : 
     170           0 :                             pSh->SetObjAttr(*pOutSet);
     171           0 :                         }
     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 :                         boost::scoped_ptr<SfxAbstractTabDialog> pDlg;
     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.reset(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.reset(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             :                         bool bRTL;
     232             :                         bool bVertL2R;
     233           0 :                         aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrmVertical(true, bRTL, bVertL2R)));
     234           0 :                         aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL));
     235             : 
     236           0 :                         SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
     237             : 
     238           0 :                         aSet.Put( pFrameFormat->GetFormatAttr(RES_FOLLOW_TEXT_FLOW) );
     239             : 
     240           0 :                         SwFormatVertOrient aVOrient(static_cast<const SwFormatVertOrient&>(pFrameFormat->GetFormatAttr(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 :                         SwFormatHoriOrient aHOrient(static_cast<const SwFormatHoriOrient&>(pFrameFormat->GetFormatAttr(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             :                                 SfxItemState::SET != pOutSet->GetItemState(
     270           0 :                                     SID_ATTR_TRANSFORM_POS_X, false ) &&
     271             :                                 SfxItemState::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(SfxItemState::SET == pOutSet->GetItemState(
     280           0 :                                 SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem))
     281             :                             {
     282           0 :                                 if(!bSingleSelection)
     283             :                                     pSh->ChgAnchor(static_cast<const SfxInt16Item*>(pAnchorItem)
     284           0 :                                             ->GetValue(), false, bPosCorr );
     285             :                                 else
     286             :                                 {
     287           0 :                                     SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
     288           0 :                                     aAnchor.SetType((RndStdIds)static_cast<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           0 :                         }
     348             :                     }
     349             :                 }
     350             :                 else
     351             :                 {
     352           0 :                     pSdrView->SetGeoAttrToMarked( *pArgs );
     353             :                 }
     354             :             }
     355             :         }
     356           0 :         break;
     357             : 
     358             :         case SID_DELETE:
     359             :         case FN_BACKSPACE:
     360           0 :             if (pSh->IsObjSelected() && !pSdrView->IsTextEdit())
     361             :             {
     362           0 :                 bDone = true;
     363             : 
     364           0 :                 if( GetView().IsDrawRotate() )
     365             :                 {
     366           0 :                     pSh->SetDragMode( SDRDRAG_MOVE );
     367           0 :                     GetView().FlipDrawRotate();
     368             :                 }
     369             : 
     370           0 :                 pSh->SetModified();
     371           0 :                 pSh->DelSelectedObj();
     372             : 
     373           0 :                 if (rReq.IsAPI() ||
     374           0 :                     GetView().GetEditWin().IsObjectSelect() )
     375             :                 {
     376             :                     // If basic call, then back to the text shell, because the
     377             :                     // Basic otherwise has no possibility to return.
     378           0 :                     if (GetView().GetDrawFuncPtr())
     379             :                     {
     380           0 :                         GetView().GetDrawFuncPtr()->Deactivate();
     381           0 :                         GetView().SetDrawFuncPtr(NULL);
     382             :                     }
     383           0 :                     GetView().LeaveDrawCreate();    // Switch to selection mode
     384             :                 }
     385             : 
     386           0 :                 if (pSh->IsSelFrmMode())
     387             :                 {
     388           0 :                     pSh->LeaveSelFrmMode();
     389             :                     // #105852# FME
     390             :                 }
     391             :             }
     392           0 :             break;
     393             : 
     394             :         case SID_GROUP:
     395           0 :             if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed())
     396             :             {
     397           0 :                 pSh->GroupSelection();
     398           0 :                 rBind.Invalidate(SID_UNGROUP);
     399             :             }
     400           0 :             break;
     401             : 
     402             :         case SID_UNGROUP:
     403           0 :             if (pSh->IsGroupSelected() && pSh->IsUnGroupAllowed())
     404             :             {
     405           0 :                 pSh->UnGroupSelection();
     406           0 :                 rBind.Invalidate(SID_GROUP);
     407             :             }
     408           0 :             break;
     409             : 
     410             :         case SID_ENTER_GROUP:
     411           0 :             if (pSh->IsGroupSelected())
     412             :             {
     413           0 :                 pSdrView->EnterMarkedGroup();
     414           0 :                 rBind.InvalidateAll(false);
     415             :             }
     416           0 :             break;
     417             : 
     418             :         case SID_LEAVE_GROUP:
     419           0 :             if (pSdrView->IsGroupEntered())
     420             :             {
     421           0 :                 pSdrView->LeaveOneGroup();
     422           0 :                 rBind.Invalidate(SID_ENTER_GROUP);
     423           0 :                 rBind.Invalidate(SID_UNGROUP);
     424             :             }
     425           0 :             break;
     426             : 
     427             :         case SID_OBJECT_ALIGN_LEFT:
     428             :         case SID_OBJECT_ALIGN_CENTER:
     429             :         case SID_OBJECT_ALIGN_RIGHT:
     430             :         case SID_OBJECT_ALIGN_UP:
     431             :         case SID_OBJECT_ALIGN_MIDDLE:
     432             :         case SID_OBJECT_ALIGN_DOWN:
     433             :         {
     434           0 :             if ( bAlignPossible )
     435             :             {
     436           0 :                 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     437           0 :                 if( rMarkList.GetMarkCount() == 1 && bAlignPossible )
     438             :                 {   // Do not align objects to each other
     439           0 :                     sal_uInt16 nAnchor = pSh->GetAnchorId();
     440           0 :                     if (nAnchor == FLY_AS_CHAR)
     441             :                     {
     442           0 :                         sal_Int16 nVertOrient = -1;
     443             : 
     444           0 :                         switch (nSlotId)
     445             :                         {
     446             :                             case SID_OBJECT_ALIGN_UP:
     447           0 :                                 nVertOrient = text::VertOrientation::TOP;
     448           0 :                                 break;
     449             :                             case SID_OBJECT_ALIGN_MIDDLE:
     450           0 :                                 nVertOrient = text::VertOrientation::CENTER;
     451           0 :                                 break;
     452             :                             case SID_OBJECT_ALIGN_DOWN:
     453           0 :                                 nVertOrient = text::VertOrientation::BOTTOM;
     454           0 :                                 break;
     455             :                             default:
     456           0 :                                 break;
     457             :                         }
     458           0 :                         if (nVertOrient != -1)
     459             :                         {
     460           0 :                             pSh->StartAction();
     461           0 :                             SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     462           0 :                             SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
     463           0 :                             SwFormatVertOrient aVOrient(static_cast<const SwFormatVertOrient&>(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT)));
     464           0 :                             aVOrient.SetVertOrient( nVertOrient );
     465           0 :                             pFrameFormat->SetFormatAttr(aVOrient);
     466           0 :                             pSh->EndAction();
     467             :                         }
     468           0 :                         break;
     469             :                     }
     470           0 :                     if (nAnchor == FLY_AT_PARA)
     471           0 :                         break;  // Do not align frames of an anchored paragraph
     472             :                 }
     473             : 
     474           0 :                 pSh->StartAction();
     475           0 :                 switch (nSlotId)
     476             :                 {
     477             :                     case SID_OBJECT_ALIGN_LEFT:
     478           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
     479           0 :                         break;
     480             :                     case SID_OBJECT_ALIGN_CENTER:
     481           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
     482           0 :                         break;
     483             :                     case SID_OBJECT_ALIGN_RIGHT:
     484           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
     485           0 :                         break;
     486             :                     case SID_OBJECT_ALIGN_UP:
     487           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
     488           0 :                         break;
     489             :                     case SID_OBJECT_ALIGN_MIDDLE:
     490           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
     491           0 :                         break;
     492             :                     case SID_OBJECT_ALIGN_DOWN:
     493           0 :                         pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
     494           0 :                         break;
     495             :                 }
     496           0 :                 pSh->EndAction();
     497             :             }
     498             :         }
     499           0 :         break;
     500             : 
     501             :         case FN_FRAME_UP:
     502           0 :             bTopParam = false;
     503             :             /* no break */
     504             :         case SID_FRAME_TO_TOP:
     505           0 :             pSh->SelectionToTop( bTopParam );
     506           0 :             break;
     507             : 
     508             :         case FN_FRAME_DOWN:
     509           0 :             bBottomParam = false;
     510             :             /* no break */
     511             :         case SID_FRAME_TO_BOTTOM:
     512           0 :             pSh->SelectionToBottom( bBottomParam );
     513           0 :             break;
     514             : 
     515             :         case FN_NAME_SHAPE:
     516             :         {
     517           0 :             bDone = true;
     518             : 
     519           0 :             if(1L == pSdrView->GetMarkedObjectCount())
     520             :             {
     521             :                 // #i68101#
     522           0 :                 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
     523             :                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
     524           0 :                 OUString aName(pSelected->GetName());
     525             : 
     526           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     527             :                 OSL_ENSURE(pFact, "Dialog creation failed!");
     528           0 :                 boost::scoped_ptr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(NULL, aName));
     529             :                 OSL_ENSURE(pDlg, "Dialog creation failed!");
     530             : 
     531           0 :                 pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
     532             : 
     533           0 :                 if(RET_OK == pDlg->Execute())
     534             :                 {
     535           0 :                     pDlg->GetName(aName);
     536           0 :                     pSelected->SetName(aName);
     537           0 :                     pSh->SetModified();
     538           0 :                 }
     539             :             }
     540             : 
     541           0 :             break;
     542             :         }
     543             : 
     544             :         // #i68101#
     545             :         case FN_TITLE_DESCRIPTION_SHAPE:
     546             :         {
     547           0 :             bDone = true;
     548             : 
     549           0 :             if(1L == pSdrView->GetMarkedObjectCount())
     550             :             {
     551           0 :                 SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
     552             :                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
     553           0 :                 OUString aTitle(pSelected->GetTitle());
     554           0 :                 OUString aDescription(pSelected->GetDescription());
     555             : 
     556           0 :                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     557             :                 OSL_ENSURE(pFact, "Dialog creation failed!");
     558           0 :                 boost::scoped_ptr<AbstractSvxObjectTitleDescDialog> pDlg(pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription));
     559             :                 OSL_ENSURE(pDlg, "Dialog creation failed!");
     560             : 
     561           0 :                 if(RET_OK == pDlg->Execute())
     562             :                 {
     563           0 :                     pDlg->GetTitle(aTitle);
     564           0 :                     pDlg->GetDescription(aDescription);
     565             : 
     566           0 :                     pSelected->SetTitle(aTitle);
     567           0 :                     pSelected->SetDescription(aDescription);
     568             : 
     569           0 :                     pSh->SetModified();
     570           0 :                 }
     571             :             }
     572             : 
     573           0 :             break;
     574             :         }
     575             : 
     576             :         default:
     577             :             OSL_ENSURE(false, "wrong Dispatcher");
     578           0 :             return;
     579             :     }
     580           0 :     if(!bDone)
     581             :     {
     582           0 :         if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN)
     583           0 :             rBind.Invalidate(SID_ATTR_LONG_LRSPACE);
     584           0 :         if (pSdrView->GetModel()->IsChanged())
     585           0 :             pSh->SetModified();
     586           0 :         else if (bChanged)
     587           0 :             pSdrView->GetModel()->SetChanged(true);
     588             :     }
     589             : }
     590             : 
     591             : // Checks whether a given name is allowed for a group shape
     592             : 
     593           0 : IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNameDialog )
     594             : {
     595           0 :     SwWrtShell          &rSh = GetShell();
     596           0 :     SdrView *pSdrView = rSh.GetDrawView();
     597           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     598             :     OSL_ENSURE(rMarkList.GetMarkCount() == 1, "wrong draw selection");
     599           0 :     SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     600           0 :     const OUString sCurrentName = pObj->GetName();
     601           0 :     OUString sNewName;
     602           0 :     pNameDialog->GetName(sNewName);
     603           0 :     long nRet = 0;
     604           0 :     if (sNewName.isEmpty() || sCurrentName == sNewName)
     605           0 :         nRet = 1;
     606             :     else
     607             :     {
     608           0 :         nRet = 1;
     609           0 :         SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
     610           0 :         SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS );
     611           0 :         while( aIter.IsMore() )
     612             :         {
     613           0 :             SdrObject* pTempObj = aIter.Next();
     614           0 :             if ( pObj != pTempObj && pTempObj->GetName().equals(sNewName) )
     615             :             {
     616           0 :                 nRet = 0;
     617           0 :                 break;
     618             :             }
     619           0 :         }
     620             :     }
     621           0 :     return nRet;
     622             : }
     623             : 
     624           0 : void SwDrawBaseShell::GetState(SfxItemSet& rSet)
     625             : {
     626           0 :     SwWrtShell &rSh = GetShell();
     627           0 :     SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
     628           0 :     SfxWhichIter aIter( rSet );
     629           0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     630           0 :     bool bProtected = rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
     631             : 
     632           0 :     if (!bProtected)    // Look in the parent
     633           0 :         bProtected |= rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
     634             : 
     635           0 :     while( nWhich )
     636             :     {
     637           0 :         switch( nWhich )
     638             :         {
     639             :             case FN_DRAW_WRAP_DLG:
     640             :             case SID_ATTR_TRANSFORM:
     641             :             case SID_FRAME_TO_TOP:
     642             :             case SID_FRAME_TO_BOTTOM:
     643             :             case FN_FRAME_UP:
     644             :             case FN_FRAME_DOWN:
     645             :             case SID_DELETE:
     646             :             case FN_BACKSPACE:
     647           0 :                 if( bProtected || !rSh.IsObjSelected() )
     648           0 :                     rSet.DisableItem( nWhich );
     649           0 :                 break;
     650             :             case SID_GROUP:
     651           0 :                 if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() )
     652           0 :                     rSet.DisableItem( nWhich );
     653           0 :                 break;
     654             :             case SID_UNGROUP:
     655           0 :                 if ( !rSh.IsGroupSelected() || bProtected || !rSh.IsUnGroupAllowed() )
     656           0 :                     rSet.DisableItem( nWhich );
     657           0 :                 break;
     658             :             case SID_ENTER_GROUP:
     659           0 :                 if ( !rSh.IsGroupSelected() )
     660           0 :                     rSet.DisableItem( nWhich );
     661           0 :                 break;
     662             :             case SID_LEAVE_GROUP:
     663           0 :                 if ( !pSdrView->IsGroupEntered() )
     664           0 :                     rSet.DisableItem( nWhich );
     665           0 :                 break;
     666             :             case SID_OBJECT_ALIGN_LEFT:
     667             :             case SID_OBJECT_ALIGN_CENTER:
     668             :             case SID_OBJECT_ALIGN_RIGHT:
     669             :             case SID_OBJECT_ALIGN_UP:
     670             :             case SID_OBJECT_ALIGN_MIDDLE:
     671             :             case SID_OBJECT_ALIGN_DOWN:
     672             :             case SID_OBJECT_ALIGN:
     673           0 :                 if ( !rSh.IsAlignPossible() || bProtected )
     674           0 :                     rSet.DisableItem( nWhich );
     675             :                 else
     676             :                 {
     677           0 :                     SfxAllEnumItem aEnumItem(nWhich, USHRT_MAX);
     678           0 :                     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     679             :                     //if only one object is selected it can only be vertically
     680             :                     // aligned because it is character bound
     681           0 :                     if( rMarkList.GetMarkCount() == 1 )
     682             :                     {
     683           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_LEFT);
     684           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_CENTER);
     685           0 :                         aEnumItem.DisableValue(SID_OBJECT_ALIGN_RIGHT);
     686             :                     }
     687           0 :                     rSet.Put(aEnumItem);
     688             :                 }
     689           0 :                 break;
     690             : 
     691             :             case FN_NAME_SHAPE :
     692             :                 {
     693           0 :                     if(1L != pSdrView->GetMarkedObjectCount())
     694             :                     {
     695           0 :                         rSet.DisableItem( nWhich );
     696             :                     }
     697             :                 }
     698           0 :                 break;
     699             : 
     700             :             // #i68101#
     701             :             case FN_TITLE_DESCRIPTION_SHAPE:
     702             :                 {
     703           0 :                     const bool bIsWebView(NULL != dynamic_cast<SwWebView*>(&GetView()));
     704             : 
     705           0 :                     if(!bIsWebView && 1L != pSdrView->GetMarkedObjectCount())
     706             :                     {
     707           0 :                         rSet.DisableItem( nWhich );
     708             :                     }
     709             :                 }
     710           0 :                 break;
     711             :         }
     712           0 :         nWhich = aIter.NextWhich();
     713           0 :     }
     714           0 : }
     715             : 
     716           0 : void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
     717             : {
     718           0 :     SwWrtShell *pSh = &GetShell();
     719           0 :     SdrView*    pSdrView = pSh->GetDrawView();
     720           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     721           0 :     if( rMarkList.GetMark(0) != 0 )
     722             :     {
     723           0 :         SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
     724           0 :         rSet.Put(aNewAttr,false);
     725             :     }
     726           0 : }
     727             : 
     728           0 : bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
     729             : {
     730           0 :     bool bDisable = GetShell().IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
     731             : 
     732           0 :     if (bDisable)
     733             :     {
     734           0 :         if (nWhich)
     735           0 :             rSet.DisableItem( nWhich );
     736             :         else
     737             :         {
     738           0 :             SfxWhichIter aIter( rSet );
     739           0 :             nWhich = aIter.FirstWhich();
     740           0 :             while (nWhich)
     741             :             {
     742           0 :                 rSet.DisableItem( nWhich );
     743           0 :                 nWhich = aIter.NextWhich();
     744           0 :             }
     745             :         }
     746             :     }
     747             : 
     748           0 :     return bDisable;
     749             : }
     750             : 
     751             : // Validate of drawing positions
     752             : 
     753           0 : IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation )
     754             : {
     755           0 :     SwWrtShell *pSh = &GetShell();
     756           0 :     pValidation->nMinHeight = MINFLY;
     757           0 :     pValidation->nMinWidth =  MINFLY;
     758             : 
     759           0 :     SwRect aBoundRect;
     760             : 
     761             :     // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
     762             :     //      aligned to page for fly frame anchored to paragraph or to character.
     763           0 :     const RndStdIds eAnchorType = static_cast<RndStdIds >(pValidation->nAnchorType);
     764           0 :     const SwPosition* pContentPos = 0;
     765           0 :     SdrView*  pSdrView = pSh->GetDrawView();
     766           0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     767           0 :     if( rMarkList.GetMarkCount() == 1 )
     768             :     {
     769           0 :         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     770           0 :         SwFrameFormat* pFrameFormat = FindFrameFormat( pObj );
     771           0 :         pContentPos = pFrameFormat->GetAnchor().GetContentAnchor();
     772             :     }
     773             : 
     774             :     pSh->CalcBoundRect( aBoundRect, eAnchorType,
     775             :                            pValidation->nHRelOrient,
     776             :                            pValidation->nVRelOrient,
     777             :                            pContentPos,
     778             :                            pValidation->bFollowTextFlow,
     779           0 :                            pValidation->bMirror, NULL, &pValidation->aPercentSize);
     780             : 
     781           0 :     bool bIsInVertical( false );
     782             :     {
     783             :         bool bRTL;
     784             :         bool bVertL2R;
     785           0 :         bIsInVertical = pSh->IsFrmVertical(true, bRTL, bVertL2R);
     786             :     }
     787           0 :     if(bIsInVertical)
     788             :     {
     789           0 :         Point aPos(aBoundRect.Pos());
     790           0 :         long nTmp = aPos.X();
     791           0 :         aPos.X() = aPos.Y();
     792           0 :         aPos.Y() = nTmp;
     793           0 :         Size aSize(aBoundRect.SSize());
     794           0 :         nTmp = aSize.Width();
     795           0 :         aSize.Width() = aSize.Height();
     796           0 :         aSize.Height() = nTmp;
     797           0 :         aBoundRect.Chg( aPos, aSize );
     798             :         //exchange width/height to enable correct values
     799           0 :         nTmp = pValidation->nWidth;
     800           0 :         pValidation->nWidth = pValidation->nHeight;
     801           0 :         pValidation->nHeight = nTmp;
     802             :     }
     803           0 :     if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
     804             :     {
     805             :         // MinimalPosition
     806           0 :         pValidation->nMinHPos = aBoundRect.Left();
     807           0 :         pValidation->nMinVPos = aBoundRect.Top();
     808           0 :         SwTwips nH = pValidation->nHPos;
     809           0 :         SwTwips nV = pValidation->nVPos;
     810             : 
     811           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     812             :         {
     813           0 :             if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
     814             :             {
     815           0 :                 pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
     816           0 :                 nH = pValidation->nHPos;
     817             :             }
     818             :             else
     819           0 :                 pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     820             :         }
     821             : 
     822           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     823           0 :             pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     824             : 
     825           0 :         if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
     826             :         {
     827           0 :             if (pValidation->nVertOrient == text::VertOrientation::NONE)
     828             :             {
     829           0 :                 pValidation->nVPos -= ((pValidation->nVPos + pValidation->nHeight) - aBoundRect.Bottom());
     830           0 :                 nV = pValidation->nVPos;
     831             :             }
     832             :             else
     833           0 :                 pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
     834             :         }
     835             : 
     836           0 :         if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
     837           0 :             pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
     838             : 
     839           0 :         if ( pValidation->nVertOrient != text::VertOrientation::NONE )
     840           0 :             nV = aBoundRect.Top();
     841             : 
     842           0 :         if ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
     843           0 :             nH = aBoundRect.Left();
     844             : 
     845           0 :         pValidation->nMaxHPos   = aBoundRect.Right()  - pValidation->nWidth;
     846           0 :         pValidation->nMaxHeight = aBoundRect.Bottom() - nV;
     847             : 
     848           0 :         pValidation->nMaxVPos   = aBoundRect.Bottom() - pValidation->nHeight;
     849           0 :         pValidation->nMaxWidth  = aBoundRect.Right()  - nH;
     850             :     }
     851           0 :     else if ((eAnchorType == FLY_AT_PARA) || (eAnchorType == FLY_AT_CHAR))
     852             :     {
     853           0 :         if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
     854             :         {
     855           0 :             if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
     856             :             {
     857           0 :                 pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
     858             :             }
     859             :             else
     860           0 :                 pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
     861             :         }
     862             : 
     863             :         // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
     864             :         // and alignment at page areas.
     865           0 :         const bool bMaxVPosAtBottom = !pValidation->bFollowTextFlow ||
     866           0 :                                       pValidation->nVRelOrient == text::RelOrientation::PAGE_FRAME ||
     867           0 :                                       pValidation->nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
     868             :         {
     869             :             SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
     870             :                                     ? aBoundRect.Bottom()
     871           0 :                                     : aBoundRect.Height() ) -
     872           0 :                                   pValidation->nHeight;
     873           0 :             if ( pValidation->nVPos > nTmpMaxVPos )
     874             :             {
     875           0 :                 if (pValidation->nVertOrient == text::VertOrientation::NONE)
     876             :                 {
     877           0 :                     pValidation->nVPos = nTmpMaxVPos;
     878             :                 }
     879             :                 else
     880             :                 {
     881             :                     pValidation->nHeight = ( bMaxVPosAtBottom
     882           0 :                                      ? aBoundRect.Bottom()
     883           0 :                                      : aBoundRect.Height() ) - pValidation->nVPos;
     884             :                 }
     885             :             }
     886             :         }
     887             : 
     888           0 :         pValidation->nMinHPos  = aBoundRect.Left();
     889           0 :         pValidation->nMaxHPos  = aBoundRect.Right() - pValidation->nWidth;
     890             : 
     891           0 :         pValidation->nMinVPos  = aBoundRect.Top();
     892             :         // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
     893           0 :         if ( bMaxVPosAtBottom )
     894             :         {
     895           0 :             pValidation->nMaxVPos  = aBoundRect.Bottom() - pValidation->nHeight;
     896             :         }
     897             :         else
     898             :         {
     899           0 :             pValidation->nMaxVPos  = aBoundRect.Height() - pValidation->nHeight;
     900             :         }
     901             : 
     902             :         // Maximum width height
     903           0 :         const SwTwips nH = ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
     904             :                            ? aBoundRect.Left()
     905           0 :                            : pValidation->nHPos;
     906           0 :         const SwTwips nV = ( pValidation->nVertOrient != text::VertOrientation::NONE )
     907             :                            ? aBoundRect.Top()
     908           0 :                            : pValidation->nVPos;
     909           0 :         pValidation->nMaxHeight  = pValidation->nMaxVPos + pValidation->nHeight - nV;
     910           0 :         pValidation->nMaxWidth   = pValidation->nMaxHPos + pValidation->nWidth - nH;
     911             :     }
     912           0 :     else if (eAnchorType == FLY_AS_CHAR)
     913             :     {
     914           0 :         pValidation->nMinHPos = 0;
     915           0 :         pValidation->nMaxHPos = 0;
     916             : 
     917           0 :         pValidation->nMaxHeight = aBoundRect.Height();
     918           0 :         pValidation->nMaxWidth  = aBoundRect.Width();
     919             : 
     920           0 :         pValidation->nMaxVPos   = aBoundRect.Height();
     921           0 :         pValidation->nMinVPos   = -aBoundRect.Height() + pValidation->nHeight;
     922           0 :         if (pValidation->nMaxVPos < pValidation->nMinVPos)
     923             :         {
     924           0 :             pValidation->nMinVPos = pValidation->nMaxVPos;
     925           0 :             pValidation->nMaxVPos = -aBoundRect.Height();
     926             :         }
     927             :     }
     928           0 :     if(bIsInVertical)
     929             :     {
     930             :         //restore width/height exchange
     931           0 :         long nTmp = pValidation->nWidth;
     932           0 :         pValidation->nWidth = pValidation->nHeight;
     933           0 :         pValidation->nHeight = nTmp;
     934             :     }
     935             : 
     936           0 :     if (pValidation->nMaxWidth < pValidation->nWidth)
     937           0 :         pValidation->nWidth = pValidation->nMaxWidth;
     938           0 :     if (pValidation->nMaxHeight < pValidation->nHeight)
     939           0 :         pValidation->nHeight = pValidation->nMaxHeight;
     940           0 :     return 0;
     941         177 : }
     942             : 
     943             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11