1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #include <sfx2/bindings.hxx>
26cdf0e10cSrcweir #include <svx/htmlmode.hxx>
27cdf0e10cSrcweir #include <svx/sdtacitm.hxx>
28cdf0e10cSrcweir #include <svx/svdobj.hxx>
29cdf0e10cSrcweir #include <svx/sdtagitm.hxx>
30cdf0e10cSrcweir #include <svx/sdtakitm.hxx>
31cdf0e10cSrcweir #include <svx/sdtaditm.hxx>
32cdf0e10cSrcweir #include <svx/sdtaaitm.hxx>
33cdf0e10cSrcweir #include <svx/svdview.hxx>
34cdf0e10cSrcweir #include <svx/svdocapt.hxx>
35cdf0e10cSrcweir #include <editeng/outlobj.hxx>
36cdf0e10cSrcweir #include <cmdid.h>
37cdf0e10cSrcweir #include <view.hxx>
38cdf0e10cSrcweir #include <edtwin.hxx>
39cdf0e10cSrcweir #include <wrtsh.hxx>
40cdf0e10cSrcweir #include <viewopt.hxx>
41cdf0e10cSrcweir #include <drawbase.hxx>
42cdf0e10cSrcweir #include <conrect.hxx>
43cdf0e10cSrcweir
44cdf0e10cSrcweir /*************************************************************************
45*372e31e8Smseidel |* C'Tor
46cdf0e10cSrcweir \************************************************************************/
47cdf0e10cSrcweir
ConstRectangle(SwWrtShell * pWrtShell,SwEditWin * pEditWin,SwView * pSwView)48cdf0e10cSrcweir ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
49cdf0e10cSrcweir SwView* pSwView )
50cdf0e10cSrcweir : SwDrawBase( pWrtShell, pEditWin, pSwView ),
51cdf0e10cSrcweir bMarquee(sal_False),
52cdf0e10cSrcweir // #93382#
53cdf0e10cSrcweir mbVertical(sal_False)
54cdf0e10cSrcweir {
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
57cdf0e10cSrcweir /*************************************************************************
58cdf0e10cSrcweir |* MouseButtonDown-event
59cdf0e10cSrcweir \************************************************************************/
60cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)61cdf0e10cSrcweir sal_Bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir sal_Bool bReturn;
64cdf0e10cSrcweir
65cdf0e10cSrcweir if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True
66cdf0e10cSrcweir && m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
67cdf0e10cSrcweir {
68cdf0e10cSrcweir m_pView->NoRotate();
69cdf0e10cSrcweir if (m_pView->IsDrawSelMode())
70cdf0e10cSrcweir {
71cdf0e10cSrcweir m_pView->FlipDrawSelMode();
72cdf0e10cSrcweir m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
73cdf0e10cSrcweir }
74cdf0e10cSrcweir }
75cdf0e10cSrcweir return (bReturn);
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
78cdf0e10cSrcweir /*************************************************************************
79cdf0e10cSrcweir |* MouseButtonUp-event
80cdf0e10cSrcweir \************************************************************************/
81cdf0e10cSrcweir
MouseButtonUp(const MouseEvent & rMEvt)82cdf0e10cSrcweir sal_Bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
85cdf0e10cSrcweir
86cdf0e10cSrcweir sal_Bool bRet = SwDrawBase::MouseButtonUp(rMEvt);
87cdf0e10cSrcweir if( bRet )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir SdrView *pSdrView = m_pSh->GetDrawView();
90cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
91cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
92cdf0e10cSrcweir : 0;
93cdf0e10cSrcweir switch( m_pWin->GetSdrDrawMode() )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir case OBJ_TEXT:
96cdf0e10cSrcweir if( bMarquee )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir m_pSh->ChgAnchor(FLY_AS_CHAR);
99cdf0e10cSrcweir
100cdf0e10cSrcweir if( pObj )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir // die fuer das Scrollen benoetigten Attribute setzen
103cdf0e10cSrcweir SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
104cdf0e10cSrcweir SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
105cdf0e10cSrcweir
106cdf0e10cSrcweir aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) );
107cdf0e10cSrcweir aItemSet.Put( SdrTextAutoGrowHeightItem( sal_False ) );
108cdf0e10cSrcweir aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
109cdf0e10cSrcweir aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
110cdf0e10cSrcweir aItemSet.Put( SdrTextAniCountItem( 0 ) );
111cdf0e10cSrcweir aItemSet.Put( SdrTextAniAmountItem(
112cdf0e10cSrcweir (sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
113cdf0e10cSrcweir
114cdf0e10cSrcweir pObj->SetMergedItemSetAndBroadcast(aItemSet);
115cdf0e10cSrcweir }
116cdf0e10cSrcweir }
117cdf0e10cSrcweir else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
118cdf0e10cSrcweir {
119cdf0e10cSrcweir // #93382#
120cdf0e10cSrcweir SdrTextObj* pText = (SdrTextObj*)pObj;
121cdf0e10cSrcweir SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
122cdf0e10cSrcweir
123cdf0e10cSrcweir pText->SetVerticalWriting(sal_True);
124cdf0e10cSrcweir
125cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
126cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
127cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
128cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
129cdf0e10cSrcweir
130cdf0e10cSrcweir pText->SetMergedItemSet(aSet);
131cdf0e10cSrcweir }
132cdf0e10cSrcweir if( pObj )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir SdrPageView* pPV = pSdrView->GetSdrPageView();
135cdf0e10cSrcweir m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
136cdf0e10cSrcweir }
137cdf0e10cSrcweir m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
138cdf0e10cSrcweir m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
139cdf0e10cSrcweir break;
140cdf0e10cSrcweir
141cdf0e10cSrcweir case OBJ_CAPTION:
142cdf0e10cSrcweir {
143cdf0e10cSrcweir SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
144cdf0e10cSrcweir if( bCapVertical && pCaptObj )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir pCaptObj->ForceOutlinerParaObject();
147cdf0e10cSrcweir OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
148cdf0e10cSrcweir if( pOPO && !pOPO->IsVertical() )
149cdf0e10cSrcweir pOPO->SetVertical( sal_True );
150cdf0e10cSrcweir }
151cdf0e10cSrcweir }
152cdf0e10cSrcweir break;
153cdf0e10cSrcweir default:; //prevent warning
154cdf0e10cSrcweir }
155cdf0e10cSrcweir }
156cdf0e10cSrcweir return bRet;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir
159cdf0e10cSrcweir /*************************************************************************
160*372e31e8Smseidel |* activate function
161cdf0e10cSrcweir \************************************************************************/
162cdf0e10cSrcweir
Activate(const sal_uInt16 nSlotId)163cdf0e10cSrcweir void ConstRectangle::Activate(const sal_uInt16 nSlotId)
164cdf0e10cSrcweir {
165cdf0e10cSrcweir bMarquee = bCapVertical = sal_False;
166cdf0e10cSrcweir mbVertical = sal_False;
167cdf0e10cSrcweir
168cdf0e10cSrcweir switch (nSlotId)
169cdf0e10cSrcweir {
170cdf0e10cSrcweir case SID_DRAW_LINE:
171cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_LINE);
172cdf0e10cSrcweir break;
173cdf0e10cSrcweir
174cdf0e10cSrcweir case SID_DRAW_RECT:
175cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_RECT);
176cdf0e10cSrcweir break;
177cdf0e10cSrcweir
178cdf0e10cSrcweir case SID_DRAW_ELLIPSE:
179cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_CIRC);
180cdf0e10cSrcweir break;
181cdf0e10cSrcweir
182cdf0e10cSrcweir case SID_DRAW_TEXT_MARQUEE:
183cdf0e10cSrcweir bMarquee = sal_True;
184cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_TEXT);
185cdf0e10cSrcweir break;
186cdf0e10cSrcweir
187cdf0e10cSrcweir case SID_DRAW_TEXT_VERTICAL:
188cdf0e10cSrcweir // #93382#
189cdf0e10cSrcweir mbVertical = sal_True;
190cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_TEXT);
191cdf0e10cSrcweir break;
192cdf0e10cSrcweir
193cdf0e10cSrcweir case SID_DRAW_TEXT:
194cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_TEXT);
195cdf0e10cSrcweir break;
196cdf0e10cSrcweir
197cdf0e10cSrcweir case SID_DRAW_CAPTION_VERTICAL:
198cdf0e10cSrcweir bCapVertical = sal_True;
199cdf0e10cSrcweir // no break
200cdf0e10cSrcweir case SID_DRAW_CAPTION:
201cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_CAPTION);
202cdf0e10cSrcweir break;
203cdf0e10cSrcweir
204cdf0e10cSrcweir default:
205cdf0e10cSrcweir m_pWin->SetSdrDrawMode(OBJ_NONE);
206cdf0e10cSrcweir break;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
209cdf0e10cSrcweir SwDrawBase::Activate(nSlotId);
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212*372e31e8Smseidel /* vim: set noet sw=4 ts=4: */
213