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