1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION 28cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC 32cdf0e10cSrcweir #include <svx/dialogs.hrc> 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir #include <editeng/eeitem.hxx> 35cdf0e10cSrcweir #include <editeng/flditem.hxx> 36cdf0e10cSrcweir #include <editeng/langitem.hxx> 37cdf0e10cSrcweir #include <svx/langbox.hxx> 38cdf0e10cSrcweir #include <svx/svdotext.hxx> 39cdf0e10cSrcweir #include <editeng/editeng.hxx> 40cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #ifndef _SD_SDRESID_HXX 43cdf0e10cSrcweir #include "sdresid.hxx" 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <vcl/fixed.hxx> 47cdf0e10cSrcweir #include <vcl/button.hxx> 48cdf0e10cSrcweir #include <vcl/edit.hxx> 49cdf0e10cSrcweir #include <vcl/combobox.hxx> 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include "helpids.h" 52cdf0e10cSrcweir #include "Outliner.hxx" 53cdf0e10cSrcweir #include "dialogs.hrc" 54cdf0e10cSrcweir #include "headerfooterdlg.hxx" 55cdf0e10cSrcweir #include "DrawDocShell.hxx" 56cdf0e10cSrcweir #include "drawdoc.hxx" 57cdf0e10cSrcweir #include "ViewShell.hxx" 58cdf0e10cSrcweir 59cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 60cdf0e10cSrcweir // preview control for presentation layout 61cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 62cdf0e10cSrcweir #include <vcl/ctrl.hxx> 63cdf0e10cSrcweir #ifndef _SV_COLOR_HXX 64cdf0e10cSrcweir #include <tools/color.hxx> 65cdf0e10cSrcweir #endif 66cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 67cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 68cdf0e10cSrcweir #include <svx/xlndsit.hxx> 69cdf0e10cSrcweir #include <svx/xlineit0.hxx> 70cdf0e10cSrcweir #include <svx/xlnclit.hxx> 71cdf0e10cSrcweir #include <vcl/decoview.hxx> 72cdf0e10cSrcweir 73cdf0e10cSrcweir #include "undoheaderfooter.hxx" 74cdf0e10cSrcweir #include "sdundogr.hxx" 75cdf0e10cSrcweir #include "ViewShell.hxx" 76cdf0e10cSrcweir 77cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 78cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx> 79cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx> 80cdf0e10cSrcweir 81cdf0e10cSrcweir namespace sd 82cdf0e10cSrcweir { 83cdf0e10cSrcweir 84cdf0e10cSrcweir class PresLayoutPreview : public Control 85cdf0e10cSrcweir { 86cdf0e10cSrcweir private: 87cdf0e10cSrcweir SdPage* mpMaster; 88cdf0e10cSrcweir HeaderFooterSettings maSettings; 89cdf0e10cSrcweir Size maPageSize; 90cdf0e10cSrcweir Rectangle maOutRect; 91cdf0e10cSrcweir 92cdf0e10cSrcweir private: 93cdf0e10cSrcweir void Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted = false ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir public: 96cdf0e10cSrcweir PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster ); 97cdf0e10cSrcweir ~PresLayoutPreview(); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir void update( HeaderFooterSettings& rSettings ); 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 107cdf0e10cSrcweir // tab page for slide & header'n'notes 108cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 109cdf0e10cSrcweir 110cdf0e10cSrcweir namespace sd 111cdf0e10cSrcweir { 112cdf0e10cSrcweir 113cdf0e10cSrcweir const int nDateTimeFormatsCount = 10; 114cdf0e10cSrcweir int nDateTimeFormats[nDateTimeFormatsCount] = 115cdf0e10cSrcweir { 116cdf0e10cSrcweir SVXDATEFORMAT_A, 117cdf0e10cSrcweir SVXDATEFORMAT_F, 118cdf0e10cSrcweir SVXDATEFORMAT_D, 119cdf0e10cSrcweir SVXDATEFORMAT_C, 120cdf0e10cSrcweir 121cdf0e10cSrcweir SVXDATEFORMAT_A | (SVXTIMEFORMAT_24_HM << 4), 122cdf0e10cSrcweir SVXDATEFORMAT_A | (SVXTIMEFORMAT_12_HM << 4), 123cdf0e10cSrcweir 124cdf0e10cSrcweir (SVXTIMEFORMAT_24_HM << 4), 125cdf0e10cSrcweir (SVXTIMEFORMAT_24_HMS <<4), 126cdf0e10cSrcweir 127cdf0e10cSrcweir (SVXTIMEFORMAT_12_HM << 4 ), 128cdf0e10cSrcweir (SVXTIMEFORMAT_12_HMS << 4 ) 129cdf0e10cSrcweir }; 130cdf0e10cSrcweir 131cdf0e10cSrcweir class HeaderFooterTabPage : public TabPage 132cdf0e10cSrcweir { 133cdf0e10cSrcweir private: 134cdf0e10cSrcweir FixedLine maFLIncludeOnPage; 135cdf0e10cSrcweir 136cdf0e10cSrcweir CheckBox maCBHeader; 137cdf0e10cSrcweir FixedText maFTHeader; 138cdf0e10cSrcweir Edit maTBHeader; 139cdf0e10cSrcweir 140cdf0e10cSrcweir FixedLine maFLDateTime; 141cdf0e10cSrcweir CheckBox maCBDateTime; 142cdf0e10cSrcweir RadioButton maRBDateTimeFixed; 143cdf0e10cSrcweir RadioButton maRBDateTimeAutomatic; 144cdf0e10cSrcweir Edit maTBDateTimeFixed; 145cdf0e10cSrcweir ListBox maCBDateTimeFormat; 146cdf0e10cSrcweir FixedText maFTDateTimeLanguage; 147cdf0e10cSrcweir SvxLanguageBox maCBDateTimeLanguage; 148cdf0e10cSrcweir 149cdf0e10cSrcweir FixedLine maFLFooter; 150cdf0e10cSrcweir CheckBox maCBFooter; 151cdf0e10cSrcweir FixedText maFTFooter; 152cdf0e10cSrcweir Edit maTBFooter; 153cdf0e10cSrcweir 154cdf0e10cSrcweir FixedLine maFLSlideNumber; 155cdf0e10cSrcweir CheckBox maCBSlideNumber; 156cdf0e10cSrcweir 157cdf0e10cSrcweir FixedLine maFLNotOnTitle; 158cdf0e10cSrcweir CheckBox maCBNotOnTitle; 159cdf0e10cSrcweir 160cdf0e10cSrcweir PushButton maPBApplyToAll; 161cdf0e10cSrcweir PushButton maPBApply; 162cdf0e10cSrcweir CancelButton maPBCancel; 163cdf0e10cSrcweir HelpButton maPBHelp; 164cdf0e10cSrcweir 165cdf0e10cSrcweir PresLayoutPreview maCTPreview; 166cdf0e10cSrcweir 167cdf0e10cSrcweir SdPage* mpCurrentPage; 168cdf0e10cSrcweir SdDrawDocument * mpDoc; 169cdf0e10cSrcweir HeaderFooterDialog* mpDialog; 170cdf0e10cSrcweir LanguageType meOldLanguage; 171cdf0e10cSrcweir 172cdf0e10cSrcweir bool mbHandoutMode; 173cdf0e10cSrcweir 174cdf0e10cSrcweir DECL_LINK( UpdateOnClickHdl, void * ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir DECL_LINK( ClickApplyToAllHdl, void * ); 177cdf0e10cSrcweir DECL_LINK( ClickApplyHdl, void * ); 178cdf0e10cSrcweir DECL_LINK( ClickCancelHdl, void * ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir DECL_LINK( LanguageChangeHdl, void * ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir void FillFormatList(int eFormat); 183cdf0e10cSrcweir void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet ); 184cdf0e10cSrcweir void GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage ); 185cdf0e10cSrcweir 186cdf0e10cSrcweir public: 187cdf0e10cSrcweir HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); 188cdf0e10cSrcweir ~HeaderFooterTabPage(); 189cdf0e10cSrcweir 190cdf0e10cSrcweir static SfxTabPage* Create( ::Window*, const SfxItemSet& ); 191cdf0e10cSrcweir static sal_uInt16* GetRanges(); 192cdf0e10cSrcweir 193cdf0e10cSrcweir void init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply ); 194cdf0e10cSrcweir void getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ); 195cdf0e10cSrcweir void update(); 196cdf0e10cSrcweir }; 197cdf0e10cSrcweir 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 201cdf0e10cSrcweir 202cdf0e10cSrcweir using namespace ::sd; 203cdf0e10cSrcweir 204cdf0e10cSrcweir 205cdf0e10cSrcweir HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) : 206cdf0e10cSrcweir TabDialog ( pParent, SdResId( RID_SD_DLG_HEADERFOOTER ) ), 207cdf0e10cSrcweir maTabCtrl( this, SdResId( 1 ) ), 208cdf0e10cSrcweir mpDoc( pDoc ), 209cdf0e10cSrcweir mpCurrentPage( pCurrentPage ), 210cdf0e10cSrcweir mpViewShell( pViewShell ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir FreeResource(); 213cdf0e10cSrcweir 214cdf0e10cSrcweir SdPage* pSlide; 215cdf0e10cSrcweir SdPage* pNotes; 216cdf0e10cSrcweir if( pCurrentPage->GetPageKind() == PK_STANDARD ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir pSlide = pCurrentPage; 219cdf0e10cSrcweir pNotes = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() + 1 ); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir else if( pCurrentPage->GetPageKind() == PK_NOTES ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir pNotes = pCurrentPage; 224cdf0e10cSrcweir pSlide = (SdPage*)pDoc->GetPage( pCurrentPage->GetPageNum() -1 ); 225cdf0e10cSrcweir mpCurrentPage = pSlide; 226cdf0e10cSrcweir } 227cdf0e10cSrcweir else 228cdf0e10cSrcweir { 229cdf0e10cSrcweir // handout 230cdf0e10cSrcweir pSlide = pDoc->GetSdPage( 0, PK_STANDARD ); 231cdf0e10cSrcweir pNotes = pDoc->GetSdPage( 0, PK_NOTES ); 232cdf0e10cSrcweir mpCurrentPage = NULL; 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir // maTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL ); 236cdf0e10cSrcweir maTabCtrl.Show(); 237cdf0e10cSrcweir 238cdf0e10cSrcweir mpSlideTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pSlide, false ); 239cdf0e10cSrcweir mpSlideTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_SLIDE ); 240cdf0e10cSrcweir maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_SLIDE, mpSlideTabPage ); 241cdf0e10cSrcweir 242cdf0e10cSrcweir Size aSiz = mpSlideTabPage->GetSizePixel(); 243cdf0e10cSrcweir Size aCtrlSiz = maTabCtrl.GetOutputSizePixel(); 244cdf0e10cSrcweir // set size on TabControl only if smaller than TabPage 245cdf0e10cSrcweir if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir maTabCtrl.SetOutputSizePixel( aSiz ); 248cdf0e10cSrcweir aCtrlSiz = aSiz; 249cdf0e10cSrcweir } 250cdf0e10cSrcweir 251cdf0e10cSrcweir mpNotesHandoutsTabPage = new HeaderFooterTabPage( this, &maTabCtrl, pDoc, pNotes, true ); 252cdf0e10cSrcweir mpNotesHandoutsTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT ); 253cdf0e10cSrcweir maTabCtrl.SetTabPage( RID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT, mpNotesHandoutsTabPage ); 254cdf0e10cSrcweir 255cdf0e10cSrcweir aSiz = mpNotesHandoutsTabPage->GetSizePixel(); 256cdf0e10cSrcweir if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir maTabCtrl.SetOutputSizePixel( aSiz ); 259cdf0e10cSrcweir aCtrlSiz = aSiz; 260cdf0e10cSrcweir } 261cdf0e10cSrcweir 262cdf0e10cSrcweir ActivatePageHdl( &maTabCtrl ); 263cdf0e10cSrcweir 264cdf0e10cSrcweir AdjustLayout(); 265cdf0e10cSrcweir 266cdf0e10cSrcweir maTabCtrl.SetActivatePageHdl( LINK( this, HeaderFooterDialog, ActivatePageHdl ) ); 267cdf0e10cSrcweir maTabCtrl.SetDeactivatePageHdl( LINK( this, HeaderFooterDialog, DeactivatePageHdl ) ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir maSlideSettings = pSlide->getHeaderFooterSettings(); 270cdf0e10cSrcweir 271cdf0e10cSrcweir const HeaderFooterSettings& rTitleSettings = mpDoc->GetSdPage(0, PK_STANDARD)->getHeaderFooterSettings(); 272cdf0e10cSrcweir bool bNotOnTitle = !rTitleSettings.mbFooterVisible && !rTitleSettings.mbSlideNumberVisible && !rTitleSettings.mbDateTimeVisible; 273cdf0e10cSrcweir 274cdf0e10cSrcweir mpSlideTabPage->init( maSlideSettings, bNotOnTitle, mpCurrentPage != NULL ); 275cdf0e10cSrcweir 276cdf0e10cSrcweir maNotesHandoutSettings = pNotes->getHeaderFooterSettings(); 277cdf0e10cSrcweir mpNotesHandoutsTabPage->init( maNotesHandoutSettings, false, false ); 278cdf0e10cSrcweir } 279cdf0e10cSrcweir 280cdf0e10cSrcweir // ----------------------------------------------------------------------- 281cdf0e10cSrcweir 282cdf0e10cSrcweir HeaderFooterDialog::~HeaderFooterDialog() 283cdf0e10cSrcweir { 284cdf0e10cSrcweir delete mpSlideTabPage; 285cdf0e10cSrcweir delete mpNotesHandoutsTabPage; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir // ----------------------------------------------------------------------- 289cdf0e10cSrcweir 290cdf0e10cSrcweir IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir const sal_uInt16 nId = pTabCtrl->GetCurPageId(); 293cdf0e10cSrcweir TabPage* pTabPage = pTabCtrl->GetTabPage( nId ); 294cdf0e10cSrcweir pTabPage->Show(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir return 0; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir // ----------------------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir IMPL_LINK( HeaderFooterDialog, DeactivatePageHdl, TabControl *, EMPTYARG ) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir return sal_True; 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir // ----------------------------------------------------------------------- 307cdf0e10cSrcweir 308cdf0e10cSrcweir short HeaderFooterDialog::Execute() 309cdf0e10cSrcweir { 310cdf0e10cSrcweir sal_uInt16 nRet = TabDialog::Execute(); 311cdf0e10cSrcweir if( nRet ) 312cdf0e10cSrcweir mpViewShell->GetDocSh()->SetModified(); 313cdf0e10cSrcweir return nRet; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir // ----------------------------------------------------------------------- 317cdf0e10cSrcweir 318cdf0e10cSrcweir void HeaderFooterDialog::ApplyToAll( TabPage* pPage ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir apply( true, pPage == mpSlideTabPage ); 321cdf0e10cSrcweir EndDialog(1); 322cdf0e10cSrcweir } 323cdf0e10cSrcweir 324cdf0e10cSrcweir // ----------------------------------------------------------------------- 325cdf0e10cSrcweir 326cdf0e10cSrcweir void HeaderFooterDialog::Apply( TabPage* pPage ) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir apply( false, pPage == mpSlideTabPage ); 329cdf0e10cSrcweir EndDialog(1); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir // ----------------------------------------------------------------------- 333cdf0e10cSrcweir 334cdf0e10cSrcweir void HeaderFooterDialog::Cancel( TabPage* ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir EndDialog(); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir // ----------------------------------------------------------------------- 340cdf0e10cSrcweir 341cdf0e10cSrcweir void HeaderFooterDialog::apply( bool bToAll, bool bForceSlides ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc); 344cdf0e10cSrcweir String aComment( GetText() ); 345cdf0e10cSrcweir pUndoGroup->SetComment( aComment ); 346cdf0e10cSrcweir 347cdf0e10cSrcweir HeaderFooterSettings aNewSettings; 348cdf0e10cSrcweir bool bNewNotOnTitle; 349cdf0e10cSrcweir 350cdf0e10cSrcweir // change slide settings first ... 351cdf0e10cSrcweir 352cdf0e10cSrcweir mpSlideTabPage->getData( aNewSettings, bNewNotOnTitle ); 353cdf0e10cSrcweir 354cdf0e10cSrcweir // only if we pressed apply or apply all on the slide tab page or if the slide settings 355cdf0e10cSrcweir // have been changed 356cdf0e10cSrcweir if( bForceSlides || !(aNewSettings == maSlideSettings) ) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir // apply to all slides 359cdf0e10cSrcweir if( bToAll ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir int nPageCount = mpDoc->GetSdPageCount( PK_STANDARD ); 362cdf0e10cSrcweir int nPage; 363cdf0e10cSrcweir for( nPage = 0; nPage < nPageCount; nPage++ ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_STANDARD ); 366cdf0e10cSrcweir change( pUndoGroup, pPage, aNewSettings ); 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir else 370cdf0e10cSrcweir { 371cdf0e10cSrcweir // apply only to the current slide 372cdf0e10cSrcweir DBG_ASSERT( mpCurrentPage && mpCurrentPage->GetPageKind() == PK_STANDARD, "no current page to apply to!" ); 373cdf0e10cSrcweir if( mpCurrentPage && (mpCurrentPage->GetPageKind() == PK_STANDARD) ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir change( pUndoGroup, mpCurrentPage, aNewSettings ); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir // if we don't want to have header&footer on the first slide 381cdf0e10cSrcweir if( bNewNotOnTitle ) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir // just hide them, plain simple UI feature 384cdf0e10cSrcweir HeaderFooterSettings aTempSettings = mpDoc->GetSdPage( 0, PK_STANDARD )->getHeaderFooterSettings(); 385cdf0e10cSrcweir 386cdf0e10cSrcweir aTempSettings.mbFooterVisible = false; 387cdf0e10cSrcweir aTempSettings.mbSlideNumberVisible = false; 388cdf0e10cSrcweir aTempSettings.mbDateTimeVisible = false; 389cdf0e10cSrcweir 390cdf0e10cSrcweir change( pUndoGroup, mpDoc->GetSdPage( 0, PK_STANDARD ), aTempSettings ); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir // now notes settings 394cdf0e10cSrcweir 395cdf0e10cSrcweir mpNotesHandoutsTabPage->getData( aNewSettings, bNewNotOnTitle ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir // only if we pressed apply or apply all on the notes tab page or if the notes settings 398cdf0e10cSrcweir // have been changed 399cdf0e10cSrcweir if( !bForceSlides || !(aNewSettings == maNotesHandoutSettings) ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir // first set to all notes pages 402cdf0e10cSrcweir int nPageCount = mpDoc->GetSdPageCount( PK_NOTES ); 403cdf0e10cSrcweir int nPage; 404cdf0e10cSrcweir for( nPage = 0; nPage < nPageCount; nPage++ ) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir SdPage* pPage = mpDoc->GetSdPage( (sal_uInt16)nPage, PK_NOTES ); 407cdf0e10cSrcweir 408cdf0e10cSrcweir change( pUndoGroup, pPage, aNewSettings ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir // and last but not least to the handout page 412cdf0e10cSrcweir change( pUndoGroup, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ), aNewSettings ); 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir // Undo Gruppe dem Undo Manager uebergeben 416cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager()->AddUndoAction(pUndoGroup); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir // ----------------------------------------------------------------------- 420cdf0e10cSrcweir 421cdf0e10cSrcweir void HeaderFooterDialog::change( SdUndoGroup* pUndoGroup, SdPage* pPage, const HeaderFooterSettings& rNewSettings ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir pUndoGroup->AddAction(new SdHeaderFooterUndoAction(mpDoc, pPage, rNewSettings )); 424cdf0e10cSrcweir pPage->setHeaderFooterSettings( rNewSettings ); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 428cdf0e10cSrcweir 429cdf0e10cSrcweir inline void moveY( ::Window& rWin, int deltaY ) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir Point aPos = rWin.GetPosPixel(); 432cdf0e10cSrcweir aPos.Y() += deltaY; 433cdf0e10cSrcweir rWin.SetPosPixel( aPos ); 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window* pWindow, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ) : 437cdf0e10cSrcweir TabPage( pWindow, SdResId( RID_SD_TABPAGE_HEADERFOOTER ) ), 438cdf0e10cSrcweir maFLIncludeOnPage( this, SdResId( FL_INCLUDE_ON_PAGE ) ), 439cdf0e10cSrcweir maCBHeader( this, SdResId( CB_HEADER ) ), 440cdf0e10cSrcweir maFTHeader( this, SdResId( FT_HEADER ) ), 441cdf0e10cSrcweir maTBHeader( this, SdResId( TB_HEADER_FIXED ) ), 442cdf0e10cSrcweir maFLDateTime( this, SdResId( FL_DATETIME ) ), 443cdf0e10cSrcweir maCBDateTime( this, SdResId( CB_DATETIME ) ), 444cdf0e10cSrcweir maRBDateTimeFixed( this, SdResId( RB_DATETIME_FIXED ) ), 445cdf0e10cSrcweir maRBDateTimeAutomatic( this, SdResId( RB_DATETIME_AUTOMATIC ) ), 446cdf0e10cSrcweir maTBDateTimeFixed( this, SdResId( TB_DATETIME_FIXED ) ), 447cdf0e10cSrcweir maCBDateTimeFormat( this, SdResId( CB_DATETIME_FORMAT ) ), 448cdf0e10cSrcweir maFTDateTimeLanguage( this, SdResId( FT_DATETIME_LANGUAGE ) ), 449cdf0e10cSrcweir maCBDateTimeLanguage( this, SdResId( CB_DATETIME_LANGUAGE ) ), 450cdf0e10cSrcweir 451cdf0e10cSrcweir maFLFooter( this, SdResId( FL_FOOTER ) ), 452cdf0e10cSrcweir maCBFooter( this, SdResId( CB_FOOTER ) ), 453cdf0e10cSrcweir maFTFooter( this, SdResId( FT_FOOTER ) ), 454cdf0e10cSrcweir maTBFooter( this, SdResId( TB_FOOTER_FIXED ) ), 455cdf0e10cSrcweir 456cdf0e10cSrcweir maFLSlideNumber( this, SdResId( FL_SLIDENUMBER ) ), 457cdf0e10cSrcweir maCBSlideNumber( this, SdResId( CB_SLIDENUMBER ) ), 458cdf0e10cSrcweir 459cdf0e10cSrcweir maFLNotOnTitle( this, SdResId( FL_NOTONTITLE ) ), 460cdf0e10cSrcweir maCBNotOnTitle( this, SdResId( CB_NOTONTITLE ) ), 461cdf0e10cSrcweir 462cdf0e10cSrcweir maPBApplyToAll( this, SdResId( BT_APPLYTOALL ) ), 463cdf0e10cSrcweir maPBApply( this, SdResId( BT_APPLY ) ), 464cdf0e10cSrcweir maPBCancel( this, SdResId( BT_CANCEL ) ), 465cdf0e10cSrcweir maPBHelp( this, SdResId( BT_HELP ) ), 466cdf0e10cSrcweir 467cdf0e10cSrcweir maCTPreview( this, SdResId( CT_PREVIEW ), 468cdf0e10cSrcweir pActualPage ? 469cdf0e10cSrcweir (pActualPage->IsMasterPage() ? pActualPage : (SdPage*)(&(pActualPage->TRG_GetMasterPage()))) : 470cdf0e10cSrcweir (pDoc->GetMasterSdPage( 0, bHandoutMode ? PK_NOTES : PK_STANDARD )) ), 471cdf0e10cSrcweir mpCurrentPage(pActualPage), 472cdf0e10cSrcweir mpDoc(pDoc), 473cdf0e10cSrcweir mpDialog(pDialog), 474cdf0e10cSrcweir mbHandoutMode( bHandoutMode ) 475cdf0e10cSrcweir 476cdf0e10cSrcweir { 477cdf0e10cSrcweir pDoc->StopWorkStartupDelay(); 478cdf0e10cSrcweir 479cdf0e10cSrcweir if( !mbHandoutMode ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir int deltaY = maCBHeader.GetPosPixel().Y() - maCBDateTime.GetPosPixel().Y(); 482cdf0e10cSrcweir 483cdf0e10cSrcweir moveY( maCBDateTime, deltaY ); 484cdf0e10cSrcweir moveY( maRBDateTimeFixed, deltaY ); 485cdf0e10cSrcweir moveY( maRBDateTimeAutomatic, deltaY ); 486cdf0e10cSrcweir moveY( maTBDateTimeFixed, deltaY ); 487cdf0e10cSrcweir moveY( maCBDateTimeFormat, deltaY ); 488cdf0e10cSrcweir moveY( maFTDateTimeLanguage, deltaY ); 489cdf0e10cSrcweir moveY( maCBDateTimeLanguage, deltaY ); 490cdf0e10cSrcweir moveY( maFLFooter, deltaY ); 491cdf0e10cSrcweir moveY( maCBFooter, deltaY ); 492cdf0e10cSrcweir moveY( maFTFooter, deltaY ); 493cdf0e10cSrcweir moveY( maTBFooter, deltaY ); 494cdf0e10cSrcweir moveY( maFLSlideNumber, deltaY ); 495cdf0e10cSrcweir moveY( maCBSlideNumber, deltaY ); 496cdf0e10cSrcweir moveY( maFLNotOnTitle, deltaY ); 497cdf0e10cSrcweir moveY( maCBNotOnTitle, deltaY ); 498cdf0e10cSrcweir } 499cdf0e10cSrcweir else 500cdf0e10cSrcweir { 501cdf0e10cSrcweir int deltaY = maPBApply.GetPosPixel().Y() - maPBCancel.GetPosPixel().Y(); 502cdf0e10cSrcweir 503cdf0e10cSrcweir moveY( maPBCancel, deltaY ); 504cdf0e10cSrcweir moveY( maPBHelp, deltaY ); 505cdf0e10cSrcweir 506cdf0e10cSrcweir String aPageNumberStr( SdResId( STR_PAGE_NUMBER ) ); 507cdf0e10cSrcweir maCBSlideNumber.SetText( aPageNumberStr ); 508cdf0e10cSrcweir 509cdf0e10cSrcweir String aIncludeOnPageStr( SdResId( STR_INCLUDE_ON_PAGE ) ); 510cdf0e10cSrcweir maFLIncludeOnPage.SetText( aIncludeOnPageStr ); 511cdf0e10cSrcweir } 512cdf0e10cSrcweir 513cdf0e10cSrcweir FreeResource(); 514cdf0e10cSrcweir 515cdf0e10cSrcweir maPBApply.Show( !mbHandoutMode ); 516cdf0e10cSrcweir maCBHeader.Show( mbHandoutMode ); 517cdf0e10cSrcweir maFTHeader.Show( mbHandoutMode ); 518cdf0e10cSrcweir maTBHeader.Show( mbHandoutMode ); 519cdf0e10cSrcweir maFLDateTime.Show( mbHandoutMode ); 520cdf0e10cSrcweir maFLNotOnTitle.Show( !mbHandoutMode ); 521cdf0e10cSrcweir maCBNotOnTitle.Show( !mbHandoutMode ); 522cdf0e10cSrcweir 523cdf0e10cSrcweir maCBDateTime.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 524cdf0e10cSrcweir maRBDateTimeFixed.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 525cdf0e10cSrcweir maRBDateTimeAutomatic.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 526cdf0e10cSrcweir maCBFooter.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 527cdf0e10cSrcweir maCBHeader.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 528cdf0e10cSrcweir maCBSlideNumber.SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) ); 529cdf0e10cSrcweir 530cdf0e10cSrcweir maPBApplyToAll.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyToAllHdl ) ); 531cdf0e10cSrcweir maPBApply.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickApplyHdl ) ); 532cdf0e10cSrcweir maPBCancel.SetClickHdl( LINK( this, HeaderFooterTabPage, ClickCancelHdl ) ); 533cdf0e10cSrcweir 534cdf0e10cSrcweir maCBDateTimeLanguage.SetLanguageList( LANG_LIST_ALL|LANG_LIST_ONLY_KNOWN, false ); 535cdf0e10cSrcweir maCBDateTimeLanguage.SetSelectHdl( LINK( this, HeaderFooterTabPage, LanguageChangeHdl ) ); 536cdf0e10cSrcweir 537cdf0e10cSrcweir GetOrSetDateTimeLanguage( meOldLanguage, false ); 538cdf0e10cSrcweir meOldLanguage = MsLangId::getRealLanguage( meOldLanguage ); 539cdf0e10cSrcweir maCBDateTimeLanguage.SelectLanguage( meOldLanguage ); 540cdf0e10cSrcweir 541cdf0e10cSrcweir FillFormatList(SVXDATEFORMAT_A); 542cdf0e10cSrcweir 543cdf0e10cSrcweir maTBHeader.SetAccessibleRelationMemberOf(&maCBHeader); 544cdf0e10cSrcweir maRBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime); 545cdf0e10cSrcweir maRBDateTimeAutomatic.SetAccessibleRelationMemberOf(&maCBDateTime); 546cdf0e10cSrcweir maTBDateTimeFixed.SetAccessibleName(maRBDateTimeFixed.GetText()); 547cdf0e10cSrcweir maTBDateTimeFixed.SetAccessibleRelationMemberOf(&maCBDateTime); 548cdf0e10cSrcweir maTBDateTimeFixed.SetAccessibleRelationLabeledBy(&maRBDateTimeFixed); 549cdf0e10cSrcweir maCBDateTimeFormat.SetAccessibleRelationMemberOf(&maCBDateTime); 550cdf0e10cSrcweir maCBDateTimeFormat.SetAccessibleName(maRBDateTimeAutomatic.GetText()); 551cdf0e10cSrcweir maCBDateTimeFormat.SetAccessibleRelationLabeledBy(&maRBDateTimeAutomatic); 552cdf0e10cSrcweir maCBDateTimeLanguage.SetAccessibleRelationMemberOf(&maCBDateTime); 553cdf0e10cSrcweir maTBFooter.SetAccessibleRelationMemberOf(&maCBFooter); 554cdf0e10cSrcweir maCBSlideNumber.SetAccessibleRelationMemberOf(&maFLIncludeOnPage); 555cdf0e10cSrcweir maCBFooter.SetAccessibleRelationMemberOf(&maFLIncludeOnPage); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir // ----------------------------------------------------------------------- 558cdf0e10cSrcweir 559cdf0e10cSrcweir HeaderFooterTabPage::~HeaderFooterTabPage() 560cdf0e10cSrcweir { 561cdf0e10cSrcweir } 562cdf0e10cSrcweir 563cdf0e10cSrcweir // ----------------------------------------------------------------------- 564cdf0e10cSrcweir 565cdf0e10cSrcweir IMPL_LINK( HeaderFooterTabPage, LanguageChangeHdl, void *, EMPTYARG ) 566cdf0e10cSrcweir { 567cdf0e10cSrcweir FillFormatList( (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() ) ); 568cdf0e10cSrcweir 569cdf0e10cSrcweir 570cdf0e10cSrcweir return 0L; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir // ----------------------------------------------------------------------- 574cdf0e10cSrcweir 575cdf0e10cSrcweir void HeaderFooterTabPage::FillFormatList( int eFormat ) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage(); 578cdf0e10cSrcweir 579cdf0e10cSrcweir maCBDateTimeFormat.Clear(); 580cdf0e10cSrcweir 581cdf0e10cSrcweir Date aDate; 582cdf0e10cSrcweir Time aTime; 583cdf0e10cSrcweir 584cdf0e10cSrcweir int nFormat; 585cdf0e10cSrcweir for( nFormat = 0; nFormat < nDateTimeFormatsCount; nFormat++ ) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, nDateTimeFormats[nFormat], *(SD_MOD()->GetNumberFormatter()), eLanguage ) ); 588cdf0e10cSrcweir sal_uInt16 nEntry = maCBDateTimeFormat.InsertEntry( aStr ); 589cdf0e10cSrcweir maCBDateTimeFormat.SetEntryData( nEntry, (void*)nDateTimeFormats[nFormat] ); 590cdf0e10cSrcweir if( nDateTimeFormats[nFormat] == eFormat ) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir maCBDateTimeFormat.SelectEntryPos( nEntry ); 593cdf0e10cSrcweir maCBDateTimeFormat.SetText( aStr ); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir } 596cdf0e10cSrcweir } 597cdf0e10cSrcweir 598cdf0e10cSrcweir // ----------------------------------------------------------------------- 599cdf0e10cSrcweir 600cdf0e10cSrcweir void HeaderFooterTabPage::init( const HeaderFooterSettings& rSettings, bool bNotOnTitle, bool bHasApply ) 601cdf0e10cSrcweir { 602cdf0e10cSrcweir maCBDateTime.Check( rSettings.mbDateTimeVisible ); 603cdf0e10cSrcweir maRBDateTimeFixed.Check( rSettings.mbDateTimeIsFixed ); 604cdf0e10cSrcweir maRBDateTimeAutomatic.Check( !rSettings.mbDateTimeIsFixed ); 605cdf0e10cSrcweir maTBDateTimeFixed.SetText( rSettings.maDateTimeText ); 606cdf0e10cSrcweir 607cdf0e10cSrcweir maCBHeader.Check( rSettings.mbHeaderVisible ); 608cdf0e10cSrcweir maTBHeader.SetText( rSettings.maHeaderText ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir maCBFooter.Check( rSettings.mbFooterVisible ); 611cdf0e10cSrcweir maTBFooter.SetText( rSettings.maFooterText ); 612cdf0e10cSrcweir 613cdf0e10cSrcweir maCBSlideNumber.Check( rSettings.mbSlideNumberVisible ); 614cdf0e10cSrcweir 615cdf0e10cSrcweir maCBNotOnTitle.Check( bNotOnTitle ); 616cdf0e10cSrcweir maPBApply.Enable( bHasApply ); 617cdf0e10cSrcweir 618cdf0e10cSrcweir maCBDateTimeLanguage.SelectLanguage( meOldLanguage ); 619cdf0e10cSrcweir 620cdf0e10cSrcweir sal_uInt16 nPos; 621cdf0e10cSrcweir for( nPos = 0; nPos < maCBDateTimeFormat.GetEntryCount(); nPos++ ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir int nFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( nPos ); 624cdf0e10cSrcweir if( nFormat == rSettings.meDateTimeFormat ) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir maCBDateTimeFormat.SelectEntryPos( nPos ); 627cdf0e10cSrcweir maCBDateTimeFormat.SetText( maCBDateTimeFormat.GetEntry(nPos) ); 628cdf0e10cSrcweir break; 629cdf0e10cSrcweir } 630cdf0e10cSrcweir } 631cdf0e10cSrcweir 632cdf0e10cSrcweir update(); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir 635cdf0e10cSrcweir // ----------------------------------------------------------------------- 636cdf0e10cSrcweir 637cdf0e10cSrcweir void HeaderFooterTabPage::getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir rSettings.mbDateTimeVisible = maCBDateTime.IsChecked(); 640cdf0e10cSrcweir rSettings.mbDateTimeIsFixed = maRBDateTimeFixed.IsChecked(); 641cdf0e10cSrcweir rSettings.maDateTimeText = maTBDateTimeFixed.GetText(); 642cdf0e10cSrcweir rSettings.mbFooterVisible = maCBFooter.IsChecked(); 643cdf0e10cSrcweir rSettings.maFooterText = maTBFooter.GetText(); 644cdf0e10cSrcweir rSettings.mbSlideNumberVisible = maCBSlideNumber.IsChecked(); 645cdf0e10cSrcweir rSettings.mbHeaderVisible = maCBHeader.IsChecked(); 646cdf0e10cSrcweir rSettings.maHeaderText = maTBHeader.GetText(); 647cdf0e10cSrcweir 648cdf0e10cSrcweir if( maCBDateTimeFormat.GetSelectEntryCount() == 1 ) 649cdf0e10cSrcweir rSettings.meDateTimeFormat = (int)(sal_IntPtr)maCBDateTimeFormat.GetEntryData( maCBDateTimeFormat.GetSelectEntryPos() ); 650cdf0e10cSrcweir 651cdf0e10cSrcweir LanguageType eLanguage = maCBDateTimeLanguage.GetSelectLanguage(); 652cdf0e10cSrcweir if( eLanguage != meOldLanguage ) 653cdf0e10cSrcweir GetOrSetDateTimeLanguage( eLanguage, true ); 654cdf0e10cSrcweir 655cdf0e10cSrcweir rNotOnTitle = maCBNotOnTitle.IsChecked(); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir // ----------------------------------------------------------------------- 659cdf0e10cSrcweir 660cdf0e10cSrcweir void HeaderFooterTabPage::update() 661cdf0e10cSrcweir { 662cdf0e10cSrcweir maRBDateTimeFixed.Enable( maCBDateTime.IsChecked() ); 663cdf0e10cSrcweir maTBDateTimeFixed.Enable( maRBDateTimeFixed.IsChecked() && maCBDateTime.IsChecked() ); 664cdf0e10cSrcweir maRBDateTimeAutomatic.Enable( maCBDateTime.IsChecked() ); 665cdf0e10cSrcweir maCBDateTimeFormat.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); 666cdf0e10cSrcweir maFTDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); 667cdf0e10cSrcweir maCBDateTimeLanguage.Enable( maCBDateTime.IsChecked() && maRBDateTimeAutomatic.IsChecked() ); 668cdf0e10cSrcweir 669cdf0e10cSrcweir maFTFooter.Enable( maCBFooter.IsChecked() ); 670cdf0e10cSrcweir maTBFooter.Enable( maCBFooter.IsChecked() ); 671cdf0e10cSrcweir 672cdf0e10cSrcweir maFTHeader.Enable( maCBHeader.IsChecked() ); 673cdf0e10cSrcweir maTBHeader.Enable( maCBHeader.IsChecked() ); 674cdf0e10cSrcweir 675cdf0e10cSrcweir HeaderFooterSettings aSettings; 676cdf0e10cSrcweir bool bNotOnTitle; 677cdf0e10cSrcweir getData( aSettings, bNotOnTitle ); 678cdf0e10cSrcweir maCTPreview.update( aSettings ); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir 681cdf0e10cSrcweir // ----------------------------------------------------------------------- 682cdf0e10cSrcweir 683cdf0e10cSrcweir IMPL_LINK( HeaderFooterTabPage, UpdateOnClickHdl, void *, EMPTYARG ) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir update(); 686cdf0e10cSrcweir 687cdf0e10cSrcweir return 0; 688cdf0e10cSrcweir } 689cdf0e10cSrcweir 690cdf0e10cSrcweir // ----------------------------------------------------------------------- 691cdf0e10cSrcweir 692cdf0e10cSrcweir IMPL_LINK( HeaderFooterTabPage, ClickApplyToAllHdl, void *, EMPTYARG ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir mpDialog->ApplyToAll( this ); 695cdf0e10cSrcweir return 0; 696cdf0e10cSrcweir } 697cdf0e10cSrcweir 698cdf0e10cSrcweir // ----------------------------------------------------------------------- 699cdf0e10cSrcweir 700cdf0e10cSrcweir IMPL_LINK( HeaderFooterTabPage, ClickApplyHdl, void *, EMPTYARG ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir mpDialog->Apply( this ); 703cdf0e10cSrcweir return 0; 704cdf0e10cSrcweir } 705cdf0e10cSrcweir 706cdf0e10cSrcweir // ----------------------------------------------------------------------- 707cdf0e10cSrcweir 708cdf0e10cSrcweir IMPL_LINK( HeaderFooterTabPage, ClickCancelHdl, void *, EMPTYARG ) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir mpDialog->Cancel( this ); 711cdf0e10cSrcweir return 0; 712cdf0e10cSrcweir } 713cdf0e10cSrcweir 714cdf0e10cSrcweir // ----------------------------------------------------------------------- 715cdf0e10cSrcweir 716cdf0e10cSrcweir void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet ) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir if( mbHandoutMode ) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir // if set, set it on all notes master pages 721cdf0e10cSrcweir if( bSet ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount( PK_NOTES ); 724cdf0e10cSrcweir sal_uInt16 nPage; 725cdf0e10cSrcweir for( nPage = 0; nPage < nPageCount; nPage++ ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_NOTES ) ); 728cdf0e10cSrcweir } 729cdf0e10cSrcweir } 730cdf0e10cSrcweir 731cdf0e10cSrcweir // and set it, or just get it from the handout master page 732cdf0e10cSrcweir GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 0, PK_HANDOUT ) ); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir else 735cdf0e10cSrcweir { 736cdf0e10cSrcweir // get the language from the first master page 737cdf0e10cSrcweir // or set it to all master pages 738cdf0e10cSrcweir sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PK_NOTES ) : 1; 739cdf0e10cSrcweir sal_uInt16 nPage; 740cdf0e10cSrcweir for( nPage = 0; nPage < nPageCount; nPage++ ) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PK_STANDARD ) ); 743cdf0e10cSrcweir } 744cdf0e10cSrcweir } 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir // ----------------------------------------------------------------------- 748cdf0e10cSrcweir 749cdf0e10cSrcweir void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType &rLanguage, bool bSet, SdPage* pPage ) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir if( pPage ) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir SdrTextObj* pObj = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_DATETIME ); 754cdf0e10cSrcweir if( pObj ) 755cdf0e10cSrcweir { 756cdf0e10cSrcweir Outliner* pOutl = mpDoc->GetInternalOutliner(); 757cdf0e10cSrcweir pOutl->Init( OUTLINERMODE_TEXTOBJECT ); 758cdf0e10cSrcweir sal_uInt16 nOutlMode = pOutl->GetMode(); 759cdf0e10cSrcweir 760cdf0e10cSrcweir EditEngine* pEdit = const_cast< EditEngine* >(&pOutl->GetEditEngine()); 761cdf0e10cSrcweir 762cdf0e10cSrcweir OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); 763cdf0e10cSrcweir if( pOPO ) 764cdf0e10cSrcweir pOutl->SetText( *pOPO ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir EFieldInfo aFieldInfo; 767cdf0e10cSrcweir aFieldInfo.pFieldItem = NULL; 768cdf0e10cSrcweir 769cdf0e10cSrcweir sal_uInt16 nParaCount = pEdit->GetParagraphCount(); 770cdf0e10cSrcweir sal_uInt16 nPara; 771cdf0e10cSrcweir for( nPara = 0; (nPara < nParaCount) && (aFieldInfo.pFieldItem == NULL); nPara++ ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir sal_uInt16 nFieldCount = pEdit->GetFieldCount( nPara ); 774cdf0e10cSrcweir sal_uInt16 nField; 775cdf0e10cSrcweir for( nField = 0; (nField < nFieldCount) && (aFieldInfo.pFieldItem == NULL); nField++ ) 776cdf0e10cSrcweir { 777cdf0e10cSrcweir aFieldInfo = pEdit->GetFieldInfo( nPara, nField ); 778cdf0e10cSrcweir if( aFieldInfo.pFieldItem ) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir const SvxFieldData* pFieldData = aFieldInfo.pFieldItem->GetField(); 781cdf0e10cSrcweir if( pFieldData && pFieldData->ISA( SvxDateTimeField ) ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir break; 784cdf0e10cSrcweir } 785cdf0e10cSrcweir } 786cdf0e10cSrcweir aFieldInfo.pFieldItem = NULL; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir } 789cdf0e10cSrcweir 790cdf0e10cSrcweir 791cdf0e10cSrcweir if( aFieldInfo.pFieldItem != NULL ) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir if( bSet ) 794cdf0e10cSrcweir { 795cdf0e10cSrcweir SfxItemSet aSet( pEdit->GetAttribs( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nIndex+1, bSet ? GETATTRIBS_CHARATTRIBS : GETATTRIBS_ALL ) ); 796cdf0e10cSrcweir 797cdf0e10cSrcweir SvxLanguageItem aItem( rLanguage, EE_CHAR_LANGUAGE ); 798cdf0e10cSrcweir aSet.Put( aItem ); 799cdf0e10cSrcweir 800cdf0e10cSrcweir SvxLanguageItem aItemCJK( rLanguage, EE_CHAR_LANGUAGE_CJK ); 801cdf0e10cSrcweir aSet.Put( aItemCJK ); 802cdf0e10cSrcweir 803cdf0e10cSrcweir SvxLanguageItem aItemCTL( rLanguage, EE_CHAR_LANGUAGE_CTL ); 804cdf0e10cSrcweir aSet.Put( aItemCTL ); 805cdf0e10cSrcweir 806cdf0e10cSrcweir ESelection aSel( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex, aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex+1 ); 807cdf0e10cSrcweir pEdit->QuickSetAttribs( aSet, aSel ); 808cdf0e10cSrcweir 809cdf0e10cSrcweir pObj->SetOutlinerParaObject( pOutl->CreateParaObject() ); 810cdf0e10cSrcweir pOutl->UpdateFields(); 811cdf0e10cSrcweir } 812cdf0e10cSrcweir else 813cdf0e10cSrcweir { 814cdf0e10cSrcweir rLanguage = pOutl->GetLanguage( aFieldInfo.aPosition.nPara, aFieldInfo.aPosition.nIndex ); 815cdf0e10cSrcweir } 816cdf0e10cSrcweir } 817cdf0e10cSrcweir 818cdf0e10cSrcweir pOutl->Clear(); 819cdf0e10cSrcweir pOutl->Init( nOutlMode ); 820cdf0e10cSrcweir } 821cdf0e10cSrcweir } 822cdf0e10cSrcweir } 823cdf0e10cSrcweir 824cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 825cdf0e10cSrcweir 826cdf0e10cSrcweir PresLayoutPreview::PresLayoutPreview( ::Window* pParent, const ResId& rResId, SdPage* pMaster ) 827cdf0e10cSrcweir :Control( pParent, rResId ), mpMaster( pMaster ), maPageSize( pMaster->GetSize() ) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir } 830cdf0e10cSrcweir 831cdf0e10cSrcweir // ----------------------------------------------------------------------- 832cdf0e10cSrcweir 833cdf0e10cSrcweir PresLayoutPreview::~PresLayoutPreview() 834cdf0e10cSrcweir { 835cdf0e10cSrcweir } 836cdf0e10cSrcweir 837cdf0e10cSrcweir // ----------------------------------------------------------------------- 838cdf0e10cSrcweir 839cdf0e10cSrcweir void PresLayoutPreview::update( HeaderFooterSettings& rSettings ) 840cdf0e10cSrcweir { 841cdf0e10cSrcweir maSettings = rSettings; 842cdf0e10cSrcweir Invalidate(); 843cdf0e10cSrcweir } 844cdf0e10cSrcweir 845cdf0e10cSrcweir // ----------------------------------------------------------------------- 846cdf0e10cSrcweir 847cdf0e10cSrcweir void PresLayoutPreview::Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisible, bool bDotted /* = false*/ ) 848cdf0e10cSrcweir { 849cdf0e10cSrcweir // get object transformation 850cdf0e10cSrcweir basegfx::B2DHomMatrix aObjectTransform; 851cdf0e10cSrcweir basegfx::B2DPolyPolygon aObjectPolyPolygon; 852cdf0e10cSrcweir pObj->TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon); 853cdf0e10cSrcweir 854cdf0e10cSrcweir // build complete transformation by adding view transformation from 855cdf0e10cSrcweir // logic page coordinates to local pixel coordinates 856cdf0e10cSrcweir const double fScaleX((double)maOutRect.getWidth() / (double)maPageSize.Width()); 857cdf0e10cSrcweir const double fScaleY((double)maOutRect.getHeight() / (double)maPageSize.Height()); 858cdf0e10cSrcweir aObjectTransform.scale(fScaleX, fScaleY); 859cdf0e10cSrcweir aObjectTransform.translate(maOutRect.TopLeft().X(), maOutRect.TopLeft().Y()); 860cdf0e10cSrcweir 861cdf0e10cSrcweir // create geometry using unit range and object transform 862cdf0e10cSrcweir basegfx::B2DPolyPolygon aGeometry(basegfx::tools::createUnitPolygon()); 863cdf0e10cSrcweir aGeometry.transform(aObjectTransform); 864cdf0e10cSrcweir 865cdf0e10cSrcweir // apply line pattern if wanted 866cdf0e10cSrcweir if(bDotted) 867cdf0e10cSrcweir { 868cdf0e10cSrcweir ::std::vector<double> aPattern; 869cdf0e10cSrcweir static double fFactor(1.0); 870cdf0e10cSrcweir aPattern.push_back(3.0 * fFactor); 871cdf0e10cSrcweir aPattern.push_back(1.0 * fFactor); 872cdf0e10cSrcweir 873cdf0e10cSrcweir basegfx::B2DPolyPolygon aDashed; 874cdf0e10cSrcweir basegfx::tools::applyLineDashing(aGeometry, aPattern, &aDashed); 875cdf0e10cSrcweir aGeometry = aDashed; 876cdf0e10cSrcweir } 877cdf0e10cSrcweir 878cdf0e10cSrcweir // determine line color 879cdf0e10cSrcweir svtools::ColorConfig aColorConfig; 880cdf0e10cSrcweir svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( bVisible ? svtools::FONTCOLOR : svtools::OBJECTBOUNDARIES ) ); 881cdf0e10cSrcweir 882cdf0e10cSrcweir // paint at OutDev 883cdf0e10cSrcweir aOut.SetLineColor(Color(aColor.nColor)); 884cdf0e10cSrcweir aOut.SetFillColor(); 885cdf0e10cSrcweir 886cdf0e10cSrcweir for(sal_uInt32 a(0); a < aGeometry.count(); a++) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir aOut.DrawPolyLine(aGeometry.getB2DPolygon(a)); 889cdf0e10cSrcweir } 890cdf0e10cSrcweir } 891cdf0e10cSrcweir 892cdf0e10cSrcweir // ----------------------------------------------------------------------- 893cdf0e10cSrcweir 894cdf0e10cSrcweir void PresLayoutPreview::Paint( const Rectangle& ) 895cdf0e10cSrcweir { 896cdf0e10cSrcweir Push(); 897cdf0e10cSrcweir 898cdf0e10cSrcweir svtools::ColorConfig aColorConfig; 899cdf0e10cSrcweir svtools::ColorConfigValue aColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ) ); 900cdf0e10cSrcweir 901cdf0e10cSrcweir maOutRect = Rectangle( Point(0,0), GetOutputSize() ); 902cdf0e10cSrcweir 903cdf0e10cSrcweir // calculate page size with correct aspect ratio 904cdf0e10cSrcweir int nWidth, nHeight; 905cdf0e10cSrcweir if( maPageSize.Width() > maPageSize.Height() ) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir nWidth = maOutRect.GetWidth(); 908cdf0e10cSrcweir nHeight = long( (double)(nWidth * maPageSize.Height()) / (double)maPageSize.Width() ); 909cdf0e10cSrcweir } 910cdf0e10cSrcweir else 911cdf0e10cSrcweir { 912cdf0e10cSrcweir nHeight = maOutRect.GetHeight(); 913cdf0e10cSrcweir nWidth = long( (double)(nHeight * maPageSize.Width()) / (double)maPageSize.Height() ); 914cdf0e10cSrcweir } 915cdf0e10cSrcweir 916cdf0e10cSrcweir maOutRect.nLeft += (maOutRect.GetWidth() - nWidth) >> 1; 917cdf0e10cSrcweir maOutRect.nRight = maOutRect.nLeft + nWidth - 1; 918cdf0e10cSrcweir maOutRect.nTop += (maOutRect.GetHeight() - nHeight) >> 1; 919cdf0e10cSrcweir maOutRect.nBottom = maOutRect.nTop + nHeight - 1; 920cdf0e10cSrcweir 921cdf0e10cSrcweir // draw decoration frame 922cdf0e10cSrcweir DecorationView aDecoView( this ); 923cdf0e10cSrcweir maOutRect = aDecoView.DrawFrame( maOutRect, FRAME_HIGHLIGHT_IN ); 924cdf0e10cSrcweir 925cdf0e10cSrcweir // draw page background 926cdf0e10cSrcweir SetFillColor( Color(COL_WHITE) ); 927cdf0e10cSrcweir DrawRect( maOutRect ); 928cdf0e10cSrcweir 929cdf0e10cSrcweir // paint presentation objects from masterpage 930cdf0e10cSrcweir SdrTextObj* pMasterTitle = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_TITLE ); 931cdf0e10cSrcweir SdrTextObj* pMasterOutline = (SdrTextObj*)mpMaster->GetPresObj( mpMaster->GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE ); 932cdf0e10cSrcweir SdrTextObj* pHeader = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_HEADER ); 933cdf0e10cSrcweir SdrTextObj* pFooter = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_FOOTER ); 934cdf0e10cSrcweir SdrTextObj* pDate = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_DATETIME ); 935cdf0e10cSrcweir SdrTextObj* pNumber = (SdrTextObj*)mpMaster->GetPresObj( PRESOBJ_SLIDENUMBER ); 936cdf0e10cSrcweir 937cdf0e10cSrcweir if( pMasterTitle ) 938cdf0e10cSrcweir Paint( *this, pMasterTitle, true, true ); 939cdf0e10cSrcweir if( pMasterOutline ) 940cdf0e10cSrcweir Paint( *this, pMasterOutline, true, true ); 941cdf0e10cSrcweir if( pHeader ) 942cdf0e10cSrcweir Paint( *this, pHeader, maSettings.mbHeaderVisible ); 943cdf0e10cSrcweir if( pFooter ) 944cdf0e10cSrcweir Paint( *this, pFooter, maSettings.mbFooterVisible ); 945cdf0e10cSrcweir if( pDate ) 946cdf0e10cSrcweir Paint( *this, pDate, maSettings.mbDateTimeVisible ); 947cdf0e10cSrcweir if( pNumber ) 948cdf0e10cSrcweir Paint( *this, pNumber, maSettings.mbSlideNumberVisible ); 949cdf0e10cSrcweir 950cdf0e10cSrcweir Pop(); 951cdf0e10cSrcweir } 952