LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/ribbar - conrect.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 79 0.0 %
Date: 2012-12-27 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/bindings.hxx>
      21             : #include <svx/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             : 
      40             : /*************************************************************************
      41             : |*
      42             : |* Konstruktor
      43             : |*
      44             : \************************************************************************/
      45             : 
      46           0 : ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
      47             :                                 SwView* pSwView )
      48             :     : SwDrawBase( pWrtShell, pEditWin, pSwView ),
      49             :     bMarquee(sal_False),
      50             :     // #93382#
      51           0 :     mbVertical(sal_False)
      52             : {
      53           0 : }
      54             : 
      55             : /*************************************************************************
      56             : |*
      57             : |* MouseButtonDown-event
      58             : |*
      59             : \************************************************************************/
      60             : 
      61           0 : sal_Bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
      62             : {
      63             :     sal_Bool bReturn;
      64             : 
      65           0 :     if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True
      66           0 :                                     && m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
      67             :     {
      68           0 :         m_pView->NoRotate();
      69           0 :         if (m_pView->IsDrawSelMode())
      70             :         {
      71           0 :             m_pView->FlipDrawSelMode();
      72           0 :             m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
      73             :         }
      74             :     }
      75           0 :     return (bReturn);
      76             : }
      77             : 
      78             : /*************************************************************************
      79             : |*
      80             : |* MouseButtonUp-event
      81             : |*
      82             : \************************************************************************/
      83             : 
      84           0 : sal_Bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
      85             : {
      86           0 :     sal_Bool bRet = SwDrawBase::MouseButtonUp(rMEvt);
      87           0 :     if( bRet )
      88             :     {
      89           0 :         SdrView *pSdrView = m_pSh->GetDrawView();
      90           0 :         const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
      91           0 :         SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
      92           0 :                                                : 0;
      93           0 :         switch( m_pWin->GetSdrDrawMode() )
      94             :         {
      95             :         case OBJ_TEXT:
      96           0 :             if( bMarquee )
      97             :             {
      98           0 :                 m_pSh->ChgAnchor(FLY_AS_CHAR);
      99             : 
     100           0 :                 if( pObj )
     101             :                 {
     102             :                     // die fuer das Scrollen benoetigten Attribute setzen
     103           0 :                     SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
     104           0 :                                         SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
     105             : 
     106           0 :                     aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) );
     107           0 :                     aItemSet.Put( SdrTextAutoGrowHeightItem( sal_False ) );
     108           0 :                     aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
     109           0 :                     aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
     110           0 :                     aItemSet.Put( SdrTextAniCountItem( 0 ) );
     111             :                     aItemSet.Put( SdrTextAniAmountItem(
     112           0 :                             (sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
     113             : 
     114           0 :                     pObj->SetMergedItemSetAndBroadcast(aItemSet);
     115             :                 }
     116             :             }
     117           0 :             else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
     118             :             {
     119             :                 // #93382#
     120           0 :                 SdrTextObj* pText = (SdrTextObj*)pObj;
     121           0 :                 SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
     122             : 
     123           0 :                 pText->SetVerticalWriting(sal_True);
     124             : 
     125           0 :                 aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
     126           0 :                 aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
     127           0 :                 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
     128           0 :                 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
     129             : 
     130           0 :                 pText->SetMergedItemSet(aSet);
     131             :             }
     132           0 :             if( pObj )
     133             :             {
     134           0 :                 SdrPageView* pPV = pSdrView->GetSdrPageView();
     135           0 :                 m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
     136             :             }
     137           0 :             m_pView->LeaveDrawCreate();  // In Selektionsmode wechseln
     138           0 :             m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
     139           0 :             break;
     140             : 
     141             :         case OBJ_CAPTION:
     142             :         {
     143           0 :             SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
     144           0 :             if( bCapVertical && pCaptObj )
     145             :             {
     146           0 :                 pCaptObj->ForceOutlinerParaObject();
     147           0 :                 OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
     148           0 :                 if( pOPO && !pOPO->IsVertical() )
     149           0 :                     pOPO->SetVertical( sal_True );
     150             :             }
     151             :         }
     152           0 :         break;
     153             :         default:; //prevent warning
     154             :         }
     155             :     }
     156           0 :     return bRet;
     157             : }
     158             : 
     159             : /*************************************************************************
     160             : |*
     161             : |* Function aktivieren
     162             : |*
     163             : \************************************************************************/
     164             : 
     165           0 : void ConstRectangle::Activate(const sal_uInt16 nSlotId)
     166             : {
     167           0 :     bMarquee = bCapVertical = sal_False;
     168           0 :     mbVertical = sal_False;
     169             : 
     170           0 :     switch (nSlotId)
     171             :     {
     172             :     case SID_DRAW_LINE:
     173           0 :         m_pWin->SetSdrDrawMode(OBJ_LINE);
     174           0 :         break;
     175             : 
     176             :     case SID_DRAW_RECT:
     177           0 :         m_pWin->SetSdrDrawMode(OBJ_RECT);
     178           0 :         break;
     179             : 
     180             :     case SID_DRAW_ELLIPSE:
     181           0 :         m_pWin->SetSdrDrawMode(OBJ_CIRC);
     182           0 :         break;
     183             : 
     184             :     case SID_DRAW_TEXT_MARQUEE:
     185           0 :         bMarquee = sal_True;
     186           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     187           0 :         break;
     188             : 
     189             :     case SID_DRAW_TEXT_VERTICAL:
     190             :         // #93382#
     191           0 :         mbVertical = sal_True;
     192           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     193           0 :         break;
     194             : 
     195             :     case SID_DRAW_TEXT:
     196           0 :         m_pWin->SetSdrDrawMode(OBJ_TEXT);
     197           0 :         break;
     198             : 
     199             :     case SID_DRAW_CAPTION_VERTICAL:
     200           0 :         bCapVertical = sal_True;
     201             :         // no break
     202             :     case SID_DRAW_CAPTION:
     203           0 :         m_pWin->SetSdrDrawMode(OBJ_CAPTION);
     204           0 :         break;
     205             : 
     206             :     default:
     207           0 :         m_pWin->SetSdrDrawMode(OBJ_NONE);
     208           0 :         break;
     209             :     }
     210             : 
     211           0 :     SwDrawBase::Activate(nSlotId);
     212           0 : }
     213             : 
     214             : 
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10