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
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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 #include <hintids.hxx>
29cdf0e10cSrcweir #include <sfx2/request.hxx>
30cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
31cdf0e10cSrcweir #include <sfx2/childwin.hxx>
32cdf0e10cSrcweir #include <unotools/useroptions.hxx>
33cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
34cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
35cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
36cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
37cdf0e10cSrcweir #include <svx/dataaccessdescriptor.hxx>
38cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
39cdf0e10cSrcweir #include <editeng/postitem.hxx>
40cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
41cdf0e10cSrcweir #include <editeng/crsditem.hxx>
42cdf0e10cSrcweir #include <editeng/cmapitem.hxx>
43cdf0e10cSrcweir #include <editeng/colritem.hxx>
44cdf0e10cSrcweir #include <editeng/brshitem.hxx>
45cdf0e10cSrcweir #include <vcl/msgbox.hxx>
46cdf0e10cSrcweir #include <swmodule.hxx>
47cdf0e10cSrcweir #include <swtypes.hxx>
48cdf0e10cSrcweir #include <usrpref.hxx>
49cdf0e10cSrcweir #include <modcfg.hxx>
50cdf0e10cSrcweir #include <view.hxx>
51cdf0e10cSrcweir #include <pview.hxx>
52cdf0e10cSrcweir #include <wview.hxx>
53cdf0e10cSrcweir #include <wrtsh.hxx>
54cdf0e10cSrcweir #include <docsh.hxx>
55cdf0e10cSrcweir #include <dbmgr.hxx>
56cdf0e10cSrcweir #include <uinums.hxx>
57cdf0e10cSrcweir #include <prtopt.hxx> // fuer PrintOptions
58cdf0e10cSrcweir #include <navicfg.hxx>
59cdf0e10cSrcweir #include <doc.hxx>
60cdf0e10cSrcweir #include <cmdid.h>
61cdf0e10cSrcweir #include <app.hrc>
62cdf0e10cSrcweir #include "helpid.h"
63cdf0e10cSrcweir
64cdf0e10cSrcweir #include <unomid.h>
65cdf0e10cSrcweir #include <tools/color.hxx>
66cdf0e10cSrcweir #include "PostItMgr.hxx"
67cdf0e10cSrcweir
68cdf0e10cSrcweir using ::rtl::OUString;
69cdf0e10cSrcweir using namespace ::svx;
70cdf0e10cSrcweir using namespace ::com::sun::star;
71cdf0e10cSrcweir using namespace ::com::sun::star::uno;
72cdf0e10cSrcweir using namespace ::com::sun::star::beans;
73cdf0e10cSrcweir using namespace ::com::sun::star::frame;
74cdf0e10cSrcweir using namespace ::com::sun::star::view;
75cdf0e10cSrcweir using namespace ::com::sun::star::lang;
76cdf0e10cSrcweir
77cdf0e10cSrcweir
78cdf0e10cSrcweir /*-----------------08/28/97 08:41pm-----------------
79cdf0e10cSrcweir
80cdf0e10cSrcweir --------------------------------------------------*/
lcl_SetUIPrefs(const SwViewOption * pPref,SwView * pView,ViewShell * pSh)81cdf0e10cSrcweir void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh )
82cdf0e10cSrcweir {
83cdf0e10cSrcweir // in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen
84cdf0e10cSrcweir sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
85cdf0e10cSrcweir sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
86cdf0e10cSrcweir sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
87cdf0e10cSrcweir
88cdf0e10cSrcweir pSh->SetUIOptions(*pPref);
89cdf0e10cSrcweir const SwViewOption* pNewPref = pSh->GetViewOptions();
90cdf0e10cSrcweir
91cdf0e10cSrcweir // Scrollbars an / aus
92cdf0e10cSrcweir if(bVScrollChanged)
93cdf0e10cSrcweir {
94cdf0e10cSrcweir pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
95cdf0e10cSrcweir }
96cdf0e10cSrcweir if(bHScrollChanged)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pNewPref->getBrowseMode() );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir //if only the position of the vertical ruler has been changed initiate an update
101cdf0e10cSrcweir if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
102cdf0e10cSrcweir pView->InvalidateBorder();
103cdf0e10cSrcweir
104cdf0e10cSrcweir // Lineale an / aus
105cdf0e10cSrcweir if(pNewPref->IsViewVRuler())
106cdf0e10cSrcweir pView->CreateVLineal();
107cdf0e10cSrcweir else
108cdf0e10cSrcweir pView->KillVLineal();
109cdf0e10cSrcweir
110cdf0e10cSrcweir // TabWindow an/aus
111cdf0e10cSrcweir if(pNewPref->IsViewHRuler())
112cdf0e10cSrcweir pView->CreateTab();
113cdf0e10cSrcweir else
114cdf0e10cSrcweir pView->KillTab();
115cdf0e10cSrcweir
116cdf0e10cSrcweir pView->GetPostItMgr()->PrepareView(true);
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
119cdf0e10cSrcweir /*--------------------------------------------------------------------
120cdf0e10cSrcweir Beschreibung: Aktuelle SwWrtShell
121cdf0e10cSrcweir --------------------------------------------------------------------*/
122cdf0e10cSrcweir
123cdf0e10cSrcweir
GetActiveWrtShell()124cdf0e10cSrcweir SwWrtShell* GetActiveWrtShell()
125cdf0e10cSrcweir {
126cdf0e10cSrcweir SwView *pActive = ::GetActiveView();
127cdf0e10cSrcweir if( pActive )
128cdf0e10cSrcweir return &pActive->GetWrtShell();
129cdf0e10cSrcweir return 0;
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir /*--------------------------------------------------------------------
133cdf0e10cSrcweir Beschreibung: Pointer auf die aktuelle Sicht
134cdf0e10cSrcweir --------------------------------------------------------------------*/
135cdf0e10cSrcweir
136cdf0e10cSrcweir
GetActiveView()137cdf0e10cSrcweir SwView* GetActiveView()
138cdf0e10cSrcweir {
139cdf0e10cSrcweir SfxViewShell* pView = SfxViewShell::Current();
140cdf0e10cSrcweir return PTR_CAST( SwView, pView );
141cdf0e10cSrcweir }
142cdf0e10cSrcweir /*--------------------------------------------------------------------
143cdf0e10cSrcweir Beschreibung: Ueber Views iterieren - static
144cdf0e10cSrcweir --------------------------------------------------------------------*/
145cdf0e10cSrcweir
GetFirstView()146cdf0e10cSrcweir SwView* SwModule::GetFirstView()
147cdf0e10cSrcweir {
148cdf0e10cSrcweir // liefert nur sichtbare SwViews
149cdf0e10cSrcweir const TypeId aTypeId = TYPE(SwView);
150cdf0e10cSrcweir SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
151cdf0e10cSrcweir return pView;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir
GetNextView(SwView * pView)155cdf0e10cSrcweir SwView* SwModule::GetNextView(SwView* pView)
156cdf0e10cSrcweir {
157cdf0e10cSrcweir DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben");
158cdf0e10cSrcweir const TypeId aTypeId = TYPE(SwView);
159cdf0e10cSrcweir SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, sal_True);
160cdf0e10cSrcweir return pNView;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir /*------------------------------------------------------------------------
164cdf0e10cSrcweir Beschreibung: Neuer Master fuer die Einstellungen wird gesetzt;
165cdf0e10cSrcweir dieser wirkt sich auf die aktuelle Sicht und alle
166cdf0e10cSrcweir folgenden aus.
167cdf0e10cSrcweir ------------------------------------------------------------------------*/
168cdf0e10cSrcweir
ApplyUsrPref(const SwViewOption & rUsrPref,SwView * pActView,sal_uInt16 nDest)169cdf0e10cSrcweir void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
170cdf0e10cSrcweir sal_uInt16 nDest )
171cdf0e10cSrcweir {
172cdf0e10cSrcweir SwView* pCurrView = pActView;
173cdf0e10cSrcweir ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
174cdf0e10cSrcweir
175cdf0e10cSrcweir SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
176cdf0e10cSrcweir VIEWOPT_DEST_WEB == nDest ? sal_True :
177cdf0e10cSrcweir VIEWOPT_DEST_TEXT== nDest ? sal_False :
178cdf0e10cSrcweir pCurrView && pCurrView->ISA(SwWebView) ));
179cdf0e10cSrcweir
180cdf0e10cSrcweir //per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden
181cdf0e10cSrcweir sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
182cdf0e10cSrcweir //PreView abfruehstuecken
183cdf0e10cSrcweir SwPagePreView* pPPView;
184cdf0e10cSrcweir if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir if(!bViewOnly)
187cdf0e10cSrcweir pPref->SetUIOptions( rUsrPref );
188cdf0e10cSrcweir pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
189cdf0e10cSrcweir pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
190cdf0e10cSrcweir if(!bViewOnly)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
193cdf0e10cSrcweir pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
194cdf0e10cSrcweir }
195cdf0e10cSrcweir return;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
198cdf0e10cSrcweir if(!bViewOnly)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir pPref->SetUsrPref( rUsrPref );
201cdf0e10cSrcweir pPref->SetModified();
202cdf0e10cSrcweir }
203cdf0e10cSrcweir
204cdf0e10cSrcweir if( !pCurrView )
205cdf0e10cSrcweir return;
206cdf0e10cSrcweir
207cdf0e10cSrcweir // Weitergabe an die CORE
208cdf0e10cSrcweir sal_Bool bReadonly;
209cdf0e10cSrcweir const SwDocShell* pDocSh = pCurrView->GetDocShell();
210cdf0e10cSrcweir if (pDocSh)
211cdf0e10cSrcweir bReadonly = pDocSh->IsReadOnly();
212cdf0e10cSrcweir else //Use existing option if DocShell missing
213cdf0e10cSrcweir bReadonly = pSh->GetViewOptions()->IsReadonly();
214cdf0e10cSrcweir SwViewOption* pViewOpt;
215cdf0e10cSrcweir if(!bViewOnly)
216cdf0e10cSrcweir pViewOpt = new SwViewOption( *pPref );
217cdf0e10cSrcweir else
218cdf0e10cSrcweir pViewOpt = new SwViewOption( rUsrPref );
219cdf0e10cSrcweir pViewOpt->SetReadonly( bReadonly );
220cdf0e10cSrcweir if( !(*pSh->GetViewOptions() == *pViewOpt) )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir //Ist evtl. nur eine ViewShell
223cdf0e10cSrcweir pSh->StartAction();
224cdf0e10cSrcweir pSh->ApplyViewOptions( *pViewOpt );
225cdf0e10cSrcweir ((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea());
226cdf0e10cSrcweir pSh->EndAction();
227cdf0e10cSrcweir }
228cdf0e10cSrcweir if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
229cdf0e10cSrcweir pSh->SetReadonlyOption(bReadonly);
230cdf0e10cSrcweir
231cdf0e10cSrcweir lcl_SetUIPrefs(pViewOpt, pCurrView, pSh);
232cdf0e10cSrcweir
233cdf0e10cSrcweir // zum Schluss wird das Idle-Flag wieder gesetzt
234cdf0e10cSrcweir // #42510#
235cdf0e10cSrcweir pPref->SetIdle(sal_True);
236*46d82201SHerbert Dürr
237*46d82201SHerbert Dürr delete pViewOpt;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir /* -----------------------------28.09.00 12:36--------------------------------
240cdf0e10cSrcweir
241cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ApplyUserMetric(FieldUnit eMetric,sal_Bool bWeb)242cdf0e10cSrcweir void SwModule::ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir SwMasterUsrPref* pPref;
245cdf0e10cSrcweir if(bWeb)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir if(!pWebUsrPref)
248cdf0e10cSrcweir GetUsrPref(sal_True);
249cdf0e10cSrcweir pPref = pWebUsrPref;
250cdf0e10cSrcweir }
251cdf0e10cSrcweir else
252cdf0e10cSrcweir {
253cdf0e10cSrcweir if(!pUsrPref)
254cdf0e10cSrcweir GetUsrPref(sal_False);
255cdf0e10cSrcweir pPref = pUsrPref;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir FieldUnit eOldMetric = pPref->GetMetric();
258cdf0e10cSrcweir if(eOldMetric != eMetric)
259cdf0e10cSrcweir pPref->SetMetric(eMetric);
260cdf0e10cSrcweir
261cdf0e10cSrcweir FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
262cdf0e10cSrcweir FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
263cdf0e10cSrcweir
264cdf0e10cSrcweir SwView* pTmpView = SwModule::GetFirstView();
265cdf0e10cSrcweir // fuer alle MDI-Fenster das Lineal umschalten
266cdf0e10cSrcweir while(pTmpView)
267cdf0e10cSrcweir {
268cdf0e10cSrcweir if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
269cdf0e10cSrcweir {
270cdf0e10cSrcweir pTmpView->ChangeVLinealMetric(eVScrollMetric);
271cdf0e10cSrcweir pTmpView->ChangeTabMetric(eHScrollMetric);
272cdf0e10cSrcweir }
273cdf0e10cSrcweir
274cdf0e10cSrcweir pTmpView = SwModule::GetNextView(pTmpView);
275cdf0e10cSrcweir }
276cdf0e10cSrcweir }
277cdf0e10cSrcweir /*-- 12.11.2008 14:47:58---------------------------------------------------
278cdf0e10cSrcweir
279cdf0e10cSrcweir -----------------------------------------------------------------------*/
ApplyRulerMetric(FieldUnit eMetric,sal_Bool bHorizontal,sal_Bool bWeb)280cdf0e10cSrcweir void SwModule::ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb )
281cdf0e10cSrcweir {
282cdf0e10cSrcweir SwMasterUsrPref* pPref;
283cdf0e10cSrcweir if(bWeb)
284cdf0e10cSrcweir {
285cdf0e10cSrcweir if(!pWebUsrPref)
286cdf0e10cSrcweir GetUsrPref(sal_True);
287cdf0e10cSrcweir pPref = pWebUsrPref;
288cdf0e10cSrcweir }
289cdf0e10cSrcweir else
290cdf0e10cSrcweir {
291cdf0e10cSrcweir if(!pUsrPref)
292cdf0e10cSrcweir GetUsrPref(sal_False);
293cdf0e10cSrcweir pPref = pUsrPref;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir if( bHorizontal )
296cdf0e10cSrcweir pPref->SetHScrollMetric(eMetric);
297cdf0e10cSrcweir else
298cdf0e10cSrcweir pPref->SetVScrollMetric(eMetric);
299cdf0e10cSrcweir
300cdf0e10cSrcweir SwView* pTmpView = SwModule::GetFirstView();
301cdf0e10cSrcweir // switch metric at the appropriate rulers
302cdf0e10cSrcweir while(pTmpView)
303cdf0e10cSrcweir {
304cdf0e10cSrcweir if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
305cdf0e10cSrcweir {
306cdf0e10cSrcweir if( bHorizontal )
307cdf0e10cSrcweir pTmpView->ChangeTabMetric(eMetric);
308cdf0e10cSrcweir else
309cdf0e10cSrcweir pTmpView->ChangeVLinealMetric(eMetric);
310cdf0e10cSrcweir }
311cdf0e10cSrcweir pTmpView = SwModule::GetNextView(pTmpView);
312cdf0e10cSrcweir }
313cdf0e10cSrcweir }
314cdf0e10cSrcweir /*-----------------13.11.96 11.57-------------------
315cdf0e10cSrcweir
316cdf0e10cSrcweir --------------------------------------------------*/
317cdf0e10cSrcweir
GetNavigationConfig()318cdf0e10cSrcweir SwNavigationConfig* SwModule::GetNavigationConfig()
319cdf0e10cSrcweir {
320cdf0e10cSrcweir if(!pNavigationConfig)
321cdf0e10cSrcweir {
322cdf0e10cSrcweir pNavigationConfig = new SwNavigationConfig;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir return pNavigationConfig;
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
327cdf0e10cSrcweir /*-----------------05.02.97 08.03-------------------
328cdf0e10cSrcweir
329cdf0e10cSrcweir --------------------------------------------------*/
330cdf0e10cSrcweir
GetPrtOptions(sal_Bool bWeb)331cdf0e10cSrcweir SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir if(bWeb && !pWebPrtOpt)
334cdf0e10cSrcweir {
335cdf0e10cSrcweir pWebPrtOpt = new SwPrintOptions(sal_True);
336cdf0e10cSrcweir }
337cdf0e10cSrcweir else if(!bWeb && !pPrtOpt)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir pPrtOpt = new SwPrintOptions(sal_False);
340cdf0e10cSrcweir }
341cdf0e10cSrcweir
342cdf0e10cSrcweir return bWeb ? pWebPrtOpt : pPrtOpt;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir
345cdf0e10cSrcweir /*-----------------26.06.97 07.52-------------------
346cdf0e10cSrcweir
347cdf0e10cSrcweir --------------------------------------------------*/
GetChapterNumRules()348cdf0e10cSrcweir SwChapterNumRules* SwModule::GetChapterNumRules()
349cdf0e10cSrcweir {
350cdf0e10cSrcweir if(!pChapterNumRules)
351cdf0e10cSrcweir pChapterNumRules = new SwChapterNumRules;
352cdf0e10cSrcweir return pChapterNumRules;
353cdf0e10cSrcweir }
354cdf0e10cSrcweir
355cdf0e10cSrcweir /*--------------------------------------------------------------------
356cdf0e10cSrcweir Beschreibung:
357cdf0e10cSrcweir --------------------------------------------------------------------*/
358cdf0e10cSrcweir
ShowDBObj(SwView & rView,const SwDBData & rData,sal_Bool)359cdf0e10cSrcweir void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, sal_Bool /*bOnlyIfAvailable*/)
360cdf0e10cSrcweir {
361cdf0e10cSrcweir Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
362cdf0e10cSrcweir Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
363cdf0e10cSrcweir
364cdf0e10cSrcweir uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
365cdf0e10cSrcweir rtl::OUString::createFromAscii("_beamer"),
366cdf0e10cSrcweir FrameSearchFlag::CHILDREN);
367cdf0e10cSrcweir if (xBeamerFrame.is())
368cdf0e10cSrcweir { // the beamer has been opened by the SfxViewFrame
369cdf0e10cSrcweir Reference<XController> xController = xBeamerFrame->getController();
370cdf0e10cSrcweir Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
371cdf0e10cSrcweir if (xControllerSelection.is())
372cdf0e10cSrcweir {
373cdf0e10cSrcweir
374cdf0e10cSrcweir ODataAccessDescriptor aSelection;
375cdf0e10cSrcweir aSelection.setDataSource(rData.sDataSource);
376cdf0e10cSrcweir aSelection[daCommand] <<= rData.sCommand;
377cdf0e10cSrcweir aSelection[daCommandType] <<= rData.nCommandType;
378cdf0e10cSrcweir xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
379cdf0e10cSrcweir }
380cdf0e10cSrcweir else {
381cdf0e10cSrcweir DBG_ERROR("no selection supplier in the beamer!");
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir }
385cdf0e10cSrcweir /*--------------------------------------------------------------------
386cdf0e10cSrcweir Beschreibung: Redlining
387cdf0e10cSrcweir --------------------------------------------------------------------*/
388cdf0e10cSrcweir
GetRedlineAuthor()389cdf0e10cSrcweir sal_uInt16 SwModule::GetRedlineAuthor()
390cdf0e10cSrcweir {
391cdf0e10cSrcweir if (!bAuthorInitialised)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir const SvtUserOptions& rOpt = GetUserOptions();
394cdf0e10cSrcweir if( !(sActAuthor = rOpt.GetFullName()).Len() )
395cdf0e10cSrcweir if( !(sActAuthor = rOpt.GetID()).Len() )
396cdf0e10cSrcweir sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
397cdf0e10cSrcweir bAuthorInitialised = sal_True;
398cdf0e10cSrcweir }
399cdf0e10cSrcweir return InsertRedlineAuthor( sActAuthor );
400cdf0e10cSrcweir }
401cdf0e10cSrcweir
402cdf0e10cSrcweir /*--------------------------------------------------------------------
403cdf0e10cSrcweir Beschreibung:
404cdf0e10cSrcweir --------------------------------------------------------------------*/
405cdf0e10cSrcweir
GetRedlineAuthor(sal_uInt16 nPos)406cdf0e10cSrcweir const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
407cdf0e10cSrcweir {
408cdf0e10cSrcweir DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
409cdf0e10cSrcweir while (!(nPos<pAuthorNames->Count()))
410cdf0e10cSrcweir {
411cdf0e10cSrcweir InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
412cdf0e10cSrcweir };
413cdf0e10cSrcweir return *pAuthorNames->GetObject(nPos);
414cdf0e10cSrcweir }
415cdf0e10cSrcweir
416cdf0e10cSrcweir /*--------------------------------------------------------------------
417cdf0e10cSrcweir Beschreibung:
418cdf0e10cSrcweir --------------------------------------------------------------------*/
419cdf0e10cSrcweir
InsertRedlineAuthor(const String & rAuthor)420cdf0e10cSrcweir sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
421cdf0e10cSrcweir {
422cdf0e10cSrcweir sal_uInt16 nPos = 0;
423cdf0e10cSrcweir
424cdf0e10cSrcweir while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
425cdf0e10cSrcweir nPos++;
426cdf0e10cSrcweir
427cdf0e10cSrcweir if (nPos == pAuthorNames->Count())
428cdf0e10cSrcweir pAuthorNames->Insert(new String(rAuthor), nPos);
429cdf0e10cSrcweir
430cdf0e10cSrcweir return nPos;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir
433cdf0e10cSrcweir /*--------------------------------------------------------------------
434cdf0e10cSrcweir Beschreibung:
435cdf0e10cSrcweir --------------------------------------------------------------------*/
436cdf0e10cSrcweir
lcl_FillAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet,const AuthorCharAttr & rAttr)437cdf0e10cSrcweir void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
438cdf0e10cSrcweir const AuthorCharAttr &rAttr )
439cdf0e10cSrcweir {
440cdf0e10cSrcweir Color aCol( rAttr.nColor );
441cdf0e10cSrcweir
442cdf0e10cSrcweir if( COL_TRANSPARENT == rAttr.nColor )
443cdf0e10cSrcweir {
444cdf0e10cSrcweir static const ColorData aColArr[] = {
445cdf0e10cSrcweir COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
446cdf0e10cSrcweir COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
447cdf0e10cSrcweir COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
448cdf0e10cSrcweir
449cdf0e10cSrcweir aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
450cdf0e10cSrcweir sizeof( aColArr[0] )) ] );
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
453cdf0e10cSrcweir sal_Bool bBackGr = COL_NONE == rAttr.nColor;
454cdf0e10cSrcweir
455cdf0e10cSrcweir switch (rAttr.nItemId)
456cdf0e10cSrcweir {
457cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT:
458cdf0e10cSrcweir {
459cdf0e10cSrcweir SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
460cdf0e10cSrcweir rSet.Put( aW );
461cdf0e10cSrcweir aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
462cdf0e10cSrcweir rSet.Put( aW );
463cdf0e10cSrcweir aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
464cdf0e10cSrcweir rSet.Put( aW );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir break;
467cdf0e10cSrcweir
468cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE:
469cdf0e10cSrcweir {
470cdf0e10cSrcweir SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
471cdf0e10cSrcweir rSet.Put( aP );
472cdf0e10cSrcweir aP.SetWhich( RES_CHRATR_CJK_POSTURE );
473cdf0e10cSrcweir rSet.Put( aP );
474cdf0e10cSrcweir aP.SetWhich( RES_CHRATR_CTL_POSTURE );
475cdf0e10cSrcweir rSet.Put( aP );
476cdf0e10cSrcweir }
477cdf0e10cSrcweir break;
478cdf0e10cSrcweir
479cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE:
480cdf0e10cSrcweir rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
481cdf0e10cSrcweir RES_CHRATR_UNDERLINE));
482cdf0e10cSrcweir break;
483cdf0e10cSrcweir
484cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT:
485cdf0e10cSrcweir rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
486cdf0e10cSrcweir RES_CHRATR_CROSSEDOUT));
487cdf0e10cSrcweir break;
488cdf0e10cSrcweir
489cdf0e10cSrcweir case SID_ATTR_CHAR_CASEMAP:
490cdf0e10cSrcweir rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
491cdf0e10cSrcweir RES_CHRATR_CASEMAP));
492cdf0e10cSrcweir break;
493cdf0e10cSrcweir
494cdf0e10cSrcweir case SID_ATTR_BRUSH:
495cdf0e10cSrcweir rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
496cdf0e10cSrcweir bBackGr = sal_True;
497cdf0e10cSrcweir break;
498cdf0e10cSrcweir }
499cdf0e10cSrcweir
500cdf0e10cSrcweir if( !bBackGr )
501cdf0e10cSrcweir rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
502cdf0e10cSrcweir }
503cdf0e10cSrcweir
504cdf0e10cSrcweir /*--------------------------------------------------------------------
505cdf0e10cSrcweir Beschreibung:
506cdf0e10cSrcweir --------------------------------------------------------------------*/
507cdf0e10cSrcweir
GetInsertAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)508cdf0e10cSrcweir void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
511cdf0e10cSrcweir }
512cdf0e10cSrcweir
513cdf0e10cSrcweir /*--------------------------------------------------------------------
514cdf0e10cSrcweir Beschreibung:
515cdf0e10cSrcweir --------------------------------------------------------------------*/
516cdf0e10cSrcweir
GetDeletedAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)517cdf0e10cSrcweir void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
518cdf0e10cSrcweir {
519cdf0e10cSrcweir lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
520cdf0e10cSrcweir }
521cdf0e10cSrcweir
522cdf0e10cSrcweir /*--------------------------------------------------------------------
523cdf0e10cSrcweir Beschreibung: Fuer zukuenftige Erweiterung:
524cdf0e10cSrcweir --------------------------------------------------------------------*/
525cdf0e10cSrcweir
GetFormatAuthorAttr(sal_uInt16 nAuthor,SfxItemSet & rSet)526cdf0e10cSrcweir void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
527cdf0e10cSrcweir {
528cdf0e10cSrcweir lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
529cdf0e10cSrcweir }
530cdf0e10cSrcweir
531cdf0e10cSrcweir /*--------------------------------------------------------------------
532cdf0e10cSrcweir Beschreibung:
533cdf0e10cSrcweir --------------------------------------------------------------------*/
534cdf0e10cSrcweir
GetRedlineMarkPos()535cdf0e10cSrcweir sal_uInt16 SwModule::GetRedlineMarkPos()
536cdf0e10cSrcweir {
537cdf0e10cSrcweir return pModuleConfig->GetMarkAlignMode();
538cdf0e10cSrcweir }
539cdf0e10cSrcweir
540cdf0e10cSrcweir /*--------------------------------------------------------------------
541cdf0e10cSrcweir Beschreibung:
542cdf0e10cSrcweir --------------------------------------------------------------------*/
543cdf0e10cSrcweir
IsInsTblFormatNum(sal_Bool bHTML) const544cdf0e10cSrcweir sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
545cdf0e10cSrcweir {
546cdf0e10cSrcweir return pModuleConfig->IsInsTblFormatNum(bHTML);
547cdf0e10cSrcweir }
548cdf0e10cSrcweir
IsInsTblChangeNumFormat(sal_Bool bHTML) const549cdf0e10cSrcweir sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
550cdf0e10cSrcweir {
551cdf0e10cSrcweir return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
552cdf0e10cSrcweir }
553cdf0e10cSrcweir
554cdf0e10cSrcweir /*--------------------------------------------------------------------
555cdf0e10cSrcweir Beschreibung:
556cdf0e10cSrcweir --------------------------------------------------------------------*/
557cdf0e10cSrcweir
IsInsTblAlignNum(sal_Bool bHTML) const558cdf0e10cSrcweir sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
559cdf0e10cSrcweir {
560cdf0e10cSrcweir return pModuleConfig->IsInsTblAlignNum(bHTML);
561cdf0e10cSrcweir }
562cdf0e10cSrcweir
563cdf0e10cSrcweir /*--------------------------------------------------------------------
564cdf0e10cSrcweir Beschreibung:
565cdf0e10cSrcweir --------------------------------------------------------------------*/
566cdf0e10cSrcweir
GetRedlineMarkColor()567cdf0e10cSrcweir const Color &SwModule::GetRedlineMarkColor()
568cdf0e10cSrcweir {
569cdf0e10cSrcweir return pModuleConfig->GetMarkAlignColor();
570cdf0e10cSrcweir }
571cdf0e10cSrcweir
572cdf0e10cSrcweir /*-----------------03.03.98 16:47-------------------
573cdf0e10cSrcweir
574cdf0e10cSrcweir --------------------------------------------------*/
GetViewOption(sal_Bool bWeb)575cdf0e10cSrcweir const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
576cdf0e10cSrcweir {
577cdf0e10cSrcweir return GetUsrPref( bWeb );
578cdf0e10cSrcweir }
579cdf0e10cSrcweir
580cdf0e10cSrcweir // returne den definierten DocStat - WordDelimiter
GetDocStatWordDelim() const581cdf0e10cSrcweir const String& SwModule::GetDocStatWordDelim() const
582cdf0e10cSrcweir {
583cdf0e10cSrcweir return pModuleConfig->GetWordDelimiter();
584cdf0e10cSrcweir }
585cdf0e10cSrcweir /* ---------------------------------------------------------------------------
586cdf0e10cSrcweir
587cdf0e10cSrcweir ---------------------------------------------------------------------------*/
588cdf0e10cSrcweir // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
GetMetric(sal_Bool bWeb) const589cdf0e10cSrcweir sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
590cdf0e10cSrcweir {
591cdf0e10cSrcweir SwMasterUsrPref* pPref;
592cdf0e10cSrcweir if(bWeb)
593cdf0e10cSrcweir {
594cdf0e10cSrcweir if(!pWebUsrPref)
595cdf0e10cSrcweir GetUsrPref(sal_True);
596cdf0e10cSrcweir pPref = pWebUsrPref;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir else
599cdf0e10cSrcweir {
600cdf0e10cSrcweir if(!pUsrPref)
601cdf0e10cSrcweir GetUsrPref(sal_False);
602cdf0e10cSrcweir pPref = pUsrPref;
603cdf0e10cSrcweir }
604cdf0e10cSrcweir return static_cast< sal_uInt16 >(pPref->GetMetric());
605cdf0e10cSrcweir }
606cdf0e10cSrcweir /* ---------------------------------------------------------------------------
607cdf0e10cSrcweir
608cdf0e10cSrcweir ---------------------------------------------------------------------------*/
609cdf0e10cSrcweir // Update-Stati durchreichen
GetLinkUpdMode(sal_Bool) const610cdf0e10cSrcweir sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
611cdf0e10cSrcweir {
612cdf0e10cSrcweir if(!pUsrPref)
613cdf0e10cSrcweir GetUsrPref(sal_False);
614cdf0e10cSrcweir return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
615cdf0e10cSrcweir }
616cdf0e10cSrcweir /* ---------------------------------------------------------------------------
617cdf0e10cSrcweir
618cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetFldUpdateFlags(sal_Bool) const619cdf0e10cSrcweir SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
620cdf0e10cSrcweir {
621cdf0e10cSrcweir if(!pUsrPref)
622cdf0e10cSrcweir GetUsrPref(sal_False);
623cdf0e10cSrcweir return pUsrPref->GetFldUpdateFlags();
624cdf0e10cSrcweir }
625cdf0e10cSrcweir /* -----------------------------28.09.00 14:18--------------------------------
626cdf0e10cSrcweir
627cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)628cdf0e10cSrcweir void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
629cdf0e10cSrcweir {
630cdf0e10cSrcweir if(!pUsrPref)
631cdf0e10cSrcweir GetUsrPref(sal_False);
632cdf0e10cSrcweir pUsrPref->SetFldUpdateFlags(eFldFlags);
633cdf0e10cSrcweir }
634cdf0e10cSrcweir /* -----------------------------28.09.00 14:18--------------------------------
635cdf0e10cSrcweir
636cdf0e10cSrcweir ---------------------------------------------------------------------------*/
ApplyLinkMode(sal_Int32 nNewLinkMode)637cdf0e10cSrcweir void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
638cdf0e10cSrcweir {
639cdf0e10cSrcweir if(!pUsrPref)
640cdf0e10cSrcweir GetUsrPref(sal_False);
641cdf0e10cSrcweir pUsrPref->SetUpdateLinkMode(nNewLinkMode);
642cdf0e10cSrcweir }
643cdf0e10cSrcweir /* ---------------------------------------------------------------------------
644cdf0e10cSrcweir
645cdf0e10cSrcweir ---------------------------------------------------------------------------*/
CheckSpellChanges(sal_Bool bOnlineSpelling,sal_Bool bIsSpellWrongAgain,sal_Bool bIsSpellAllAgain,sal_Bool bSmartTags)646cdf0e10cSrcweir void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
647cdf0e10cSrcweir sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
648cdf0e10cSrcweir {
649cdf0e10cSrcweir sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
650cdf0e10cSrcweir sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
651cdf0e10cSrcweir if( bOnlineSpelling || bInvalid )
652cdf0e10cSrcweir {
653cdf0e10cSrcweir TypeId aType = TYPE(SwDocShell);
654cdf0e10cSrcweir for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
655cdf0e10cSrcweir pDocSh;
656cdf0e10cSrcweir pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
657cdf0e10cSrcweir {
658cdf0e10cSrcweir SwDoc* pTmp = pDocSh->GetDoc();
659cdf0e10cSrcweir if ( pTmp->GetCurrentViewShell() ) //swmod 071108//swmod 071225
660cdf0e10cSrcweir {
661cdf0e10cSrcweir pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
662cdf0e10cSrcweir ViewShell* pViewShell = 0;
663cdf0e10cSrcweir pTmp->GetEditShell( &pViewShell );
664cdf0e10cSrcweir if ( bSmartTags && pViewShell && pViewShell->GetWin() )
665cdf0e10cSrcweir pViewShell->GetWin()->Invalidate();
666cdf0e10cSrcweir }
667cdf0e10cSrcweir }
668cdf0e10cSrcweir // pSpell->SetSpellWrongAgain( sal_False );
669cdf0e10cSrcweir // pSpell->SetSpellAllAgain( sal_False );
670cdf0e10cSrcweir }
671cdf0e10cSrcweir }
672cdf0e10cSrcweir
ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)673cdf0e10cSrcweir void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
674cdf0e10cSrcweir {
675cdf0e10cSrcweir if(!pUsrPref)
676cdf0e10cSrcweir GetUsrPref(sal_False);
677cdf0e10cSrcweir pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
678cdf0e10cSrcweir }
679