Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <sfx2/bindings.hxx>
30 : : #include <svx/htmlmode.hxx>
31 : : #include <svx/sdtacitm.hxx>
32 : : #include <svx/svdobj.hxx>
33 : : #include <svx/sdtagitm.hxx>
34 : : #include <svx/sdtakitm.hxx>
35 : : #include <svx/sdtaditm.hxx>
36 : : #include <svx/sdtaaitm.hxx>
37 : : #include <svx/svdview.hxx>
38 : : #include <svx/svdocapt.hxx>
39 : : #include <editeng/outlobj.hxx>
40 : : #include <cmdid.h>
41 : : #include <view.hxx>
42 : : #include <edtwin.hxx>
43 : : #include <wrtsh.hxx>
44 : : #include <viewopt.hxx>
45 : : #include <drawbase.hxx>
46 : : #include <conrect.hxx>
47 : :
48 : :
49 : : /*************************************************************************
50 : : |*
51 : : |* Konstruktor
52 : : |*
53 : : \************************************************************************/
54 : :
55 : 0 : ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
56 : : SwView* pSwView )
57 : : : SwDrawBase( pWrtShell, pEditWin, pSwView ),
58 : : bMarquee(sal_False),
59 : : // #93382#
60 : 0 : mbVertical(sal_False)
61 : : {
62 : 0 : }
63 : :
64 : : /*************************************************************************
65 : : |*
66 : : |* MouseButtonDown-event
67 : : |*
68 : : \************************************************************************/
69 : :
70 : 0 : sal_Bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
71 : : {
72 : : sal_Bool bReturn;
73 : :
74 [ # # # # ]: 0 : if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True
[ # # ]
75 : 0 : && m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
76 : : {
77 : 0 : m_pView->NoRotate();
78 [ # # ]: 0 : if (m_pView->IsDrawSelMode())
79 : : {
80 : 0 : m_pView->FlipDrawSelMode();
81 : 0 : m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
82 : : }
83 : : }
84 : 0 : return (bReturn);
85 : : }
86 : :
87 : : /*************************************************************************
88 : : |*
89 : : |* MouseButtonUp-event
90 : : |*
91 : : \************************************************************************/
92 : :
93 : 0 : sal_Bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
94 : : {
95 : 0 : sal_Bool bRet = SwDrawBase::MouseButtonUp(rMEvt);
96 [ # # ]: 0 : if( bRet )
97 : : {
98 : 0 : SdrView *pSdrView = m_pSh->GetDrawView();
99 : 0 : const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
100 : 0 : SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
101 [ # # ]: 0 : : 0;
102 [ # # # ]: 0 : switch( m_pWin->GetSdrDrawMode() )
103 : : {
104 : : case OBJ_TEXT:
105 [ # # ]: 0 : if( bMarquee )
106 : : {
107 : 0 : m_pSh->ChgAnchor(FLY_AS_CHAR);
108 : :
109 [ # # ]: 0 : if( pObj )
110 : : {
111 : : // die fuer das Scrollen benoetigten Attribute setzen
112 : 0 : SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
113 [ # # ]: 0 : SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
114 : :
115 [ # # ][ # # ]: 0 : aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) );
[ # # ]
116 [ # # ][ # # ]: 0 : aItemSet.Put( SdrTextAutoGrowHeightItem( sal_False ) );
[ # # ]
117 [ # # ][ # # ]: 0 : aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
[ # # ]
118 [ # # ][ # # ]: 0 : aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
[ # # ]
119 [ # # ][ # # ]: 0 : aItemSet.Put( SdrTextAniCountItem( 0 ) );
[ # # ]
120 : : aItemSet.Put( SdrTextAniAmountItem(
121 [ # # ][ # # ]: 0 : (sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
[ # # ][ # # ]
122 : :
123 [ # # ][ # # ]: 0 : pObj->SetMergedItemSetAndBroadcast(aItemSet);
124 : : }
125 : : }
126 [ # # ][ # # ]: 0 : else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
[ # # ][ # # ]
127 : : {
128 : : // #93382#
129 : 0 : SdrTextObj* pText = (SdrTextObj*)pObj;
130 [ # # ]: 0 : SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
131 : :
132 [ # # ]: 0 : pText->SetVerticalWriting(sal_True);
133 : :
134 [ # # ][ # # ]: 0 : aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
[ # # ]
135 [ # # ][ # # ]: 0 : aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
[ # # ]
136 [ # # ][ # # ]: 0 : aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
[ # # ]
137 [ # # ][ # # ]: 0 : aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
[ # # ]
138 : :
139 [ # # ][ # # ]: 0 : pText->SetMergedItemSet(aSet);
140 : : }
141 [ # # ]: 0 : if( pObj )
142 : : {
143 : 0 : SdrPageView* pPV = pSdrView->GetSdrPageView();
144 : 0 : m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
145 : : }
146 : 0 : m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
147 : 0 : m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
148 : 0 : break;
149 : :
150 : : case OBJ_CAPTION:
151 : : {
152 [ # # ]: 0 : SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
153 [ # # ][ # # ]: 0 : if( bCapVertical && pCaptObj )
154 : : {
155 : 0 : pCaptObj->ForceOutlinerParaObject();
156 : 0 : OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
157 [ # # ][ # # ]: 0 : if( pOPO && !pOPO->IsVertical() )
[ # # ]
158 : 0 : pOPO->SetVertical( sal_True );
159 : : }
160 : : }
161 : 0 : break;
162 : : default:; //prevent warning
163 : : }
164 : : }
165 : 0 : return bRet;
166 : : }
167 : :
168 : : /*************************************************************************
169 : : |*
170 : : |* Function aktivieren
171 : : |*
172 : : \************************************************************************/
173 : :
174 : 0 : void ConstRectangle::Activate(const sal_uInt16 nSlotId)
175 : : {
176 : 0 : bMarquee = bCapVertical = sal_False;
177 : 0 : mbVertical = sal_False;
178 : :
179 [ # # # # : 0 : switch (nSlotId)
# # # #
# ]
180 : : {
181 : : case SID_DRAW_LINE:
182 : 0 : m_pWin->SetSdrDrawMode(OBJ_LINE);
183 : 0 : break;
184 : :
185 : : case SID_DRAW_RECT:
186 : 0 : m_pWin->SetSdrDrawMode(OBJ_RECT);
187 : 0 : break;
188 : :
189 : : case SID_DRAW_ELLIPSE:
190 : 0 : m_pWin->SetSdrDrawMode(OBJ_CIRC);
191 : 0 : break;
192 : :
193 : : case SID_DRAW_TEXT_MARQUEE:
194 : 0 : bMarquee = sal_True;
195 : 0 : m_pWin->SetSdrDrawMode(OBJ_TEXT);
196 : 0 : break;
197 : :
198 : : case SID_DRAW_TEXT_VERTICAL:
199 : : // #93382#
200 : 0 : mbVertical = sal_True;
201 : 0 : m_pWin->SetSdrDrawMode(OBJ_TEXT);
202 : 0 : break;
203 : :
204 : : case SID_DRAW_TEXT:
205 : 0 : m_pWin->SetSdrDrawMode(OBJ_TEXT);
206 : 0 : break;
207 : :
208 : : case SID_DRAW_CAPTION_VERTICAL:
209 : 0 : bCapVertical = sal_True;
210 : : // no break
211 : : case SID_DRAW_CAPTION:
212 : 0 : m_pWin->SetSdrDrawMode(OBJ_CAPTION);
213 : 0 : break;
214 : :
215 : : default:
216 : 0 : m_pWin->SetSdrDrawMode(OBJ_NONE);
217 : 0 : break;
218 : : }
219 : :
220 : 0 : SwDrawBase::Activate(nSlotId);
221 : 0 : }
222 : :
223 : :
224 : :
225 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|