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_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #undef SC_DLLIMPLEMENTATION 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir //------------------------------------------------------------------ 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include "scitems.hxx" 38*cdf0e10cSrcweir //CHINA001 #include <svx/align.hxx> 39*cdf0e10cSrcweir //CHINA001 #include <svx/backgrnd.hxx> 40*cdf0e10cSrcweir //CHINA001 #include <svx/border.hxx> 41*cdf0e10cSrcweir //CHINA001 #include <svx/chardlg.hxx> 42*cdf0e10cSrcweir //CHINA001 #include <svx/numfmt.hxx> 43*cdf0e10cSrcweir #include <svx/numinf.hxx> //CHINA001 44*cdf0e10cSrcweir //CHINA001 #include <svx/page.hxx> 45*cdf0e10cSrcweir //CHINA001 #include <svx/paragrph.hxx> 46*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 47*cdf0e10cSrcweir #include <svl/style.hxx> 48*cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir #include "styledlg.hxx" 51*cdf0e10cSrcweir #include "tabpages.hxx" // Zellvorlagen 52*cdf0e10cSrcweir #include "tphf.hxx" // Seitenvorlage: Kopf-/Fusszeilen 53*cdf0e10cSrcweir #include "tptable.hxx" // Seitenvorlage: Tabelle 54*cdf0e10cSrcweir #include "scresid.hxx" 55*cdf0e10cSrcweir #include "sc.hrc" 56*cdf0e10cSrcweir #include "styledlg.hrc" 57*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 58*cdf0e10cSrcweir #include <svx/svxids.hrc> //CHINA001 59*cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001 60*cdf0e10cSrcweir #include <svl/intitem.hxx> //CHINA001 61*cdf0e10cSrcweir #include <editeng/flstitem.hxx> //CHINA001 62*cdf0e10cSrcweir #include <svl/aeitem.hxx> //CHINA001 63*cdf0e10cSrcweir #include <svx/flagsdef.hxx> //CHINA001 64*cdf0e10cSrcweir //================================================================== 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir ScStyleDlg::ScStyleDlg( Window* pParent, 67*cdf0e10cSrcweir SfxStyleSheetBase& rStyleBase, 68*cdf0e10cSrcweir sal_uInt16 nRscId ) 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir : SfxStyleDialog ( pParent, 71*cdf0e10cSrcweir ScResId( nRscId ), 72*cdf0e10cSrcweir rStyleBase, 73*cdf0e10cSrcweir sal_False ), 74*cdf0e10cSrcweir nDlgRsc ( nRscId ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); //CHINA001 77*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 78*cdf0e10cSrcweir switch ( nRscId ) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir case RID_SCDLG_STYLES_PAR: // Zellformatvorlagen 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 83*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001 84*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageRangesFunc fail!");//CHINA001 85*cdf0e10cSrcweir AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT ) ); //CHINA001 AddTabPage( TP_NUMBER, &SvxNumberFormatTabPage::Create, &SvxNumberFormatTabPage::GetRanges ); 86*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001 87*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");//CHINA001 88*cdf0e10cSrcweir AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) ); //CHINA001 AddTabPage( TP_FONT, &SvxCharNamePage::Create, &SvxCharNamePage::GetRanges ); 89*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001 90*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");//CHINA001 91*cdf0e10cSrcweir AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) ); //CHINA001 AddTabPage( TP_FONTEFF, &SvxCharEffectsPage::Create, &SvxCharEffectsPage::GetRanges ); 92*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001 93*cdf0e10cSrcweir DBG_ASSERT( pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageRangesFunc fail!");//CHINA001 94*cdf0e10cSrcweir AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT ) ); //CHINA001 AddTabPage( TP_ALIGNMENT, &SvxAlignmentTabPage::Create, &SvxAlignmentTabPage::GetRanges ); 95*cdf0e10cSrcweir if ( aCJKOptions.IsAsianTypographyEnabled() ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir //CHINA001 AddTabPage( TP_ASIAN, &SvxAsianTabPage::Create, &SvxAsianTabPage::GetRanges ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001 100*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");//CHINA001 101*cdf0e10cSrcweir AddTabPage( TP_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) ); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir else 104*cdf0e10cSrcweir RemoveTabPage( TP_ASIAN ); 105*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001 106*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");//CHINA001 107*cdf0e10cSrcweir AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create, &SvxBorderTabPage::GetRanges ); 108*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001 109*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");//CHINA001 110*cdf0e10cSrcweir AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create, &SvxBackgroundTabPage::GetRanges ); 111*cdf0e10cSrcweir AddTabPage( TP_PROTECTION, &ScTabPageProtection::Create, &ScTabPageProtection::GetRanges ); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir break; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir case RID_SCDLG_STYLES_PAGE: // Seitenvorlagen 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");//CHINA001 118*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");//CHINA001 119*cdf0e10cSrcweir AddTabPage( TP_PAGE_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ) ); //CHINA001 AddTabPage( TP_PAGE_STD, &SvxPageDescPage::Create, &SvxPageDescPage::GetRanges ); 120*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001 121*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");//CHINA001 122*cdf0e10cSrcweir AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); //CHINA001 AddTabPage( TP_BORDER, &SvxBorderTabPage::Create, &SvxBorderTabPage::GetRanges ); 123*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001 124*cdf0e10cSrcweir DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");//CHINA001 125*cdf0e10cSrcweir AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); //CHINA001 AddTabPage( TP_BACKGROUND, &SvxBackgroundTabPage::Create, &SvxBackgroundTabPage::GetRanges ); 126*cdf0e10cSrcweir AddTabPage( TP_PAGE_HEADER, &ScHeaderPage::Create, &ScHeaderPage::GetRanges ); 127*cdf0e10cSrcweir AddTabPage( TP_PAGE_FOOTER, &ScFooterPage::Create, &ScFooterPage::GetRanges ); 128*cdf0e10cSrcweir AddTabPage( TP_TABLE, &ScTablePage::Create, &ScTablePage::GetRanges ); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir break; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir default: 133*cdf0e10cSrcweir DBG_ERROR( "Family not supported" ); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir //-------------------------------------------------------------------- 137*cdf0e10cSrcweir FreeResource(); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // ----------------------------------------------------------------------- 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir __EXPORT ScStyleDlg::~ScStyleDlg() 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // ----------------------------------------------------------------------- 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void __EXPORT ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir if ( nDlgRsc == RID_SCDLG_STYLES_PAR ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 153*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001 154*cdf0e10cSrcweir switch ( nPageId ) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir case TP_NUMBER: 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir const SfxPoolItem* pInfoItem 159*cdf0e10cSrcweir = pDocSh->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir DBG_ASSERT( pInfoItem, "NumberInfoItem nicht gefunden!" ); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir //CHINA001 ((SvxNumberFormatTabPage&)rTabPage). 164*cdf0e10cSrcweir //CHINA001 SetNumberFormatList( 165*cdf0e10cSrcweir //CHINA001 (const SvxNumberInfoItem&)*pInfoItem ) ; 166*cdf0e10cSrcweir aSet.Put (SvxNumberInfoItem( (const SvxNumberInfoItem&)*pInfoItem ) ); 167*cdf0e10cSrcweir rTabPage.PageCreated(aSet); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir break; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir case TP_FONT: 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir const SfxPoolItem* pInfoItem 174*cdf0e10cSrcweir = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir DBG_ASSERT( pInfoItem, "FontListItem nicht gefunden!" ); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir //CHINA001 ((SvxCharNamePage&)rTabPage). 179*cdf0e10cSrcweir //CHINA001 SetFontList( 180*cdf0e10cSrcweir //CHINA001 (const SvxFontListItem&)*pInfoItem ); 181*cdf0e10cSrcweir aSet.Put (SvxFontListItem(((const SvxFontListItem&)*pInfoItem).GetFontList(), SID_ATTR_CHAR_FONTLIST)); 182*cdf0e10cSrcweir rTabPage.PageCreated(aSet); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir break; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir default: 187*cdf0e10cSrcweir break; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir else if ( nDlgRsc == RID_SCDLG_STYLES_PAGE ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));//CHINA001 193*cdf0e10cSrcweir switch ( nPageId ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir case TP_PAGE_STD: 196*cdf0e10cSrcweir //CHINA001 ((SvxPageDescPage&)rTabPage).SetMode( SVX_PAGE_MODE_CENTER ); 197*cdf0e10cSrcweir aSet.Put (SfxAllEnumItem((const sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER)); //CHINA001 198*cdf0e10cSrcweir rTabPage.PageCreated(aSet); //CHINA001 199*cdf0e10cSrcweir break; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir case TP_PAGE_HEADER: 202*cdf0e10cSrcweir case TP_PAGE_FOOTER: 203*cdf0e10cSrcweir ((ScHFPage&)rTabPage).SetStyleDlg( this ); 204*cdf0e10cSrcweir ((ScHFPage&)rTabPage).SetPageStyle( GetStyleSheet().GetName() ); 205*cdf0e10cSrcweir ((ScHFPage&)rTabPage).DisableDeleteQueryBox(); 206*cdf0e10cSrcweir break; 207*cdf0e10cSrcweir case TP_BACKGROUND: 208*cdf0e10cSrcweir if( nDlgRsc == RID_SCDLG_STYLES_PAGE) 209*cdf0e10cSrcweir //CHINA001 ((SvxBackgroundTabPage&)rTabPage).ShowSelector(); 210*cdf0e10cSrcweir { //add CHINA001 211*cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); 212*cdf0e10cSrcweir rTabPage.PageCreated(aSet); 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir break; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir default: 217*cdf0e10cSrcweir break; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir // ----------------------------------------------------------------------- 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir const SfxItemSet* __EXPORT ScStyleDlg::GetRefreshedSet() 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir SfxItemSet* pItemSet = GetInputSetImpl(); 228*cdf0e10cSrcweir pItemSet->ClearItem(); 229*cdf0e10cSrcweir pItemSet->SetParent( GetStyleSheet().GetItemSet().GetParent() ); 230*cdf0e10cSrcweir return pItemSet; 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir 235