1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 31*cdf0e10cSrcweir #include <editeng/flditem.hxx> 32*cdf0e10cSrcweir #include <sfx2/printer.hxx> 33*cdf0e10cSrcweir #include <svl/inethist.hxx> 34*cdf0e10cSrcweir #include <svl/poolitem.hxx> 35*cdf0e10cSrcweir #include <svl/flagitem.hxx> 36*cdf0e10cSrcweir #include <unotools/useroptions.hxx> 37*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 38*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 39*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 40*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 41*cdf0e10cSrcweir #include <sfx2/request.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <editeng/measfld.hxx> 44*cdf0e10cSrcweir #include <editeng/editstat.hxx> 45*cdf0e10cSrcweir #include <editeng/editeng.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <svx/dialogs.hrc> 48*cdf0e10cSrcweir #include <svx/svdotext.hxx> 49*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 50*cdf0e10cSrcweir #include <svx/svdopage.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include <sfx2/sfxdlg.hxx> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #define _SD_DLL // fuer SD_MOD() 58*cdf0e10cSrcweir #include "sdmod.hxx" 59*cdf0e10cSrcweir #include "sddll.hxx" 60*cdf0e10cSrcweir #include "app.hrc" 61*cdf0e10cSrcweir #include "glob.hrc" 62*cdf0e10cSrcweir #include "strings.hrc" 63*cdf0e10cSrcweir #include "res_bmp.hrc" 64*cdf0e10cSrcweir #include "ViewShell.hxx" 65*cdf0e10cSrcweir #ifndef SD_FRAMW_VIEW_HXX 66*cdf0e10cSrcweir #include "FrameView.hxx" 67*cdf0e10cSrcweir #endif 68*cdf0e10cSrcweir #include "sdattr.hxx" 69*cdf0e10cSrcweir #include "tpoption.hrc" 70*cdf0e10cSrcweir #include "optsitem.hxx" 71*cdf0e10cSrcweir #include "DrawDocShell.hxx" 72*cdf0e10cSrcweir #include "drawdoc.hxx" 73*cdf0e10cSrcweir #include "Outliner.hxx" 74*cdf0e10cSrcweir #include "sdresid.hxx" 75*cdf0e10cSrcweir #include "pres.hxx" 76*cdf0e10cSrcweir #include "DrawViewShell.hxx" 77*cdf0e10cSrcweir #include "OutlineViewShell.hxx" 78*cdf0e10cSrcweir #include "OutlineView.hxx" 79*cdf0e10cSrcweir #include "ViewShellBase.hxx" 80*cdf0e10cSrcweir #include "sdpage.hxx" 81*cdf0e10cSrcweir #include "sdxfer.hxx" 82*cdf0e10cSrcweir #include "sdabstdlg.hxx" 83*cdf0e10cSrcweir #include "tpoption.hrc" 84*cdf0e10cSrcweir #include "prntopts.hrc" 85*cdf0e10cSrcweir #include <svl/intitem.hxx> 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir /** retrieves the page that is currently painted. This will only be the master page 88*cdf0e10cSrcweir if the current drawn view only shows the master page*/ 89*cdf0e10cSrcweir static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, bool& bMasterView ) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir if( !pInfo ) 92*cdf0e10cSrcweir return 0; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir bMasterView = false; 95*cdf0e10cSrcweir SdPage* pPage = dynamic_cast< SdPage* >( pInfo->GetSdrPage() ); 96*cdf0e10cSrcweir SdrOutliner* pOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir // special case, someone already set the current page on the EditFieldInfo 99*cdf0e10cSrcweir // This is used from the svx::UnoGraphicsExporter f.e. 100*cdf0e10cSrcweir if( pPage ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir bMasterView = false; 103*cdf0e10cSrcweir return pPage; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir // first try to check if we are inside the outline view 107*cdf0e10cSrcweir sd::OutlineView* pSdView = NULL; 108*cdf0e10cSrcweir if( pViewSh && pViewSh->ISA(sd::OutlineViewShell)) 109*cdf0e10cSrcweir pSdView = static_cast<sd::OutlineView*> (static_cast<sd::OutlineViewShell*>(pViewSh)->GetView()); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir if (pSdView != NULL && (pOutliner == pSdView->GetOutliner())) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir // outline mode 114*cdf0e10cSrcweir int nPgNum = 0; 115*cdf0e10cSrcweir Outliner* pOutl = pSdView->GetOutliner(); 116*cdf0e10cSrcweir long nPos = pInfo->GetPara(); 117*cdf0e10cSrcweir sal_uLong nParaPos = 0; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir for( Paragraph* pPara = pOutl->GetParagraph( 0 ); pPara && nPos >= 0; pPara = pOutl->GetParagraph( ++nParaPos ), nPos-- ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) 122*cdf0e10cSrcweir nPgNum++; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir pPage = pViewSh->GetDoc()->GetSdPage( (sal_uInt16)nPgNum, PK_STANDARD ); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir else 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir // draw mode, slide mode and preview. Get the processed page from the outliner 130*cdf0e10cSrcweir if(pOutliner) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir pPage = dynamic_cast< SdPage* >(const_cast< SdrPage* >(pOutliner->getVisualizedPage())); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir // The path using GetPaintingPageView() and GetCurrentPaintingDisplayInfo() 136*cdf0e10cSrcweir // is no longer needed. I debugged and checked all usages of PageNumber decompositions 137*cdf0e10cSrcweir // which all use the new possibility of setting the visualized page at the SdrOutliner. 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // if all else failed, geht the current page from the object that is 140*cdf0e10cSrcweir // currently formated from the document 141*cdf0e10cSrcweir if(!pPage) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir const SdrTextObj* pTextObj = (pViewSh && pViewSh->GetDoc()) ? pViewSh->GetDoc()->GetFormattingTextObj() : NULL; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir if( pTextObj ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() ); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir if(pPage) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir bMasterView = pPage && pPage->IsMasterPage(); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir return pPage; 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir /************************************************************************* 161*cdf0e10cSrcweir |* 162*cdf0e10cSrcweir |* Link fuer CalcFieldValue des Outliners 163*cdf0e10cSrcweir |* 164*cdf0e10cSrcweir \************************************************************************/ 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir if (pInfo) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir const SvxFieldData* pField = pInfo->GetField().GetField(); 171*cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = NULL; 172*cdf0e10cSrcweir SdDrawDocument* pDoc = 0; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir SdrOutliner* pSdrOutliner = dynamic_cast< SdrOutliner* >( pInfo->GetOutliner() ); 175*cdf0e10cSrcweir if( pSdrOutliner ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj(); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir if( pTextObj ) 180*cdf0e10cSrcweir pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir if( pDoc ) 183*cdf0e10cSrcweir pDocShell = pDoc->GetDocSh(); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir if( !pDocShell ) 187*cdf0e10cSrcweir pDocShell = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir const SvxDateField* pDateField = 0; 190*cdf0e10cSrcweir const SvxExtTimeField* pExtTimeField = 0; 191*cdf0e10cSrcweir const SvxExtFileField* pExtFileField = 0; 192*cdf0e10cSrcweir const SvxAuthorField* pAuthorField = 0; 193*cdf0e10cSrcweir const SvxURLField* pURLField = 0; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir if( (pDateField = dynamic_cast< const SvxDateField* >(pField)) != 0 ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); 198*cdf0e10cSrcweir pInfo->SetRepresentation( pDateField->GetFormatted( *GetNumberFormatter(), eLang ) ); 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir else if( (pExtTimeField = dynamic_cast< const SvxExtTimeField *>(pField)) != 0 ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); 203*cdf0e10cSrcweir pInfo->SetRepresentation( pExtTimeField->GetFormatted( *GetNumberFormatter(), eLang ) ); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir else if( (pExtFileField = dynamic_cast< const SvxExtFileField * >(pField)) != 0 ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir if( pDocShell && (pExtFileField->GetType() != SVXFILETYPE_FIX) ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir String aName; 210*cdf0e10cSrcweir if( pDocShell->HasName() ) 211*cdf0e10cSrcweir aName = pDocShell->GetMedium()->GetName(); 212*cdf0e10cSrcweir else 213*cdf0e10cSrcweir aName = pDocShell->GetName(); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir const_cast< SvxExtFileField* >(pExtFileField)->SetFile( aName ); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir pInfo->SetRepresentation( pExtFileField->GetFormatted() ); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir else if( (pAuthorField = dynamic_cast< const SvxAuthorField* >( pField )) != 0 ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir if( pAuthorField->GetType() != SVXAUTHORTYPE_FIX ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir SvtUserOptions aUserOptions; 225*cdf0e10cSrcweir SvxAuthorField aAuthorField( 226*cdf0e10cSrcweir aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID(), 227*cdf0e10cSrcweir pAuthorField->GetType(), pAuthorField->GetFormat() ); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir *(const_cast< SvxAuthorField* >(pAuthorField)) = aAuthorField; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir pInfo->SetRepresentation( pAuthorField->GetFormatted() ); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir else if( dynamic_cast< const SvxPageField* >(pField) ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir String aRepresentation; 237*cdf0e10cSrcweir aRepresentation += sal_Unicode( ' ' ); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; 240*cdf0e10cSrcweir if(pViewSh == NULL) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); 243*cdf0e10cSrcweir if(pBase) 244*cdf0e10cSrcweir pViewSh = pBase->GetMainViewShell().get(); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir if( !pDoc && pViewSh ) 247*cdf0e10cSrcweir pDoc = pViewSh->GetDoc(); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir bool bMasterView; 250*cdf0e10cSrcweir SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir if( pPage && pDoc && !bMasterView ) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir int nPgNum; 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir if( (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir nPgNum = pViewSh->GetPrintedHandoutPageNum(); 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir else 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir nPgNum = (pPage->GetPageNum() - 1) / 2 + 1; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir aRepresentation = pDoc->CreatePageNumValue((sal_uInt16)nPgNum); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir else 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir static String aNumberText( SdResId( STR_FIELD_PLACEHOLDER_NUMBER ) ); 269*cdf0e10cSrcweir aRepresentation = aNumberText; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir pInfo->SetRepresentation( aRepresentation ); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir else if( dynamic_cast< const SvxPagesField* >(pField) ) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir String aRepresentation; 277*cdf0e10cSrcweir aRepresentation += sal_Unicode( ' ' ); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; 280*cdf0e10cSrcweir if(pViewSh == NULL) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current()); 283*cdf0e10cSrcweir if(pBase) 284*cdf0e10cSrcweir pViewSh = pBase->GetMainViewShell().get(); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir if( !pDoc && pViewSh ) 287*cdf0e10cSrcweir pDoc = pViewSh->GetDoc(); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir bool bMasterView; 290*cdf0e10cSrcweir SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir sal_uInt16 nPageCount = 0; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir if( !bMasterView ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir if( pPage && (pPage->GetPageKind() == PK_HANDOUT) && pViewSh ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir nPageCount = pViewSh->GetPrintedHandoutPageCount(); 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir else if( pDoc ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir nPageCount = (sal_uInt16)pDoc->GetSdPageCount(PK_STANDARD); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir if( nPageCount > 0 ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir aRepresentation = pDoc->CreatePageNumValue(nPageCount); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir else 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir static String aNumberText( SdResId( STR_FIELD_PLACEHOLDER_COUNT ) ); 313*cdf0e10cSrcweir aRepresentation = aNumberText; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir pInfo->SetRepresentation( aRepresentation ); 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir else if( (pURLField = dynamic_cast< const SvxURLField* >(pField)) != 0 ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir switch ( pURLField->GetFormat() ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App??? 323*cdf0e10cSrcweir case SVXURLFORMAT_REPR: 324*cdf0e10cSrcweir pInfo->SetRepresentation( pURLField->GetRepresentation() ); 325*cdf0e10cSrcweir break; 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir case SVXURLFORMAT_URL: 328*cdf0e10cSrcweir pInfo->SetRepresentation( pURLField->GetURL() ); 329*cdf0e10cSrcweir break; 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir String aURL = pURLField->GetURL(); 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir svtools::ColorConfig aConfig; 335*cdf0e10cSrcweir svtools::ColorConfigEntry eEntry = 336*cdf0e10cSrcweir INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS; 337*cdf0e10cSrcweir pInfo->SetTxtColor( aConfig.GetColorValue(eEntry).nColor ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir else if ( dynamic_cast< const SdrMeasureField* >(pField)) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir pInfo->ClearFldColor(); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir else 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir String aRepresentation; 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir bool bHeaderField = dynamic_cast< const SvxHeaderField* >( pField ) != 0; 348*cdf0e10cSrcweir bool bFooterField = !bHeaderField && (dynamic_cast< const SvxFooterField* >( pField ) != 0 ); 349*cdf0e10cSrcweir bool bDateTimeField = !bHeaderField && !bFooterField && (dynamic_cast< const SvxDateTimeField* >( pField ) != 0); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir if( bHeaderField || bFooterField || bDateTimeField ) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL; 354*cdf0e10cSrcweir bool bMasterView = false; 355*cdf0e10cSrcweir SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView ); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir if( (pPage == NULL) || bMasterView ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir if( bHeaderField ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir static String aHeaderStr( SdResId( STR_FIELD_PLACEHOLDER_HEADER ) ); 362*cdf0e10cSrcweir aRepresentation = aHeaderStr; 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir else if (bFooterField ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir static String aFooterStr( SdResId( STR_FIELD_PLACEHOLDER_FOOTER ) ); 367*cdf0e10cSrcweir aRepresentation = aFooterStr; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir else if (bDateTimeField ) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir static String aDateTimeStr( SdResId( STR_FIELD_PLACEHOLDER_DATETIME ) ); 372*cdf0e10cSrcweir aRepresentation = aDateTimeStr; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir const sd::HeaderFooterSettings &rSettings = pPage->getHeaderFooterSettings(); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir if( bHeaderField ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir aRepresentation = rSettings.maHeaderText; 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir else if( bFooterField ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir aRepresentation = rSettings.maFooterText; 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir else if( bDateTimeField ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir if( rSettings.mbDateTimeIsFixed ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir aRepresentation = rSettings.maDateTimeText; 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir else 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir Date aDate; 396*cdf0e10cSrcweir Time aTime; 397*cdf0e10cSrcweir LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); 398*cdf0e10cSrcweir aRepresentation = SvxDateTimeField::GetFormatted( aDate, aTime, (SvxDateFormat)rSettings.meDateTimeFormat, *GetNumberFormatter(), eLang ); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir else 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir DBG_ERROR("sd::SdModule::CalcFieldValueHdl(), unknown field type!"); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir if( aRepresentation.Len() == 0 ) // TODO: Edit engine doesn't handle empty fields? 409*cdf0e10cSrcweir aRepresentation += sal_Unicode( ' ' ); 410*cdf0e10cSrcweir pInfo->SetRepresentation( aRepresentation ); 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir return(0); 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir /************************************************************************* 420*cdf0e10cSrcweir |* 421*cdf0e10cSrcweir |* virt. Methoden fuer Optionendialog 422*cdf0e10cSrcweir |* 423*cdf0e10cSrcweir \************************************************************************/ 424*cdf0e10cSrcweir SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir ::sd::FrameView* pFrameView = NULL; 427*cdf0e10cSrcweir ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); 428*cdf0e10cSrcweir SdDrawDocument* pDoc = NULL; 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir // Hier wird der DocType vom Optionsdialog gesetzt (nicht Dokument!) 431*cdf0e10cSrcweir DocumentType eDocType = DOCUMENT_TYPE_IMPRESS; 432*cdf0e10cSrcweir if( nSlot == SID_SD_GRAPHIC_OPTIONS ) 433*cdf0e10cSrcweir eDocType = DOCUMENT_TYPE_DRAW; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir ::sd::ViewShell* pViewShell = NULL; 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir if (pDocSh) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir pDoc = pDocSh->GetDoc(); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir // Wenn der Optionsdialog zum Dokumenttyp identisch ist, 442*cdf0e10cSrcweir // kann auch die FrameView mit uebergeben werden: 443*cdf0e10cSrcweir if( pDoc && eDocType == pDoc->GetDocumentType() ) 444*cdf0e10cSrcweir pFrameView = pDocSh->GetFrameView(); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir pViewShell = pDocSh->GetViewShell(); 447*cdf0e10cSrcweir if (pViewShell != NULL) 448*cdf0e10cSrcweir pViewShell->WriteFrameViewData(); 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir SdOptions* pOptions = GetSdOptions(eDocType); 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir // Pool hat standardmaessig MapUnit Twips (Baeh!) 454*cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 455*cdf0e10cSrcweir rPool.SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir SfxItemSet* pRet = new SfxItemSet( rPool, 458*cdf0e10cSrcweir SID_ATTR_METRIC, SID_ATTR_METRIC, 459*cdf0e10cSrcweir SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP, 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir ATTR_OPTIONS_LAYOUT, ATTR_OPTIONS_LAYOUT, 462*cdf0e10cSrcweir ATTR_OPTIONS_CONTENTS, ATTR_OPTIONS_CONTENTS, 463*cdf0e10cSrcweir ATTR_OPTIONS_MISC, ATTR_OPTIONS_MISC, 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir ATTR_OPTIONS_SNAP, ATTR_OPTIONS_SNAP, 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir ATTR_OPTIONS_SCALE_START, ATTR_OPTIONS_SCALE_END, 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS, 472*cdf0e10cSrcweir 0 ); 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir // TP_OPTIONS_LAYOUT: 475*cdf0e10cSrcweir pRet->Put( SdOptionsLayoutItem( ATTR_OPTIONS_LAYOUT, pOptions, pFrameView ) ); 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir sal_uInt16 nDefTab = 0; 478*cdf0e10cSrcweir if( pFrameView) 479*cdf0e10cSrcweir nDefTab = pDoc->GetDefaultTabulator(); 480*cdf0e10cSrcweir else 481*cdf0e10cSrcweir nDefTab = pOptions->GetDefTab(); 482*cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, nDefTab ) ); 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir FieldUnit nMetric = (FieldUnit)0xffff; 485*cdf0e10cSrcweir if( pFrameView) 486*cdf0e10cSrcweir nMetric = pDoc->GetUIUnit(); 487*cdf0e10cSrcweir else 488*cdf0e10cSrcweir nMetric = (FieldUnit)pOptions->GetMetric(); 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir if( nMetric == (FieldUnit)0xffff ) 491*cdf0e10cSrcweir nMetric = GetFieldUnit(); 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)nMetric ) ); 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir // TP_OPTIONS_CONTENTS: 496*cdf0e10cSrcweir pRet->Put( SdOptionsContentsItem( ATTR_OPTIONS_CONTENTS, pOptions, pFrameView ) ); 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir // TP_OPTIONS_MISC: 499*cdf0e10cSrcweir SdOptionsMiscItem aSdOptionsMiscItem( ATTR_OPTIONS_MISC, pOptions, pFrameView ); 500*cdf0e10cSrcweir if ( pFrameView ) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir aSdOptionsMiscItem.GetOptionsMisc().SetSummationOfParagraphs( pDoc->IsSummationOfParagraphs() ); 503*cdf0e10cSrcweir aSdOptionsMiscItem.GetOptionsMisc().SetPrinterIndependentLayout ( 504*cdf0e10cSrcweir (sal_uInt16)pDoc->GetPrinterIndependentLayout()); 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir pRet->Put( aSdOptionsMiscItem ); 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir // TP_OPTIONS_SNAP: 510*cdf0e10cSrcweir pRet->Put( SdOptionsSnapItem( ATTR_OPTIONS_SNAP, pOptions, pFrameView ) ); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir // TP_SCALE: 513*cdf0e10cSrcweir sal_uInt32 nW = 10L; 514*cdf0e10cSrcweir sal_uInt32 nH = 10L; 515*cdf0e10cSrcweir sal_Int32 nX; 516*cdf0e10cSrcweir sal_Int32 nY; 517*cdf0e10cSrcweir if( pDocSh ) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir SdrPage* pPage = (SdrPage*) pDoc->GetSdPage(0, PK_STANDARD); 520*cdf0e10cSrcweir Size aSize(pPage->GetSize()); 521*cdf0e10cSrcweir nW = aSize.Width(); 522*cdf0e10cSrcweir nH = aSize.Height(); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir if(pFrameView) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir const Fraction& rFraction = pDoc->GetUIScale(); 528*cdf0e10cSrcweir nX=rFraction.GetNumerator(); 529*cdf0e10cSrcweir nY=rFraction.GetDenominator(); 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir else 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir // Optionen aus Configdatei holen 534*cdf0e10cSrcweir pOptions->GetScale( nX, nY ); 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) ); 538*cdf0e10cSrcweir pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) ); 539*cdf0e10cSrcweir pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_WIDTH, nW ) ); 540*cdf0e10cSrcweir pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_HEIGHT, nH ) ); 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir // TP_OPTIONS_PRINT: 544*cdf0e10cSrcweir pRet->Put( SdOptionsPrintItem( ATTR_OPTIONS_PRINT, pOptions ) ); 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir // RID_SVXPAGE_GRID: 547*cdf0e10cSrcweir pRet->Put( SdOptionsGridItem( SID_ATTR_GRID_OPTIONS, pOptions ) ); 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir return pRet; 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 554*cdf0e10cSrcweir sal_Bool bNewDefTab = sal_False; 555*cdf0e10cSrcweir sal_Bool bNewPrintOptions = sal_False; 556*cdf0e10cSrcweir sal_Bool bMiscOptions = sal_False; 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir ::sd::FrameView* pFrameView = NULL; 559*cdf0e10cSrcweir ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() ); 560*cdf0e10cSrcweir SdDrawDocument* pDoc = NULL; 561*cdf0e10cSrcweir // Hier wird der DocType vom Optionsdialog gesetzt (nicht Dokument!) 562*cdf0e10cSrcweir DocumentType eDocType = DOCUMENT_TYPE_IMPRESS; 563*cdf0e10cSrcweir if( nSlot == SID_SD_GRAPHIC_OPTIONS ) 564*cdf0e10cSrcweir eDocType = DOCUMENT_TYPE_DRAW; 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir ::sd::ViewShell* pViewShell = NULL; 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir if (pDocSh) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir pDoc = pDocSh->GetDoc(); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir // Wenn der Optionsdialog zum Dokumenttyp identisch ist, 573*cdf0e10cSrcweir // kann auch die FrameView mit uebergeben werden: 574*cdf0e10cSrcweir if( pDoc && eDocType == pDoc->GetDocumentType() ) 575*cdf0e10cSrcweir pFrameView = pDocSh->GetFrameView(); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir pViewShell = pDocSh->GetViewShell(); 578*cdf0e10cSrcweir if (pViewShell != NULL) 579*cdf0e10cSrcweir pViewShell->WriteFrameViewData(); 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir SdOptions* pOptions = GetSdOptions(eDocType); 582*cdf0e10cSrcweir // Raster 583*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , 584*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pItem )) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir const SdOptionsGridItem* pGridItem = (SdOptionsGridItem*) pItem; 587*cdf0e10cSrcweir pGridItem->SetOptions( pOptions ); 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir // Layout 591*cdf0e10cSrcweir const SdOptionsLayoutItem* pLayoutItem = NULL; 592*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_LAYOUT, 593*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pLayoutItem )) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir pLayoutItem->SetOptions( pOptions ); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir // Metric 599*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC, sal_False, &pItem ) ) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir if( pDoc && eDocType == pDoc->GetDocumentType() ) 602*cdf0e10cSrcweir PutItem( *pItem ); 603*cdf0e10cSrcweir pOptions->SetMetric( ( (SfxUInt16Item*) pItem )->GetValue() ); 604*cdf0e10cSrcweir } 605*cdf0e10cSrcweir sal_uInt16 nDefTab = pOptions->GetDefTab(); 606*cdf0e10cSrcweir // Default-Tabulator 607*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_DEFTABSTOP, sal_False, &pItem ) ) 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir nDefTab = ( (SfxUInt16Item*) pItem )->GetValue(); 610*cdf0e10cSrcweir pOptions->SetDefTab( nDefTab ); 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir bNewDefTab = sal_True; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir // Massstab 616*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_X, sal_False, &pItem ) ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir sal_Int32 nX = ( (SfxInt32Item*) pItem )->GetValue(); 619*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_Y, sal_False, &pItem ) ) 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir sal_Int32 nY = ( (SfxInt32Item*) pItem )->GetValue(); 622*cdf0e10cSrcweir pOptions->SetScale( nX, nY ); 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir // #92067# Apply to document only if doc type match 625*cdf0e10cSrcweir if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() ) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir pDoc->SetUIScale( Fraction( nX, nY ) ); 628*cdf0e10cSrcweir if( pViewShell ) 629*cdf0e10cSrcweir pViewShell->SetRuler( pViewShell->HasRuler() ); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir } 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir // Contents (Inhalte) 635*cdf0e10cSrcweir const SdOptionsContentsItem* pContentsItem = NULL; 636*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_CONTENTS, 637*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pContentsItem )) 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir pContentsItem->SetOptions( pOptions ); 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir // Misc (Sonstiges) 643*cdf0e10cSrcweir const SdOptionsMiscItem* pMiscItem = NULL; 644*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_MISC, 645*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pMiscItem )) 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir pMiscItem->SetOptions( pOptions ); 648*cdf0e10cSrcweir bMiscOptions = sal_True; 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir // Fangen/Einrasten 652*cdf0e10cSrcweir const SdOptionsSnapItem* pSnapItem = NULL; 653*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_SNAP, 654*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pSnapItem )) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir pSnapItem->SetOptions( pOptions ); 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir SfxItemSet aPrintSet( GetPool(), 660*cdf0e10cSrcweir SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, 661*cdf0e10cSrcweir SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 662*cdf0e10cSrcweir ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT, 663*cdf0e10cSrcweir 0 ); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir // Drucken 666*cdf0e10cSrcweir const SdOptionsPrintItem* pPrintItem = NULL; 667*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( ATTR_OPTIONS_PRINT, 668*cdf0e10cSrcweir sal_False, (const SfxPoolItem**) &pPrintItem )) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir pPrintItem->SetOptions( pOptions ); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir // PrintOptionsSet setzen 673*cdf0e10cSrcweir SdOptionsPrintItem aPrintItem( ATTR_OPTIONS_PRINT, pOptions ); 674*cdf0e10cSrcweir SfxFlagItem aFlagItem( SID_PRINTER_CHANGESTODOC ); 675*cdf0e10cSrcweir sal_uInt16 nFlags = 0; 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir nFlags = (aPrintItem.GetOptionsPrint().IsWarningSize() ? SFX_PRINTER_CHG_SIZE : 0) | 678*cdf0e10cSrcweir (aPrintItem.GetOptionsPrint().IsWarningOrientation() ? SFX_PRINTER_CHG_ORIENTATION : 0); 679*cdf0e10cSrcweir aFlagItem.SetValue( nFlags ); 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir aPrintSet.Put( aPrintItem ); 682*cdf0e10cSrcweir aPrintSet.Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) ); 683*cdf0e10cSrcweir aPrintSet.Put( aFlagItem ); 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir bNewPrintOptions = sal_True; 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir // Nur, wenn auch der Dokumenttyp uebereinstimmt... 689*cdf0e10cSrcweir if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() ) 690*cdf0e10cSrcweir { 691*cdf0e10cSrcweir if( bNewPrintOptions ) 692*cdf0e10cSrcweir { 693*cdf0e10cSrcweir pDocSh->GetPrinter(sal_True)->SetOptions( aPrintSet ); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir // Am Model den DefTab setzen 697*cdf0e10cSrcweir if( bNewDefTab ) 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir SdDrawDocument* pDocument = pDocSh->GetDoc(); 700*cdf0e10cSrcweir pDocument->SetDefaultTabulator( nDefTab ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False ); 703*cdf0e10cSrcweir if( pOutl ) 704*cdf0e10cSrcweir pOutl->SetDefTab( nDefTab ); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir ::sd::Outliner* pInternalOutl = pDocument->GetInternalOutliner( sal_False ); 707*cdf0e10cSrcweir if( pInternalOutl ) 708*cdf0e10cSrcweir pInternalOutl->SetDefTab( nDefTab ); 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir if ( bMiscOptions ) 711*cdf0e10cSrcweir { 712*cdf0e10cSrcweir pDoc->SetSummationOfParagraphs( pMiscItem->GetOptionsMisc().IsSummationOfParagraphs() ); 713*cdf0e10cSrcweir sal_uInt32 nSum = pMiscItem->GetOptionsMisc().IsSummationOfParagraphs() ? EE_CNTRL_ULSPACESUMMATION : 0; 714*cdf0e10cSrcweir sal_uInt32 nCntrl; 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir SdDrawDocument* pDocument = pDocSh->GetDoc(); 717*cdf0e10cSrcweir SdrOutliner& rOutl = pDocument->GetDrawOutliner( sal_False ); 718*cdf0e10cSrcweir nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; 719*cdf0e10cSrcweir rOutl.SetControlWord( nCntrl | nSum ); 720*cdf0e10cSrcweir ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False ); 721*cdf0e10cSrcweir if( pOutl ) 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; 724*cdf0e10cSrcweir pOutl->SetControlWord( nCntrl | nSum ); 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir pOutl = pDocument->GetInternalOutliner( sal_False ); 727*cdf0e10cSrcweir if( pOutl ) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION; 730*cdf0e10cSrcweir pOutl->SetControlWord( nCntrl | nSum ); 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir // Set printer independent layout mode. 734*cdf0e10cSrcweir if( pDoc->GetPrinterIndependentLayout() != pMiscItem->GetOptionsMisc().GetPrinterIndependentLayout() ) 735*cdf0e10cSrcweir pDoc->SetPrinterIndependentLayout (pMiscItem->GetOptionsMisc().GetPrinterIndependentLayout()); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir pOptions->StoreConfig(); 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir // Nur, wenn auch der Dokumenttyp uebereinstimmt... 742*cdf0e10cSrcweir if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() ) 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir FieldUnit eUIUnit = (FieldUnit) pOptions->GetMetric(); 745*cdf0e10cSrcweir pDoc->SetUIUnit(eUIUnit); 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir if (pViewShell) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir // #74495# make sure no one is in text edit mode, cause there 750*cdf0e10cSrcweir // are some pointers remembered else (!) 751*cdf0e10cSrcweir if(pViewShell->GetView()) 752*cdf0e10cSrcweir pViewShell->GetView()->SdrEndTextEdit(); 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir ::sd::FrameView* pFrame = pViewShell->GetFrameView(); 755*cdf0e10cSrcweir pFrame->Update(pOptions); 756*cdf0e10cSrcweir pViewShell->ReadFrameViewData(pFrame); 757*cdf0e10cSrcweir pViewShell->SetUIUnit(eUIUnit); 758*cdf0e10cSrcweir pViewShell->SetDefTabHRuler( nDefTab ); 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir if( pViewShell && pViewShell->GetViewFrame() ) 763*cdf0e10cSrcweir pViewShell->GetViewFrame()->GetBindings().InvalidateAll( sal_True ); 764*cdf0e10cSrcweir } 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir SfxTabPage* SdModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir SfxTabPage* pRet = NULL; 769*cdf0e10cSrcweir SfxAllItemSet aSet(*(rSet.GetPool())); 770*cdf0e10cSrcweir SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 771*cdf0e10cSrcweir if( pFact ) 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir switch(nId) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir case SID_SD_TP_CONTENTS: 776*cdf0e10cSrcweir case SID_SI_TP_CONTENTS: 777*cdf0e10cSrcweir { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsContentsTabPageCreatorFunc(); 778*cdf0e10cSrcweir if( fnCreatePage ) 779*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir break; 782*cdf0e10cSrcweir case SID_SD_TP_SNAP: 783*cdf0e10cSrcweir case SID_SI_TP_SNAP: 784*cdf0e10cSrcweir { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsSnapTabPageCreatorFunc(); 785*cdf0e10cSrcweir if( fnCreatePage ) 786*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir break; 789*cdf0e10cSrcweir case SID_SD_TP_PRINT: 790*cdf0e10cSrcweir case SID_SI_TP_PRINT: 791*cdf0e10cSrcweir { 792*cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetSdPrintOptionsTabPageCreatorFunc(); 793*cdf0e10cSrcweir if( fnCreatePage ) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 796*cdf0e10cSrcweir if(SID_SD_TP_PRINT == nId) 797*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); 798*cdf0e10cSrcweir pRet->PageCreated(aSet); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir break; 802*cdf0e10cSrcweir case SID_SI_TP_MISC: 803*cdf0e10cSrcweir case SID_SD_TP_MISC: 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetSdOptionsMiscTabPageCreatorFunc(); 806*cdf0e10cSrcweir if( fnCreatePage ) 807*cdf0e10cSrcweir { 808*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 809*cdf0e10cSrcweir if(SID_SD_TP_MISC == nId) 810*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE)); 811*cdf0e10cSrcweir else 812*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_IMPRESS_MODE)); 813*cdf0e10cSrcweir pRet->PageCreated(aSet); 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir break; 817*cdf0e10cSrcweir case RID_OFA_TP_INTERNATIONAL_SD: 818*cdf0e10cSrcweir case RID_OFA_TP_INTERNATIONAL_IMPR: 819*cdf0e10cSrcweir case RID_SVXPAGE_TEXTANIMATION : 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir SfxAbstractDialogFactory* pSfxFact = SfxAbstractDialogFactory::Create(); 822*cdf0e10cSrcweir if ( pSfxFact ) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pSfxFact->GetTabPageCreatorFunc( nId ); 825*cdf0e10cSrcweir if ( fnCreatePage ) 826*cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet ); 827*cdf0e10cSrcweir } 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir break; 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir DBG_ASSERT( pRet, "SdModule::CreateTabPage(): no valid ID for TabPage!" ); 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir return pRet; 835*cdf0e10cSrcweir } 836