1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 #undef SC_DLLIMPLEMENTATION 32 33 34 35 #include "scitems.hxx" 36 37 #include <sfx2/objsh.hxx> 38 #include <sfx2/tabdlg.hxx> 39 //CHINA001 #include <svx/align.hxx> 40 //CHINA001 #include <svx/backgrnd.hxx> 41 //CHINA001 #include <svx/border.hxx> 42 //CHINA001 #include <svx/chardlg.hxx> 43 //CHINA001 #include <svx/numfmt.hxx> 44 //CHINA001 #include <svx/paragrph.hxx> 45 #include <svl/cjkoptions.hxx> 46 47 #include "tabpages.hxx" 48 #include "attrdlg.hxx" 49 #include "scresid.hxx" 50 #include "attrdlg.hrc" 51 #include <svx/svxdlg.hxx> //CHINA001 52 #include <svx/dialogs.hrc> //CHINA001 53 #include <svx/flagsdef.hxx> //CHINA001 54 #include <editeng/flstitem.hxx> //CHINA001 55 #include <sfx2/app.hxx> //CHINA001 56 57 #if !LAYOUT_SFX_TABDIALOG_BROKEN 58 #include <layout/layout-pre.hxx> 59 #endif 60 61 //================================================================== 62 63 ScAttrDlg::ScAttrDlg( SfxViewFrame* pFrameP, 64 Window* pParent, 65 const SfxItemSet* pCellAttrs ) 66 67 : SfxTabDialog( pFrameP, 68 pParent, 69 ScResId( RID_SCDLG_ATTR ), 70 pCellAttrs ) 71 { 72 SvtCJKOptions aCJKOptions; 73 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 74 DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 75 76 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), "GetTabPageCreatorFunc fail!");//CHINA001 77 #if LAYOUT_SFX_TABDIALOG_BROKEN 78 AddTabPage( TP_NUMBER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), 0 ); //CHINA001 AddTabPage( TP_NUMBER, SvxNumberFormatTabPage::Create, 0 ); 79 #else 80 String number = rtl::OUString::createFromAscii ("Numbers"); 81 AddTabPage( TP_NUMBER, number, pFact->GetTabPageCreatorFunc (RID_SVXPAGE_NUMBERFORMAT), 0, sal_False, TAB_APPEND); 82 #endif 83 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");//CHINA001 84 AddTabPage( TP_FONT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); //CHINA001 AddTabPage( TP_FONT, SvxCharNamePage::Create, 0 ); 85 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");//CHINA001 86 AddTabPage( TP_FONTEFF, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); //CHINA001 AddTabPage( TP_FONTEFF, SvxCharEffectsPage::Create, 0 ); 87 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!");//CHINA001 88 AddTabPage( TP_ALIGNMENT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), 0 ); //CHINA001 AddTabPage( TP_ALIGNMENT, SvxAlignmentTabPage::Create, 0 ); 89 90 if ( aCJKOptions.IsAsianTypographyEnabled() ) 91 { 92 //CHINA001 AddTabPage( TP_ASIAN, SvxAsianTabPage::Create, 0 ); 93 // ::CreateTabPage pCreateTabpage = pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN); 94 DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");//CHINA001 95 AddTabPage( TP_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), 0 ); 96 } 97 else 98 RemoveTabPage( TP_ASIAN ); 99 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");//CHINA001 100 AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); //CHINA001 AddTabPage( TP_BORDER, SvxBorderTabPage::Create, 0 ); 101 DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");//CHINA001 102 AddTabPage( TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); //CHINA001 AddTabPage( TP_BACKGROUND, SvxBackgroundTabPage::Create, 0 ); 103 AddTabPage( TP_PROTECTION, ScTabPageProtection::Create, 0 ); 104 FreeResource(); 105 } 106 107 // ----------------------------------------------------------------------- 108 109 __EXPORT ScAttrDlg::~ScAttrDlg() 110 { 111 } 112 113 // ----------------------------------------------------------------------- 114 115 void __EXPORT ScAttrDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) 116 { 117 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 118 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); //CHINA001 119 switch ( nPageId ) 120 { 121 case TP_NUMBER: 122 { 123 //CHINA001 SvxNumberFormatTabPage& rNumPage = (SvxNumberFormatTabPage&)rTabPage; 124 125 //CHINA001 rNumPage.SetOkHdl( LINK( this, ScAttrDlg, OkHandler ) ); 126 aSet.Put (SfxLinkItem( SID_LINK_TYPE, LINK( this, ScAttrDlg, OkHandler ))); 127 rTabPage.PageCreated(aSet); 128 } 129 break; 130 131 case TP_FONT: 132 { 133 const SfxPoolItem* pInfoItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); 134 135 DBG_ASSERT( pInfoItem, "FontListItem not found :-(" ); 136 137 //CHINA001 ((SvxCharNamePage&)rTabPage). 138 //CHINA001 SetFontList( *((const SvxFontListItem*)pInfoItem) ); 139 aSet.Put (SvxFontListItem(((const SvxFontListItem*)pInfoItem)->GetFontList(), SID_ATTR_CHAR_FONTLIST )); 140 rTabPage.PageCreated(aSet); 141 } 142 break; 143 144 default: 145 break; 146 } 147 } 148 149 // ----------------------------------------------------------------------- 150 151 IMPL_LINK( ScAttrDlg, OkHandler, void*, EMPTYARG ) 152 { 153 ((Link&)GetOKButton().GetClickHdl()).Call( NULL ); 154 155 return 0; 156 } 157 158 159