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 <hintids.hxx>
30 : : #include <svl/whiter.hxx>
31 : : #include <svtools/imapobj.hxx>
32 : : #include <svtools/miscopt.hxx>
33 : : #include <svl/srchitem.hxx>
34 : : #include <svtools/imap.hxx>
35 : : #include <sfx2/viewfrm.hxx>
36 : : #include <basic/sbstar.hxx>
37 : : #include <svl/rectitem.hxx>
38 : : #include <svl/ptitem.hxx>
39 : : #include <svl/stritem.hxx>
40 : : #include <editeng/colritem.hxx>
41 : : #include <editeng/bolnitem.hxx>
42 : : #include <editeng/boxitem.hxx>
43 : : #include <editeng/protitem.hxx>
44 : : #include <sfx2/dispatch.hxx>
45 : : #include <sfx2/request.hxx>
46 : : #include <sfx2/objface.hxx>
47 : : #include <svx/hlnkitem.hxx>
48 : : // #i73249#
49 : : #include <svx/svdview.hxx>
50 : : #include <vcl/msgbox.hxx>
51 : :
52 : : #include <doc.hxx>
53 : : #include <fmturl.hxx>
54 : : #include <fmtclds.hxx>
55 : : #include <fmtcnct.hxx>
56 : : #include <swmodule.hxx>
57 : : #include <wrtsh.hxx>
58 : : #include <wview.hxx>
59 : : #include <frmatr.hxx>
60 : : #include <uitool.hxx>
61 : : #include <frmfmt.hxx>
62 : : #include <frmsh.hxx>
63 : : #include <frmmgr.hxx>
64 : : #include <frmdlg.hxx>
65 : : #include <swevent.hxx>
66 : : #include <usrpref.hxx>
67 : : #include <edtwin.hxx>
68 : : #include <swdtflvr.hxx>
69 : : #include <swwait.hxx>
70 : : #include <docstat.hxx>
71 : : #include <IDocumentStatistics.hxx>
72 : :
73 : : #include <comphelper/processfactory.hxx>
74 : : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
75 : :
76 : : #include <helpid.h>
77 : : #include <cmdid.h>
78 : : #include <cfgitems.hxx>
79 : : #include <globals.hrc>
80 : : #include <popup.hrc>
81 : : #include <shells.hrc>
82 : : #include "swabstdlg.hxx"
83 : : #include "misc.hrc"
84 : : // #i73249#
85 : : #include <svx/dialogs.hrc>
86 : : #include <wordcountdialog.hxx>
87 : :
88 : : using ::editeng::SvxBorderLine;
89 : : using namespace ::com::sun::star;
90 : : using namespace ::com::sun::star::uno;
91 : :
92 : : // Prototypen ------------------------------------------------------------
93 : : void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
94 : 0 : const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName)
95 : : {
96 : 0 : sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
97 [ # # ]: 0 : for( sal_uInt16 i = 0; i < nCount; i++)
98 : : {
99 : 0 : const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
100 [ # # ]: 0 : if(pFmt->GetName() == rName)
101 : 0 : return pFmt;
102 : : }
103 : 0 : return 0;
104 : : }
105 : :
106 : : #define SwFrameShell
107 : : #include <sfx2/msg.hxx>
108 : : #include "swslots.hxx"
109 : :
110 [ + + ][ + - ]: 438 : SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME))
[ + - ][ + - ]
111 : : {
112 [ + - ][ + - ]: 73 : SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU));
113 [ + - ][ + - ]: 73 : SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_FRAME_TOOLBOX));
114 : 73 : }
115 : :
116 : 0 : void SwFrameShell::Execute(SfxRequest &rReq)
117 : : {
118 : : //Erstmal die, die keinen FrmMgr benoetigen.
119 [ # # ]: 0 : SwWrtShell &rSh = GetShell();
120 : 0 : sal_Bool bMore = sal_False;
121 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
122 : : const SfxPoolItem* pItem;
123 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
124 : :
125 [ # # # # : 0 : switch ( nSlot )
# # # # #
# # # #
# ]
126 : : {
127 : : case FN_FRAME_TO_ANCHOR:
128 [ # # ][ # # ]: 0 : if ( rSh.IsFrmSelected() )
129 : : {
130 [ # # ]: 0 : rSh.GotoFlyAnchor();
131 [ # # ]: 0 : rSh.EnterStdMode();
132 [ # # ]: 0 : rSh.CallChgLnk();
133 : : }
134 : 0 : break;
135 : : case SID_FRAME_TO_TOP:
136 [ # # ]: 0 : rSh.SelectionToTop();
137 : 0 : break;
138 : :
139 : : case SID_FRAME_TO_BOTTOM:
140 [ # # ]: 0 : rSh.SelectionToBottom();
141 : 0 : break;
142 : :
143 : : case FN_FRAME_UP:
144 [ # # ]: 0 : rSh.SelectionToTop( sal_False );
145 : 0 : break;
146 : :
147 : : case FN_FRAME_DOWN:
148 [ # # ]: 0 : rSh.SelectionToBottom( sal_False );
149 : 0 : break;
150 : : case FN_INSERT_FRAME:
151 [ # # ]: 0 : if (!pArgs)
152 : : {
153 : : // Rahmen existiert bereits, Rahmendialog zur Bearbeitung oeffnen
154 [ # # ]: 0 : SfxUInt16Item aDefPage(FN_FORMAT_FRAME_DLG, TP_COLUMN);
155 : 0 : rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_FORMAT_FRAME_DLG,
156 : : SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
157 [ # # ][ # # ]: 0 : &aDefPage, 0L );
158 : :
159 : : }
160 : : else
161 : : {
162 : : // Rahmen existiert bereits, nur Spaltenanzahl wird geaendert
163 : 0 : sal_uInt16 nCols = 1;
164 [ # # ][ # # ]: 0 : if(pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET)
165 : 0 : nCols = ((SfxUInt16Item *)pItem)->GetValue();
166 : :
167 [ # # ]: 0 : SfxItemSet aSet(GetPool(),RES_COL,RES_COL);
168 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
169 [ # # ][ # # ]: 0 : SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
170 : : // GutterWidth wird nicht immer uebergeben, daher erst besorgen (siehe view2: Execute auf diesen Slot)
171 [ # # ]: 0 : sal_uInt16 nGutterWidth = aCol.GetGutterWidth();
172 [ # # ]: 0 : if(!nCols )
173 : 0 : nCols++;
174 [ # # ]: 0 : aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
175 [ # # ]: 0 : aSet.Put(aCol);
176 : : // Vorlagen-AutoUpdate
177 [ # # ]: 0 : SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
178 [ # # ][ # # ]: 0 : if(pFmt && pFmt->IsAutoUpdateFmt())
[ # # ]
179 : : {
180 [ # # ]: 0 : rSh.AutoUpdateFrame(pFmt, aSet);
181 : : }
182 : : else
183 : : {
184 [ # # ]: 0 : rSh.StartAllAction();
185 [ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
186 [ # # ]: 0 : rSh.SetModified();
187 [ # # ]: 0 : rSh.EndAllAction();
188 [ # # ][ # # ]: 0 : }
189 : :
190 : : }
191 : : return;
192 : :
193 : : case SID_HYPERLINK_SETLINK:
194 : : {
195 [ # # ][ # # ]: 0 : if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, sal_False, &pItem))
[ # # ][ # # ]
196 : : {
197 : 0 : const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
198 : 0 : const String& rURL = rHLinkItem.GetURL();
199 : 0 : const String& rTarget = rHLinkItem.GetTargetFrame();
200 : :
201 [ # # ][ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
202 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
203 [ # # ][ # # ]: 0 : SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
204 : :
205 [ # # ]: 0 : String sOldName(rHLinkItem.GetName());
206 [ # # ][ # # ]: 0 : String sFlyName(rSh.GetFlyName());
207 [ # # ][ # # ]: 0 : if (sOldName.ToUpperAscii() != sFlyName.ToUpperAscii())
[ # # ][ # # ]
208 : : {
209 [ # # ]: 0 : String sName(sOldName);
210 : 0 : sal_uInt16 i = 1;
211 [ # # ][ # # ]: 0 : while (rSh.FindFlyByName(sName))
212 : : {
213 [ # # ]: 0 : sName = sOldName;
214 [ # # ]: 0 : sName += '_';
215 [ # # ][ # # ]: 0 : sName += String::CreateFromInt32(i++);
[ # # ]
216 : : }
217 [ # # ][ # # ]: 0 : rSh.SetFlyName(sName);
218 : : }
219 [ # # ]: 0 : aURL.SetURL( rURL, sal_False );
220 [ # # ]: 0 : aURL.SetTargetFrameName(rTarget);
221 : :
222 [ # # ]: 0 : aSet.Put( aURL );
223 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aSet );
[ # # ][ # # ]
[ # # ]
224 : : }
225 : : }
226 : 0 : break;
227 : :
228 : : case FN_FRAME_CHAIN:
229 [ # # ]: 0 : rSh.GetView().GetEditWin().SetChainMode( !rSh.GetView().GetEditWin().IsChainMode() );
230 : 0 : break;
231 : :
232 : : case FN_FRAME_UNCHAIN:
233 [ # # ][ # # ]: 0 : rSh.Unchain( (SwFrmFmt&)*rSh.GetFlyFrmFmt() );
234 [ # # ]: 0 : GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN);
235 : 0 : break;
236 : : case FN_FORMAT_FOOTNOTE_DLG:
237 : : {
238 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
239 : : OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
240 : :
241 [ # # ]: 0 : VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
242 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
243 [ # # ]: 0 : pDlg->Execute();
244 [ # # ][ # # ]: 0 : delete pDlg;
245 : 0 : break;
246 : : }
247 : : case FN_NUMBERING_OUTLINE_DLG:
248 : : {
249 [ # # ]: 0 : SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
250 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
251 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
252 : : SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
253 [ # # ]: 0 : GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
254 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
255 [ # # ]: 0 : pDlg->Execute();
256 [ # # ][ # # ]: 0 : delete pDlg;
257 [ # # ]: 0 : rReq.Done();
258 [ # # ]: 0 : break;
259 : : }
260 : : case SID_OPEN_XML_FILTERSETTINGS:
261 : : {
262 : : try
263 : : {
264 [ # # ][ # # ]: 0 : uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ui.XSLTFilterDialog"))), uno::UNO_QUERY);
[ # # ][ # # ]
[ # # ]
265 [ # # ]: 0 : if( xDialog.is() )
266 : : {
267 [ # # ][ # # ]: 0 : xDialog->execute();
268 [ # # ]: 0 : }
269 : : }
270 [ # # ]: 0 : catch (const uno::Exception&)
271 : : {
272 : : }
273 [ # # ]: 0 : rReq.Ignore ();
274 : : }
275 : 0 : break;
276 : : case FN_WORDCOUNT_DIALOG:
277 : : {
278 : 0 : SfxViewFrame* pVFrame = GetView().GetViewFrame();
279 [ # # ]: 0 : if (pVFrame != NULL)
280 : : {
281 [ # # ]: 0 : pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
282 [ # # ]: 0 : Invalidate(rReq.GetSlot());
283 : :
284 [ # # ][ # # ]: 0 : SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
285 [ # # ]: 0 : if (pWrdCnt)
286 [ # # ]: 0 : pWrdCnt->UpdateCounts();
287 : : }
288 : : }
289 : 0 : break;
290 : 0 : default: bMore = sal_True;
291 : : }
292 : :
293 [ # # ]: 0 : if ( !bMore )
294 : : {
295 : : return;
296 : : }
297 : :
298 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
299 : 0 : sal_Bool bUpdateMgr = sal_True;
300 : 0 : sal_Bool bCopyToFmt = sal_False;
301 [ # # # # : 0 : switch ( nSlot )
# # # # #
# # # # #
# # # #
# ]
302 : : {
303 : : case SID_OBJECT_ALIGN_MIDDLE:
304 : : case FN_FRAME_ALIGN_VERT_CENTER:
305 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::CENTER );
306 : 0 : break;
307 : : case SID_OBJECT_ALIGN_DOWN :
308 : : case FN_FRAME_ALIGN_VERT_BOTTOM:
309 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
310 : 0 : break;
311 : : case SID_OBJECT_ALIGN_UP :
312 : : case FN_FRAME_ALIGN_VERT_TOP:
313 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::TOP );
314 : 0 : break;
315 : :
316 : : case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
317 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
318 : 0 : break;
319 : :
320 : : case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
321 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
322 : 0 : break;
323 : :
324 : : case FN_FRAME_ALIGN_VERT_CHAR_TOP:
325 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
326 : 0 : break;
327 : :
328 : : case FN_FRAME_ALIGN_VERT_ROW_CENTER:
329 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
330 : 0 : break;
331 : :
332 : : case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
333 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
334 : 0 : break;
335 : :
336 : : case FN_FRAME_ALIGN_VERT_ROW_TOP:
337 [ # # ]: 0 : aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
338 : 0 : break;
339 : : case SID_OBJECT_ALIGN_CENTER :
340 : : case FN_FRAME_ALIGN_HORZ_CENTER:
341 [ # # ]: 0 : aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
342 : 0 : break;
343 : : case SID_OBJECT_ALIGN_RIGHT:
344 : : case FN_FRAME_ALIGN_HORZ_RIGHT:
345 [ # # ]: 0 : aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
346 : 0 : break;
347 : : case SID_OBJECT_ALIGN_LEFT:
348 : : case FN_FRAME_ALIGN_HORZ_LEFT:
349 [ # # ]: 0 : aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
350 : 0 : break;
351 : :
352 : : case FN_SET_FRM_POSITION:
353 : : {
354 : : aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get
355 [ # # ][ # # ]: 0 : (FN_SET_FRM_POSITION)).GetValue());
356 : : }
357 : 0 : break;
358 : : case SID_ATTR_BRUSH:
359 : : {
360 [ # # ]: 0 : if(pArgs)
361 : : {
362 [ # # ]: 0 : aMgr.SetAttrSet( *pArgs );
363 : 0 : bCopyToFmt = sal_True;
364 : : }
365 : : }
366 : 0 : break;
367 : : case SID_ATTR_ULSPACE:
368 : : case SID_ATTR_LRSPACE:
369 : : {
370 [ # # ][ # # ]: 0 : if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem))
[ # # ][ # # ]
[ # # ]
371 : : {
372 [ # # ]: 0 : aMgr.SetAttrSet( *pArgs );
373 : 0 : bCopyToFmt = sal_True;
374 : : }
375 : : }
376 : 0 : break;
377 : : case FN_FORMAT_FRAME_DLG:
378 : : {
379 [ # # ]: 0 : const int nSel = rSh.GetSelectionType();
380 [ # # ]: 0 : if (nSel & nsSelectionType::SEL_GRF)
381 : : {
382 [ # # ]: 0 : rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_GRAFIC_DLG);
383 : 0 : bUpdateMgr = sal_False;
384 : : }
385 : : else
386 : : {
387 : 0 : SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
388 : : SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
389 : : FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
390 : : SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
391 : : SID_ATTR_BRUSH, SID_ATTR_BRUSH,
392 : : SID_ATTR_LRSPACE, SID_ATTR_ULSPACE,
393 : : FN_SURROUND, FN_HORI_ORIENT,
394 : : FN_SET_FRM_NAME, FN_SET_FRM_NAME,
395 : : FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO,
396 : : SID_DOCFRAME, SID_DOCFRAME,
397 : : SID_HTML_MODE, SID_HTML_MODE,
398 : : FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
399 : : FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT,
400 : : FN_OLE_IS_MATH, FN_OLE_IS_MATH,
401 : : FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT,
402 [ # # ]: 0 : 0);
403 : :
404 : 0 : const SwViewOption* pVOpt = rSh.GetViewOptions();
405 [ # # ]: 0 : if(nSel & nsSelectionType::SEL_OLE)
406 [ # # ][ # # ]: 0 : aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
[ # # ]
407 [ # # ][ # # ]: 0 : aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
[ # # ][ # # ]
[ # # ]
408 [ # # ][ # # ]: 0 : aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
[ # # ][ # # ]
409 [ # # ]: 0 : if( nSel & nsSelectionType::SEL_OLE )
410 : : {
411 : : // #i73249#
412 [ # # ][ # # ]: 0 : aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
[ # # ][ # # ]
[ # # ]
413 : : }
414 : :
415 [ # # ]: 0 : const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
416 [ # # ]: 0 : SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
417 [ # # ]: 0 : aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
418 [ # # ]: 0 : aSet.Put(aFrmSize);
419 : :
420 [ # # ]: 0 : const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT);
421 [ # # ]: 0 : SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
422 [ # # ]: 0 : aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
423 [ # # ]: 0 : aSet.Put(aPrtSize);
424 : :
425 [ # # ]: 0 : aSet.Put(aMgr.GetAttrSet());
426 : 0 : aSet.SetParent( aMgr.GetAttrSet().GetParent() );
427 : :
428 : : // Bei %-Werten Groesse initialisieren
429 [ # # ]: 0 : SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
430 [ # # ][ # # ]: 0 : if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff)
[ # # ]
431 [ # # ]: 0 : rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
432 [ # # ][ # # ]: 0 : if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff)
[ # # ]
433 [ # # ]: 0 : rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
434 : :
435 : : // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
436 : : aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT,
437 [ # # ][ # # ]: 0 : rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) );
[ # # ][ # # ]
438 [ # # ]: 0 : const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
439 [ # # ][ # # ]: 0 : aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
440 : :
441 : 0 : sal_uInt16 nDefPage = 0;
442 [ # # ][ # # ]: 0 : if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, sal_False, &pItem) == SFX_ITEM_SET)
[ # # ][ # # ]
443 : 0 : nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
444 : :
445 [ # # ][ # # ]: 0 : aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
[ # # ][ # # ]
446 [ # # ][ # # ]: 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
[ # # ][ # # ]
[ # # ][ # # ]
447 [ # # ][ # # ]: 0 : SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
[ # # ][ # # ]
448 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
449 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
450 : : SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD,
451 : 0 : GetView().GetViewFrame(),
452 : 0 : GetView().GetWindow(),
453 : : aSet, sal_False,
454 : : nSel & nsSelectionType::SEL_GRF ? DLG_FRM_GRF :
455 : : nSel & nsSelectionType::SEL_OLE ? DLG_FRM_OLE :
456 : : DLG_FRM_STD,
457 : : sal_False,
458 [ # # ][ # # ]: 0 : nDefPage);
[ # # ]
459 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
460 : :
461 [ # # ][ # # ]: 0 : if ( pDlg->Execute() )
462 : : {
463 [ # # ]: 0 : const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
464 [ # # ]: 0 : if(pOutSet)
465 : : {
466 [ # # ]: 0 : rReq.Done(*pOutSet);
467 [ # # ][ # # ]: 0 : if(nSel & nsSelectionType::SEL_OLE &&
[ # # ]
468 [ # # ]: 0 : SFX_ITEM_SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, sal_True, &pItem))
469 : : {
470 [ # # ]: 0 : SwViewOption aUsrPref( *pVOpt );
471 : 0 : aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue());
472 [ # # ][ # # ]: 0 : SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
[ # # ]
473 : : }
474 [ # # ][ # # ]: 0 : if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, sal_True, &pItem))
475 : : {
476 : : // #i73249#
477 [ # # ]: 0 : rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue());
478 : : }
479 : : // Vorlagen-AutoUpdate
480 [ # # ]: 0 : SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
481 [ # # ][ # # ]: 0 : if(pFmt && pFmt->IsAutoUpdateFmt())
[ # # ]
482 : : {
483 [ # # ]: 0 : rSh.AutoUpdateFrame(pFmt, *pOutSet);
484 : : // alles, dass das Format nicht kann, muss hart
485 : : // gesetzt werden
486 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem))
487 [ # # ]: 0 : rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
488 : 0 : SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
489 : : RES_SURROUND, RES_SURROUND,
490 : : RES_ANCHOR, RES_ANCHOR,
491 : : RES_VERT_ORIENT,RES_HORI_ORIENT,
492 [ # # ]: 0 : 0);
493 [ # # ]: 0 : aShellSet.Put(*pOutSet);
494 [ # # ]: 0 : aMgr.SetAttrSet(aShellSet);
495 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem))
496 [ # # ][ # # ]: 0 : rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
497 : : }
498 : : else
499 [ # # ]: 0 : aMgr.SetAttrSet( *pOutSet );
500 : :
501 [ # # ]: 0 : const SwFrmFmt* pCurrFlyFmt = rSh.GetFlyFrmFmt();
502 [ # # ]: 0 : if(SFX_ITEM_SET ==
503 : : pOutSet->GetItemState(FN_PARAM_CHAIN_PREVIOUS,
504 [ # # ]: 0 : sal_False, &pItem))
505 : : {
506 [ # # ]: 0 : rSh.HideChainMarker();
507 : :
508 : : String sPrevName =
509 [ # # ]: 0 : ((const SfxStringItem*)pItem)->GetValue();
510 [ # # ]: 0 : const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
511 : : //needs cast - no non-const method available
512 : : SwFlyFrmFmt* pFlyFmt =
513 : 0 : (SwFlyFrmFmt*)rChain.GetPrev();
514 [ # # ]: 0 : if(pFlyFmt)
515 : : {
516 [ # # ][ # # ]: 0 : if (pFlyFmt->GetName() != sPrevName)
517 : : {
518 [ # # ]: 0 : rSh.Unchain(*pFlyFmt);
519 : : }
520 : : else
521 [ # # ]: 0 : sPrevName.Erase();
522 : : }
523 : :
524 [ # # ]: 0 : if(sPrevName.Len())
525 : : {
526 : : //needs cast - no non-const method available
527 : : SwFrmFmt* pPrevFmt = (SwFrmFmt*)
528 [ # # ]: 0 : lcl_GetFrmFmtByName(rSh, sPrevName);
529 : : OSL_ENSURE(pPrevFmt, "No frame found!");
530 [ # # ]: 0 : if(pPrevFmt)
531 : : {
532 [ # # ]: 0 : rSh.Chain(*pPrevFmt, *pCurrFlyFmt);
533 : : }
534 : : }
535 [ # # ][ # # ]: 0 : rSh.SetChainMarker();
536 : : }
537 [ # # ]: 0 : if(SFX_ITEM_SET ==
538 : : pOutSet->GetItemState(FN_PARAM_CHAIN_NEXT, sal_False,
539 [ # # ]: 0 : &pItem))
540 : : {
541 [ # # ]: 0 : rSh.HideChainMarker();
542 : : String sNextName =
543 [ # # ]: 0 : ((const SfxStringItem*)pItem)->GetValue();
544 [ # # ]: 0 : const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
545 : : //needs cast - no non-const method available
546 : : SwFlyFrmFmt* pFlyFmt =
547 : 0 : (SwFlyFrmFmt*)rChain.GetNext();
548 [ # # ]: 0 : if(pFlyFmt)
549 : : {
550 [ # # ][ # # ]: 0 : if (pFlyFmt->GetName() != sNextName)
551 : : {
552 [ # # ]: 0 : rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt));
553 : : }
554 : : else
555 [ # # ]: 0 : sNextName.Erase();
556 : : }
557 : :
558 [ # # ]: 0 : if(sNextName.Len())
559 : : {
560 : : //needs cast - no non-const method available
561 : : SwFrmFmt* pNextFmt = (SwFrmFmt*)
562 [ # # ]: 0 : lcl_GetFrmFmtByName(rSh, sNextName);
563 : : OSL_ENSURE(pNextFmt, "No frame found!");
564 [ # # ]: 0 : if(pNextFmt)
565 : : {
566 : : rSh.Chain(*(SwFrmFmt*)
567 [ # # ]: 0 : pCurrFlyFmt, *pNextFmt);
568 : : }
569 : : }
570 [ # # ][ # # ]: 0 : rSh.SetChainMarker();
571 : : }
572 : : }
573 : : }
574 : : else
575 : 0 : bUpdateMgr = sal_False;
576 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ][ # # ]
[ # # ]
577 : : }
578 : : }
579 : 0 : break;
580 : : case FN_FRAME_MIRROR_ON_EVEN_PAGES:
581 : : {
582 [ # # ][ # # ]: 0 : SwFmtHoriOrient aHori(aMgr.GetHoriOrient());
583 : 0 : sal_Bool bMirror = !aHori.IsPosToggle();
584 : 0 : aHori.SetPosToggle(bMirror);
585 [ # # ]: 0 : SfxItemSet aSet(GetPool(), RES_HORI_ORIENT, RES_HORI_ORIENT);
586 [ # # ]: 0 : aSet.Put(aHori);
587 [ # # ]: 0 : aMgr.SetAttrSet(aSet);
588 : 0 : bCopyToFmt = sal_True;
589 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
[ # # ][ # # ]
[ # # ]
590 : : }
591 : 0 : break;
592 : : // #i73249#
593 : : case FN_TITLE_DESCRIPTION_SHAPE:
594 : : {
595 : 0 : bUpdateMgr = sal_False;
596 [ # # ]: 0 : SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
597 [ # # # # ]: 0 : if ( pSdrView &&
[ # # ]
598 : 0 : pSdrView->GetMarkedObjectCount() == 1 )
599 : : {
600 [ # # ]: 0 : String aDescription(rSh.GetObjDescription());
601 [ # # ]: 0 : String aTitle(rSh.GetObjTitle());
602 : :
603 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
604 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
605 : : AbstractSvxObjectTitleDescDialog* pDlg =
606 : : pFact->CreateSvxObjectTitleDescDialog( NULL,
607 : : aTitle,
608 [ # # ]: 0 : aDescription );
609 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
610 : :
611 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
612 : : {
613 [ # # ]: 0 : pDlg->GetDescription(aDescription);
614 [ # # ]: 0 : pDlg->GetTitle(aTitle);
615 : :
616 [ # # ]: 0 : rSh.SetObjDescription(aDescription);
617 [ # # ]: 0 : rSh.SetObjTitle(aTitle);
618 : : }
619 : :
620 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ][ # # ]
621 : : }
622 : : }
623 : 0 : break;
624 : : default:
625 : : OSL_ENSURE( !this, "wrong dispatcher" );
626 : : return;
627 : : }
628 : : // Vorlagen-AutoUpdate
629 [ # # ]: 0 : SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
630 [ # # ]: 0 : if ( bUpdateMgr )
631 : : {
632 [ # # ][ # # ]: 0 : if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt())
[ # # ][ # # ]
633 : : {
634 [ # # ]: 0 : rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
635 : : }
636 : : else
637 [ # # ]: 0 : aMgr.UpdateFlyFrm();
638 [ # # ][ # # ]: 0 : }
639 : :
640 : : }
641 : :
642 : 0 : void SwFrameShell::GetState(SfxItemSet& rSet)
643 : : {
644 : 0 : SwWrtShell &rSh = GetShell();
645 : 0 : sal_Bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
646 [ # # ]: 0 : if (rSh.IsFrmSelected())
647 : : {
648 [ # # ]: 0 : SfxItemSet aSet( rSh.GetAttrPool(),
649 : : RES_LR_SPACE, RES_UL_SPACE,
650 : : RES_PROTECT, RES_HORI_ORIENT,
651 : : RES_OPAQUE, RES_OPAQUE,
652 : : RES_PRINT, RES_OPAQUE,
653 [ # # ]: 0 : 0 );
654 [ # # ]: 0 : rSh.GetFlyFrmAttr( aSet );
655 : :
656 [ # # ]: 0 : sal_Bool bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS);
657 [ # # ]: 0 : sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
658 : :
659 : 0 : bProtect |= bParentCntProt;
660 : :
661 [ # # ]: 0 : const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
662 [ # # ]: 0 : SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
663 : :
664 [ # # ]: 0 : SfxWhichIter aIter( rSet );
665 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
666 [ # # ]: 0 : while ( nWhich )
667 : : {
668 [ # # # # : 0 : switch ( nWhich )
# # # # #
# # # ]
669 : : {
670 : : case RES_FRM_SIZE:
671 : : {
672 [ # # ][ # # ]: 0 : SwFmtFrmSize aSz(aMgr.GetFrmSize());
673 [ # # ][ # # ]: 0 : rSet.Put(aSz);
674 : : }
675 : 0 : break;
676 : : case RES_VERT_ORIENT:
677 : : case RES_HORI_ORIENT:
678 : : case SID_ATTR_ULSPACE:
679 : : case SID_ATTR_LRSPACE:
680 : : case RES_LR_SPACE:
681 : : case RES_UL_SPACE:
682 : : case RES_PROTECT:
683 : : case RES_OPAQUE:
684 : : case RES_PRINT:
685 : : case RES_SURROUND:
686 : : {
687 [ # # ][ # # ]: 0 : rSet.Put(aSet.Get(GetPool().GetWhich(nWhich), sal_True ));
[ # # ]
688 : : }
689 : 0 : break;
690 : : case SID_OBJECT_ALIGN_LEFT :
691 : : case SID_OBJECT_ALIGN_CENTER :
692 : : case SID_OBJECT_ALIGN_RIGHT :
693 : : case FN_FRAME_ALIGN_HORZ_CENTER:
694 : : case FN_FRAME_ALIGN_HORZ_RIGHT:
695 : : case FN_FRAME_ALIGN_HORZ_LEFT:
696 [ # # ][ # # ]: 0 : if ( (eFrmType & FRMTYPE_FLY_INCNT) ||
[ # # ][ # # ]
[ # # ]
697 : : bProtect ||
698 : : ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER) &&
699 : : bHtmlMode ))
700 [ # # ]: 0 : rSet.DisableItem( nWhich );
701 : 0 : break;
702 : : case FN_FRAME_ALIGN_VERT_ROW_TOP:
703 : : case FN_FRAME_ALIGN_VERT_ROW_CENTER:
704 : : case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
705 : : case FN_FRAME_ALIGN_VERT_CHAR_TOP:
706 : : case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
707 : : case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
708 [ # # ][ # # ]: 0 : if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect
[ # # ][ # # ]
709 : : || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
710 [ # # ]: 0 : rSet.DisableItem( nWhich );
711 : 0 : break;
712 : :
713 : : case SID_OBJECT_ALIGN_UP :
714 : : case SID_OBJECT_ALIGN_MIDDLE :
715 : : case SID_OBJECT_ALIGN_DOWN :
716 : :
717 : : case FN_FRAME_ALIGN_VERT_TOP:
718 : : case FN_FRAME_ALIGN_VERT_CENTER:
719 : : case FN_FRAME_ALIGN_VERT_BOTTOM:
720 [ # # ][ # # ]: 0 : if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT))
[ # # ]
721 [ # # ]: 0 : rSet.DisableItem( nWhich );
722 : : else
723 : : {
724 : 0 : sal_uInt16 nId = 0;
725 [ # # ]: 0 : if (eFrmType & FRMTYPE_FLY_INCNT)
726 : : {
727 [ # # # # ]: 0 : switch (nWhich)
728 : : {
729 : : case SID_OBJECT_ALIGN_UP :
730 : : case FN_FRAME_ALIGN_VERT_TOP:
731 : 0 : nId = STR_TOP_BASE; break;
732 : : case SID_OBJECT_ALIGN_MIDDLE :
733 : : case FN_FRAME_ALIGN_VERT_CENTER:
734 : 0 : nId = STR_CENTER_BASE; break;
735 : : case SID_OBJECT_ALIGN_DOWN :
736 : : case FN_FRAME_ALIGN_VERT_BOTTOM:
737 [ # # ]: 0 : if(!bHtmlMode)
738 : 0 : nId = STR_BOTTOM_BASE;
739 : : else
740 [ # # ]: 0 : rSet.DisableItem( nWhich );
741 : 0 : break;
742 : : }
743 : : }
744 : : else
745 : : {
746 [ # # ][ # # ]: 0 : if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
747 : : nWhich != SID_OBJECT_ALIGN_UP )
748 : : {
749 [ # # ][ # # ]: 0 : if (aMgr.GetAnchor() == FLY_AT_FLY)
750 : : {
751 [ # # ]: 0 : const SwFrmFmt* pFmt = rSh.IsFlyInFly();
752 [ # # ]: 0 : if (pFmt)
753 : : {
754 [ # # ]: 0 : const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
755 [ # # ]: 0 : if (rFrmSz.GetHeightSizeType() != ATT_FIX_SIZE)
756 : : {
757 [ # # ]: 0 : rSet.DisableItem( nWhich );
758 : 0 : break;
759 : : }
760 : : }
761 : : }
762 : : }
763 [ # # # # ]: 0 : switch (nWhich)
764 : : {
765 : : case SID_OBJECT_ALIGN_UP :
766 : : case FN_FRAME_ALIGN_VERT_TOP:
767 : 0 : nId = STR_TOP; break;
768 : : case SID_OBJECT_ALIGN_MIDDLE:
769 : : case FN_FRAME_ALIGN_VERT_CENTER:
770 : 0 : nId = STR_CENTER_VERT; break;
771 : : case SID_OBJECT_ALIGN_DOWN:
772 : : case FN_FRAME_ALIGN_VERT_BOTTOM:
773 : 0 : nId = STR_BOTTOM; break;
774 : : }
775 : : }
776 [ # # ]: 0 : if ( nId )
777 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( nWhich, SW_RES(nId) ));
[ # # ][ # # ]
[ # # ]
778 : : }
779 : 0 : break;
780 : : case SID_HYPERLINK_GETLINK:
781 : : {
782 [ # # ]: 0 : String sURL;
783 [ # # ]: 0 : SvxHyperlinkItem aHLinkItem;
784 : : const SfxPoolItem* pItem;
785 : :
786 [ # # ]: 0 : SfxItemSet aURLSet(GetPool(), RES_URL, RES_URL);
787 [ # # ]: 0 : rSh.GetFlyFrmAttr( aURLSet );
788 : :
789 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == aURLSet.GetItemState(RES_URL, sal_True, &pItem))
790 : : {
791 : 0 : const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
792 [ # # ]: 0 : aHLinkItem.SetURL(pFmtURL->GetURL());
793 [ # # ]: 0 : aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName());
794 [ # # ][ # # ]: 0 : aHLinkItem.SetName(rSh.GetFlyName());
795 : : }
796 : :
797 : 0 : aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
798 [ # # ]: 0 : (bHtmlMode ? HLINK_HTMLMODE : 0)));
799 : :
800 [ # # ][ # # ]: 0 : rSet.Put(aHLinkItem);
[ # # ][ # # ]
801 : : }
802 : 0 : break;
803 : :
804 : : case FN_FRAME_CHAIN:
805 : : {
806 [ # # ]: 0 : const int nSel = rSh.GetSelectionType();
807 [ # # ][ # # ]: 0 : if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
808 [ # # ]: 0 : rSet.DisableItem( FN_FRAME_CHAIN );
809 : : else
810 : : {
811 [ # # ]: 0 : const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
812 [ # # ][ # # ]: 0 : if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
[ # # # # ]
[ # # ]
813 [ # # ]: 0 : !pFmt || pFmt->GetChain().GetNext() )
814 : : {
815 [ # # ]: 0 : rSet.DisableItem( FN_FRAME_CHAIN );
816 : : }
817 : : else
818 : : {
819 : 0 : sal_Bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
820 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
[ # # ]
821 : : }
822 : : }
823 : : }
824 : 0 : break;
825 : : case FN_FRAME_UNCHAIN:
826 : : {
827 [ # # ]: 0 : const int nSel = rSh.GetSelectionType();
828 [ # # ][ # # ]: 0 : if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
829 [ # # ]: 0 : rSet.DisableItem( FN_FRAME_UNCHAIN );
830 : : else
831 : : {
832 [ # # ]: 0 : const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
833 [ # # ][ # # ]: 0 : if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
[ # # # # ]
[ # # ]
834 [ # # ]: 0 : !pFmt || !pFmt->GetChain().GetNext() )
835 : : {
836 [ # # ]: 0 : rSet.DisableItem( FN_FRAME_UNCHAIN );
837 : : }
838 : : }
839 : : }
840 : 0 : break;
841 : : case SID_FRAME_TO_TOP:
842 : : case SID_FRAME_TO_BOTTOM:
843 : : case FN_FRAME_UP:
844 : : case FN_FRAME_DOWN:
845 [ # # ]: 0 : if ( bParentCntProt )
846 [ # # ]: 0 : rSet.DisableItem( nWhich );
847 : 0 : break;
848 : : case FN_FORMAT_FRAME_DLG:
849 : : {
850 [ # # ]: 0 : const int nSel = rSh.GetSelectionType();
851 [ # # ][ # # ]: 0 : if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF)
852 [ # # ]: 0 : rSet.DisableItem( nWhich );
853 : : }
854 : 0 : break;
855 : : // #i73249#
856 : : case FN_TITLE_DESCRIPTION_SHAPE:
857 : : {
858 [ # # ]: 0 : SwWrtShell &rWrtSh = GetShell();
859 [ # # ]: 0 : SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
860 [ # # # # ]: 0 : if ( !pSdrView ||
[ # # ]
861 : 0 : pSdrView->GetMarkedObjectCount() != 1 )
862 : : {
863 [ # # ]: 0 : rSet.DisableItem( nWhich );
864 : : }
865 : :
866 : : }
867 : 0 : break;
868 : : default:
869 : : /* do nothing */;
870 : 0 : break;
871 : : }
872 [ # # ]: 0 : nWhich = aIter.NextWhich();
873 [ # # ][ # # ]: 0 : }
[ # # ]
874 : : }
875 : 0 : }
876 : :
877 : : /*--------------------------------------------------------------------
878 : : Beschreibung: Ctor fuer FrameShell
879 : : --------------------------------------------------------------------*/
880 : 0 : SwFrameShell::SwFrameShell(SwView &_rView) :
881 : 0 : SwBaseShell( _rView )
882 : : {
883 [ # # ][ # # ]: 0 : SetName(rtl::OUString("Frame"));
[ # # ]
884 [ # # ]: 0 : SetHelpId(SW_FRAMESHELL);
885 : :
886 : : /* #96392# Use this to announce it is the frame shell who creates the
887 : : selection. */
888 [ # # ]: 0 : SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this );
889 : 0 : }
890 : :
891 : 0 : SwFrameShell::~SwFrameShell()
892 : : {
893 : : /* #96392# Only clear the selection if it was this frame shell who created
894 : : it. */
895 [ # # ][ # # ]: 0 : SwTransferable::ClearSelection( GetShell(), (ViewShell *) this );
896 [ # # ]: 0 : }
897 : :
898 : 0 : void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
899 : : {
900 [ # # ]: 0 : SwWrtShell &rSh = GetShell();
901 : 0 : sal_Bool bDefault = sal_False;
902 [ # # ][ # # ]: 0 : if (!rSh.IsFrmSelected())
903 : 0 : return;
904 : :
905 : : // Erst Default-BoxItem aus Pool holen. Wenn ungleich normalem Boxitem,
906 : : // dann ist es bereits geaendert worden (neues ist kein Default).
907 [ # # ]: 0 : const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX);
908 : :
909 : 0 : const SfxItemSet *pArgs = rReq.GetArgs();
910 [ # # ][ # # ]: 0 : SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX);
911 : :
912 [ # # ]: 0 : rSh.GetFlyFrmAttr( aFrameSet );
913 [ # # ]: 0 : const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX);
914 : :
915 [ # # ]: 0 : if (pPoolBoxItem == &rBoxItem)
916 : 0 : bDefault = sal_True;
917 : :
918 [ # # ]: 0 : SvxBoxItem aBoxItem(rBoxItem);
919 : :
920 [ # # ]: 0 : SvxBorderLine aBorderLine;
921 : 0 : const SfxPoolItem *pItem = 0;
922 : :
923 [ # # ]: 0 : if(pArgs) //irgendein Controller kann auch mal nichts liefern #48169#
924 : : {
925 [ # # # # ]: 0 : switch (rReq.GetSlot())
926 : : {
927 : : case SID_ATTR_BORDER:
928 : : {
929 [ # # ][ # # ]: 0 : if (pArgs->GetItemState(RES_BOX, sal_True, &pItem) == SFX_ITEM_SET)
930 : : {
931 [ # # ]: 0 : SvxBoxItem aNewBox(*((SvxBoxItem *)pItem));
932 : : const SvxBorderLine* pBorderLine;
933 : :
934 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetTop()) != NULL)
935 [ # # ]: 0 : lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
936 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
937 [ # # ]: 0 : lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
938 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
939 [ # # ]: 0 : lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
940 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetRight()) != NULL)
941 [ # # ]: 0 : lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
942 : :
943 [ # # ][ # # ]: 0 : if(aBorderLine.GetOutWidth() == 0)
944 : : {
945 : : aBorderLine.SetBorderLineStyle(
946 [ # # ]: 0 : table::BorderLineStyle::SOLID);
947 : 0 : aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
948 : : }
949 : : //Distance nur setzen, wenn der Request vom Controller kommt
950 : :
951 : : #ifndef DISABLE_SCRIPTING
952 [ # # ][ # # ]: 0 : if(!StarBASIC::IsRunning())
953 : : #endif
954 : : {
955 [ # # ]: 0 : aNewBox.SetDistance( rBoxItem.GetDistance() );
956 : : }
957 : :
958 [ # # ]: 0 : aBoxItem = aNewBox;
959 [ # # ]: 0 : SvxBorderLine aDestBorderLine;
960 : :
961 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetTop()) != NULL)
962 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
963 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
964 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
965 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
966 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
967 [ # # ]: 0 : if ((pBorderLine = aBoxItem.GetRight()) != NULL)
968 [ # # ][ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
969 : : }
970 : : }
971 : 0 : break;
972 : :
973 : : case SID_FRAME_LINESTYLE:
974 : : {
975 [ # # ][ # # ]: 0 : if (pArgs->GetItemState(SID_FRAME_LINESTYLE, sal_False, &pItem) == SFX_ITEM_SET)
976 : : {
977 : : const SvxLineItem* pLineItem =
978 : 0 : (const SvxLineItem*)pItem;
979 : :
980 [ # # ]: 0 : if ( pLineItem->GetLine() )
981 : : {
982 [ # # ]: 0 : aBorderLine = *(pLineItem->GetLine());
983 : :
984 [ # # ][ # # : 0 : if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
# # # # ]
[ # # ]
985 : 0 : !aBoxItem.GetLeft() && !aBoxItem.GetRight())
986 : : {
987 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
988 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
989 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
990 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
991 : : }
992 : : else
993 : : {
994 [ # # ]: 0 : if( aBoxItem.GetTop() )
995 : : {
996 : 0 : aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() );
997 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
998 : : }
999 [ # # ]: 0 : if( aBoxItem.GetBottom() )
1000 : : {
1001 : 0 : aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor());
1002 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1003 : : }
1004 [ # # ]: 0 : if( aBoxItem.GetLeft() )
1005 : : {
1006 : 0 : aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor());
1007 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1008 : : }
1009 [ # # ]: 0 : if( aBoxItem.GetRight() )
1010 : : {
1011 : 0 : aBorderLine.SetColor(aBoxItem.GetRight()->GetColor());
1012 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1013 : : }
1014 : : }
1015 : : }
1016 : : else
1017 : : {
1018 [ # # ]: 0 : aBoxItem.SetLine(0, BOX_LINE_TOP);
1019 [ # # ]: 0 : aBoxItem.SetLine(0, BOX_LINE_BOTTOM);
1020 [ # # ]: 0 : aBoxItem.SetLine(0, BOX_LINE_LEFT);
1021 [ # # ]: 0 : aBoxItem.SetLine(0, BOX_LINE_RIGHT);
1022 : : }
1023 : : }
1024 : : }
1025 : 0 : break;
1026 : :
1027 : : case SID_FRAME_LINECOLOR:
1028 : : {
1029 [ # # ][ # # ]: 0 : if (pArgs->GetItemState(SID_FRAME_LINECOLOR, sal_False, &pItem) == SFX_ITEM_SET)
1030 : : {
1031 : 0 : const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue();
1032 : :
1033 [ # # # # : 0 : if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
# # ][ # # ]
[ # # ]
1034 : 0 : !aBoxItem.GetLeft() && !aBoxItem.GetRight())
1035 : : {
1036 : 0 : aBorderLine.SetColor( rNewColor );
1037 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
1038 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1039 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1040 [ # # ]: 0 : aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1041 : : }
1042 : : else
1043 : : {
1044 [ # # ]: 0 : if ( aBoxItem.GetTop() )
1045 : 0 : ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor );
1046 [ # # ]: 0 : if ( aBoxItem.GetBottom() )
1047 : 0 : ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor );
1048 [ # # ]: 0 : if ( aBoxItem.GetLeft() )
1049 : 0 : ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor );
1050 [ # # ]: 0 : if ( aBoxItem.GetRight() )
1051 : 0 : ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor );
1052 : : }
1053 : : }
1054 : : }
1055 : 0 : break;
1056 : : }
1057 : : }
1058 [ # # ][ # # ]: 0 : if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() ||
[ # # # #
# # ][ # # ]
1059 : 0 : aBoxItem.GetLeft() || aBoxItem.GetRight()))
1060 : : {
1061 : 0 : aBoxItem.SetDistance(MIN_BORDER_DIST);
1062 : : }
1063 [ # # ]: 0 : aFrameSet.Put( aBoxItem );
1064 : : // Vorlagen-AutoUpdate
1065 [ # # ]: 0 : SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
1066 [ # # ][ # # ]: 0 : if(pFmt && pFmt->IsAutoUpdateFmt())
[ # # ]
1067 : : {
1068 [ # # ]: 0 : rSh.AutoUpdateFrame(pFmt, aFrameSet);
1069 : : }
1070 : : else
1071 [ # # ][ # # ]: 0 : rSh.SetFlyFrmAttr( aFrameSet );
[ # # ]
1072 : :
1073 : : }
1074 : :
1075 : 0 : void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
1076 : : {
1077 [ # # ]: 0 : if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
1078 : 0 : rBorderLine.SetWidth(pBorderLine->GetWidth());
1079 : :
1080 : 0 : rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
1081 : 0 : rBorderLine.SetColor(pBorderLine->GetColor());
1082 : 0 : }
1083 : :
1084 : 0 : void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
1085 : : {
1086 : 0 : SwWrtShell &rSh = GetShell();
1087 : 0 : sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1088 : :
1089 [ # # ]: 0 : if (bParentCntProt)
1090 : : {
1091 [ # # ]: 0 : if (rSh.IsFrmSelected())
1092 : 0 : rSet.DisableItem( SID_FRAME_LINECOLOR );
1093 : :
1094 : 0 : rSet.DisableItem( SID_ATTR_BORDER );
1095 : 0 : rSet.DisableItem( SID_FRAME_LINESTYLE );
1096 : : }
1097 : : else
1098 : : {
1099 [ # # ]: 0 : if (rSh.IsFrmSelected())
1100 : : {
1101 [ # # ][ # # ]: 0 : SfxItemSet aFrameSet( rSh.GetAttrPool(), RES_BOX, RES_BOX );
1102 : :
1103 [ # # ]: 0 : rSh.GetFlyFrmAttr(aFrameSet);
1104 : :
1105 [ # # ]: 0 : const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop();
1106 [ # # ][ # # ]: 0 : rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
[ # # ][ # # ]
[ # # ]
1107 : : }
1108 : : }
1109 : 0 : }
1110 : :
1111 : 0 : void SwFrameShell::StateInsert(SfxItemSet &rSet)
1112 : : {
1113 : 0 : const int nSel = GetShell().GetSelectionType();
1114 : :
1115 [ # # ][ # # ]: 0 : if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE))
1116 : 0 : rSet.DisableItem(FN_INSERT_FRAME);
1117 : 0 : }
1118 : :
1119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|