1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew 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 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 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 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 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 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(), 389cdf0e10cSrcweir SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, 390cdf0e10cSrcweir SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, 391cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 392cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 393cdf0e10cSrcweir 0); 394cdf0e10cSrcweir 395cdf0e10cSrcweir // dynamische oder feste Hoehe 396cdf0e10cSrcweir // 397cdf0e10cSrcweir SfxBoolItem aOn(SID_ATTR_PAGE_ON, sal_True); 398cdf0e10cSrcweir aHeaderSet.Put(aOn); 399cdf0e10cSrcweir 400cdf0e10cSrcweir const SwFmtFrmSize &rFrmSize = pHeaderFmt->GetFrmSize(); 401cdf0e10cSrcweir const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType(); 402cdf0e10cSrcweir SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE); 403cdf0e10cSrcweir aHeaderSet.Put(aDynamic); 404cdf0e10cSrcweir 405cdf0e10cSrcweir // Links gleich rechts 406cdf0e10cSrcweir // 407cdf0e10cSrcweir SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsHeaderShared()); 408cdf0e10cSrcweir aHeaderSet.Put(aShared); 409cdf0e10cSrcweir 410cdf0e10cSrcweir // Groesse 411cdf0e10cSrcweir SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize())); 412cdf0e10cSrcweir aHeaderSet.Put(aSize); 413cdf0e10cSrcweir 414cdf0e10cSrcweir // Rahmen-Attribute umschaufeln 415cdf0e10cSrcweir // 416cdf0e10cSrcweir aHeaderSet.Put(pHeaderFmt->GetAttrSet()); 417cdf0e10cSrcweir aHeaderSet.Put( aBoxInfo ); 418cdf0e10cSrcweir 419cdf0e10cSrcweir // SetItem erzeugen 420cdf0e10cSrcweir // 421cdf0e10cSrcweir SvxSetItem aSetItem(SID_ATTR_PAGE_HEADERSET, aHeaderSet); 422cdf0e10cSrcweir rSet.Put(aSetItem); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir // Footer 426cdf0e10cSrcweir if(rMaster.GetFooter().IsActive()) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir const SwFmtFooter &rFooterFmt = rMaster.GetFooter(); 429cdf0e10cSrcweir const SwFrmFmt *pFooterFmt = rFooterFmt.GetFooterFmt(); 430cdf0e10cSrcweir ASSERT(pFooterFmt != 0, kein FooterFormat.); 431cdf0e10cSrcweir 432cdf0e10cSrcweir // FooterInfo, Raender, Hintergrund, Umrandung 433cdf0e10cSrcweir // 434cdf0e10cSrcweir SfxItemSet aFooterSet( *rSet.GetPool(), 435cdf0e10cSrcweir SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, 436cdf0e10cSrcweir SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, 437cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 438cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END-1, 439cdf0e10cSrcweir 0); 440cdf0e10cSrcweir 441cdf0e10cSrcweir // dynamische oder feste Hoehe 442cdf0e10cSrcweir // 443cdf0e10cSrcweir SfxBoolItem aOn(SID_ATTR_PAGE_ON, sal_True); 444cdf0e10cSrcweir aFooterSet.Put(aOn); 445cdf0e10cSrcweir 446cdf0e10cSrcweir const SwFmtFrmSize &rFrmSize = pFooterFmt->GetFrmSize(); 447cdf0e10cSrcweir const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType(); 448cdf0e10cSrcweir SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE); 449cdf0e10cSrcweir aFooterSet.Put(aDynamic); 450cdf0e10cSrcweir 451cdf0e10cSrcweir // Links gleich rechts 452cdf0e10cSrcweir // 453cdf0e10cSrcweir SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsFooterShared()); 454cdf0e10cSrcweir aFooterSet.Put(aShared); 455cdf0e10cSrcweir 456cdf0e10cSrcweir // Groesse 457cdf0e10cSrcweir SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize())); 458cdf0e10cSrcweir aFooterSet.Put(aSize); 459cdf0e10cSrcweir 460cdf0e10cSrcweir // Rahmen-Attribute umschaufeln 461cdf0e10cSrcweir // 462cdf0e10cSrcweir aFooterSet.Put(pFooterFmt->GetAttrSet()); 463cdf0e10cSrcweir aFooterSet.Put( aBoxInfo ); 464cdf0e10cSrcweir 465cdf0e10cSrcweir // SetItem erzeugen 466cdf0e10cSrcweir // 467cdf0e10cSrcweir SvxSetItem aSetItem(SID_ATTR_PAGE_FOOTERSET, aFooterSet); 468cdf0e10cSrcweir rSet.Put(aSetItem); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir 471cdf0e10cSrcweir // Fussnoten einbauen 472cdf0e10cSrcweir // 473cdf0e10cSrcweir SwPageFtnInfo& rInfo = (SwPageFtnInfo&)rPageDesc.GetFtnInfo(); 474cdf0e10cSrcweir SwPageFtnInfoItem aFtnItem(FN_PARAM_FTN_INFO, rInfo); 475cdf0e10cSrcweir rSet.Put(aFtnItem); 476cdf0e10cSrcweir 477cdf0e10cSrcweir // Registerhaltigkeit 478cdf0e10cSrcweir 479cdf0e10cSrcweir const SwTxtFmtColl* pCol = rPageDesc.GetRegisterFmtColl(); 480cdf0e10cSrcweir SwRegisterItem aReg(pCol != 0); 481cdf0e10cSrcweir aReg.SetWhich(SID_SWREGISTER_MODE); 482cdf0e10cSrcweir rSet.Put(aReg); 483cdf0e10cSrcweir if(pCol) 484cdf0e10cSrcweir rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, pCol->GetName())); 485cdf0e10cSrcweir 486cdf0e10cSrcweir } 487cdf0e10cSrcweir 488cdf0e10cSrcweir 489cdf0e10cSrcweir /*-------------------------------------------------------------------- 490cdf0e10cSrcweir Beschreibung: DefaultTabs setzen 491cdf0e10cSrcweir --------------------------------------------------------------------*/ 492cdf0e10cSrcweir 493cdf0e10cSrcweir 494cdf0e10cSrcweir void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem& rTabs) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir if( rTabs.Count() ) 497cdf0e10cSrcweir return; 498cdf0e10cSrcweir { 499cdf0e10cSrcweir SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT ); 500cdf0e10cSrcweir rTabs.Insert( aSwTabStop ); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir 504cdf0e10cSrcweir /*-------------------------------------------------------------------- 505cdf0e10cSrcweir Beschreibung: Abstand zwischen zwei Tabs 506cdf0e10cSrcweir --------------------------------------------------------------------*/ 507cdf0e10cSrcweir 508cdf0e10cSrcweir 509cdf0e10cSrcweir sal_uInt16 GetTabDist(const SvxTabStopItem& rTabs) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir sal_uInt16 nDefDist; 512cdf0e10cSrcweir if( rTabs.Count() ) 513cdf0e10cSrcweir nDefDist = (sal_uInt16)( rTabs[0].GetTabPos() ); 514cdf0e10cSrcweir else 515cdf0e10cSrcweir nDefDist = 1134; // 2cm 516cdf0e10cSrcweir return nDefDist; 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir 520cdf0e10cSrcweir // erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese 521cdf0e10cSrcweir void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet ) 522cdf0e10cSrcweir { 523cdf0e10cSrcweir const SfxPoolItem* pItem; 524cdf0e10cSrcweir SwFmtPageDesc aPgDesc; 525cdf0e10cSrcweir 526cdf0e10cSrcweir sal_Bool bChanged = sal_False; 527cdf0e10cSrcweir // Seitennummer 528cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_PARA_PAGENUM, sal_False, &pItem)) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir aPgDesc.SetNumOffset(((SfxUInt16Item*)pItem)->GetValue()); 531cdf0e10cSrcweir bChanged = sal_True; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PARA_MODEL, sal_False, &pItem )) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir const String& rDescName = ((SvxPageModelItem*)pItem)->GetValue(); 536cdf0e10cSrcweir if( rDescName.Len() ) // kein Name -> PageDesc ausschalten! 537cdf0e10cSrcweir { 538cdf0e10cSrcweir // nur loeschen, wenn PageDesc eingschaltet wird! 539cdf0e10cSrcweir rSet.ClearItem( RES_BREAK ); 540cdf0e10cSrcweir SwPageDesc* pDesc = ((SwWrtShell&)rShell).FindPageDescByName( 541cdf0e10cSrcweir rDescName, sal_True ); 542cdf0e10cSrcweir if( pDesc ) 543cdf0e10cSrcweir aPgDesc.RegisterToPageDesc( *pDesc ); 544cdf0e10cSrcweir } 545cdf0e10cSrcweir rSet.ClearItem( SID_ATTR_PARA_MODEL ); 546cdf0e10cSrcweir bChanged = sal_True; 547cdf0e10cSrcweir } 548cdf0e10cSrcweir else 549cdf0e10cSrcweir { 550cdf0e10cSrcweir SfxItemSet aCoreSet(rShell.GetView().GetPool(), RES_PAGEDESC, RES_PAGEDESC ); 551cdf0e10cSrcweir rShell.GetCurAttr( aCoreSet ); 552cdf0e10cSrcweir if(SFX_ITEM_SET == aCoreSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) ) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir if( ((SwFmtPageDesc*)pItem)->GetPageDesc() ) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir aPgDesc.RegisterToPageDesc( *((SwFmtPageDesc*)pItem)->GetPageDesc() ); 557cdf0e10cSrcweir } 558cdf0e10cSrcweir } 559cdf0e10cSrcweir } 560cdf0e10cSrcweir 561cdf0e10cSrcweir 562cdf0e10cSrcweir if(bChanged) 563cdf0e10cSrcweir rSet.Put( aPgDesc ); 564cdf0e10cSrcweir } 565cdf0e10cSrcweir 566cdf0e10cSrcweir 567cdf0e10cSrcweir // erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese 568cdf0e10cSrcweir void SwToSfxPageDescAttr( SfxItemSet& rCoreSet ) 569cdf0e10cSrcweir { 570cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 571cdf0e10cSrcweir String aName; 572cdf0e10cSrcweir sal_uInt16 nPageNum = 0; 573cdf0e10cSrcweir sal_Bool bPut = sal_True; 574cdf0e10cSrcweir switch( rCoreSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir case SFX_ITEM_SET: 577cdf0e10cSrcweir { 578cdf0e10cSrcweir if( ((SwFmtPageDesc*)pItem)->GetPageDesc() ) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir aName = ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetName(); 581cdf0e10cSrcweir nPageNum = ((SwFmtPageDesc*)pItem)->GetNumOffset(); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir rCoreSet.ClearItem( RES_PAGEDESC ); 584cdf0e10cSrcweir // Seitennummer 585cdf0e10cSrcweir } 586cdf0e10cSrcweir break; 587cdf0e10cSrcweir 588cdf0e10cSrcweir case SFX_ITEM_AVAILABLE: 589cdf0e10cSrcweir break; 590cdf0e10cSrcweir 591cdf0e10cSrcweir default: 592cdf0e10cSrcweir bPut = sal_False; 593cdf0e10cSrcweir } 594cdf0e10cSrcweir SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, nPageNum ); 595cdf0e10cSrcweir rCoreSet.Put( aPageNum ); 596cdf0e10cSrcweir 597cdf0e10cSrcweir if(bPut) 598cdf0e10cSrcweir rCoreSet.Put( SvxPageModelItem( aName, sal_True, SID_ATTR_PARA_MODEL ) ); 599cdf0e10cSrcweir } 600cdf0e10cSrcweir 601cdf0e10cSrcweir /*-------------------------------------------------------------------- 602cdf0e10cSrcweir Beschreibung: Metric ermitteln 603cdf0e10cSrcweir --------------------------------------------------------------------*/ 604cdf0e10cSrcweir 605cdf0e10cSrcweir 606cdf0e10cSrcweir FieldUnit GetDfltMetric(sal_Bool bWeb) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir return SW_MOD()->GetUsrPref(bWeb)->GetMetric(); 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir /*-------------------------------------------------------------------- 612cdf0e10cSrcweir Beschreibung: Metric ermitteln 613cdf0e10cSrcweir --------------------------------------------------------------------*/ 614cdf0e10cSrcweir 615cdf0e10cSrcweir 616cdf0e10cSrcweir void SetDfltMetric( FieldUnit eMetric, sal_Bool bWeb ) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir SW_MOD()->ApplyUserMetric(eMetric, bWeb); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir 621cdf0e10cSrcweir /*-----------------09.04.98 16:58------------------- 622cdf0e10cSrcweir 623cdf0e10cSrcweir --------------------------------------------------*/ 624cdf0e10cSrcweir sal_uInt16 InsertStringSorted(const String& rEntry, ListBox& rToFill, sal_uInt16 nOffset ) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir sal_uInt16 i = nOffset; 627cdf0e10cSrcweir CollatorWrapper& rCaseColl = ::GetAppCaseCollator(); 628cdf0e10cSrcweir 629cdf0e10cSrcweir for( ; i < rToFill.GetEntryCount(); i++ ) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir if( 0 < rCaseColl.compareString( rToFill.GetEntry(i), rEntry )) 632cdf0e10cSrcweir break; 633cdf0e10cSrcweir } 634cdf0e10cSrcweir return rToFill.InsertEntry(rEntry, i); 635cdf0e10cSrcweir } 636cdf0e10cSrcweir void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, sal_Bool bSorted, sal_Bool bWithDefault) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir sal_Bool bHasOffset = rToFill.GetEntryCount() > 0; 639cdf0e10cSrcweir SfxStyleSheetBasePool* pPool = pDocSh->GetStyleSheetPool(); 640cdf0e10cSrcweir pPool->SetSearchMask(SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL); 641cdf0e10cSrcweir SwDoc* pDoc = pDocSh->GetDoc(); 642cdf0e10cSrcweir const SfxStyleSheetBase* pBase = pPool->First(); 643cdf0e10cSrcweir String sStandard; 644cdf0e10cSrcweir SwStyleNameMapper::FillUIName( RES_POOLCOLL_STANDARD, sStandard ); 645cdf0e10cSrcweir while(pBase) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir if(bWithDefault || pBase->GetName() != sStandard) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir sal_uInt16 nPos; 650cdf0e10cSrcweir if(bSorted) 651cdf0e10cSrcweir nPos = InsertStringSorted(pBase->GetName(), rToFill, bHasOffset ); 652cdf0e10cSrcweir else 653cdf0e10cSrcweir nPos = rToFill.InsertEntry(pBase->GetName()); 654cdf0e10cSrcweir long nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( pBase->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); 655cdf0e10cSrcweir rToFill.SetEntryData( nPos, (void*) (nPoolId)); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir pBase = pPool->Next(); 658cdf0e10cSrcweir } 659cdf0e10cSrcweir // non-pool styles 660cdf0e10cSrcweir const SwCharFmts* pFmts = pDoc->GetCharFmts(); 661cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pFmts->Count(); i++) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir const SwCharFmt* pFmt = (*pFmts)[i]; 664cdf0e10cSrcweir if(pFmt->IsDefault()) 665cdf0e10cSrcweir continue; 666cdf0e10cSrcweir const String& rName = pFmt->GetName(); 667cdf0e10cSrcweir if(rToFill.GetEntryPos(rName) == LISTBOX_ENTRY_NOTFOUND) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir sal_uInt16 nPos; 670cdf0e10cSrcweir if(bSorted) 671cdf0e10cSrcweir nPos = InsertStringSorted(rName, rToFill, bHasOffset ); 672cdf0e10cSrcweir else 673cdf0e10cSrcweir nPos = rToFill.InsertEntry(rName); 674cdf0e10cSrcweir long nPoolId = USHRT_MAX; 675cdf0e10cSrcweir rToFill.SetEntryData( nPos, (void*) (nPoolId)); 676cdf0e10cSrcweir } 677cdf0e10cSrcweir } 678cdf0e10cSrcweir }; 679cdf0e10cSrcweir 680cdf0e10cSrcweir /* -----------------27.04.98 08:26------------------- 681cdf0e10cSrcweir * 682cdf0e10cSrcweir * --------------------------------------------------*/ 683cdf0e10cSrcweir SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, sal_uInt16 *pPercent, 684cdf0e10cSrcweir SwWrtShell* pSh ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir //Die Breite zu besorgen ist etwas komplizierter. 687cdf0e10cSrcweir SwTwips nWidth = 0; 688cdf0e10cSrcweir const sal_Int16 eOri = pFmt->GetHoriOrient().GetHoriOrient(); 689cdf0e10cSrcweir switch(eOri) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir case text::HoriOrientation::FULL: nWidth = rCols.GetRight(); break; 692cdf0e10cSrcweir case text::HoriOrientation::LEFT_AND_WIDTH: 693cdf0e10cSrcweir case text::HoriOrientation::LEFT: 694cdf0e10cSrcweir case text::HoriOrientation::RIGHT: 695cdf0e10cSrcweir case text::HoriOrientation::CENTER: 696cdf0e10cSrcweir nWidth = pFmt->GetFrmSize().GetWidth(); 697cdf0e10cSrcweir break; 698cdf0e10cSrcweir default: 699cdf0e10cSrcweir { 700cdf0e10cSrcweir if(pSh) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir const SwFrmFmt *pFlyFmt; 703cdf0e10cSrcweir if ( 0 == (pFlyFmt = pSh->GetFlyFrmFmt()) ) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir nWidth = pSh->GetAnyCurRect(RECT_PAGE_PRT).Width(); 706cdf0e10cSrcweir } 707cdf0e10cSrcweir else 708cdf0e10cSrcweir { 709cdf0e10cSrcweir nWidth = pSh->GetAnyCurRect(RECT_FLY_PRT_EMBEDDED).Width(); 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir else 713cdf0e10cSrcweir { 714cdf0e10cSrcweir DBG_ERROR("wo soll die Breite denn herkommen?"); 715cdf0e10cSrcweir } 716cdf0e10cSrcweir const SvxLRSpaceItem& rLRSpace = pFmt->GetLRSpace(); 717cdf0e10cSrcweir nWidth -= (rLRSpace.GetRight() + rLRSpace.GetLeft()); 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir if (pPercent) 721cdf0e10cSrcweir *pPercent = pFmt->GetFrmSize().GetWidthPercent(); 722cdf0e10cSrcweir return nWidth; 723cdf0e10cSrcweir } 724cdf0e10cSrcweir 725cdf0e10cSrcweir /*------------------------------------------------------------------------*/ 726cdf0e10cSrcweir 727cdf0e10cSrcweir String GetAppLangDateTimeString( const DateTime& rDT ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir const SvtSysLocale aSysLocale; 730cdf0e10cSrcweir const LocaleDataWrapper& rAppLclData = aSysLocale.GetLocaleData(); 731cdf0e10cSrcweir String sRet( rAppLclData.getDate( rDT )); 732cdf0e10cSrcweir ( sRet += ' ' ) += rAppLclData.getTime( rDT, sal_False, sal_False ); 733cdf0e10cSrcweir return sRet; 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir /*-- 26.01.2006 08:06:33--------------------------------------------------- 737cdf0e10cSrcweir 738cdf0e10cSrcweir -----------------------------------------------------------------------*/ 739cdf0e10cSrcweir bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, sal_uInt16 nId ) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir bool bRet = false; 742cdf0e10cSrcweir sal_uInt16 nItemCount = rMenu.GetItemCount(); 743cdf0e10cSrcweir String sCommand; 744cdf0e10cSrcweir for( sal_uInt16 nItem = 0; nItem < nItemCount; ++nItem) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir PopupMenu* pPopup = rMenu.GetPopupMenu( rMenu.GetItemId( nItem ) ); 747cdf0e10cSrcweir if(pPopup) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir sCommand = pPopup->GetItemCommand(nId); 750cdf0e10cSrcweir if(sCommand.Len()) 751cdf0e10cSrcweir break; 752cdf0e10cSrcweir } 753cdf0e10cSrcweir } 754cdf0e10cSrcweir if(sCommand.Len()) 755cdf0e10cSrcweir { 756cdf0e10cSrcweir uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame().GetFrameInterface(); 757cdf0e10cSrcweir uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY ); 758cdf0e10cSrcweir util::URL aURL; 759cdf0e10cSrcweir aURL.Complete = sCommand; 760cdf0e10cSrcweir uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); 761cdf0e10cSrcweir xTrans->parseStrict( aURL ); 762cdf0e10cSrcweir uno::Reference< frame::XDispatch > xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); 763cdf0e10cSrcweir if( xDisp.is() ) 764cdf0e10cSrcweir { 765cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aSeq; 766cdf0e10cSrcweir xDisp->dispatch( aURL, aSeq ); 767cdf0e10cSrcweir bRet = true; 768cdf0e10cSrcweir } 769cdf0e10cSrcweir } 770cdf0e10cSrcweir return bRet; 771cdf0e10cSrcweir } 772