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