xref: /trunk/main/sw/source/ui/utlui/uitool.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
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 
30cdf0e10cSrcweir #include <tools/datetime.hxx>
31cdf0e10cSrcweir #include <vcl/svapp.hxx>
32cdf0e10cSrcweir #include <unotools/collatorwrapper.hxx>
33cdf0e10cSrcweir #include <svl/urihelper.hxx>
34cdf0e10cSrcweir #include <svl/stritem.hxx>
35cdf0e10cSrcweir #include <unotools/syslocale.hxx>
36cdf0e10cSrcweir #include <sfx2/app.hxx>
37cdf0e10cSrcweir #include <sfx2/docfile.hxx>
38cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
39cdf0e10cSrcweir #include <editeng/pmdlitem.hxx>
40cdf0e10cSrcweir #ifndef _SVX_TSTPITEM_HXX //autogen
41cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
42cdf0e10cSrcweir #endif
43cdf0e10cSrcweir #include <editeng/boxitem.hxx>
44cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
45cdf0e10cSrcweir #include <svx/pageitem.hxx>
46cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
47cdf0e10cSrcweir #include <svl/style.hxx>
48cdf0e10cSrcweir #ifndef _VCL_LSTBOX_HXX //autogen
49cdf0e10cSrcweir #include <vcl/lstbox.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
52cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
53cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
54cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
55cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
56cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
57cdf0e10cSrcweir #include <fmtornt.hxx>
58cdf0e10cSrcweir #include <tabcol.hxx>
59cdf0e10cSrcweir #include <edtwin.hxx>
60cdf0e10cSrcweir #include <fmtfsize.hxx>
61cdf0e10cSrcweir #include <fmthdft.hxx>
62cdf0e10cSrcweir #include <fmtpdsc.hxx>
63cdf0e10cSrcweir #include <wview.hxx>
64cdf0e10cSrcweir #include <uiitems.hxx>
65cdf0e10cSrcweir #ifndef _DOCSH_HXX
66cdf0e10cSrcweir #include <docsh.hxx>
67cdf0e10cSrcweir #endif
68cdf0e10cSrcweir #include <wrtsh.hxx>
69cdf0e10cSrcweir #include <swmodule.hxx>
70cdf0e10cSrcweir #ifndef _VIEW_HXX
71cdf0e10cSrcweir #include <view.hxx>
72cdf0e10cSrcweir #endif
73cdf0e10cSrcweir #include <uitool.hxx>
74cdf0e10cSrcweir #include <frmatr.hxx>
75cdf0e10cSrcweir #include <paratr.hxx>
76cdf0e10cSrcweir #include <fmtcol.hxx>
77cdf0e10cSrcweir #include <poolfmt.hxx>
78cdf0e10cSrcweir #include "usrpref.hxx"
79cdf0e10cSrcweir 
80cdf0e10cSrcweir #ifndef _ERROR_H
81cdf0e10cSrcweir #include <error.h>
82cdf0e10cSrcweir #endif
83cdf0e10cSrcweir #ifndef _CMDID_H
84cdf0e10cSrcweir #include <cmdid.h>
85cdf0e10cSrcweir #endif
86cdf0e10cSrcweir #ifndef _GLOBALS_HRC
87cdf0e10cSrcweir #include <globals.hrc>
88cdf0e10cSrcweir #endif
89cdf0e10cSrcweir #ifndef _UTLUI_HRC
90cdf0e10cSrcweir #include <utlui.hrc>
91cdf0e10cSrcweir #endif
92cdf0e10cSrcweir #include <doc.hxx>
93cdf0e10cSrcweir #include <docary.hxx>
94cdf0e10cSrcweir #include <charfmt.hxx>
95cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
96cdf0e10cSrcweir // 50 cm 28350
97cdf0e10cSrcweir //
98cdf0e10cSrcweir #define MAXHEIGHT 28350
99cdf0e10cSrcweir #define MAXWIDTH  28350
100cdf0e10cSrcweir 
101cdf0e10cSrcweir using namespace ::com::sun::star;
102cdf0e10cSrcweir /*--------------------------------------------------------------------
103cdf0e10cSrcweir     Beschreibung: Allgemeine List von StringPointern
104cdf0e10cSrcweir  --------------------------------------------------------------------*/
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 
107cdf0e10cSrcweir /*--------------------------------------------------------------------
108cdf0e10cSrcweir     Beschreibung: Metric umschalten
109cdf0e10cSrcweir  --------------------------------------------------------------------*/
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
SetMetric(MetricFormatter & rCtrl,FieldUnit eUnit)112cdf0e10cSrcweir void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir     SwTwips nMin = static_cast< SwTwips >(rCtrl.GetMin(FUNIT_TWIP));
115cdf0e10cSrcweir     SwTwips nMax = static_cast< SwTwips >(rCtrl.GetMax(FUNIT_TWIP));
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     rCtrl.SetUnit(eUnit);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     rCtrl.SetMin(nMin, FUNIT_TWIP);
120cdf0e10cSrcweir     rCtrl.SetMax(nMax, FUNIT_TWIP);
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir /*--------------------------------------------------------------------
124cdf0e10cSrcweir     Beschreibung:   Boxinfo-Attribut setzen
125cdf0e10cSrcweir  --------------------------------------------------------------------*/
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 
PrepareBoxInfo(SfxItemSet & rSet,const SwWrtShell & rSh)128cdf0e10cSrcweir void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
131cdf0e10cSrcweir     const SfxPoolItem *pBoxInfo;
132cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
133cdf0e10cSrcweir                                         sal_True, &pBoxInfo))
134cdf0e10cSrcweir         aBoxInfo = *(SvxBoxInfoItem*)pBoxInfo;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         // Tabellenvariante, wenn mehrere Tabellenzellen selektiert
137cdf0e10cSrcweir     rSh.GetCrsr();                  //Damit GetCrsrCnt() auch das Richtige liefert
138cdf0e10cSrcweir     aBoxInfo.SetTable          (rSh.IsTableMode() && rSh.GetCrsrCnt() > 1);
139cdf0e10cSrcweir         // Abstandsfeld immer anzeigen
140cdf0e10cSrcweir     aBoxInfo.SetDist           ((sal_Bool) sal_True);
141cdf0e10cSrcweir         // Minimalgroesse in Tabellen und Absaetzen setzen
142cdf0e10cSrcweir     aBoxInfo.SetMinDist        (rSh.IsTableMode() || rSh.GetSelectionType() & (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL));
143cdf0e10cSrcweir         // Default-Abstand immer setzen
144cdf0e10cSrcweir     aBoxInfo.SetDefDist        (MIN_BORDER_DIST);
145cdf0e10cSrcweir         // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
146cdf0e10cSrcweir     aBoxInfo.SetValid(VALID_DISABLE, !rSh.IsTableMode());
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     rSet.Put(aBoxInfo);
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir /*--------------------------------------------------------------------
152cdf0e10cSrcweir     Beschreibung:   Header Footer fuellen
153cdf0e10cSrcweir  --------------------------------------------------------------------*/
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 
FillHdFt(SwFrmFmt * pFmt,const SfxItemSet & rSet)156cdf0e10cSrcweir void FillHdFt(SwFrmFmt* pFmt, const  SfxItemSet& rSet)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir     SwAttrSet aSet(pFmt->GetAttrSet());
159cdf0e10cSrcweir     aSet.Put(rSet);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(SID_ATTR_PAGE_SIZE);
162cdf0e10cSrcweir     const SfxBoolItem& rDynamic = (const SfxBoolItem&)rSet.Get(SID_ATTR_PAGE_DYNAMIC);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     // Groesse umsetzen
165cdf0e10cSrcweir     //
166cdf0e10cSrcweir     SwFmtFrmSize aFrmSize(rDynamic.GetValue() ? ATT_MIN_SIZE : ATT_FIX_SIZE,
167cdf0e10cSrcweir                             rSize.GetSize().Width(),
168cdf0e10cSrcweir                             rSize.GetSize().Height());
169cdf0e10cSrcweir     aSet.Put(aFrmSize);
170cdf0e10cSrcweir     pFmt->SetFmtAttr(aSet);
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir /*--------------------------------------------------------------------
174cdf0e10cSrcweir     Beschreibung:   PageDesc <-> in Sets wandeln und zurueck
175cdf0e10cSrcweir  --------------------------------------------------------------------*/
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 
ItemSetToPageDesc(const SfxItemSet & rSet,SwPageDesc & rPageDesc)178cdf0e10cSrcweir void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     SwFrmFmt& rMaster = rPageDesc.GetMaster();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     // alle allgemeinen Rahmen-Attribute uebertragen
183cdf0e10cSrcweir     //
184cdf0e10cSrcweir     rMaster.SetFmtAttr(rSet);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     // PageData
187cdf0e10cSrcweir     //
188cdf0e10cSrcweir     if(rSet.GetItemState(SID_ATTR_PAGE) == SFX_ITEM_SET)
189cdf0e10cSrcweir     {
190cdf0e10cSrcweir         const SvxPageItem& rPageItem = (const SvxPageItem&)rSet.Get(SID_ATTR_PAGE);
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         sal_uInt16 nUse = (sal_uInt16)rPageItem.GetPageUsage();
193cdf0e10cSrcweir         if(nUse & 0x04)
194cdf0e10cSrcweir             nUse |= 0x03;
195cdf0e10cSrcweir         if(nUse)
196cdf0e10cSrcweir             rPageDesc.SetUseOn( (UseOnPage) nUse );
197cdf0e10cSrcweir         rPageDesc.SetLandscape(rPageItem.IsLandscape());
198cdf0e10cSrcweir         SvxNumberType aNumType;
199cdf0e10cSrcweir         aNumType.SetNumberingType( static_cast< sal_Int16 >(rPageItem.GetNumType()) );
200cdf0e10cSrcweir         rPageDesc.SetNumType(aNumType);
201cdf0e10cSrcweir     }
202cdf0e10cSrcweir     // Groesse
203cdf0e10cSrcweir     //
204cdf0e10cSrcweir     if(rSet.GetItemState(SID_ATTR_PAGE_SIZE) == SFX_ITEM_SET)
205cdf0e10cSrcweir     {
206cdf0e10cSrcweir         const SvxSizeItem& rSizeItem = (const SvxSizeItem&)rSet.Get(SID_ATTR_PAGE_SIZE);
207cdf0e10cSrcweir         SwFmtFrmSize aSize(ATT_FIX_SIZE);
208cdf0e10cSrcweir         aSize.SetSize(rSizeItem.GetSize());
209cdf0e10cSrcweir         rMaster.SetFmtAttr(aSize);
210cdf0e10cSrcweir     }
211cdf0e10cSrcweir     // Kopzeilen-Attribute auswerten
212cdf0e10cSrcweir     //
213cdf0e10cSrcweir     const SfxPoolItem* pItem;
214cdf0e10cSrcweir     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_HEADERSET,
215cdf0e10cSrcweir             sal_False, &pItem ) )
216cdf0e10cSrcweir     {
217cdf0e10cSrcweir         const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
218cdf0e10cSrcweir         const SfxBoolItem& rHeaderOn = (const SfxBoolItem&)rHeaderSet.Get(SID_ATTR_PAGE_ON);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir         if(rHeaderOn.GetValue())
221cdf0e10cSrcweir         {
222cdf0e10cSrcweir             // Werte uebernehmen
223cdf0e10cSrcweir             if(!rMaster.GetHeader().IsActive())
224cdf0e10cSrcweir                 rMaster.SetFmtAttr(SwFmtHeader(sal_True));
225cdf0e10cSrcweir 
226cdf0e10cSrcweir             // Das Headerformat rausholen und anpassen
227cdf0e10cSrcweir             //
228cdf0e10cSrcweir             SwFmtHeader aHeaderFmt(rMaster.GetHeader());
229cdf0e10cSrcweir             SwFrmFmt *pHeaderFmt = aHeaderFmt.GetHeaderFmt();
230cdf0e10cSrcweir             ASSERT(pHeaderFmt != 0, "kein HeaderFormat");
231cdf0e10cSrcweir 
232cdf0e10cSrcweir             ::FillHdFt(pHeaderFmt, rHeaderSet);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir             rPageDesc.ChgHeaderShare(((const SfxBoolItem&)
235cdf0e10cSrcweir                         rHeaderSet.Get(SID_ATTR_PAGE_SHARED)).GetValue());
236cdf0e10cSrcweir         }
237cdf0e10cSrcweir         else
238cdf0e10cSrcweir         {   // Header ausschalten
239cdf0e10cSrcweir             //
240cdf0e10cSrcweir             if(rMaster.GetHeader().IsActive())
241cdf0e10cSrcweir             {
242cdf0e10cSrcweir                 rMaster.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False)));
243cdf0e10cSrcweir                 rPageDesc.ChgHeaderShare(sal_False);
244cdf0e10cSrcweir             }
245cdf0e10cSrcweir         }
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     // Fusszeilen-Attribute auswerten
249cdf0e10cSrcweir     //
250cdf0e10cSrcweir     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_FOOTERSET,
251cdf0e10cSrcweir             sal_False, &pItem ) )
252cdf0e10cSrcweir     {
253cdf0e10cSrcweir         const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
254cdf0e10cSrcweir         const SfxBoolItem& rFooterOn = (const SfxBoolItem&)rFooterSet.Get(SID_ATTR_PAGE_ON);
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         if(rFooterOn.GetValue())
257cdf0e10cSrcweir         {
258cdf0e10cSrcweir             // Werte uebernehmen
259cdf0e10cSrcweir             if(!rMaster.GetFooter().IsActive())
260cdf0e10cSrcweir                 rMaster.SetFmtAttr(SwFmtFooter(sal_True));
261cdf0e10cSrcweir 
262cdf0e10cSrcweir             // Das Footerformat rausholen und anpassen
263cdf0e10cSrcweir             //
264cdf0e10cSrcweir             SwFmtFooter aFooterFmt(rMaster.GetFooter());
265cdf0e10cSrcweir             SwFrmFmt *pFooterFmt = aFooterFmt.GetFooterFmt();
266cdf0e10cSrcweir             ASSERT(pFooterFmt != 0, "kein FooterFormat");
267cdf0e10cSrcweir 
268cdf0e10cSrcweir             ::FillHdFt(pFooterFmt, rFooterSet);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir             rPageDesc.ChgFooterShare(((const SfxBoolItem&)
271cdf0e10cSrcweir                         rFooterSet.Get(SID_ATTR_PAGE_SHARED)).GetValue());
272cdf0e10cSrcweir         }
273cdf0e10cSrcweir         else
274cdf0e10cSrcweir         {   // Footer ausschalten
275cdf0e10cSrcweir             //
276cdf0e10cSrcweir             if(rMaster.GetFooter().IsActive())
277cdf0e10cSrcweir             {
278cdf0e10cSrcweir                 rMaster.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False)));
279cdf0e10cSrcweir                 rPageDesc.ChgFooterShare(sal_False);
280cdf0e10cSrcweir             }
281cdf0e10cSrcweir         }
282cdf0e10cSrcweir     }
283cdf0e10cSrcweir 
284cdf0e10cSrcweir     // Fussnoten
285cdf0e10cSrcweir     //
286cdf0e10cSrcweir     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_FTN_INFO,
287cdf0e10cSrcweir             sal_False, &pItem ) )
288cdf0e10cSrcweir         rPageDesc.SetFtnInfo( ((SwPageFtnInfoItem*)pItem)->GetPageFtnInfo() );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     //
292cdf0e10cSrcweir     // Columns
293cdf0e10cSrcweir     //
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     // Registerhaltigkeit
296cdf0e10cSrcweir 
297cdf0e10cSrcweir     if(SFX_ITEM_SET == rSet.GetItemState(
298cdf0e10cSrcweir                             SID_SWREGISTER_MODE, sal_False, &pItem))
299cdf0e10cSrcweir     {
300cdf0e10cSrcweir         sal_Bool bSet = ((const SfxBoolItem*)pItem)->GetValue();
301cdf0e10cSrcweir         if(!bSet)
302cdf0e10cSrcweir             rPageDesc.SetRegisterFmtColl(0);
303cdf0e10cSrcweir         else if(SFX_ITEM_SET == rSet.GetItemState(
304cdf0e10cSrcweir                                 SID_SWREGISTER_COLLECTION, sal_False, &pItem))
305cdf0e10cSrcweir         {
306cdf0e10cSrcweir             const String& rColl = ((const SfxStringItem*)pItem)->GetValue();
307cdf0e10cSrcweir             SwDoc& rDoc = *rMaster.GetDoc();
308cdf0e10cSrcweir             SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( rColl );
309cdf0e10cSrcweir             if( !pColl )
310cdf0e10cSrcweir             {
311cdf0e10cSrcweir                 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rColl, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
312cdf0e10cSrcweir                 if( USHRT_MAX != nId )
313cdf0e10cSrcweir                     pColl = rDoc.GetTxtCollFromPool( nId );
314cdf0e10cSrcweir                 else
315cdf0e10cSrcweir                     pColl = rDoc.MakeTxtFmtColl( rColl,
316cdf0e10cSrcweir                                 (SwTxtFmtColl*)rDoc.GetDfltTxtFmtColl() );
317cdf0e10cSrcweir             }
318cdf0e10cSrcweir             if( pColl )
319cdf0e10cSrcweir                 pColl->SetFmtAttr( SwRegisterItem ( sal_True ));
320cdf0e10cSrcweir             rPageDesc.SetRegisterFmtColl( pColl );
321cdf0e10cSrcweir         }
322cdf0e10cSrcweir     }
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir /*--------------------------------------------------------------------
326cdf0e10cSrcweir     Beschreibung:
327cdf0e10cSrcweir  --------------------------------------------------------------------*/
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 
PageDescToItemSet(const SwPageDesc & rPageDesc,SfxItemSet & rSet)330cdf0e10cSrcweir void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
331cdf0e10cSrcweir {
332cdf0e10cSrcweir     const SwFrmFmt& rMaster = rPageDesc.GetMaster();
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     // Seitendaten
335cdf0e10cSrcweir     //
336cdf0e10cSrcweir     SvxPageItem aPageItem(SID_ATTR_PAGE);
337cdf0e10cSrcweir     aPageItem.SetDescName(rPageDesc.GetName());
338cdf0e10cSrcweir     aPageItem.SetPageUsage(rPageDesc.GetUseOn());
339cdf0e10cSrcweir     aPageItem.SetLandscape(rPageDesc.GetLandscape());
340cdf0e10cSrcweir     aPageItem.SetNumType((SvxNumType)rPageDesc.GetNumType().GetNumberingType());
341cdf0e10cSrcweir     rSet.Put(aPageItem);
342cdf0e10cSrcweir 
343cdf0e10cSrcweir     // Groesse
344cdf0e10cSrcweir     SvxSizeItem aSizeItem(SID_ATTR_PAGE_SIZE, rMaster.GetFrmSize().GetSize());
345cdf0e10cSrcweir     rSet.Put(aSizeItem);
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     // Maximale Groesse
348cdf0e10cSrcweir     SvxSizeItem aMaxSizeItem(SID_ATTR_PAGE_MAXSIZE, Size(MAXWIDTH, MAXHEIGHT));
349cdf0e10cSrcweir     rSet.Put(aMaxSizeItem);
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     // Raender, Umrandung und das andere Zeug
352cdf0e10cSrcweir     //
353cdf0e10cSrcweir     rSet.Put(rMaster.GetAttrSet());
354cdf0e10cSrcweir 
355cdf0e10cSrcweir     SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
356cdf0e10cSrcweir     const SfxPoolItem *pBoxInfo;
357cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
358cdf0e10cSrcweir                                             sal_True, &pBoxInfo) )
359cdf0e10cSrcweir         aBoxInfo = *(SvxBoxInfoItem*)pBoxInfo;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     aBoxInfo.SetTable( sal_False );
362cdf0e10cSrcweir         // Abstandsfeld immer anzeigen
363cdf0e10cSrcweir     aBoxInfo.SetDist( sal_True);
364cdf0e10cSrcweir         // Minimalgroesse in Tabellen und Absaetzen setzen
365cdf0e10cSrcweir     aBoxInfo.SetMinDist( sal_False );
366cdf0e10cSrcweir     // Default-Abstand immer setzen
367cdf0e10cSrcweir     aBoxInfo.SetDefDist( MIN_BORDER_DIST );
368cdf0e10cSrcweir         // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
369cdf0e10cSrcweir     aBoxInfo.SetValid( VALID_DISABLE );
370cdf0e10cSrcweir     rSet.Put( aBoxInfo );
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 
373cdf0e10cSrcweir     SfxStringItem aFollow(SID_ATTR_PAGE_EXT1, aEmptyStr);
374cdf0e10cSrcweir     if(rPageDesc.GetFollow())
375cdf0e10cSrcweir         aFollow.SetValue(rPageDesc.GetFollow()->GetName());
376cdf0e10cSrcweir     rSet.Put(aFollow);
377cdf0e10cSrcweir 
378cdf0e10cSrcweir     // Header
379cdf0e10cSrcweir     //
380cdf0e10cSrcweir     if(rMaster.GetHeader().IsActive())
381cdf0e10cSrcweir     {
382cdf0e10cSrcweir         const SwFmtHeader &rHeaderFmt = rMaster.GetHeader();
383cdf0e10cSrcweir         const SwFrmFmt *pHeaderFmt = rHeaderFmt.GetHeaderFmt();
384cdf0e10cSrcweir         ASSERT(pHeaderFmt != 0, kein HeaderFormat.);
385cdf0e10cSrcweir 
386cdf0e10cSrcweir         // HeaderInfo, Raender, Hintergrund, Umrandung
387cdf0e10cSrcweir         //
388cdf0e10cSrcweir         SfxItemSet aHeaderSet(*rSet.GetPool(),
389*56b35d86SArmin Le Grand             RES_FRMATR_BEGIN,RES_FRMATR_END - 1,            // [82
390*56b35d86SArmin Le Grand 
391*56b35d86SArmin Le Grand             //UUUU FillAttribute support
392*56b35d86SArmin Le Grand             XATTR_FILL_FIRST, XATTR_FILL_LAST,              // [1014
393*56b35d86SArmin Le Grand 
394*56b35d86SArmin Le Grand             SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER,    // [10023
395*56b35d86SArmin Le Grand             SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE,          // [10051
396*56b35d86SArmin Le Grand             SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED,          // [10060
397*56b35d86SArmin Le Grand             0, 0);
398*56b35d86SArmin Le Grand 
399*56b35d86SArmin Le Grand         //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
400*56b35d86SArmin Le Grand         aHeaderSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet());
401cdf0e10cSrcweir 
402cdf0e10cSrcweir         // dynamische oder feste Hoehe
403cdf0e10cSrcweir         //
404cdf0e10cSrcweir         SfxBoolItem aOn(SID_ATTR_PAGE_ON, sal_True);
405cdf0e10cSrcweir         aHeaderSet.Put(aOn);
406cdf0e10cSrcweir 
407cdf0e10cSrcweir         const SwFmtFrmSize &rFrmSize = pHeaderFmt->GetFrmSize();
408cdf0e10cSrcweir         const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType();
409cdf0e10cSrcweir         SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE);
410cdf0e10cSrcweir         aHeaderSet.Put(aDynamic);
411cdf0e10cSrcweir 
412cdf0e10cSrcweir         // Links gleich rechts
413cdf0e10cSrcweir         //
414cdf0e10cSrcweir         SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsHeaderShared());
415cdf0e10cSrcweir         aHeaderSet.Put(aShared);
416cdf0e10cSrcweir 
417cdf0e10cSrcweir         // Groesse
418cdf0e10cSrcweir         SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize()));
419cdf0e10cSrcweir         aHeaderSet.Put(aSize);
420cdf0e10cSrcweir 
421cdf0e10cSrcweir         // Rahmen-Attribute umschaufeln
422cdf0e10cSrcweir         //
423cdf0e10cSrcweir         aHeaderSet.Put(pHeaderFmt->GetAttrSet());
424cdf0e10cSrcweir         aHeaderSet.Put( aBoxInfo );
425cdf0e10cSrcweir 
426cdf0e10cSrcweir         // SetItem erzeugen
427cdf0e10cSrcweir         //
428cdf0e10cSrcweir         SvxSetItem aSetItem(SID_ATTR_PAGE_HEADERSET, aHeaderSet);
429cdf0e10cSrcweir         rSet.Put(aSetItem);
430cdf0e10cSrcweir     }
431cdf0e10cSrcweir 
432cdf0e10cSrcweir     // Footer
433cdf0e10cSrcweir     if(rMaster.GetFooter().IsActive())
434cdf0e10cSrcweir     {
435cdf0e10cSrcweir         const SwFmtFooter &rFooterFmt = rMaster.GetFooter();
436cdf0e10cSrcweir         const SwFrmFmt *pFooterFmt = rFooterFmt.GetFooterFmt();
437cdf0e10cSrcweir         ASSERT(pFooterFmt != 0, kein FooterFormat.);
438cdf0e10cSrcweir 
439cdf0e10cSrcweir         // FooterInfo, Raender, Hintergrund, Umrandung
440cdf0e10cSrcweir         //
441cdf0e10cSrcweir         SfxItemSet aFooterSet(*rSet.GetPool(),
442*56b35d86SArmin Le Grand             RES_FRMATR_BEGIN,RES_FRMATR_END - 1,            // [82
443*56b35d86SArmin Le Grand 
444*56b35d86SArmin Le Grand             //UUUU FillAttribute support
445*56b35d86SArmin Le Grand             XATTR_FILL_FIRST, XATTR_FILL_LAST,              // [1014
446*56b35d86SArmin Le Grand 
447*56b35d86SArmin Le Grand             SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER,    // [10023
448*56b35d86SArmin Le Grand             SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE,          // [10051
449*56b35d86SArmin Le Grand             SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED,          // [10060
450*56b35d86SArmin Le Grand             0, 0);
451*56b35d86SArmin Le Grand 
452*56b35d86SArmin Le Grand         //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
453*56b35d86SArmin Le Grand         aFooterSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet());
454cdf0e10cSrcweir 
455cdf0e10cSrcweir         // dynamische oder feste Hoehe
456cdf0e10cSrcweir         //
457cdf0e10cSrcweir         SfxBoolItem aOn(SID_ATTR_PAGE_ON, sal_True);
458cdf0e10cSrcweir         aFooterSet.Put(aOn);
459cdf0e10cSrcweir 
460cdf0e10cSrcweir         const SwFmtFrmSize &rFrmSize = pFooterFmt->GetFrmSize();
461cdf0e10cSrcweir         const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType();
462cdf0e10cSrcweir         SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE);
463cdf0e10cSrcweir         aFooterSet.Put(aDynamic);
464cdf0e10cSrcweir 
465cdf0e10cSrcweir         // Links gleich rechts
466cdf0e10cSrcweir         //
467cdf0e10cSrcweir         SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsFooterShared());
468cdf0e10cSrcweir         aFooterSet.Put(aShared);
469cdf0e10cSrcweir 
470cdf0e10cSrcweir         // Groesse
471cdf0e10cSrcweir         SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize()));
472cdf0e10cSrcweir         aFooterSet.Put(aSize);
473cdf0e10cSrcweir 
474cdf0e10cSrcweir         // Rahmen-Attribute umschaufeln
475cdf0e10cSrcweir         //
476cdf0e10cSrcweir         aFooterSet.Put(pFooterFmt->GetAttrSet());
477cdf0e10cSrcweir         aFooterSet.Put( aBoxInfo );
478cdf0e10cSrcweir 
479cdf0e10cSrcweir         // SetItem erzeugen
480cdf0e10cSrcweir         //
481cdf0e10cSrcweir         SvxSetItem aSetItem(SID_ATTR_PAGE_FOOTERSET, aFooterSet);
482cdf0e10cSrcweir         rSet.Put(aSetItem);
483cdf0e10cSrcweir     }
484cdf0e10cSrcweir 
485cdf0e10cSrcweir     // Fussnoten einbauen
486cdf0e10cSrcweir     //
487cdf0e10cSrcweir     SwPageFtnInfo& rInfo = (SwPageFtnInfo&)rPageDesc.GetFtnInfo();
488cdf0e10cSrcweir     SwPageFtnInfoItem aFtnItem(FN_PARAM_FTN_INFO, rInfo);
489cdf0e10cSrcweir     rSet.Put(aFtnItem);
490cdf0e10cSrcweir 
491cdf0e10cSrcweir     // Registerhaltigkeit
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     const SwTxtFmtColl* pCol = rPageDesc.GetRegisterFmtColl();
494cdf0e10cSrcweir     SwRegisterItem aReg(pCol != 0);
495cdf0e10cSrcweir     aReg.SetWhich(SID_SWREGISTER_MODE);
496cdf0e10cSrcweir     rSet.Put(aReg);
497cdf0e10cSrcweir     if(pCol)
498cdf0e10cSrcweir         rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, pCol->GetName()));
499cdf0e10cSrcweir 
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 
503cdf0e10cSrcweir /*--------------------------------------------------------------------
504cdf0e10cSrcweir     Beschreibung:   DefaultTabs setzen
505cdf0e10cSrcweir  --------------------------------------------------------------------*/
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 
MakeDefTabs(SwTwips nDefDist,SvxTabStopItem & rTabs)508cdf0e10cSrcweir void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem& rTabs)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     if( rTabs.Count() )
511cdf0e10cSrcweir         return;
512cdf0e10cSrcweir     {
513cdf0e10cSrcweir         SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
514cdf0e10cSrcweir         rTabs.Insert( aSwTabStop );
515cdf0e10cSrcweir     }
516cdf0e10cSrcweir }
517cdf0e10cSrcweir 
518cdf0e10cSrcweir /*--------------------------------------------------------------------
519cdf0e10cSrcweir     Beschreibung:   Abstand zwischen zwei Tabs
520cdf0e10cSrcweir  --------------------------------------------------------------------*/
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 
GetTabDist(const SvxTabStopItem & rTabs)523cdf0e10cSrcweir sal_uInt16 GetTabDist(const SvxTabStopItem& rTabs)
524cdf0e10cSrcweir {
525cdf0e10cSrcweir     sal_uInt16 nDefDist;
526cdf0e10cSrcweir     if( rTabs.Count() )
527cdf0e10cSrcweir         nDefDist = (sal_uInt16)( rTabs[0].GetTabPos() );
528cdf0e10cSrcweir     else
529cdf0e10cSrcweir         nDefDist = 1134;     // 2cm
530cdf0e10cSrcweir     return nDefDist;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 
534cdf0e10cSrcweir // erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese
SfxToSwPageDescAttr(const SwWrtShell & rShell,SfxItemSet & rSet)535cdf0e10cSrcweir void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir     const SfxPoolItem* pItem;
538cdf0e10cSrcweir     SwFmtPageDesc aPgDesc;
539cdf0e10cSrcweir 
540cdf0e10cSrcweir     sal_Bool bChanged = sal_False;
541cdf0e10cSrcweir     // Seitennummer
542cdf0e10cSrcweir     if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_PARA_PAGENUM, sal_False, &pItem))
543cdf0e10cSrcweir     {
544cdf0e10cSrcweir         aPgDesc.SetNumOffset(((SfxUInt16Item*)pItem)->GetValue());
545cdf0e10cSrcweir         bChanged = sal_True;
546cdf0e10cSrcweir     }
547cdf0e10cSrcweir     if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PARA_MODEL, sal_False, &pItem ))
548cdf0e10cSrcweir     {
549cdf0e10cSrcweir         const String& rDescName = ((SvxPageModelItem*)pItem)->GetValue();
550cdf0e10cSrcweir         if( rDescName.Len() )   // kein Name -> PageDesc ausschalten!
551cdf0e10cSrcweir         {
552cdf0e10cSrcweir             // nur loeschen, wenn PageDesc eingschaltet wird!
553cdf0e10cSrcweir             rSet.ClearItem( RES_BREAK );
554cdf0e10cSrcweir             SwPageDesc* pDesc = ((SwWrtShell&)rShell).FindPageDescByName(
555cdf0e10cSrcweir                                                     rDescName, sal_True );
556cdf0e10cSrcweir             if( pDesc )
557cdf0e10cSrcweir                 aPgDesc.RegisterToPageDesc( *pDesc );
558cdf0e10cSrcweir         }
559cdf0e10cSrcweir         rSet.ClearItem( SID_ATTR_PARA_MODEL );
560cdf0e10cSrcweir         bChanged = sal_True;
561cdf0e10cSrcweir     }
562cdf0e10cSrcweir     else
563cdf0e10cSrcweir     {
564cdf0e10cSrcweir         SfxItemSet aCoreSet(rShell.GetView().GetPool(), RES_PAGEDESC, RES_PAGEDESC );
565cdf0e10cSrcweir         rShell.GetCurAttr( aCoreSet );
566cdf0e10cSrcweir         if(SFX_ITEM_SET == aCoreSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
567cdf0e10cSrcweir         {
568cdf0e10cSrcweir             if( ((SwFmtPageDesc*)pItem)->GetPageDesc() )
569cdf0e10cSrcweir             {
570cdf0e10cSrcweir                 aPgDesc.RegisterToPageDesc( *((SwFmtPageDesc*)pItem)->GetPageDesc() );
571cdf0e10cSrcweir             }
572cdf0e10cSrcweir         }
573cdf0e10cSrcweir     }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 
576cdf0e10cSrcweir     if(bChanged)
577cdf0e10cSrcweir         rSet.Put( aPgDesc );
578cdf0e10cSrcweir }
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 
581cdf0e10cSrcweir // erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese
SwToSfxPageDescAttr(SfxItemSet & rCoreSet)582cdf0e10cSrcweir void SwToSfxPageDescAttr( SfxItemSet& rCoreSet )
583cdf0e10cSrcweir {
584cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
585cdf0e10cSrcweir     String aName;
586cdf0e10cSrcweir     sal_uInt16 nPageNum = 0;
587cdf0e10cSrcweir     sal_Bool bPut = sal_True;
588cdf0e10cSrcweir     switch( rCoreSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
589cdf0e10cSrcweir     {
590cdf0e10cSrcweir     case SFX_ITEM_SET:
591cdf0e10cSrcweir         {
592cdf0e10cSrcweir             if( ((SwFmtPageDesc*)pItem)->GetPageDesc() )
593cdf0e10cSrcweir             {
594cdf0e10cSrcweir                 aName = ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetName();
595cdf0e10cSrcweir                 nPageNum = ((SwFmtPageDesc*)pItem)->GetNumOffset();
596cdf0e10cSrcweir             }
597cdf0e10cSrcweir             rCoreSet.ClearItem( RES_PAGEDESC );
598cdf0e10cSrcweir             // Seitennummer
599cdf0e10cSrcweir         }
600cdf0e10cSrcweir         break;
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     case SFX_ITEM_AVAILABLE:
603cdf0e10cSrcweir         break;
604cdf0e10cSrcweir 
605cdf0e10cSrcweir     default:
606cdf0e10cSrcweir         bPut = sal_False;
607cdf0e10cSrcweir     }
608cdf0e10cSrcweir     SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, nPageNum );
609cdf0e10cSrcweir     rCoreSet.Put( aPageNum );
610cdf0e10cSrcweir 
611cdf0e10cSrcweir     if(bPut)
612cdf0e10cSrcweir         rCoreSet.Put( SvxPageModelItem( aName, sal_True, SID_ATTR_PARA_MODEL ) );
613cdf0e10cSrcweir }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir /*--------------------------------------------------------------------
616cdf0e10cSrcweir     Beschreibung:   Metric ermitteln
617cdf0e10cSrcweir  --------------------------------------------------------------------*/
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 
GetDfltMetric(sal_Bool bWeb)620cdf0e10cSrcweir FieldUnit   GetDfltMetric(sal_Bool bWeb)
621cdf0e10cSrcweir {
622cdf0e10cSrcweir     return SW_MOD()->GetUsrPref(bWeb)->GetMetric();
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir /*--------------------------------------------------------------------
626cdf0e10cSrcweir     Beschreibung:   Metric ermitteln
627cdf0e10cSrcweir  --------------------------------------------------------------------*/
628cdf0e10cSrcweir 
629cdf0e10cSrcweir 
SetDfltMetric(FieldUnit eMetric,sal_Bool bWeb)630cdf0e10cSrcweir void    SetDfltMetric( FieldUnit eMetric, sal_Bool bWeb )
631cdf0e10cSrcweir {
632cdf0e10cSrcweir     SW_MOD()->ApplyUserMetric(eMetric, bWeb);
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir /*-----------------09.04.98 16:58-------------------
636cdf0e10cSrcweir 
637cdf0e10cSrcweir --------------------------------------------------*/
InsertStringSorted(const String & rEntry,ListBox & rToFill,sal_uInt16 nOffset)638cdf0e10cSrcweir sal_uInt16 InsertStringSorted(const String& rEntry, ListBox& rToFill, sal_uInt16 nOffset )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir     sal_uInt16 i = nOffset;
641cdf0e10cSrcweir     CollatorWrapper& rCaseColl = ::GetAppCaseCollator();
642cdf0e10cSrcweir 
643cdf0e10cSrcweir     for( ; i < rToFill.GetEntryCount(); i++ )
644cdf0e10cSrcweir     {
645cdf0e10cSrcweir         if( 0 < rCaseColl.compareString( rToFill.GetEntry(i), rEntry ))
646cdf0e10cSrcweir             break;
647cdf0e10cSrcweir     }
648cdf0e10cSrcweir     return rToFill.InsertEntry(rEntry, i);
649cdf0e10cSrcweir }
FillCharStyleListBox(ListBox & rToFill,SwDocShell * pDocSh,sal_Bool bSorted,sal_Bool bWithDefault)650cdf0e10cSrcweir void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, sal_Bool bSorted, sal_Bool bWithDefault)
651cdf0e10cSrcweir {
652cdf0e10cSrcweir     sal_Bool bHasOffset = rToFill.GetEntryCount() > 0;
653cdf0e10cSrcweir     SfxStyleSheetBasePool* pPool = pDocSh->GetStyleSheetPool();
654cdf0e10cSrcweir     pPool->SetSearchMask(SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL);
655cdf0e10cSrcweir     SwDoc* pDoc = pDocSh->GetDoc();
656cdf0e10cSrcweir     const SfxStyleSheetBase* pBase = pPool->First();
657cdf0e10cSrcweir     String sStandard;
658cdf0e10cSrcweir     SwStyleNameMapper::FillUIName( RES_POOLCOLL_STANDARD, sStandard );
659cdf0e10cSrcweir     while(pBase)
660cdf0e10cSrcweir     {
661cdf0e10cSrcweir         if(bWithDefault || pBase->GetName() !=  sStandard)
662cdf0e10cSrcweir         {
663cdf0e10cSrcweir             sal_uInt16 nPos;
664cdf0e10cSrcweir             if(bSorted)
665cdf0e10cSrcweir                 nPos = InsertStringSorted(pBase->GetName(), rToFill, bHasOffset );
666cdf0e10cSrcweir             else
667cdf0e10cSrcweir                 nPos = rToFill.InsertEntry(pBase->GetName());
668cdf0e10cSrcweir             long nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( pBase->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
669cdf0e10cSrcweir             rToFill.SetEntryData( nPos, (void*) (nPoolId));
670cdf0e10cSrcweir         }
671cdf0e10cSrcweir         pBase = pPool->Next();
672cdf0e10cSrcweir     }
673cdf0e10cSrcweir     // non-pool styles
674cdf0e10cSrcweir     const SwCharFmts* pFmts = pDoc->GetCharFmts();
675cdf0e10cSrcweir     for(sal_uInt16 i = 0; i < pFmts->Count(); i++)
676cdf0e10cSrcweir     {
677cdf0e10cSrcweir         const SwCharFmt* pFmt = (*pFmts)[i];
678cdf0e10cSrcweir         if(pFmt->IsDefault())
679cdf0e10cSrcweir             continue;
680cdf0e10cSrcweir         const String& rName = pFmt->GetName();
681cdf0e10cSrcweir         if(rToFill.GetEntryPos(rName) == LISTBOX_ENTRY_NOTFOUND)
682cdf0e10cSrcweir         {
683cdf0e10cSrcweir             sal_uInt16 nPos;
684cdf0e10cSrcweir             if(bSorted)
685cdf0e10cSrcweir                 nPos = InsertStringSorted(rName, rToFill, bHasOffset );
686cdf0e10cSrcweir             else
687cdf0e10cSrcweir                 nPos = rToFill.InsertEntry(rName);
688cdf0e10cSrcweir             long nPoolId = USHRT_MAX;
689cdf0e10cSrcweir             rToFill.SetEntryData( nPos, (void*) (nPoolId));
690cdf0e10cSrcweir         }
691cdf0e10cSrcweir     }
692cdf0e10cSrcweir };
693cdf0e10cSrcweir 
694cdf0e10cSrcweir /* -----------------27.04.98 08:26-------------------
695cdf0e10cSrcweir  *
696cdf0e10cSrcweir  * --------------------------------------------------*/
GetTableWidth(SwFrmFmt * pFmt,SwTabCols & rCols,sal_uInt16 * pPercent,SwWrtShell * pSh)697cdf0e10cSrcweir SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, sal_uInt16 *pPercent,
698cdf0e10cSrcweir             SwWrtShell* pSh )
699cdf0e10cSrcweir {
700cdf0e10cSrcweir     //Die Breite zu besorgen ist etwas komplizierter.
701cdf0e10cSrcweir     SwTwips nWidth = 0;
702cdf0e10cSrcweir     const sal_Int16 eOri = pFmt->GetHoriOrient().GetHoriOrient();
703cdf0e10cSrcweir     switch(eOri)
704cdf0e10cSrcweir     {
705cdf0e10cSrcweir         case text::HoriOrientation::FULL: nWidth = rCols.GetRight(); break;
706cdf0e10cSrcweir         case text::HoriOrientation::LEFT_AND_WIDTH:
707cdf0e10cSrcweir         case text::HoriOrientation::LEFT:
708cdf0e10cSrcweir         case text::HoriOrientation::RIGHT:
709cdf0e10cSrcweir         case text::HoriOrientation::CENTER:
710cdf0e10cSrcweir             nWidth = pFmt->GetFrmSize().GetWidth();
711cdf0e10cSrcweir         break;
712cdf0e10cSrcweir         default:
713cdf0e10cSrcweir         {
714cdf0e10cSrcweir             if(pSh)
715cdf0e10cSrcweir             {
716cdf0e10cSrcweir                 const SwFrmFmt *pFlyFmt;
717cdf0e10cSrcweir                 if ( 0 == (pFlyFmt = pSh->GetFlyFrmFmt()) )
718cdf0e10cSrcweir                 {
719cdf0e10cSrcweir                     nWidth = pSh->GetAnyCurRect(RECT_PAGE_PRT).Width();
720cdf0e10cSrcweir                 }
721cdf0e10cSrcweir                 else
722cdf0e10cSrcweir                 {
723cdf0e10cSrcweir                     nWidth = pSh->GetAnyCurRect(RECT_FLY_PRT_EMBEDDED).Width();
724cdf0e10cSrcweir                 }
725cdf0e10cSrcweir             }
726cdf0e10cSrcweir             else
727cdf0e10cSrcweir             {
728cdf0e10cSrcweir                 DBG_ERROR("wo soll die Breite denn herkommen?");
729cdf0e10cSrcweir             }
730cdf0e10cSrcweir             const SvxLRSpaceItem& rLRSpace = pFmt->GetLRSpace();
731cdf0e10cSrcweir             nWidth -= (rLRSpace.GetRight() + rLRSpace.GetLeft());
732cdf0e10cSrcweir         }
733cdf0e10cSrcweir     }
734cdf0e10cSrcweir     if (pPercent)
735cdf0e10cSrcweir         *pPercent = pFmt->GetFrmSize().GetWidthPercent();
736cdf0e10cSrcweir     return nWidth;
737cdf0e10cSrcweir }
738cdf0e10cSrcweir 
739cdf0e10cSrcweir /*------------------------------------------------------------------------*/
740cdf0e10cSrcweir 
GetAppLangDateTimeString(const DateTime & rDT)741cdf0e10cSrcweir String GetAppLangDateTimeString( const DateTime& rDT )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir     const SvtSysLocale aSysLocale;
744cdf0e10cSrcweir     const LocaleDataWrapper& rAppLclData = aSysLocale.GetLocaleData();
745cdf0e10cSrcweir     String sRet( rAppLclData.getDate( rDT ));
746cdf0e10cSrcweir     ( sRet += ' ' ) += rAppLclData.getTime( rDT, sal_False, sal_False );
747cdf0e10cSrcweir     return sRet;
748cdf0e10cSrcweir }
749cdf0e10cSrcweir 
750cdf0e10cSrcweir /*-- 26.01.2006 08:06:33---------------------------------------------------
751cdf0e10cSrcweir 
752cdf0e10cSrcweir   -----------------------------------------------------------------------*/
ExecuteMenuCommand(PopupMenu & rMenu,SfxViewFrame & rViewFrame,sal_uInt16 nId)753cdf0e10cSrcweir bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, sal_uInt16 nId )
754cdf0e10cSrcweir {
755cdf0e10cSrcweir     bool bRet = false;
756cdf0e10cSrcweir     sal_uInt16 nItemCount = rMenu.GetItemCount();
757cdf0e10cSrcweir     String sCommand;
758cdf0e10cSrcweir     for( sal_uInt16 nItem = 0; nItem < nItemCount; ++nItem)
759cdf0e10cSrcweir     {
760cdf0e10cSrcweir         PopupMenu* pPopup = rMenu.GetPopupMenu( rMenu.GetItemId( nItem ) );
761cdf0e10cSrcweir         if(pPopup)
762cdf0e10cSrcweir         {
763cdf0e10cSrcweir             sCommand = pPopup->GetItemCommand(nId);
764cdf0e10cSrcweir             if(sCommand.Len())
765cdf0e10cSrcweir                 break;
766cdf0e10cSrcweir         }
767cdf0e10cSrcweir     }
768cdf0e10cSrcweir     if(sCommand.Len())
769cdf0e10cSrcweir     {
770cdf0e10cSrcweir         uno::Reference< frame::XFrame >  xFrame = rViewFrame.GetFrame().GetFrameInterface();
771cdf0e10cSrcweir         uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY );
772cdf0e10cSrcweir         util::URL aURL;
773cdf0e10cSrcweir         aURL.Complete = sCommand;
774cdf0e10cSrcweir         uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY );
775cdf0e10cSrcweir         xTrans->parseStrict( aURL );
776cdf0e10cSrcweir         uno::Reference< frame::XDispatch >  xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 );
777cdf0e10cSrcweir         if( xDisp.is() )
778cdf0e10cSrcweir         {
779cdf0e10cSrcweir             uno::Sequence< beans::PropertyValue > aSeq;
780cdf0e10cSrcweir             xDisp->dispatch( aURL, aSeq );
781cdf0e10cSrcweir             bRet = true;
782cdf0e10cSrcweir         }
783cdf0e10cSrcweir     }
784cdf0e10cSrcweir     return bRet;
785cdf0e10cSrcweir }
786