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
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
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.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC //autogen
29cdf0e10cSrcweir #include <svx/svxids.hrc>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <sfx2/app.hxx>
32cdf0e10cSrcweir #include <sfx2/childwin.hxx>
33cdf0e10cSrcweir #include <sfx2/bindings.hxx>
34cdf0e10cSrcweir #include <svx/svdmark.hxx>
35cdf0e10cSrcweir #include <svx/svdview.hxx>
36cdf0e10cSrcweir #include <svx/fmglob.hxx>
37cdf0e10cSrcweir #include <svx/svdouno.hxx>
38cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp>
39cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
40cdf0e10cSrcweir #include <svx/htmlmode.hxx>
41cdf0e10cSrcweir #include <tools/urlobj.hxx>
42cdf0e10cSrcweir #include "wrtsh.hxx"
43cdf0e10cSrcweir #include "view.hxx"
44cdf0e10cSrcweir #include "IMark.hxx"
45cdf0e10cSrcweir #include "doc.hxx"
46cdf0e10cSrcweir #include "wrtsh.hrc"
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include <unomid.h>
49cdf0e10cSrcweir
50cdf0e10cSrcweir
51cdf0e10cSrcweir using namespace ::com::sun::star;
52cdf0e10cSrcweir using ::rtl::OUString;
53cdf0e10cSrcweir
54cdf0e10cSrcweir extern sal_Bool bNoInterrupt; // in mainwn.cxx
55cdf0e10cSrcweir
MoveBookMark(BookMarkMove eFuncId,const::sw::mark::IMark * const pMark)56cdf0e10cSrcweir sal_Bool SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark)
57cdf0e10cSrcweir {
58cdf0e10cSrcweir //JP 08.03.96: die Wizards brauchen die Selektion !!
59cdf0e10cSrcweir // EndSelect();
60cdf0e10cSrcweir (this->*fnKillSel)( 0, sal_False );
61cdf0e10cSrcweir
62cdf0e10cSrcweir sal_Bool bRet = sal_True;
63cdf0e10cSrcweir switch(eFuncId)
64cdf0e10cSrcweir {
65cdf0e10cSrcweir case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoMark( pMark );break;
66cdf0e10cSrcweir case BOOKMARK_NEXT: bRet = SwCrsrShell::GoNextBookmark();break;
67cdf0e10cSrcweir case BOOKMARK_PREV: bRet = SwCrsrShell::GoPrevBookmark();break;
68cdf0e10cSrcweir default:;//prevent warning
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir if( bRet && IsSelFrmMode() )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir UnSelectFrm();
74cdf0e10cSrcweir LeaveSelFrmMode();
75cdf0e10cSrcweir }
76cdf0e10cSrcweir if( IsSelection() )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir fnKillSel = &SwWrtShell::ResetSelect;
79cdf0e10cSrcweir fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
80cdf0e10cSrcweir }
81cdf0e10cSrcweir return bRet;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir
GotoField(const SwFmtFld & rFld)84cdf0e10cSrcweir sal_Bool SwWrtShell::GotoField( const SwFmtFld& rFld )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir (this->*fnKillSel)( 0, sal_False );
87cdf0e10cSrcweir
88cdf0e10cSrcweir sal_Bool bRet = SwCrsrShell::GotoFld( rFld );
89cdf0e10cSrcweir if( bRet && IsSelFrmMode() )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir UnSelectFrm();
92cdf0e10cSrcweir LeaveSelFrmMode();
93cdf0e10cSrcweir }
94cdf0e10cSrcweir
95cdf0e10cSrcweir if( IsSelection() )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir fnKillSel = &SwWrtShell::ResetSelect;
98cdf0e10cSrcweir fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir return bRet;
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
GotoFieldmark(::sw::mark::IFieldmark const * const pMark)104cdf0e10cSrcweir bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
105cdf0e10cSrcweir {
106cdf0e10cSrcweir (this->*fnKillSel)( 0, sal_False );
107cdf0e10cSrcweir bool bRet = SwCrsrShell::GotoFieldmark(pMark);
108cdf0e10cSrcweir if( bRet && IsSelFrmMode() )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir UnSelectFrm();
111cdf0e10cSrcweir LeaveSelFrmMode();
112cdf0e10cSrcweir }
113cdf0e10cSrcweir if( IsSelection() )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir fnKillSel = &SwWrtShell::ResetSelect;
116cdf0e10cSrcweir fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir return bRet;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
121cdf0e10cSrcweir /*--------------------------------------------------------------------
122cdf0e10cSrcweir Beschreibung: FontWork-Slots invalidieren
123cdf0e10cSrcweir --------------------------------------------------------------------*/
124cdf0e10cSrcweir
125cdf0e10cSrcweir
DrawSelChanged()126cdf0e10cSrcweir void SwWrtShell::DrawSelChanged( )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] =
129cdf0e10cSrcweir {
130ee093554SAndre Fischer SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE,
131ee093554SAndre Fischer SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR,
132ee093554SAndre Fischer /*AF: these may be needed for the sidebar.
133ee093554SAndre Fischer SID_SVX_AREA_TRANSPARENCY, SID_SVX_AREA_TRANSP_GRADIENT,
134ee093554SAndre Fischer SID_SVX_AREA_TRANS_TYPE,
135ee093554SAndre Fischer */
136d5370dc8SArmin Le Grand 0
137cdf0e10cSrcweir };
138cdf0e10cSrcweir
139cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
140cdf0e10cSrcweir
141cdf0e10cSrcweir sal_Bool bOldVal = bNoInterrupt;
142cdf0e10cSrcweir bNoInterrupt = sal_True; // Trick, um AttrChangedNotify ueber Timer auszufuehren
143cdf0e10cSrcweir GetView().AttrChangedNotify(this);
144cdf0e10cSrcweir bNoInterrupt = bOldVal;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir
GotoMark(const::rtl::OUString & rName)147cdf0e10cSrcweir sal_Bool SwWrtShell::GotoMark( const ::rtl::OUString& rName )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName );
150*dec99bbdSOliver-Rainer Wittmann if(ppMark == getIDocumentMarkAccess()->getAllMarksEnd()) return false;
151cdf0e10cSrcweir return MoveBookMark( BOOKMARK_INDEX, ppMark->get() );
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir
GotoMark(const::sw::mark::IMark * const pMark)155cdf0e10cSrcweir sal_Bool SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir return MoveBookMark( BOOKMARK_INDEX, pMark );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir
GoNextBookmark()161cdf0e10cSrcweir sal_Bool SwWrtShell::GoNextBookmark()
162cdf0e10cSrcweir {
163cdf0e10cSrcweir return MoveBookMark( BOOKMARK_NEXT );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir
GoPrevBookmark()167cdf0e10cSrcweir sal_Bool SwWrtShell::GoPrevBookmark()
168cdf0e10cSrcweir {
169cdf0e10cSrcweir return MoveBookMark( BOOKMARK_PREV );
170cdf0e10cSrcweir }
171cdf0e10cSrcweir
172cdf0e10cSrcweir
ExecMacro(const SvxMacro & rMacro,String * pRet,SbxArray * pArgs)173cdf0e10cSrcweir void SwWrtShell::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir // OD 11.02.2003 #100556# - execute macro, if it is allowed.
176cdf0e10cSrcweir if ( IsMacroExecAllowed() )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir GetDoc()->ExecMacro( rMacro, pRet, pArgs );
179cdf0e10cSrcweir }
180cdf0e10cSrcweir }
181cdf0e10cSrcweir
182cdf0e10cSrcweir
CallEvent(sal_uInt16 nEvent,const SwCallMouseEvent & rCallEvent,sal_Bool bChkPtr,SbxArray * pArgs,const Link * pCallBack)183cdf0e10cSrcweir sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
184cdf0e10cSrcweir sal_Bool bChkPtr, SbxArray* pArgs,
185cdf0e10cSrcweir const Link* pCallBack )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr, pArgs, pCallBack );
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir
191cdf0e10cSrcweir // fall ein util::URL-Button selektiert ist, dessen util::URL returnen, ansonsten
192cdf0e10cSrcweir // einen LeerString
GetURLFromButton(String & rURL,String & rDescr) const193cdf0e10cSrcweir sal_Bool SwWrtShell::GetURLFromButton( String& rURL, String& rDescr ) const
194cdf0e10cSrcweir {
195cdf0e10cSrcweir sal_Bool bRet = sal_False;
196cdf0e10cSrcweir const SdrView *pDView = GetDrawView();
197cdf0e10cSrcweir if( pDView )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir // Ein Fly ist genau dann erreichbar, wenn er selektiert ist.
200cdf0e10cSrcweir const SdrMarkList &rMarkList = pDView->GetMarkedObjectList();
201cdf0e10cSrcweir
202cdf0e10cSrcweir if (rMarkList.GetMark(0))
203cdf0e10cSrcweir {
204cdf0e10cSrcweir SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
205cdf0e10cSrcweir if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
206cdf0e10cSrcweir {
207cdf0e10cSrcweir uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
208cdf0e10cSrcweir
209cdf0e10cSrcweir ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
210cdf0e10cSrcweir if( !xControlModel.is() )
211cdf0e10cSrcweir return bRet;
212cdf0e10cSrcweir
213cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
214cdf0e10cSrcweir
215cdf0e10cSrcweir uno::Any aTmp;
216cdf0e10cSrcweir
217cdf0e10cSrcweir form::FormButtonType eButtonType = form::FormButtonType_URL;
218cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
219cdf0e10cSrcweir if(xInfo->hasPropertyByName( C2U("ButtonType") ))
220cdf0e10cSrcweir {
221cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("ButtonType") );
222cdf0e10cSrcweir form::FormButtonType eTmpButtonType;
223cdf0e10cSrcweir aTmp >>= eTmpButtonType;
224cdf0e10cSrcweir if( eButtonType == eTmpButtonType)
225cdf0e10cSrcweir {
226cdf0e10cSrcweir // Label
227cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("Label") );
228cdf0e10cSrcweir OUString uTmp;
229cdf0e10cSrcweir if( (aTmp >>= uTmp) && uTmp.getLength())
230cdf0e10cSrcweir {
231cdf0e10cSrcweir rDescr = String(uTmp);
232cdf0e10cSrcweir }
233cdf0e10cSrcweir
234cdf0e10cSrcweir // util::URL
235cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("TargetURL") );
236cdf0e10cSrcweir if( (aTmp >>= uTmp) && uTmp.getLength())
237cdf0e10cSrcweir {
238cdf0e10cSrcweir rURL = String(uTmp);
239cdf0e10cSrcweir }
240cdf0e10cSrcweir bRet = sal_True;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir }
243cdf0e10cSrcweir }
244cdf0e10cSrcweir }
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir return bRet;
248cdf0e10cSrcweir }
249