Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #include <boost/scoped_ptr.hpp>
22 : :
23 : : #include <hintids.hxx>
24 : : #include <sfx2/request.hxx>
25 : : #include <sfx2/dispatch.hxx>
26 : : #include <sfx2/childwin.hxx>
27 : : #include <unotools/useroptions.hxx>
28 : : #include <cppuhelper/weak.hxx>
29 : : #include <com/sun/star/frame/FrameSearchFlag.hpp>
30 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
31 : : #include <cppuhelper/implbase1.hxx> // helper for implementations
32 : : #include <svx/dataaccessdescriptor.hxx>
33 : : #include <editeng/wghtitem.hxx>
34 : : #include <editeng/postitem.hxx>
35 : : #include <editeng/udlnitem.hxx>
36 : : #include <editeng/crsditem.hxx>
37 : : #include <editeng/cmapitem.hxx>
38 : : #include <editeng/colritem.hxx>
39 : : #include <editeng/brshitem.hxx>
40 : : #include <vcl/msgbox.hxx>
41 : : #include <svl/cjkoptions.hxx>
42 : : #include <swmodule.hxx>
43 : : #include <swtypes.hxx>
44 : : #include <usrpref.hxx>
45 : : #include <modcfg.hxx>
46 : : #include <view.hxx>
47 : : #include <pview.hxx>
48 : : #include <wview.hxx>
49 : : #include <wrtsh.hxx>
50 : : #include <docsh.hxx>
51 : : #include <dbmgr.hxx>
52 : : #include <uinums.hxx>
53 : : #include <prtopt.hxx> // for PrintOptions
54 : : #include <navicfg.hxx>
55 : : #include <doc.hxx>
56 : : #include <cmdid.h>
57 : : #include <app.hrc>
58 : : #include "helpid.h"
59 : :
60 : : #include <unomid.h>
61 : : #include <tools/color.hxx>
62 : : #include "PostItMgr.hxx"
63 : :
64 : : using ::rtl::OUString;
65 : : using namespace ::svx;
66 : : using namespace ::com::sun::star;
67 : : using namespace ::com::sun::star::uno;
68 : : using namespace ::com::sun::star::beans;
69 : : using namespace ::com::sun::star::frame;
70 : : using namespace ::com::sun::star::view;
71 : : using namespace ::com::sun::star::lang;
72 : :
73 : :
74 : 218 : void lcl_SetUIPrefs(const SwViewOption &rPref, SwView* pView, ViewShell* pSh )
75 : : {
76 : : // in FrameSets the actual visibility can differ from the ViewOption's setting
77 : 218 : sal_Bool bVScrollChanged = rPref.IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
78 : 218 : sal_Bool bHScrollChanged = rPref.IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
79 : 218 : sal_Bool bVAlignChanged = rPref.IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
80 : :
81 : 218 : pSh->SetUIOptions(rPref);
82 : 218 : const SwViewOption* pNewPref = pSh->GetViewOptions();
83 : :
84 : : // Scrollbars on / off
85 [ + + ]: 218 : if(bVScrollChanged)
86 : : {
87 : 6 : pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
88 : : }
89 [ + + ]: 218 : if(bHScrollChanged)
90 : : {
91 [ + + ][ + + ]: 6 : pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() );
92 : : }
93 : : //if only the position of the vertical ruler has been changed initiate an update
94 [ + + ][ + - ]: 218 : if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
[ + - ]
95 : 6 : pView->InvalidateBorder();
96 : :
97 : : // Rulers on / off
98 [ + + ]: 218 : if(pNewPref->IsViewVRuler())
99 : 98 : pView->CreateVLineal();
100 : : else
101 : 120 : pView->KillVLineal();
102 : :
103 : : // TabWindow on / off
104 [ + + ]: 218 : if(pNewPref->IsViewHRuler())
105 : 104 : pView->CreateTab();
106 : : else
107 : 114 : pView->KillTab();
108 : :
109 : 218 : pView->GetPostItMgr()->PrepareView(true);
110 : 218 : }
111 : :
112 : 0 : SwWrtShell* GetActiveWrtShell()
113 : : {
114 : 0 : SwView *pActive = ::GetActiveView();
115 [ # # ]: 0 : if( pActive )
116 : 0 : return &pActive->GetWrtShell();
117 : 0 : return 0;
118 : : }
119 : :
120 : 0 : SwView* GetActiveView()
121 : : {
122 : 0 : SfxViewShell* pView = SfxViewShell::Current();
123 [ # # ][ # # ]: 0 : return PTR_CAST( SwView, pView );
124 : : }
125 : :
126 : 0 : SwView* SwModule::GetFirstView()
127 : : {
128 : : // returns only sivible SwView
129 [ # # ]: 0 : const TypeId aTypeId = TYPE(SwView);
130 [ # # ]: 0 : SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
131 : 0 : return pView;
132 : : }
133 : :
134 : 0 : SwView* SwModule::GetNextView(SwView* pView)
135 : : {
136 : : OSL_ENSURE(PTR_CAST(SwView, pView),"return no SwView");
137 [ # # ]: 0 : const TypeId aTypeId = TYPE(SwView);
138 [ # # ]: 0 : SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, sal_True);
139 : 0 : return pNView;
140 : : }
141 : :
142 : : /*------------------------------------------------------------------------
143 : : Description: New Master for the settings is set; this affects the
144 : : current view and all following.
145 : : ------------------------------------------------------------------------*/
146 : :
147 : 218 : void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
148 : : sal_uInt16 nDest )
149 : : {
150 : 218 : SwView* pCurrView = pActView;
151 [ + - ]: 218 : ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
152 : :
153 : : SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
154 : : VIEWOPT_DEST_WEB == nDest ? sal_True :
155 : : VIEWOPT_DEST_TEXT== nDest ? sal_False :
156 [ + - ][ + - ]: 218 : pCurrView && pCurrView->ISA(SwWebView) ));
[ + - ][ + - ]
[ + - ][ - + ]
[ + - ]
157 : :
158 : : // with Uno, only sdbcx::View, but not the Module should be changed
159 : 218 : sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
160 : : // fob PreView off
161 : : SwPagePreView* pPPView;
162 [ - + ][ # # ]: 218 : if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ - + ]
163 : : {
164 [ # # ]: 0 : if(!bViewOnly)
165 : 0 : pPref->SetUIOptions( rUsrPref );
166 [ # # ]: 0 : pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
167 [ # # ]: 0 : pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
168 [ # # ]: 0 : if(!bViewOnly)
169 : : {
170 : 0 : pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
171 : 0 : pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
172 : : }
173 : : return;
174 : : }
175 : :
176 [ - + ]: 218 : if(!bViewOnly)
177 : : {
178 [ # # ]: 0 : pPref->SetUsrPref( rUsrPref );
179 [ # # ]: 0 : pPref->SetModified();
180 : : }
181 : :
182 [ + - ]: 218 : if( !pCurrView )
183 : : return;
184 : :
185 : : // Passing on to CORE
186 : : sal_Bool bReadonly;
187 [ + - ]: 218 : const SwDocShell* pDocSh = pCurrView->GetDocShell();
188 [ + - ]: 218 : if (pDocSh)
189 [ + - ]: 218 : bReadonly = pDocSh->IsReadOnly();
190 : : else //Use existing option if DocShell missing
191 : 0 : bReadonly = pSh->GetViewOptions()->IsReadonly();
192 : 218 : boost::scoped_ptr<SwViewOption> xViewOpt;
193 [ - + ]: 218 : if (!bViewOnly)
194 [ # # ][ # # ]: 0 : xViewOpt.reset(new SwViewOption(*pPref));
[ # # ]
195 : : else
196 [ + - ][ + - ]: 218 : xViewOpt.reset(new SwViewOption(rUsrPref));
[ + - ]
197 : 218 : xViewOpt->SetReadonly( bReadonly );
198 [ + + ][ + - ]: 218 : if( !(*pSh->GetViewOptions() == *xViewOpt) )
199 : : {
200 : : //is maybe only a ViewShell
201 [ + - ]: 136 : pSh->StartAction();
202 [ + - ]: 136 : pSh->ApplyViewOptions( *xViewOpt );
203 [ + - ]: 136 : ((SwWrtShell*)pSh)->SetReadOnlyAvailable(xViewOpt->IsCursorInProtectedArea());
204 [ + - ]: 136 : pSh->EndAction();
205 : : }
206 [ - + ]: 218 : if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
207 [ # # ]: 0 : pSh->SetReadonlyOption(bReadonly);
208 : :
209 [ + - ]: 218 : lcl_SetUIPrefs(*xViewOpt, pCurrView, pSh);
210 : :
211 : : // in the end the Idle-Flag is set again
212 [ + - ]: 218 : pPref->SetIdle(sal_True);
213 : : }
214 : :
215 : 0 : void SwModule::ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb )
216 : : {
217 : : SwMasterUsrPref* pPref;
218 [ # # ]: 0 : if(bWeb)
219 : : {
220 [ # # ]: 0 : if(!pWebUsrPref)
221 : 0 : GetUsrPref(sal_True);
222 : 0 : pPref = pWebUsrPref;
223 : : }
224 : : else
225 : : {
226 [ # # ]: 0 : if(!pUsrPref)
227 : 0 : GetUsrPref(sal_False);
228 : 0 : pPref = pUsrPref;
229 : : }
230 : 0 : FieldUnit eOldMetric = pPref->GetMetric();
231 [ # # ]: 0 : if(eOldMetric != eMetric)
232 : 0 : pPref->SetMetric(eMetric);
233 : :
234 [ # # ]: 0 : FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
235 [ # # ]: 0 : FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
236 : :
237 : 0 : SwView* pTmpView = SwModule::GetFirstView();
238 : : // switch the ruler for all MDI-Windows
239 [ # # ]: 0 : while(pTmpView)
240 : : {
241 [ # # ][ # # ]: 0 : if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
[ # # ][ # # ]
242 : : {
243 : 0 : pTmpView->ChangeVLinealMetric(eVScrollMetric);
244 : 0 : pTmpView->ChangeTabMetric(eHScrollMetric);
245 : : }
246 : :
247 : 0 : pTmpView = SwModule::GetNextView(pTmpView);
248 : : }
249 : 0 : }
250 : :
251 : 0 : void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb )
252 : : {
253 : : SwMasterUsrPref* pPref;
254 [ # # ]: 0 : if(bWeb)
255 : : {
256 [ # # ]: 0 : if(!pWebUsrPref)
257 : 0 : GetUsrPref(sal_True);
258 : 0 : pPref = pWebUsrPref;
259 : : }
260 : : else
261 : : {
262 [ # # ]: 0 : if(!pUsrPref)
263 : 0 : GetUsrPref(sal_False);
264 : 0 : pPref = pUsrPref;
265 : : }
266 [ # # ]: 0 : if( bHorizontal )
267 : 0 : pPref->SetHScrollMetric(eMetric);
268 : : else
269 : 0 : pPref->SetVScrollMetric(eMetric);
270 : :
271 : 0 : SwView* pTmpView = SwModule::GetFirstView();
272 : : // switch metric at the appropriate rulers
273 [ # # ]: 0 : while(pTmpView)
274 : : {
275 [ # # ][ # # ]: 0 : if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
[ # # ]
276 : : {
277 [ # # ]: 0 : if( bHorizontal )
278 : 0 : pTmpView->ChangeTabMetric(eMetric);
279 : : else
280 : 0 : pTmpView->ChangeVLinealMetric(eMetric);
281 : : }
282 : 0 : pTmpView = SwModule::GetNextView(pTmpView);
283 : : }
284 : 0 : }
285 : :
286 : : /*-------------------------------------------------
287 : : set the usrpref 's char unit attribute and set ruler
288 : : 's unit as char if the "apply char unit" is checked
289 : : --------------------------------------------------*/
290 : 0 : void SwModule::ApplyUserCharUnit(sal_Bool bApplyChar, sal_Bool bWeb)
291 : : {
292 : : SwMasterUsrPref* pPref;
293 [ # # ]: 0 : if(bWeb)
294 : : {
295 [ # # ]: 0 : if(!pWebUsrPref)
296 : 0 : GetUsrPref(sal_True);
297 : 0 : pPref = pWebUsrPref;
298 : : }
299 : : else
300 : : {
301 [ # # ]: 0 : if(!pUsrPref)
302 : 0 : GetUsrPref(sal_False);
303 : 0 : pPref = pUsrPref;
304 : : }
305 : 0 : sal_Bool bOldApplyCharUnit = pPref->IsApplyCharUnit();
306 : 0 : sal_Bool bHasChanged = sal_False;
307 [ # # ]: 0 : if(bOldApplyCharUnit != bApplyChar)
308 : : {
309 : 0 : pPref->SetApplyCharUnit(bApplyChar);
310 : 0 : bHasChanged = sal_True;
311 : : }
312 : :
313 [ # # ]: 0 : if( !bHasChanged )
314 : 0 : return;
315 : :
316 [ # # ]: 0 : FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : pPref->GetMetric();
317 [ # # ]: 0 : FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : pPref->GetMetric();
318 [ # # ]: 0 : if(bApplyChar)
319 : : {
320 : 0 : eHScrollMetric = FUNIT_CHAR;
321 : 0 : eVScrollMetric = FUNIT_LINE;
322 : : }
323 : : else
324 : : {
325 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
326 [ # # ][ # # ]: 0 : if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FUNIT_CHAR ))
[ # # ][ # # ]
327 : 0 : eHScrollMetric = FUNIT_INCH;
328 [ # # ]: 0 : else if ( eHScrollMetric == FUNIT_CHAR )
329 : 0 : eHScrollMetric = FUNIT_CM;
330 [ # # ][ # # ]: 0 : if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FUNIT_LINE ))
[ # # ][ # # ]
331 : 0 : eVScrollMetric = FUNIT_INCH;
332 [ # # ]: 0 : else if ( eVScrollMetric == FUNIT_LINE )
333 [ # # ]: 0 : eVScrollMetric = FUNIT_CM;
334 : : }
335 : 0 : SwView* pTmpView = SwModule::GetFirstView();
336 : : // switch rulers for all MDI-Windows
337 [ # # ]: 0 : while(pTmpView)
338 : : {
339 [ # # ][ # # ]: 0 : if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
[ # # ][ # # ]
340 : : {
341 : 0 : pTmpView->ChangeVLinealMetric(eVScrollMetric);
342 : 0 : pTmpView->ChangeTabMetric(eHScrollMetric);
343 : : }
344 : :
345 : 0 : pTmpView = SwModule::GetNextView(pTmpView);
346 : : }
347 : : }
348 : :
349 : 0 : SwNavigationConfig* SwModule::GetNavigationConfig()
350 : : {
351 [ # # ]: 0 : if(!pNavigationConfig)
352 : : {
353 [ # # ]: 0 : pNavigationConfig = new SwNavigationConfig;
354 : : }
355 : 0 : return pNavigationConfig;
356 : : }
357 : :
358 : 1562 : SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
359 : : {
360 [ + + ][ + + ]: 1562 : if(bWeb && !pWebPrtOpt)
361 : : {
362 [ + - ]: 2 : pWebPrtOpt = new SwPrintOptions(sal_True);
363 : : }
364 [ + + ][ + + ]: 1560 : else if(!bWeb && !pPrtOpt)
365 : : {
366 [ + - ]: 63 : pPrtOpt = new SwPrintOptions(sal_False);
367 : : }
368 : :
369 [ + + ]: 1562 : return bWeb ? pWebPrtOpt : pPrtOpt;
370 : : }
371 : :
372 : 0 : SwChapterNumRules* SwModule::GetChapterNumRules()
373 : : {
374 [ # # ]: 0 : if(!pChapterNumRules)
375 [ # # ]: 0 : pChapterNumRules = new SwChapterNumRules;
376 : 0 : return pChapterNumRules;
377 : : }
378 : :
379 : 2 : void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/)
380 : : {
381 [ + - ][ + - ]: 2 : Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
382 [ + - ]: 2 : Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
383 : :
384 [ + - ][ + - ]: 2 : uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame("_beamer", FrameSearchFlag::CHILDREN);
385 [ + - ]: 2 : if (xBeamerFrame.is())
386 : : { // the beamer has been opened by the SfxViewFrame
387 [ + - ][ + - ]: 2 : Reference<XController> xController = xBeamerFrame->getController();
388 [ + - ]: 2 : Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
389 [ + - ]: 2 : if (xControllerSelection.is())
390 : : {
391 : :
392 [ + - ]: 2 : ODataAccessDescriptor aSelection;
393 [ + - ]: 2 : aSelection.setDataSource(rData.sDataSource);
394 [ + - ][ + - ]: 2 : aSelection[daCommand] <<= rData.sCommand;
395 [ + - ][ + - ]: 2 : aSelection[daCommandType] <<= rData.nCommandType;
396 [ + - ][ + - ]: 2 : xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
[ + - ][ + - ]
[ + - ][ + - ]
397 : : }
398 : : else {
399 : : OSL_FAIL("no selection supplier in the beamer!");
400 : 2 : }
401 : 2 : }
402 : 2 : }
403 : :
404 : 3652 : sal_uInt16 SwModule::GetRedlineAuthor()
405 : : {
406 [ + + ]: 3652 : if (!bAuthorInitialised)
407 : : {
408 : 67 : const SvtUserOptions& rOpt = GetUserOptions();
409 [ + - ][ + - ]: 67 : if( !(sActAuthor = rOpt.GetFullName()).Len() )
410 [ + - ][ + - ]: 67 : if( !(sActAuthor = rOpt.GetID()).Len() )
411 [ + - ][ + - ]: 67 : sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
[ + - ]
412 : 67 : bAuthorInitialised = sal_True;
413 : : }
414 : 3652 : return InsertRedlineAuthor( sActAuthor );
415 : : }
416 : :
417 : 8362 : void SwModule::SetRedlineAuthor(const String &rAuthor)
418 : : {
419 : 8362 : bAuthorInitialised = sal_True;
420 : 8362 : sActAuthor = rAuthor;
421 : 8362 : InsertRedlineAuthor( sActAuthor );
422 : 8362 : }
423 : :
424 : 1566 : const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
425 : : {
426 : : OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
427 [ - + ]: 1566 : while(!(nPos < pAuthorNames->size()))
428 : : {
429 [ # # ][ # # ]: 0 : InsertRedlineAuthor(String("nn"));
[ # # ]
430 : : };
431 : 1566 : return (*pAuthorNames)[nPos];
432 : : }
433 : :
434 : 62024 : sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
435 : : {
436 : 62024 : sal_uInt16 nPos = 0;
437 : :
438 [ + + ][ + + ]: 144439 : while(nPos < pAuthorNames->size() && (*pAuthorNames)[nPos] != rAuthor)
[ + + ]
439 : 82415 : ++nPos;
440 : :
441 [ + + ]: 62024 : if (nPos == pAuthorNames->size())
442 : 157 : pAuthorNames->push_back(rAuthor);
443 : :
444 : 62024 : return nPos;
445 : : }
446 : :
447 : 0 : void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
448 : : const AuthorCharAttr &rAttr )
449 : : {
450 : 0 : Color aCol( rAttr.nColor );
451 : :
452 [ # # ]: 0 : if( COL_TRANSPARENT == rAttr.nColor )
453 : : {
454 : : static const ColorData aColArr[] = {
455 : : COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
456 : : COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
457 : : COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
458 : :
459 : : aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
460 : 0 : sizeof( aColArr[0] )) ] );
461 : : }
462 : :
463 : 0 : sal_Bool bBackGr = COL_NONE == rAttr.nColor;
464 : :
465 [ # # # # : 0 : switch (rAttr.nItemId)
# # # ]
466 : : {
467 : : case SID_ATTR_CHAR_WEIGHT:
468 : : {
469 [ # # ]: 0 : SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
470 [ # # ]: 0 : rSet.Put( aW );
471 : 0 : aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
472 [ # # ]: 0 : rSet.Put( aW );
473 : 0 : aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
474 [ # # ][ # # ]: 0 : rSet.Put( aW );
475 : : }
476 : 0 : break;
477 : :
478 : : case SID_ATTR_CHAR_POSTURE:
479 : : {
480 [ # # ]: 0 : SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
481 [ # # ]: 0 : rSet.Put( aP );
482 : 0 : aP.SetWhich( RES_CHRATR_CJK_POSTURE );
483 [ # # ]: 0 : rSet.Put( aP );
484 : 0 : aP.SetWhich( RES_CHRATR_CTL_POSTURE );
485 [ # # ][ # # ]: 0 : rSet.Put( aP );
486 : : }
487 : 0 : break;
488 : :
489 : : case SID_ATTR_CHAR_UNDERLINE:
490 : : rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
491 [ # # ][ # # ]: 0 : RES_CHRATR_UNDERLINE));
[ # # ]
492 : 0 : break;
493 : :
494 : : case SID_ATTR_CHAR_STRIKEOUT:
495 : : rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
496 [ # # ][ # # ]: 0 : RES_CHRATR_CROSSEDOUT));
[ # # ]
497 : 0 : break;
498 : :
499 : : case SID_ATTR_CHAR_CASEMAP:
500 : : rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
501 [ # # ][ # # ]: 0 : RES_CHRATR_CASEMAP));
[ # # ]
502 : 0 : break;
503 : :
504 : : case SID_ATTR_BRUSH:
505 [ # # ][ # # ]: 0 : rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
[ # # ]
506 : 0 : bBackGr = sal_True;
507 : 0 : break;
508 : : }
509 : :
510 [ # # ]: 0 : if( !bBackGr )
511 [ # # ][ # # ]: 0 : rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
[ # # ]
512 : 0 : }
513 : :
514 : 0 : void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
515 : : {
516 : 0 : lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
517 : 0 : }
518 : :
519 : 0 : void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
520 : : {
521 : 0 : lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
522 : 0 : }
523 : :
524 : : /*--------------------------------------------------------------------
525 : : Description: For future extension:
526 : : --------------------------------------------------------------------*/
527 : :
528 : 0 : void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
529 : : {
530 : 0 : lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
531 : 0 : }
532 : :
533 : 87398 : sal_uInt16 SwModule::GetRedlineMarkPos()
534 : : {
535 : 87398 : return pModuleConfig->GetMarkAlignMode();
536 : : }
537 : :
538 : 0 : sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
539 : : {
540 : 0 : return pModuleConfig->IsInsTblFormatNum(bHTML);
541 : : }
542 : :
543 : 0 : sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
544 : : {
545 : 0 : return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
546 : : }
547 : :
548 : 154 : sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
549 : : {
550 : 154 : return pModuleConfig->IsInsTblAlignNum(bHTML);
551 : : }
552 : :
553 : 0 : const Color &SwModule::GetRedlineMarkColor()
554 : : {
555 : 0 : return pModuleConfig->GetMarkAlignColor();
556 : : }
557 : :
558 : 6641 : const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
559 : : {
560 : 6641 : return GetUsrPref( bWeb );
561 : : }
562 : :
563 : 24 : const String& SwModule::GetDocStatWordDelim() const
564 : : {
565 : 24 : return pModuleConfig->GetWordDelimiter();
566 : : }
567 : :
568 : : // Passing-through of the ModuleConfig's Metric (for HTML-Export)
569 : 82 : sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
570 : : {
571 : : SwMasterUsrPref* pPref;
572 [ + + ]: 82 : if(bWeb)
573 : : {
574 [ - + ]: 2 : if(!pWebUsrPref)
575 : 0 : GetUsrPref(sal_True);
576 : 2 : pPref = pWebUsrPref;
577 : : }
578 : : else
579 : : {
580 [ - + ]: 80 : if(!pUsrPref)
581 : 0 : GetUsrPref(sal_False);
582 : 80 : pPref = pUsrPref;
583 : : }
584 : 82 : return static_cast< sal_uInt16 >(pPref->GetMetric());
585 : : }
586 : :
587 : : // Pass-through Update-Stati
588 : 610 : sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
589 : : {
590 [ - + ]: 610 : if(!pUsrPref)
591 : 0 : GetUsrPref(sal_False);
592 : 610 : return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
593 : : }
594 : :
595 : 3996 : SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
596 : : {
597 [ + + ]: 3996 : if(!pUsrPref)
598 : 14 : GetUsrPref(sal_False);
599 : 3996 : return pUsrPref->GetFldUpdateFlags();
600 : : }
601 : :
602 : 0 : void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
603 : : {
604 [ # # ]: 0 : if(!pUsrPref)
605 : 0 : GetUsrPref(sal_False);
606 : 0 : pUsrPref->SetFldUpdateFlags(eFldFlags);
607 : 0 : }
608 : :
609 : 0 : void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
610 : : {
611 [ # # ]: 0 : if(!pUsrPref)
612 : 0 : GetUsrPref(sal_False);
613 : 0 : pUsrPref->SetUpdateLinkMode(nNewLinkMode);
614 : 0 : }
615 : :
616 : 8 : void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
617 : : sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
618 : : {
619 [ + - ][ - + ]: 8 : sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
620 [ + - ][ + - ]: 8 : sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
621 [ + - ][ + - ]: 8 : if( bOnlineSpelling || bInvalid )
622 : : {
623 [ + - ]: 8 : TypeId aType = TYPE(SwDocShell);
624 [ + - ][ + - ]: 16 : for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
[ + + ]
625 : : pDocSh;
626 : 8 : pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
627 : : {
628 : 8 : SwDoc* pTmp = pDocSh->GetDoc();
629 [ + - ][ + - ]: 8 : if ( pTmp->GetCurrentViewShell() ) //swmod 071108//swmod 071225
630 : : {
631 [ + - ]: 8 : pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
632 : 8 : ViewShell* pViewShell = 0;
633 [ + - ]: 8 : pTmp->GetEditShell( &pViewShell );
634 [ + - ][ + - ]: 8 : if ( bSmartTags && pViewShell && pViewShell->GetWin() )
[ + - ][ + - ]
635 [ + - ]: 8 : pViewShell->GetWin()->Invalidate();
636 : : }
637 : : }
638 : : }
639 : 8 : }
640 : :
641 : 0 : void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
642 : : {
643 [ # # ]: 0 : if(!pUsrPref)
644 : 0 : GetUsrPref(sal_False);
645 : 0 : pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
646 : 0 : }
647 : :
648 : 0 : SvxCompareMode SwModule::GetCompareMode() const
649 : : {
650 : 0 : return pModuleConfig->GetCompareMode();
651 : : }
652 : :
653 : 0 : sal_Bool SwModule::IsUseRsid() const
654 : : {
655 : 0 : return pModuleConfig->IsUseRsid();
656 : : }
657 : :
658 : 0 : sal_Bool SwModule::IsIgnorePieces() const
659 : : {
660 : 0 : return pModuleConfig->IsIgnorePieces();
661 : : }
662 : :
663 : 0 : sal_uInt16 SwModule::GetPieceLen() const
664 : : {
665 : 0 : return pModuleConfig->GetPieceLen();
666 : : }
667 : :
668 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|