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

Generated by: LCOV version 1.10