LCOV - code coverage report
Current view: top level - sw/source/uibase/ribbar - conrect.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 79 1.3 %
Date: 2015-06-13 12:38:46 Functions: 2 6 33.3 %
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 <sfx2/bindings.hxx>
      21             : #include <sfx2/htmlmode.hxx>
      22             : #include <svx/sdtacitm.hxx>
      23             : #include <svx/svdobj.hxx>
      24             : #include <svx/sdtagitm.hxx>
      25             : #include <svx/sdtakitm.hxx>
      26             : #include <svx/sdtaditm.hxx>
      27             : #include <svx/sdtaaitm.hxx>
      28             : #include <svx/svdview.hxx>
      29             : #include <svx/svdocapt.hxx>
      30             : #include <editeng/outlobj.hxx>
      31             : #include <cmdid.h>
      32             : #include <view.hxx>
      33             : #include <edtwin.hxx>
      34             : #include <wrtsh.hxx>
      35             : #include <viewopt.hxx>
      36             : #include <drawbase.hxx>
      37             : #include <conrect.hxx>
      38             : 
      39           0 : ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
      40             :                                 SwView* pSwView )
      41             :     : SwDrawBase( pWrtShell, pEditWin, pSwView )
      42             :     , bMarquee(false)
      43             :     , bCapVertical(false)
      44             :     // #93382#
      45           0 :     , mbVertical(false)
      46             : {
      47           0 : }
      48             : 
      49           0 : bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
      50             : {
      51             :     bool bReturn;
      52             : 
      53           0 :     if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt))
      54           0 :                                     && m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
      55             :     {
      56           0 :         m_pView->NoRotate();
      57           0 :         if (m_pView->IsDrawSelMode())
      58             :         {
      59           0 :             m_pView->FlipDrawSelMode();
      60           0 :             m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
      61             :         }
      62             :     }
      63           0 :     return bReturn;
      64             : }
      65             : 
      66           0 : bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
      67             : {
      68           0 :     bool bRet = SwDrawBase::MouseButtonUp(rMEvt);
      69           0 :     if( bRet )
      70             :     {
      71           0 :         SdrView *pSdrView = m_pSh->GetDrawView();
      72           0 :         const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
      73           0 :         SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
      74           0 :                                                : 0;
      75           0 :         switch( m_pWin->GetSdrDrawMode() )
      76             :         {
      77             :         case OBJ_TEXT:
      78           0 :             if( bMarquee )
      79             :             {
      80           0 :                 m_pSh->ChgAnchor(FLY_AS_CHAR);
      81             : 
      82           0 :                 if( pObj )
      83             :                 {
      84             :                     // Set the attributes needed for scrolling
      85           0 :                     SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
      86           0 :                                         SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
      87             : 
      88           0 :                     aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
      89           0 :                     aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
      90           0 :                     aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
      91           0 :                     aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
      92           0 :                     aItemSet.Put( SdrTextAniCountItem( 0 ) );
      93             :                     aItemSet.Put( SdrTextAniAmountItem(
      94           0 :                             (sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
      95             : 
      96           0 :                     pObj->SetMergedItemSetAndBroadcast(aItemSet);
      97             :                 }
      98             :             }
      99           0 :             else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
     100             :             {
     101           0 :                 SdrTextObj* pText = static_cast<SdrTextObj*>(pObj);
     102           0 :                 SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
     103             : 
     104           0 :                 pText->SetVerticalWriting(true);
     105             : 
     106           0 :                 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
     107           0 :                 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
     108           0 :                 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
     109           0 :                 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
     110             : 
     111           0 :                 pText->SetMergedItemSet(aSet);
     112             :             }
     113           0 :             if( pObj )
     114             :             {
     115           0 :                 SdrPageView* pPV = pSdrView->GetSdrPageView();
     116           0 :                 m_pView->BeginTextEdit( pObj, pPV, m_pWin, true );
     117             :             }
     118           0 :             m_pView->LeaveDrawCreate();  // Switch to selection mode
     119           0 :             m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
     120           0 :             break;
     121             : 
     122             :         case OBJ_CAPTION:
     123             :         {
     124           0 :             SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
     125           0 :             if( bCapVertical && pCaptObj )
     126             :             {
     127           0 :                 pCaptObj->ForceOutlinerParaObject();
     128           0 :                 OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
     129           0 :                 if( pOPO && !pOPO->IsVertical() )
     130           0 :                     pOPO->SetVertical( true );
     131             :             }
     132             :         }
     133           0 :         break;
     134             :         default:; //prevent warning
     135             :         }
     136             :     }
     137           0 :     return bRet;
     138             : }
     139             : 
     140           0 : void ConstRectangle::Activate(const sal_uInt16 nSlotId)
     141             : {
     142           0 :     bMarquee = bCapVertical = false;
     143           0 :     mbVertical = false;
     144             : 
     145           0 :     switch (nSlotId)
     146             :     {
     147             :     case SID_DRAW_LINE:
     148           0 :         m_pWin->SetSdrDrawMode(OBJ_LINE);
     149           0 :         break;
     150             : 
     151             :     case SID_DRAW_RECT:
     152           0 :         m_pWin->SetSdrDrawMode(OBJ_RECT);
     153           0 :         break;
     154             : 
     155             :     case SID_DRAW_ELLIPSE:
     156           0 :         m_pWin->SetSdrDrawMode(OBJ_CIRC);
     157           0 :         break;
     158             : 
     159             :     case SID_DRAW_TEXT_MARQUEE:
     160           0 :         bMarquee = true;
     161           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     162           0 :         break;
     163             : 
     164             :     case SID_DRAW_TEXT_VERTICAL:
     165           0 :         mbVertical = true;
     166           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     167           0 :         break;
     168             : 
     169             :     case SID_DRAW_TEXT:
     170           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     171           0 :         break;
     172             : 
     173             :     case SID_DRAW_CAPTION_VERTICAL:
     174           0 :         bCapVertical = true;
     175             :         // no break
     176             :     case SID_DRAW_CAPTION:
     177           0 :         m_pWin->SetSdrDrawMode(OBJ_CAPTION);
     178           0 :         break;
     179             : 
     180             :     default:
     181           0 :         m_pWin->SetSdrDrawMode(OBJ_NONE);
     182           0 :         break;
     183             :     }
     184             : 
     185           0 :     SwDrawBase::Activate(nSlotId);
     186         177 : }
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11