1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10*efeef26fSAndrew Rist * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*efeef26fSAndrew Rist * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19*efeef26fSAndrew Rist * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew 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 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 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 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 126cdf0e10cSrcweir void SwWrtShell::DrawSelChanged( ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 129cdf0e10cSrcweir { 130cdf0e10cSrcweir SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE, 131cdf0e10cSrcweir SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0 132cdf0e10cSrcweir }; 133cdf0e10cSrcweir 134cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Invalidate(aInval); 135cdf0e10cSrcweir 136cdf0e10cSrcweir sal_Bool bOldVal = bNoInterrupt; 137cdf0e10cSrcweir bNoInterrupt = sal_True; // Trick, um AttrChangedNotify ueber Timer auszufuehren 138cdf0e10cSrcweir GetView().AttrChangedNotify(this); 139cdf0e10cSrcweir bNoInterrupt = bOldVal; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir sal_Bool SwWrtShell::GotoMark( const ::rtl::OUString& rName ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName ); 145cdf0e10cSrcweir if(ppMark == getIDocumentMarkAccess()->getMarksEnd()) return false; 146cdf0e10cSrcweir return MoveBookMark( BOOKMARK_INDEX, ppMark->get() ); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir sal_Bool SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir return MoveBookMark( BOOKMARK_INDEX, pMark ); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_Bool SwWrtShell::GoNextBookmark() 157cdf0e10cSrcweir { 158cdf0e10cSrcweir return MoveBookMark( BOOKMARK_NEXT ); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir 162cdf0e10cSrcweir sal_Bool SwWrtShell::GoPrevBookmark() 163cdf0e10cSrcweir { 164cdf0e10cSrcweir return MoveBookMark( BOOKMARK_PREV ); 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir 168cdf0e10cSrcweir void SwWrtShell::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir // OD 11.02.2003 #100556# - execute macro, if it is allowed. 171cdf0e10cSrcweir if ( IsMacroExecAllowed() ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir GetDoc()->ExecMacro( rMacro, pRet, pArgs ); 174cdf0e10cSrcweir } 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir 178cdf0e10cSrcweir sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, 179cdf0e10cSrcweir sal_Bool bChkPtr, SbxArray* pArgs, 180cdf0e10cSrcweir const Link* pCallBack ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr, pArgs, pCallBack ); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir 186cdf0e10cSrcweir // fall ein util::URL-Button selektiert ist, dessen util::URL returnen, ansonsten 187cdf0e10cSrcweir // einen LeerString 188cdf0e10cSrcweir sal_Bool SwWrtShell::GetURLFromButton( String& rURL, String& rDescr ) const 189cdf0e10cSrcweir { 190cdf0e10cSrcweir sal_Bool bRet = sal_False; 191cdf0e10cSrcweir const SdrView *pDView = GetDrawView(); 192cdf0e10cSrcweir if( pDView ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir // Ein Fly ist genau dann erreichbar, wenn er selektiert ist. 195cdf0e10cSrcweir const SdrMarkList &rMarkList = pDView->GetMarkedObjectList(); 196cdf0e10cSrcweir 197cdf0e10cSrcweir if (rMarkList.GetMark(0)) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj()); 200cdf0e10cSrcweir if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor()) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel(); 203cdf0e10cSrcweir 204cdf0e10cSrcweir ASSERT( xControlModel.is(), "UNO-Control ohne Model" ); 205cdf0e10cSrcweir if( !xControlModel.is() ) 206cdf0e10cSrcweir return bRet; 207cdf0e10cSrcweir 208cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY); 209cdf0e10cSrcweir 210cdf0e10cSrcweir uno::Any aTmp; 211cdf0e10cSrcweir 212cdf0e10cSrcweir form::FormButtonType eButtonType = form::FormButtonType_URL; 213cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); 214cdf0e10cSrcweir if(xInfo->hasPropertyByName( C2U("ButtonType") )) 215cdf0e10cSrcweir { 216cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("ButtonType") ); 217cdf0e10cSrcweir form::FormButtonType eTmpButtonType; 218cdf0e10cSrcweir aTmp >>= eTmpButtonType; 219cdf0e10cSrcweir if( eButtonType == eTmpButtonType) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir // Label 222cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("Label") ); 223cdf0e10cSrcweir OUString uTmp; 224cdf0e10cSrcweir if( (aTmp >>= uTmp) && uTmp.getLength()) 225cdf0e10cSrcweir { 226cdf0e10cSrcweir rDescr = String(uTmp); 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir // util::URL 230cdf0e10cSrcweir aTmp = xPropSet->getPropertyValue( C2U("TargetURL") ); 231cdf0e10cSrcweir if( (aTmp >>= uTmp) && uTmp.getLength()) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir rURL = String(uTmp); 234cdf0e10cSrcweir } 235cdf0e10cSrcweir bRet = sal_True; 236cdf0e10cSrcweir } 237cdf0e10cSrcweir } 238cdf0e10cSrcweir } 239cdf0e10cSrcweir } 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir return bRet; 243cdf0e10cSrcweir } 244