diff options
Diffstat (limited to 'sw/source/ui/chrdlg')
-rw-r--r-- | sw/source/ui/chrdlg/break.cxx | 252 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/break.hrc | 41 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/ccoll.cxx | 236 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/ccoll.hrc | 50 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/ccoll.src | 160 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/chardlg.cxx | 405 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/chardlg.hrc | 86 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/chardlg.src | 264 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/chrdlg.src | 77 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 894 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.hrc | 51 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.src | 226 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/makefile.mk | 69 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/numpara.cxx | 364 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/numpara.hrc | 53 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/numpara.src | 229 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/paradlg.hrc | 71 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/paradlg.src | 165 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/pardlg.cxx | 269 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/swbreak.src | 172 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/swuiccoll.cxx | 357 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/tblnumfm.cxx | 76 |
22 files changed, 4567 insertions, 0 deletions
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx new file mode 100644 index 000000000000..cc1f208950dc --- /dev/null +++ b/sw/source/ui/chrdlg/break.cxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <sfx2/request.hxx> +#include <svl/stritem.hxx> +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif + +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#include <uitool.hxx> +#include <swtypes.hxx> +#include <wrtsh.hxx> +#ifndef _BASESH_HXX +#include <basesh.hxx> +#endif +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <viewopt.hxx> +#include <break.hxx> +#include <pagedesc.hxx> +#include <poolfmt.hxx> + +#ifndef _BREAK_HRC +#include <break.hrc> +#endif +#ifndef _CHRDLG_HRC +#include <chrdlg.hrc> +#endif +#include <SwStyleNameMapper.hxx> + +void SwBreakDlg::Apply() +{ + nKind = 0; + if(aLineBtn.IsChecked()) + nKind = 1; + else if(aColumnBtn.IsChecked()) + nKind = 2; + else if(aPageBtn.IsChecked()) + { + nKind = 3; + const USHORT nPos = aPageCollBox.GetSelectEntryPos(); + if(0 != nPos && LISTBOX_ENTRY_NOTFOUND != nPos) + { + aTemplate = aPageCollBox.GetSelectEntry(); + nPgNum = aPageNumBox.IsChecked() ? (USHORT)aPageNumEdit.GetValue() : 0; + } + } +} + + +IMPL_LINK_INLINE_START( SwBreakDlg, ClickHdl, void *, EMPTYARG ) +{ + CheckEnable(); + return 0; +} +IMPL_LINK_INLINE_END( SwBreakDlg, ClickHdl, void *, EMPTYARG ) + +/*------------------------------------------------------------------------ + Beschreibung: Handler fuer Aendern Seitenummer +------------------------------------------------------------------------*/ + +IMPL_LINK_INLINE_START( SwBreakDlg, PageNumHdl, CheckBox *, pBox ) +{ + if(pBox->IsChecked()) aPageNumEdit.SetValue(1); + else aPageNumEdit.SetText(aEmptyStr); + return 0; +} +IMPL_LINK_INLINE_END( SwBreakDlg, PageNumHdl, CheckBox *, pBox ) + +/*------------------------------------------------------------------------ + Beschreibung: Durch Aendern der Seitennummer wird die Checkbox gecheckt. +------------------------------------------------------------------------*/ + +IMPL_LINK_INLINE_START( SwBreakDlg, PageNumModifyHdl, Edit *, EMPTYARG ) +{ + aPageNumBox.Check(); + return 0; +} +IMPL_LINK_INLINE_END( SwBreakDlg, PageNumModifyHdl, Edit *, EMPTYARG ) + +/*------------------------------------------------------------------------ + Beschreibung: Ok-Handler; + prueft, ob die Seitenummer nPage eine legale Seitennummer + ist (linke Seiten mit geraden Nummern etc. bei einer Seitenvorlage + mit wechselnden Seiten) +------------------------------------------------------------------------*/ + +IMPL_LINK( SwBreakDlg, OkHdl, Button *, EMPTYARG ) +{ + if(aPageNumBox.IsChecked()) { + // wenn unterschiedliche Seitenvorlagen, testen auf Gueltigkeit + const USHORT nPos = aPageCollBox.GetSelectEntryPos(); + // auf Position 0 steht 'Ohne'. + const SwPageDesc *pPageDesc; + if ( 0 != nPos && LISTBOX_ENTRY_NOTFOUND != nPos ) + pPageDesc = rSh.FindPageDescByName( aPageCollBox.GetSelectEntry(), + TRUE ); + else + pPageDesc = &rSh.GetPageDesc(rSh.GetCurPageDesc()); + + ASSERT(pPageDesc, Seitenvorlage nicht gefunden.); + const USHORT nUserPage = USHORT(aPageNumEdit.GetValue()); + BOOL bOk = TRUE; + switch(pPageDesc->GetUseOn()) + { + case nsUseOnPage::PD_MIRROR: + case nsUseOnPage::PD_ALL: break; + case nsUseOnPage::PD_LEFT: bOk = 0 == nUserPage % 2; break; + case nsUseOnPage::PD_RIGHT: bOk = static_cast< sal_Bool >(nUserPage % 2); break; + default:; //prevent warning + } + if(!bOk) { + InfoBox(this, SW_RES(MSG_ILLEGAL_PAGENUM)).Execute(); + aPageNumEdit.GrabFocus(); + return 0; + } + } + EndDialog(RET_OK); + return 0; +} + +SwBreakDlg::SwBreakDlg( Window *pParent, SwWrtShell &rS ) : + + SvxStandardDialog( pParent,SW_RES(DLG_BREAK) ), + + rSh(rS), + aLineBtn(this,SW_RES(RB_LINE)), + aColumnBtn(this,SW_RES(RB_COL)), + aPageBtn(this,SW_RES(RB_PAGE)), + aPageCollText(this, SW_RES(FT_COLL)), + aPageCollBox(this, SW_RES(LB_COLL)), + aPageNumBox(this, SW_RES(CB_PAGENUM)), + aPageNumEdit(this, SW_RES(ED_PAGENUM)), + aBreakFL(this,SW_RES(FL_BREAK)), + + aOkBtn(this,SW_RES(BT_OK)), + aCancelBtn(this,SW_RES(BT_CANCEL)), + aHelpBtn(this,SW_RES(BT_HELP)), + + nKind(0), + nPgNum(0), + + bHtmlMode(0 != ::GetHtmlMode(rS.GetView().GetDocShell())) +{ + Link aLk = LINK(this,SwBreakDlg,ClickHdl); + aPageBtn.SetClickHdl( aLk ); + aLineBtn.SetClickHdl( aLk ); + aColumnBtn.SetClickHdl( aLk ); + aPageCollBox.SetSelectHdl( aLk ); + + aOkBtn.SetClickHdl(LINK(this,SwBreakDlg,OkHdl)); + aPageNumBox.SetClickHdl(LINK(this,SwBreakDlg,PageNumHdl)); + aPageNumEdit.SetModifyHdl(LINK(this,SwBreakDlg,PageNumModifyHdl)); + + + // Einfuegen der vorhandenen Seitenvorlagen in die Listbox + const USHORT nCount = rSh.GetPageDescCnt(); + USHORT i; + + for( i = 0; i < nCount; ++i) + { + const SwPageDesc &rPageDesc = rSh.GetPageDesc(i); + ::InsertStringSorted(rPageDesc.GetName(), aPageCollBox, 1 ); + } + + String aFmtName; + for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i) + if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName = + SwStyleNameMapper::GetUIName( i, aFmtName ))) + ::InsertStringSorted(aFmtName, aPageCollBox, 1 ); + //add landscape page + if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName = + SwStyleNameMapper::GetUIName( RES_POOLPAGE_LANDSCAPE, aFmtName ))) + ::InsertStringSorted(aFmtName, aPageCollBox, 1 ); + CheckEnable(); + aPageNumEdit.SetText( aEmptyStr ); + FreeResource(); +} + + +void SwBreakDlg::CheckEnable() +{ + BOOL bEnable = TRUE; + if ( bHtmlMode ) + { + aColumnBtn .Enable(FALSE); + aPageCollBox.Enable(FALSE); + bEnable = FALSE; + } + else if(rSh.GetFrmType(0,TRUE) + & (FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE)) + { + aPageBtn.Enable(FALSE); + if(aPageBtn.IsChecked()) + aLineBtn.Check(TRUE); + bEnable = FALSE; + } + const BOOL bPage = aPageBtn.IsChecked(); + aPageCollText.Enable( bPage ); + aPageCollBox.Enable ( bPage ); + + bEnable &= bPage; + if ( bEnable ) + { + // auf Position 0 steht 'Ohne' Seitenvorlage. + const USHORT nPos = aPageCollBox.GetSelectEntryPos(); + if ( 0 == nPos || LISTBOX_ENTRY_NOTFOUND == nPos ) + bEnable = FALSE; + } + aPageNumBox .Enable(bEnable); + aPageNumEdit.Enable(bEnable); +} + +SwBreakDlg::~SwBreakDlg() +{ +} diff --git a/sw/source/ui/chrdlg/break.hrc b/sw/source/ui/chrdlg/break.hrc new file mode 100644 index 000000000000..7667a4a9f3b6 --- /dev/null +++ b/sw/source/ui/chrdlg/break.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define RB_PAGE 1 +#define RB_LINE 2 +#define RB_COL 3 +#define FT_COLL 4 +#define LB_COLL 5 +#define FL_BREAK 6 +#define CB_PAGENUM 7 +#define ED_PAGENUM 8 + +#define BT_OK 100 +#define BT_CANCEL 101 +#define BT_HELP 102 + + diff --git a/sw/source/ui/chrdlg/ccoll.cxx b/sw/source/ui/chrdlg/ccoll.cxx new file mode 100644 index 000000000000..44b144d28f4b --- /dev/null +++ b/sw/source/ui/chrdlg/ccoll.cxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + + +#include "cmdid.h" +#include <tools/list.hxx> +#include "swmodule.hxx" +#include "view.hxx" +#include "wrtsh.hxx" +#include "globals.hrc" +#include "helpid.h" + + +#include <sfx2/styfitem.hxx> + +#include "uitool.hxx" +#include "ccoll.hxx" +#include "fmtcol.hxx" +#include "hintids.hxx" +#include "docsh.hxx" +#include "docstyle.hxx" +#include "hints.hxx" + +#include "chrdlg.hrc" +#include "ccoll.hrc" +#include <vcl/svapp.hxx> + +#include <unomid.h> + +// ****************************************************************** + +//!! order of entries has to be the same as in +//!! CommandStruct SwCondCollItem::aCmds[] + +const char *aCommandContext[COND_COMMAND_COUNT] = +{ + "TableHeader", + "Table", + "Frame", + "Section", + "Footnote", + "Endnote", + "Header", + "Footer", + "OutlineLevel1", + "OutlineLevel2", + "OutlineLevel3", + "OutlineLevel4", + "OutlineLevel5", + "OutlineLevel6", + "OutlineLevel7", + "OutlineLevel8", + "OutlineLevel9", + "OutlineLevel10", + "NumberingLevel1", + "NumberingLevel2", + "NumberingLevel3", + "NumberingLevel4", + "NumberingLevel5", + "NumberingLevel6", + "NumberingLevel7", + "NumberingLevel8", + "NumberingLevel9", + "NumberingLevel10" +}; + +sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName ) +{ + sal_Int16 nRes = -1; + for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i) + { + if (rContextName.equalsAscii( aCommandContext[i] )) + nRes = i; + } + return nRes; +} + +rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex ) +{ + rtl::OUString aRes; + if (0 <= nIndex && nIndex < COND_COMMAND_COUNT) + { + aRes = C2U( aCommandContext[ nIndex ] ); + } + return aRes; +} + +// Globals ****************************************************************** + + +CommandStruct SwCondCollItem::aCmds[] = +{ + { PARA_IN_TABLEHEAD, 0 }, + { PARA_IN_TABLEBODY, 0 }, + { PARA_IN_FRAME, 0 }, + { PARA_IN_SECTION, 0 }, + { PARA_IN_FOOTENOTE, 0 }, + { PARA_IN_ENDNOTE, 0 }, + { PARA_IN_HEADER, 0 }, + { PARA_IN_FOOTER, 0 }, + { PARA_IN_OUTLINE, 0 }, + { PARA_IN_OUTLINE, 1 }, + { PARA_IN_OUTLINE, 2 }, + { PARA_IN_OUTLINE, 3 }, + { PARA_IN_OUTLINE, 4 }, + { PARA_IN_OUTLINE, 5 }, + { PARA_IN_OUTLINE, 6 }, + { PARA_IN_OUTLINE, 7 }, + { PARA_IN_OUTLINE, 8 }, + { PARA_IN_OUTLINE, 9 }, + { PARA_IN_LIST, 0 }, + { PARA_IN_LIST, 1 }, + { PARA_IN_LIST, 2 }, + { PARA_IN_LIST, 3 }, + { PARA_IN_LIST, 4 }, + { PARA_IN_LIST, 5 }, + { PARA_IN_LIST, 6 }, + { PARA_IN_LIST, 7 }, + { PARA_IN_LIST, 8 }, + { PARA_IN_LIST, 9 } +}; + + +TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem) + +/**************************************************************************** + Item fuer den Transport der Bedingungstabelle +****************************************************************************/ + + +SwCondCollItem::SwCondCollItem(USHORT _nWhich ) : + SfxPoolItem(_nWhich) +{ + +} +/**************************************************************************** + +****************************************************************************/ + + +SwCondCollItem::~SwCondCollItem() +{ +} + +/**************************************************************************** + +****************************************************************************/ + + +SfxPoolItem* SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const +{ + return new SwCondCollItem(*this); +} + +/**************************************************************************** + +****************************************************************************/ + + +int SwCondCollItem::operator==( const SfxPoolItem& rItem) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rItem), "unterschiedliche Typen" ); + BOOL bReturn = TRUE; + for(USHORT i = 0; i < COND_COMMAND_COUNT; i++) + if(sStyles[i] != ((SwCondCollItem&)rItem).sStyles[i]) + { + bReturn = FALSE; + break; + } + + return bReturn; +} + +/**************************************************************************** + +****************************************************************************/ + + +const String& SwCondCollItem::GetStyle(USHORT nPos) const +{ + return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr; +} + +/**************************************************************************** + +****************************************************************************/ + + +void SwCondCollItem::SetStyle(const String* pStyle, USHORT nPos) +{ + if( nPos < COND_COMMAND_COUNT ) + sStyles[nPos] = pStyle ? *pStyle : aEmptyStr; +} + + +/**************************************************************************** + +****************************************************************************/ + + +const CommandStruct* SwCondCollItem::GetCmds() +{ + return aCmds; +} + + + + diff --git a/sw/source/ui/chrdlg/ccoll.hrc b/sw/source/ui/chrdlg/ccoll.hrc new file mode 100644 index 000000000000..f3d21092273a --- /dev/null +++ b/sw/source/ui/chrdlg/ccoll.hrc @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CCOLL_HRC +#define _CCOLL_HRC + +// #define ****************************************************************** + +#define CB_CONDITION 1 +#define FL_CONDITION 2 +#define FT_CONTEXT 3 +#define FT_USED 4 +#define TB_CONDCOLLS 5 +#define FT_STYLE 6 +#define LB_STYLE 7 +#define LB_FILTER 8 +#define PB_REMOVE 9 +#define PB_ASSIGN 10 +#define STR_REGIONS 11 +#define STR_NOTEMPL 12 + + +// ********************************************************************** EOF + +#endif + diff --git a/sw/source/ui/chrdlg/ccoll.src b/sw/source/ui/chrdlg/ccoll.src new file mode 100644 index 000000000000..eab997761d8d --- /dev/null +++ b/sw/source/ui/chrdlg/ccoll.src @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "globals.hrc" +#include "chrdlg.hrc" +#include "ccoll.hrc" +#include "helpid.h" + // TabPage ****************************************************************** +TabPage TP_CONDCOLL +{ + HelpID = HID_COND_COLL ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_CONDITION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Options"; + }; + CheckBox CB_CONDITION + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "~Conditional Style" ; + }; + FixedText FT_CONTEXT + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Disable = TRUE ; + Text [ en-US ] = "Conte~xt" ; + }; + FixedText FT_USED + { + Pos = MAP_APPFONT ( 100 , 28 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Disable = TRUE ; + Text [ en-US ] = "Applied Styles" ; + }; + Control TB_CONDCOLLS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 39 ) ; + Size = MAP_APPFONT ( 173 , 123 ) ; + TabStop = TRUE ; + ClipChildren = TRUE ; + Disable = TRUE ; + Border = TRUE ; + }; + FixedText FT_STYLE + { + Pos = MAP_APPFONT ( 190 , 28 ) ; + Size = MAP_APPFONT ( 58 , 8 ) ; + Disable = TRUE ; + Text [ en-US ] = "~Paragraph Styles" ; + }; + ListBox LB_STYLE + { + Pos = MAP_APPFONT ( 188 , 39 ) ; + Size = MAP_APPFONT ( 60 , 108 ) ; + TabStop = TRUE ; + Border = TRUE ; + Sort = TRUE ; + Disable = TRUE ; + HScroll = TRUE ; + }; + ListBox LB_FILTER + { + Pos = MAP_APPFONT ( 188 , 150 ) ; + Size = MAP_APPFONT ( 60 , 50 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + Border = TRUE ; + Disable = TRUE ; + HScroll = TRUE ; + }; + PushButton PB_REMOVE + { + Pos = MAP_APPFONT ( 129 , 165 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "Re~move" ; + }; + PushButton PB_ASSIGN + { + Pos = MAP_APPFONT ( 185 , 165 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "~Apply" ; + }; + StringArray STR_REGIONS + { + ItemList [ en-US ] = + { + < "Table Header" ; > ; + < "Table" ; > ; + < "Frame" ; > ; + < "Section" ; > ; + < "Footnote" ; > ; + < "Endnote" ; > ; + < "Header" ; > ; + < "Footer" ; > ; + < " 1st Outline Level" ; > ; + < " 2nd Outline Level" ; > ; + < " 3rd Outline Level" ; > ; + < " 4th Outline Level" ; > ; + < " 5th Outline Level" ; > ; + < " 6th Outline Level" ; > ; + < " 7th Outline Level" ; > ; + < " 8th Outline Level" ; > ; + < " 9th Outline Level" ; > ; + < "10th Outline Level" ; > ; + < " 1st Numbering Level" ; > ; + < " 2nd Numbering Level" ; > ; + < " 3rd Numbering Level" ; > ; + < " 4th Numbering Level" ; > ; + < " 5th Numbering Level" ; > ; + < " 6th Numbering Level" ; > ; + < " 7th Numbering Level" ; > ; + < " 8th Numbering Level" ; > ; + < " 9th Numbering Level" ; > ; + < "10th Numbering Level" ; > ; + }; + }; + String STR_NOTEMPL + { + Text [ en-US ] = "<none>" ; + }; +}; + // ********************************************************************** EOF diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx new file mode 100644 index 000000000000..38b1ba906fdd --- /dev/null +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -0,0 +1,405 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <hintids.hxx> + +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> +#include <editeng/flstitem.hxx> +#include <svx/htmlmode.hxx> +#include <svl/cjkoptions.hxx> + +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _HELPID_H +#include <helpid.h> +#endif +#include <swtypes.hxx> +#include <errhdl.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <wrtsh.hxx> +#ifndef _DOCSH_HXX +#include <docsh.hxx> +#endif +#include <uitool.hxx> +#include <fmtinfmt.hxx> +#include <macassgn.hxx> +#ifndef _CHRDLG_HXX +#include <chrdlg.hxx> // der Dialog +#endif +#include <swmodule.hxx> +#include <poolfmt.hxx> + +#ifndef _GLOBALS_HRC +#include <globals.hrc> +#endif +#ifndef _CHRDLG_HRC +#include <chrdlg.hrc> +#endif +#ifndef _CHARDLG_HRC +#include <chardlg.hrc> +#endif +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <SwStyleNameMapper.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/viewfrm.hxx> + +#include <svx/svxdlg.hxx> +#include <svx/svxids.hrc> +#include <svx/flagsdef.hxx> +#include <svx/dialogs.hrc> + +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::sfx2; + +/*-------------------------------------------------------------------- + Beschreibung: Der Traeger des Dialoges + --------------------------------------------------------------------*/ + + +SwCharDlg::SwCharDlg(Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet, + const String* pStr, BOOL bIsDrwTxtDlg) : + SfxTabDialog(pParent, SW_RES(DLG_CHAR), &rCoreSet, pStr != 0), + rView(rVw), + bIsDrwTxtMode(bIsDrwTxtDlg) +{ + FreeResource(); + + // bspFonr fuer beide Bsp-TabPages + + if(pStr) + { + String aTmp( GetText() ); + aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER); + aTmp += *pStr; + aTmp += ')'; + SetText(aTmp); + } + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); + AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); + AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), 0 ); + AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), 0 ); + AddTabPage(TP_CHAR_URL, SwCharURLPage::Create, 0); + AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); + + SvtCJKOptions aCJKOptions; + if(bIsDrwTxtMode) + { + RemoveTabPage( TP_CHAR_URL ); + RemoveTabPage( TP_BACKGROUND ); + RemoveTabPage( TP_CHAR_TWOLN ); + } + else if(!aCJKOptions.IsDoubleLinesEnabled()) + RemoveTabPage( TP_CHAR_TWOLN ); +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + +SwCharDlg::~SwCharDlg() +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: FontList setzen + --------------------------------------------------------------------*/ + + + +void SwCharDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch( nId ) + { + case TP_CHAR_STD: + { + SvxFontListItem aFontListItem( *( (SvxFontListItem*) + ( rView.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) ) ); + aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST)); + if(!bIsDrwTxtMode) + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); + rPage.PageCreated(aSet); + } + break; + case TP_CHAR_EXT: + if(bIsDrwTxtMode) + aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); + + else + { + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER|SVX_ENABLE_FLASH)); + } + rPage.PageCreated(aSet); + break; + case TP_CHAR_POS: + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); + rPage.PageCreated(aSet); + break; + case TP_CHAR_TWOLN: + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER)); + rPage.PageCreated(aSet); + break; + } +} + +/*-----------------14.08.96 11.28------------------- + +--------------------------------------------------*/ + +SwCharURLPage::SwCharURLPage( Window* pParent, + const SfxItemSet& rCoreSet ) : + SfxTabPage( pParent, SW_RES( TP_CHAR_URL ), rCoreSet ), + aURLFL ( this, SW_RES(FL_URL)), + + aURLFT( this, SW_RES(FT_URL )), + aURLED( this, SW_RES(ED_URL )), + aTextFT( this, SW_RES(FT_TEXT )), + aTextED( this, SW_RES(ED_TEXT )), + aNameFT( this, SW_RES(FT_NAME )), + aNameED( this, SW_RES(ED_NAME)), + aTargetFrmFT( this, SW_RES(FT_TARGET )), + aTargetFrmLB( this, SW_RES(LB_TARGET )), + aURLPB( this, SW_RES(PB_URL )), + aEventPB( this, SW_RES(PB_EVENT )), + aStyleFL( this, SW_RES(FL_STYLE )), + aVisitedFT( this, SW_RES(FT_VISITED )), + aVisitedLB( this, SW_RES(LB_VISITED )), + aNotVisitedFT( this, SW_RES(FT_NOT_VISITED)), + aNotVisitedLB( this, SW_RES(LB_NOT_VISITED)), + pINetItem(0), + bModified(FALSE) + +{ + FreeResource(); + + const SfxPoolItem* pItem; + SfxObjectShell* pShell; + if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) || + ( 0 != ( pShell = SfxObjectShell::Current()) && + 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) + { + USHORT nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue(); + if(HTMLMODE_ON & nHtmlMode) + { + aStyleFL.Hide(); + aVisitedFT.Hide(); + aVisitedLB.Hide(); + aNotVisitedFT.Hide(); + aNotVisitedLB.Hide(); + } + } + + aURLPB.SetClickHdl (LINK( this, SwCharURLPage, InsertFileHdl)); + aEventPB.SetClickHdl(LINK( this, SwCharURLPage, EventHdl )); + + SwView *pView = ::GetActiveView(); + ::FillCharStyleListBox(aVisitedLB, pView->GetDocShell()); + ::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell()); + + TargetList* pList = new TargetList; + const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame(); + rFrame.GetTargetList(*pList); + USHORT nCount = (USHORT)pList->Count(); + if( nCount ) + { + USHORT i; + + for ( i = 0; i < nCount; i++ ) + { + aTargetFrmLB.InsertEntry(*pList->GetObject(i)); + } + for ( i = nCount; i; i-- ) + { + delete pList->GetObject( i - 1 ); + } + } + delete pList; + + +} + +/*-----------------15.08.96 09.04------------------- + +--------------------------------------------------*/ + +SwCharURLPage::~SwCharURLPage() +{ + delete pINetItem; +} + +/*-----------------14.08.96 11.31------------------- + +--------------------------------------------------*/ + +void SwCharURLPage::Reset(const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, FALSE, &pItem)) + { + const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem; + aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(), + INET_HEX_ESCAPE, + INetURLObject::DECODE_UNAMBIGUOUS, + RTL_TEXTENCODING_UTF8 )); + aURLED.SaveValue(); + aNameED.SetText(pINetFmt->GetName()); + String sEntry = pINetFmt->GetVisitedFmt(); + if( !sEntry.Len() ) + SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry ); + aVisitedLB.SelectEntry(sEntry); + sEntry = pINetFmt->GetINetFmt(); + if(!sEntry.Len()) + SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry ); + aNotVisitedLB.SelectEntry(sEntry); + + aTargetFrmLB.SetText(pINetFmt->GetTargetFrame()); + aVisitedLB. SaveValue(); + aNotVisitedLB.SaveValue(); + aTargetFrmLB. SaveValue(); + pINetItem = new SvxMacroItem(FN_INET_FIELD_MACRO); + + if( pINetFmt->GetMacroTbl() ) + pINetItem->SetMacroTable( *pINetFmt->GetMacroTbl() ); + } + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_SELECTION, FALSE, &pItem)) + { + aTextED.SetText(((const SfxStringItem*)pItem)->GetValue()); + aTextFT.Enable( FALSE ); + aTextED.Enable( FALSE ); + } +} + +/*-----------------14.08.96 11.32------------------- + +--------------------------------------------------*/ + +BOOL SwCharURLPage::FillItemSet(SfxItemSet& rSet) +{ + ::rtl::OUString sURL = aURLED.GetText(); + if(sURL.getLength()) + { + sURL = URIHelper::SmartRel2Abs(INetURLObject(), sURL, Link(), false ); + // #i100683# file URLs should be normalized in the UI + static const sal_Char* pFile = "file:"; + sal_Int32 nLength = ((sal_Int32)sizeof(pFile)-1); + if( sURL.copy(0, nLength ).equalsAsciiL( pFile, nLength )) + sURL = URIHelper::simpleNormalizedMakeRelative(::rtl::OUString(), sURL); + } + + SwFmtINetFmt aINetFmt(sURL, aTargetFrmLB.GetText()); + aINetFmt.SetName(aNameED.GetText()); + bModified |= aURLED.GetText() != aURLED.GetSavedValue(); + bModified |= aNameED.IsModified(); + bModified |= aTargetFrmLB.GetSavedValue() != aTargetFrmLB.GetText(); + + //zuerst die gueltigen Einstellungen setzen + String sEntry = aVisitedLB.GetSelectEntry(); + USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); + aINetFmt.SetVisitedFmtId(nId); + aINetFmt.SetVisitedFmt(nId == RES_POOLCHR_INET_VISIT ? aEmptyStr : sEntry); + + sEntry = aNotVisitedLB.GetSelectEntry(); + nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); + aINetFmt.SetINetFmtId( nId ); + aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry); + + if( pINetItem && pINetItem->GetMacroTable().Count() ) + aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() ); + + if(aVisitedLB.GetSavedValue() != aVisitedLB.GetSelectEntryPos()) + bModified = TRUE; + + if(aNotVisitedLB.GetSavedValue() != aNotVisitedLB.GetSelectEntryPos()) + bModified = TRUE; + + if(aTextED.IsModified()) + { + bModified = TRUE; + rSet.Put(SfxStringItem(FN_PARAM_SELECTION, aTextED.GetText())); + } + if(bModified) + rSet.Put(aINetFmt); + return bModified; +} + + +/*-----------------14.08.96 11.30------------------- + +--------------------------------------------------*/ + +SfxTabPage* SwCharURLPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return ( new SwCharURLPage( pParent, rAttrSet ) ); +} + +/*-----------------14.08.96 15.00------------------- + +--------------------------------------------------*/ + +IMPL_LINK( SwCharURLPage, InsertFileHdl, PushButton *, EMPTYARG ) +{ + FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 ); + if( aDlgHelper.Execute() == ERRCODE_NONE ) + { + Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); + aURLED.SetText(xFP->getFiles().getConstArray()[0]); + } + return 0; +} +/*-----------------14.08.96 15.00------------------- + +--------------------------------------------------*/ + +IMPL_LINK( SwCharURLPage, EventHdl, PushButton *, EMPTYARG ) +{ + bModified |= SwMacroAssignDlg::INetFmtDlg( this, + ::GetActiveView()->GetWrtShell(), pINetItem ); + return 0; +} + + diff --git a/sw/source/ui/chrdlg/chardlg.hrc b/sw/source/ui/chrdlg/chardlg.hrc new file mode 100644 index 000000000000..48a661bfebec --- /dev/null +++ b/sw/source/ui/chrdlg/chardlg.hrc @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FONT_FT 1 +#define FONT_CB 2 +#define FACE_FT 3 +#define FACE_LB 4 +#define SIZE_FT 5 +#define SIZE_CB 6 +#define OUTLINE_TB 7 +#define SHADOW_TB 8 +#define UNDERL_TB 9 +#define STRIKETHRU_TB 10 +#define COLOR_FT 11 +#define COLOR_LB 12 +#define LANG_FT 13 +#define LANG_LB 14 +#define EXAMPLE_WN 15 +#define EXAMPLE_FL 16 +#define CASEMAP_FL 17 +#define NONE_RB 20 +#define CAPS_RB 21 +#define LOWERCASE_RB 22 +#define SMALLCAPS_RB 23 +#define TITEL_RB 24 +#define HIGH_RB 25 +#define NORMAL_RB 26 +#define DEEP_RB 27 +#define DEEPHIGHT_FT 28 +#define DEEPHIGH_MF 29 +#define RELSIZE_FT 30 +#define RELSIZE_MF 31 +#define KERN_LB 32 +#define KERN_FT 33 +#define KERN_MF 34 +#define UNDERLINE_FT 35 +#define UNDERLINE_LB 36 +#define STRIKE_FT 37 +#define STRIKE_LB 38 +#define STRIKE_CB 39 +#define EFFECT_FL 41 +#define POS_FL 42 +#define POSEXT_FL 43 +#define KERN_FL 45 +#define FONTTYPE_FT 46 + +#define FL_URL 50 +#define FT_URL 51 +#define ED_URL 52 +#define FL_STYLE 53 +#define FT_VISITED 55 +#define LB_VISITED 56 +#define FT_NOT_VISITED 57 +#define LB_NOT_VISITED 58 +#define PB_EVENT 59 +#define PB_URL 60 +#define LB_TARGET 61 +#define FT_TARGET 62 +#define FT_TEXT 63 +#define ED_TEXT 64 +#define FT_NAME 65 +#define ED_NAME 66 + diff --git a/sw/source/ui/chrdlg/chardlg.src b/sw/source/ui/chrdlg/chardlg.src new file mode 100644 index 000000000000..8340b4f60669 --- /dev/null +++ b/sw/source/ui/chrdlg/chardlg.src @@ -0,0 +1,264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "globals.hrc" +#include "chrdlg.hrc" +#include "chardlg.hrc" +#include "helpid.h" + +TabDialog DLG_CHAR +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Character" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_CHAR_STD ; + Text [ en-US ] = "Font" ; + PageResID = TP_CHAR_STD ; + }; + PageItem + { + Identifier = TP_CHAR_EXT ; + Text [ en-US ] = "Font Effects" ; + PageResID = TP_CHAR_EXT ; + }; + PageItem + { + Identifier = TP_CHAR_POS ; + PageResID = TP_CHAR_POS ; + Text [ en-US ] = "Position"; + }; + PageItem + { + Identifier = TP_CHAR_TWOLN ; + PageResID = TP_CHAR_TWOLN; + Text [ en-US ] = "Asian Layout"; + }; + PageItem + { + Identifier = TP_CHAR_URL ; + Text [ en-US ] = "Hyperlink" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + PageResID = TP_BACKGROUND ; + }; + }; + }; +}; +TabDialog DLG_DRAWCHAR +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Font" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_CHAR_STD ; + Text [ en-US ] = "Font" ; + PageResID = TP_CHAR_STD ; + }; + }; + }; +}; +TabPage TP_CHAR_URL +{ + HelpID = HID_CHAR_URL ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_URL + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Hyperlink" ; + }; + FixedText FT_URL + { + Pos = MAP_APPFONT ( 12 , 17 ) ; + Size = MAP_APPFONT ( 73 , 8 ) ; + Text [ en-US ] = "~URL" ; + }; + Edit ED_URL + { + Pos = MAP_APPFONT ( 88 , 15 ) ; + Size = MAP_APPFONT ( 104 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_URL + { + Pos = MAP_APPFONT ( 198 , 14 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Browse..." ; + }; + FixedText FT_TEXT + { + Pos = MAP_APPFONT ( 12 , 33 ) ; + Size = MAP_APPFONT ( 73 , 8 ) ; + Text [ en-US ] = "Te~xt"; + }; + Edit ED_TEXT + { + Pos = MAP_APPFONT ( 88 , 31 ) ; + Size = MAP_APPFONT ( 104 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Group = TRUE ; + }; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 12 , 49 ) ; + Size = MAP_APPFONT ( 73 , 8 ) ; + Text [ en-US ] = "~Name" ; + }; + Edit ED_NAME + { + Pos = MAP_APPFONT ( 88 , 47 ) ; + Size = MAP_APPFONT ( 104 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Group = TRUE ; + }; + FixedText FT_TARGET + { + Pos = MAP_APPFONT ( 12 , 65 ) ; + Size = MAP_APPFONT ( 73 , 10 ) ; + Text [ en-US ] = "~Target frame" ; + }; + ComboBox LB_TARGET + { + Pos = MAP_APPFONT ( 88 , 63 ) ; + Size = MAP_APPFONT ( 104 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + Group = TRUE ; + }; + PushButton PB_EVENT + { + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Events..." ; + }; + FixedLine FL_STYLE + { + Pos = MAP_APPFONT ( 6 , 104 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Character Styles" ; + }; + FixedText FT_VISITED + { + Pos = MAP_APPFONT ( 12 , 116 ) ; + Size = MAP_APPFONT ( 73 , 8 ) ; + Text [ en-US ] = "~Visited links" ; + }; + ListBox LB_VISITED + { + Pos = MAP_APPFONT ( 88 , 113 ) ; + Size = MAP_APPFONT ( 104 , 60 ) ; + Border = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + Group = TRUE ; + }; + FixedText FT_NOT_VISITED + { + Pos = MAP_APPFONT ( 12 , 131 ) ; + Size = MAP_APPFONT ( 73 , 10 ) ; + Text [ en-US ] = "Unvisited ~links" ; + }; + ListBox LB_NOT_VISITED + { + Pos = MAP_APPFONT ( 88 , 129 ) ; + Size = MAP_APPFONT ( 104 , 60 ) ; + Border = TRUE ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + Group = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/chrdlg.src b/sw/source/ui/chrdlg/chrdlg.src new file mode 100644 index 000000000000..297668f6093a --- /dev/null +++ b/sw/source/ui/chrdlg/chrdlg.src @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "chrdlg.hrc" +String STR_TEXTCOLL_HEADER +{ + Text [ en-US ] = "(Paragraph Style: " ; +}; +String STR_PAGEFMT_HEADER +{ + Text [ en-US ] = "(Page Style: " ; +}; +String SW_STR_NONE +{ + Text [ en-US ] = "[None]" ; +}; +InfoBox MSG_ILLEGAL_PAGENUM +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + /* ### ACHTUNG: Neuer Text in Resource? Seitennummer kann nicht gesetzt werden. Auf linken Seiten dürfen nur gerade Seitenzahlen, auf rechten Seiten nur ungerade Seitenzahlen verwendet werden. : Seitennummer kann nicht gesetzt werden. Auf linken Seiten d³rfen nur gerade Seitenzahlen, auf rechten Seiten nur ungerade Seitenzahlen verwendet werden. */ + Message [ en-US ] = "Page numbers cannot be applied to the current page. Even numbers can be used on left pages, odd numbers on right pages." ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx new file mode 100644 index 000000000000..8caf959195dd --- /dev/null +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -0,0 +1,894 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#include <hintids.hxx> +#define _SVSTDARR_STRINGSDTOR +#define _SVSTDARR_STRINGSISORTDTOR +#include <svl/svstdarr.hxx> + +#include "cmdid.h" +#include "swmodule.hxx" +#include "view.hxx" +#include "wrtsh.hxx" +#include "globals.hrc" + + +#ifndef _METRIC_HXX //autogen +#include <vcl/metric.hxx> +#endif +#include <svl/stritem.hxx> +#include <editeng/fontitem.hxx> +#include <svx/htmlmode.hxx> +#include <sfx2/objsh.hxx> +#include <editeng/svxfont.hxx> +#include <vcl/print.hxx> +#include <sfx2/printer.hxx> +#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ +#include <com/sun/star/i18n/ScriptType.hdl> +#endif +#include <editeng/scripttypeitem.hxx> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <comphelper/processfactory.hxx> + +#define _SVSTDARR_XUB_STRLEN +#define _SVSTDARR_USHORTS +#define _SVSTDARR_ULONGS +#include <svl/svstdarr.hxx> + +#include "charatr.hxx" +#include "viewopt.hxx" +#include "drpcps.hxx" +#include "paratr.hxx" +#include "uitool.hxx" +#include "charfmt.hxx" + +#include "chrdlg.hrc" +#include "drpcps.hrc" + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +//using namespace i18n; !using this namespace leads to mysterious conflicts with ScriptType::...! +// so don't use this instead of the following defines! + +#define I18N ::com::sun::star::i18n +#define I18N_SCRIPTTYPE ::com::sun::star::i18n::ScriptType + +// Globals ****************************************************************** + +static USHORT __FAR_DATA aPageRg[] = { + RES_PARATR_DROP, RES_PARATR_DROP, + 0 +}; + + + +// class SwDropCapsPict ***************************************************** + +class SwDropCapsPict : public Control +{ + String maText; + String maScriptText; + Color maBackColor; + Color maTextLineColor; + BYTE mnLines; + long mnTotLineH; + long mnLineH; + long mnTextH; + USHORT mnDistance; + sal_Int32 mnLeading; + Printer* mpPrinter; + BOOL mbDelPrinter; + SvULongs maTextWidth; + SvXub_StrLens maScriptChg; + SvUShorts maScriptType; + SvxFont maFont; + SvxFont maCJKFont; + SvxFont maCTLFont; + Size maTextSize; + Reference< I18N::XBreakIterator > xBreak; + + virtual void Paint(const Rectangle &rRect); + void CheckScript( void ); + Size CalcTextSize( void ); + inline void InitPrinter( void ); + void _InitPrinter( void ); + void GetFontSettings( const SwDropCapsPage& _rPage, Font& _rFont, USHORT _nWhich ); +public: + + SwDropCapsPict(Window *pParent, const ResId &rResId) : + Control(pParent, rResId), mpPrinter( NULL ), mbDelPrinter( FALSE ) {} + ~SwDropCapsPict(); + + void UpdatePaintSettings( void ); // also invalidates control! + + inline void SetText( const String& rT ); + inline void SetLines( BYTE nL ); + inline void SetDistance( USHORT nD ); + inline void SetValues( const String& rText, BYTE nLines, USHORT nDistance ); + + void DrawPrev( const Point& rPt ); +}; + +inline void SwDropCapsPict::SetText( const String& rT ) +{ + maText = rT; + UpdatePaintSettings(); +} + +inline void SwDropCapsPict::SetLines( BYTE nL ) +{ + mnLines = nL; + UpdatePaintSettings(); +} + +inline void SwDropCapsPict::SetDistance( USHORT nD ) +{ + mnDistance = nD; + UpdatePaintSettings(); +} + +inline void SwDropCapsPict::SetValues( const String& rText, BYTE nLines, USHORT nDistance ) +{ + maText = rText; + mnLines = nLines; + mnDistance = nDistance; + + UpdatePaintSettings(); +} + +inline void SwDropCapsPict::InitPrinter( void ) +{ + if( !mpPrinter ) + _InitPrinter(); +} + +/**************************************************************************** +Default-String aus Zeichenanzahl erzeugen (A, AB, ABC, ...) +****************************************************************************/ + + +String GetDefaultString(USHORT nChars) +{ + String aStr; + for (USHORT i = 0; i < nChars; i++) + aStr += String((char) (i + 65)); + return aStr; +} + +static void calcFontHeightAnyAscent( OutputDevice* _pWin, Font& _rFont, long& _nHeight, long& _nAscent ) +{ + if ( !_nHeight ) + { + _pWin->SetFont( _rFont ); + FontMetric aMetric( _pWin->GetFontMetric() ); + _nHeight = aMetric.GetLineHeight(); + _nAscent = aMetric.GetAscent(); + } +} + +/**************************************************************************** +Pict: Dtor +****************************************************************************/ + + + SwDropCapsPict::~SwDropCapsPict() +{ + if( mbDelPrinter ) + delete mpPrinter; +} + +/**************************************************************************** +Pict: Update Font +****************************************************************************/ + +#define LINES 10 +#define BORDER 2 + +void SwDropCapsPict::GetFontSettings( const SwDropCapsPage& _rPage, Font& _rFont, USHORT _nWhich ) +{ + SfxItemSet aSet( _rPage.rSh.GetAttrPool(), _nWhich, _nWhich); + _rPage.rSh.GetCurAttr(aSet); + SvxFontItem aFmtFont((SvxFontItem &) aSet.Get(_nWhich)); + + _rFont.SetFamily (aFmtFont.GetFamily()); + _rFont.SetName (aFmtFont.GetFamilyName()); + _rFont.SetPitch (aFmtFont.GetPitch()); + _rFont.SetCharSet(aFmtFont.GetCharSet()); +} + +void SwDropCapsPict::UpdatePaintSettings( void ) +{ + maBackColor = GetSettings().GetStyleSettings().GetWindowColor(); + maTextLineColor = Color( COL_LIGHTGRAY ); + + // gray lines + mnTotLineH = (GetOutputSizePixel().Height() - 2 * BORDER) / LINES; + mnLineH = mnTotLineH - 2; + mnLeading = GetFontMetric().GetIntLeading(); + + Font aFont; + { + SwDropCapsPage* pPage = ( SwDropCapsPage* ) GetParent(); + if (!pPage->aTemplateBox.GetSelectEntryPos()) + { + // Font an Absatzanfang erfragen + pPage->rSh.SttCrsrMove(); + pPage->rSh.Push(); + pPage->rSh.ClearMark(); + SwWhichPara pSwuifnParaCurr = GetfnParaCurr(); + SwPosPara pSwuifnParaStart = GetfnParaStart(); + pPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart); + // normal + GetFontSettings( *pPage, aFont, RES_CHRATR_FONT ); + + // CJK + GetFontSettings( *pPage, maCJKFont, RES_CHRATR_CJK_FONT ); + + // CTL + GetFontSettings( *pPage, maCTLFont, RES_CHRATR_CTL_FONT ); + + pPage->rSh.Pop(FALSE); + pPage->rSh.EndCrsrMove(); + } + else + { + // Font an Zeichenvorlage erfragen + SwCharFmt *pFmt = pPage->rSh.GetCharStyle( + pPage->aTemplateBox.GetSelectEntry(), + SwWrtShell::GETSTYLE_CREATEANY ); + ASSERT(pFmt, "Zeichenvorlage existiert nicht!"); + const SvxFontItem &rFmtFont = pFmt->GetFont(); + + aFont.SetFamily (rFmtFont.GetFamily()); + aFont.SetName (rFmtFont.GetFamilyName()); + aFont.SetPitch (rFmtFont.GetPitch()); + aFont.SetCharSet(rFmtFont.GetCharSet()); + } + } + + mnTextH = mnLines * mnTotLineH; + aFont.SetSize(Size(0, mnTextH)); + maCJKFont.SetSize(Size(0, mnTextH)); + maCTLFont.SetSize(Size(0, mnTextH)); + + aFont.SetTransparent(TRUE); + maCJKFont.SetTransparent(TRUE); + maCTLFont.SetTransparent(TRUE); + + aFont.SetColor( SwViewOption::GetFontColor() ); + maCJKFont.SetColor( SwViewOption::GetFontColor() ); + maCTLFont.SetColor( SwViewOption::GetFontColor() ); + + aFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor()); + maCJKFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor()); + maCTLFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor()); + + maCJKFont.SetSize(Size(0, maCJKFont.GetSize().Height() + mnLeading)); + maCTLFont.SetSize(Size(0, maCTLFont.GetSize().Height() + mnLeading)); + + SetFont(aFont); + aFont.SetSize(Size(0, aFont.GetSize().Height() + mnLeading)); + SetFont(aFont); + maFont = aFont; + + CheckScript(); + + maTextSize = CalcTextSize(); + + Invalidate(); +} + +/**************************************************************************** +Pict: Paint-Overload +****************************************************************************/ + +void SwDropCapsPict::Paint(const Rectangle &/*rRect*/) +{ + if (!IsVisible()) + return; + + SetMapMode(MapMode(MAP_PIXEL)); + SetLineColor(); + + SetFillColor( maBackColor ); + + Size aOutputSizePixel( GetOutputSizePixel() ); + + DrawRect(Rectangle(Point(0, 0), aOutputSizePixel )); + SetClipRegion(Region(Rectangle( + Point(BORDER, BORDER), + Size (aOutputSizePixel.Width () - 2 * BORDER, + aOutputSizePixel.Height() - 2 * BORDER)))); + + ASSERT(mnLineH > 0, "So klein lassen wir uns nicht machen"); + long nY0 = (aOutputSizePixel.Height() - (LINES * mnTotLineH)) / 2; + SetFillColor( maTextLineColor ); + for (USHORT i = 0; i < LINES; ++i) + DrawRect(Rectangle(Point(BORDER, nY0 + i * mnTotLineH), Size(aOutputSizePixel.Width() - 2 * BORDER, mnLineH))); + + // Texthintergrund mit Abstand (240 twips ~ 1 Zeilenhoehe) + ULONG lDistance = mnDistance; + USHORT nDistW = (USHORT) (ULONG) (((lDistance * 100) / 240) * mnTotLineH) / 100; + SetFillColor( maBackColor ); + if(((SwDropCapsPage*)GetParent())->aDropCapsBox.IsChecked()) + { + Size aTextSize( maTextSize ); + aTextSize.Width() += nDistW; + DrawRect( Rectangle( Point( BORDER, nY0 ), aTextSize ) ); + + // Text zeichnen + DrawPrev( Point( BORDER, nY0 - mnLeading ) ); + } + + SetClipRegion(); +} + +void SwDropCapsPict::DrawPrev( const Point& rPt ) +{ + Point aPt(rPt); + InitPrinter(); + + Font aOldFont = mpPrinter->GetFont(); + USHORT nScript; + USHORT nIdx = 0; + xub_StrLen nStart = 0; + xub_StrLen nEnd; + USHORT nCnt = maScriptChg.Count(); + + if( nCnt ) + { + nEnd = maScriptChg[ nIdx ]; + nScript = maScriptType[ nIdx ]; + } + else + { + nEnd = maText.Len(); + nScript = I18N_SCRIPTTYPE::LATIN; + } + do + { + SvxFont& rFnt = (nScript==I18N_SCRIPTTYPE::ASIAN) ? maCJKFont : ((nScript==I18N_SCRIPTTYPE::COMPLEX) ? maCTLFont : maFont); + mpPrinter->SetFont( rFnt ); + + rFnt.DrawPrev( this, mpPrinter, aPt, maText, nStart, nEnd - nStart ); + + aPt.X() += maTextWidth[ nIdx++ ]; + if( nEnd < maText.Len() && nIdx < nCnt ) + { + nStart = nEnd; + nEnd = maScriptChg[ nIdx ]; + nScript = maScriptType[ nIdx ]; + } + else + break; + } + while( TRUE ); + mpPrinter->SetFont( aOldFont ); +} + +void SwDropCapsPict::CheckScript( void ) +{ + if( maScriptText == maText ) + return; + + maScriptText = maText; + USHORT nCnt = maScriptChg.Count(); + if( nCnt ) + { + maScriptChg.Remove( 0, nCnt ); + maScriptType.Remove( 0, nCnt ); + maTextWidth.Remove( 0, nCnt ); + nCnt = 0; + } + if( !xBreak.is() ) + { + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + xBreak = Reference< I18N::XBreakIterator >(xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),UNO_QUERY); + } + if( xBreak.is() ) + { + USHORT nScript = xBreak->getScriptType( maText, 0 ); + USHORT nChg = 0; + if( I18N_SCRIPTTYPE::WEAK == nScript ) + { + nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); + if( nChg < maText.Len() ) + nScript = xBreak->getScriptType( maText, nChg ); + else + nScript = I18N_SCRIPTTYPE::LATIN; + } + + do + { + nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); + maScriptChg.Insert( nChg, nCnt ); + maScriptType.Insert( nScript, nCnt ); + maTextWidth.Insert( ULONG(0), nCnt++ ); + + if( nChg < maText.Len() ) + nScript = xBreak->getScriptType( maText, nChg ); + else + break; + } while( TRUE ); + } +} + +Size SwDropCapsPict::CalcTextSize( void ) +{ + InitPrinter(); + + USHORT nScript; + USHORT nIdx = 0; + xub_StrLen nStart = 0; + xub_StrLen nEnd; + USHORT nCnt = maScriptChg.Count(); + if( nCnt ) + { + nEnd = maScriptChg[ nIdx ]; + nScript = maScriptType[ nIdx ]; + } + else + { + nEnd = maText.Len(); + nScript = I18N_SCRIPTTYPE::LATIN; + } + long nTxtWidth = 0; + long nCJKHeight = 0; + long nCTLHeight = 0; + long nHeight = 0; + long nAscent = 0; + long nCJKAscent = 0; + long nCTLAscent = 0; + do + { + SvxFont& rFnt = ( nScript == I18N_SCRIPTTYPE::ASIAN )? maCJKFont : + ( ( nScript == I18N_SCRIPTTYPE::COMPLEX )? maCTLFont : maFont ); + ULONG nWidth = rFnt.GetTxtSize( mpPrinter, maText, nStart, nEnd-nStart ).Width(); + + if( nIdx < maTextWidth.Count() ) + maTextWidth[ nIdx++ ] = nWidth; + nTxtWidth += nWidth; + switch(nScript) + { + case I18N_SCRIPTTYPE::ASIAN: + calcFontHeightAnyAscent( this, maCJKFont, nCJKHeight, nCJKAscent ); + break; + case I18N_SCRIPTTYPE::COMPLEX: + calcFontHeightAnyAscent( this, maCTLFont, nCTLHeight, nCTLAscent ); + break; + default: + calcFontHeightAnyAscent( this, maFont, nHeight, nAscent ); + } + + if( nEnd < maText.Len() && nIdx < nCnt ) + { + nStart = nEnd; + nEnd = maScriptChg[ nIdx ]; + nScript = maScriptType[ nIdx ]; + } + else + break; + } + while( TRUE ); + nHeight -= nAscent; + nCJKHeight -= nCJKAscent; + nCTLHeight -= nCTLAscent; + if( nHeight < nCJKHeight ) + nHeight = nCJKHeight; + if( nAscent < nCJKAscent ) + nAscent = nCJKAscent; + if( nHeight < nCTLHeight ) + nHeight = nCTLHeight; + if( nAscent < nCTLAscent ) + nAscent = nCTLAscent; + nHeight += nAscent; + + Size aTxtSize( nTxtWidth, nHeight ); + return aTxtSize; +} + +void SwDropCapsPict::_InitPrinter() +{ + SfxViewShell* pSh = SfxViewShell::Current(); + + if ( pSh ) + mpPrinter = pSh->GetPrinter(); + + if ( !mpPrinter ) + { + mpPrinter = new Printer; + mbDelPrinter = TRUE; + } +} + +/**************************************************************************** +Dlg: Ctor +****************************************************************************/ + + +SwDropCapsDlg::SwDropCapsDlg(Window *pParent, const SfxItemSet &rSet ) : + + SfxSingleTabDialog(pParent, rSet, 0) + +{ + SwDropCapsPage* pNewPage = (SwDropCapsPage*) SwDropCapsPage::Create(this, rSet); + pNewPage->SetFormat(FALSE); + SetTabPage(pNewPage); +} + +/**************************************************************************** +Dlg: Dtor +****************************************************************************/ + + + SwDropCapsDlg::~SwDropCapsDlg() +{ +} + +/**************************************************************************** +Page: Ctor +****************************************************************************/ + + +SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet) : + + SfxTabPage(pParent, SW_RES(TP_DROPCAPS), rSet), + + aDropCapsBox (this, SW_RES(CB_SWITCH )), + aWholeWordCB (this, SW_RES(CB_WORD )), + aSwitchText (this, SW_RES(FT_DROPCAPS )), + aDropCapsField(this, SW_RES(FLD_DROPCAPS)), + aLinesText (this, SW_RES(TXT_LINES )), + aLinesField (this, SW_RES(FLD_LINES )), + aDistanceText (this, SW_RES(TXT_DISTANCE)), + aDistanceField(this, SW_RES(FLD_DISTANCE)), + aSettingsFL (this, SW_RES(FL_SETTINGS)), + + aTextText (this, SW_RES(TXT_TEXT )), + aTextEdit (this, SW_RES(EDT_TEXT )), + aTemplateText (this, SW_RES(TXT_TEMPLATE)), + aTemplateBox (this, SW_RES(BOX_TEMPLATE)), + aContentFL (this, SW_RES(FL_CONTENT )), + + pPict (new SwDropCapsPict(this, SW_RES(CNT_PICT))), + + bModified(FALSE), + bFormat(TRUE), + rSh(::GetActiveView()->GetWrtShell()) +{ + FreeResource(); + SetExchangeSupport(); + + USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE; + + //Im Vorlagendialog kann der Text nicht beeinflusst werden + aTextText.Enable( !bFormat ); + aTextEdit.Enable( !bFormat ); + + // Metriken + SetMetric( aDistanceField, GetDfltMetric(bHtmlMode) ); + + pPict->SetBorderStyle( WINDOW_BORDER_MONO ); + + // Handler installieren + Link aLk = LINK(this, SwDropCapsPage, ModifyHdl); + aDropCapsField.SetModifyHdl( aLk ); + aLinesField .SetModifyHdl( aLk ); + aDistanceField.SetModifyHdl( aLk ); + aTextEdit .SetModifyHdl( aLk ); + aDropCapsBox .SetClickHdl (LINK(this, SwDropCapsPage, ClickHdl )); + aTemplateBox .SetSelectHdl(LINK(this, SwDropCapsPage, SelectHdl)); + aWholeWordCB .SetClickHdl (LINK(this, SwDropCapsPage, WholeWordHdl )); +} + +/**************************************************************************** +Page: Dtor +****************************************************************************/ + + + SwDropCapsPage::~SwDropCapsPage() +{ + delete pPict; +} + + +int SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) +{ + if ( _pSet ) + FillSet( *_pSet ); + + return LEAVE_PAGE; +} + +/**************************************************************************** +Page: Factory +****************************************************************************/ + + +SfxTabPage* SwDropCapsPage::Create(Window *pParent, + const SfxItemSet &rSet) +{ + return new SwDropCapsPage(pParent, rSet); +} + +/**************************************************************************** +Page: FillItemSet-Overload +****************************************************************************/ + + +BOOL SwDropCapsPage::FillItemSet(SfxItemSet &rSet) +{ + if(bModified) + FillSet(rSet); + return bModified; +} + +/**************************************************************************** +Page: Reset-Overload +****************************************************************************/ + + +void SwDropCapsPage::Reset(const SfxItemSet &rSet) +{ + // Zeichen, Zeilen, Abstand und Text + SwFmtDrop aFmtDrop((SwFmtDrop &) rSet.Get(RES_PARATR_DROP)); + if (aFmtDrop.GetLines() > 1) + { + aDropCapsField.SetValue(aFmtDrop.GetChars()); + aLinesField .SetValue(aFmtDrop.GetLines()); + aDistanceField.SetValue(aDistanceField.Normalize(aFmtDrop.GetDistance()), FUNIT_TWIP); + aWholeWordCB .Check (aFmtDrop.GetWholeWord()); + } + else + { + aDropCapsField.SetValue(1); + aLinesField .SetValue(3); + aDistanceField.SetValue(0); + } + + ::FillCharStyleListBox(aTemplateBox, rSh.GetView().GetDocShell(), TRUE); + + aTemplateBox.InsertEntry(SW_RESSTR(SW_STR_NONE), 0); + // Vorlage defaulten + aTemplateBox.SelectEntryPos(0); + if (aFmtDrop.GetCharFmt()) + aTemplateBox.SelectEntry(aFmtDrop.GetCharFmt()->GetName()); + + // Controls enablen + aDropCapsBox.Check(aFmtDrop.GetLines() > 1); + const USHORT nVal = USHORT(aDropCapsField.GetValue()); + if (bFormat) + aTextEdit.SetText(GetDefaultString(nVal)); + else + { + aTextEdit.SetText(rSh.GetDropTxt(nVal)); + aTextEdit.Enable(); + aTextText.Enable(); + } + + // Preview + pPict->SetValues( aTextEdit.GetText(), + BYTE( aLinesField.GetValue() ), + USHORT( aDistanceField.Denormalize( aDistanceField.GetValue( FUNIT_TWIP ) ) ) ); + + ClickHdl(&aDropCapsBox); + bModified = FALSE; +} + +/**************************************************************************** +Page: Click-Handler der CheckBox +****************************************************************************/ + + +IMPL_LINK( SwDropCapsPage, ClickHdl, Button *, EMPTYARG ) +{ + BOOL bChecked = aDropCapsBox.IsChecked(); + + aWholeWordCB .Enable( bChecked && !bHtmlMode ); + + aSwitchText.Enable( bChecked && !aWholeWordCB.IsChecked() ); + aDropCapsField.Enable( bChecked && !aWholeWordCB.IsChecked() ); + aLinesText .Enable( bChecked ); + aLinesField .Enable( bChecked ); + aDistanceText.Enable( bChecked ); + aDistanceField.Enable( bChecked ); + aTemplateText .Enable( bChecked ); + aTemplateBox .Enable( bChecked ); + aTextEdit .Enable( bChecked && !bFormat ); + aTextText .Enable( bChecked && !bFormat ); + + if ( bChecked ) + { + ModifyHdl(&aDropCapsField); + aDropCapsField.GrabFocus(); + } + else + pPict->SetText(aEmptyStr); + + bModified = TRUE; + + return 0; +} + +/**************************************************************************** +Page: Click-Handler der CheckBox +****************************************************************************/ + + +IMPL_LINK( SwDropCapsPage, WholeWordHdl, CheckBox *, EMPTYARG ) +{ + aDropCapsField.Enable( !aWholeWordCB.IsChecked() ); + + ModifyHdl(&aDropCapsField); + + bModified = TRUE; + + return 0; +} + +/**************************************************************************** +Page: Modify-Handler der SpinFields +****************************************************************************/ + + +IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit ) +{ + String sPreview; + + // Ggf. Text setzen + if (pEdit == &aDropCapsField) + { + USHORT nVal; + BOOL bSetText = FALSE; + + if (!aWholeWordCB.IsChecked()) + nVal = (USHORT)aDropCapsField.GetValue(); + else + nVal = 0; + + if (bFormat || !rSh.GetDropTxt(1).Len()) + sPreview = GetDefaultString(nVal); + else + { + bSetText = TRUE; + sPreview = rSh.GetDropTxt(nVal); + } + + String sEdit(aTextEdit.GetText()); + + if (sEdit.Len() && sPreview.CompareTo(sEdit, sEdit.Len()) != COMPARE_EQUAL) + { + sPreview = sEdit.Copy(0, sPreview.Len()); + bSetText = FALSE; + } + + if (bSetText) + aTextEdit.SetText(sPreview); + } + else if (pEdit == &aTextEdit) // Ggf. Anzahl setzen + { + USHORT nTmp = aTextEdit.GetText().Len(); + aDropCapsField.SetValue(Max((USHORT)1, nTmp)); + + sPreview = aTextEdit.GetText().Copy(0, nTmp); + } + + // Bild anpassen + if (pEdit == &aDropCapsField || pEdit == &aTextEdit) + pPict->SetText (sPreview); + else if (pEdit == &aLinesField) + pPict->SetLines((BYTE)aLinesField.GetValue()); + else + pPict->SetDistance((USHORT)aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP))); + + bModified = TRUE; + + return 0; +} + +/**************************************************************************** +Page: Select-Handler der Template-Box. +*****************************************************************************/ + + +IMPL_LINK_INLINE_START( SwDropCapsPage, SelectHdl, ListBox *, EMPTYARG ) +{ + pPict->UpdatePaintSettings(); + bModified = TRUE; + return 0; +} +IMPL_LINK_INLINE_END( SwDropCapsPage, SelectHdl, ListBox *, EMPTYARG ) + + +USHORT* SwDropCapsPage::GetRanges() +{ + return aPageRg; +} + + +void SwDropCapsPage::FillSet( SfxItemSet &rSet ) +{ + if(bModified) + { + SwFmtDrop aFmt; + + BOOL bOn = aDropCapsBox.IsChecked(); + if(bOn) + { + // Anzahl, Zeilen, Abstand + aFmt.GetChars() = (BYTE) aDropCapsField.GetValue(); + aFmt.GetLines() = (BYTE) aLinesField.GetValue(); + aFmt.GetDistance() = (USHORT) aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP)); + aFmt.GetWholeWord() = aWholeWordCB.IsChecked(); + + // Vorlage + if (aTemplateBox.GetSelectEntryPos()) + aFmt.SetCharFmt(rSh.GetCharStyle(aTemplateBox.GetSelectEntry())); + } + else + { + aFmt.GetChars() = 1; + aFmt.GetLines() = 1; + aFmt.GetDistance() = 0; + } + + // Attribute setzen + const SfxPoolItem* pOldItem; + if(0 == (pOldItem = GetOldItem( rSet, FN_FORMAT_DROPCAPS )) || + aFmt != *pOldItem ) + rSet.Put(aFmt); + + // Harte Textformatierung + // Bug 24974: In Gestalter/Vorlagenkatoplog macht das keinen Sinn!! + if( !bFormat && aDropCapsBox.IsChecked() ) + { + String sText(aTextEdit.GetText()); + + if (!aWholeWordCB.IsChecked()) + sText.Erase( static_cast< xub_StrLen >(aDropCapsField.GetValue())); + + SfxStringItem aStr(FN_PARAM_1, sText); + rSet.Put( aStr ); + } + } +} + + + + diff --git a/sw/source/ui/chrdlg/drpcps.hrc b/sw/source/ui/chrdlg/drpcps.hrc new file mode 100644 index 000000000000..d1b432edbba7 --- /dev/null +++ b/sw/source/ui/chrdlg/drpcps.hrc @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DRPCPS_HRC +#define _DRPCPS_HRC + +// #define ****************************************************************** + +#define FT_DROPCAPS 1 +#define FLD_DROPCAPS 2 +#define TXT_LINES 3 +#define FLD_LINES 4 +#define TXT_DISTANCE 5 +#define FLD_DISTANCE 6 +#define CNT_PICT 7 +#define TXT_TEXT 8 +#define EDT_TEXT 9 +#define TXT_TEMPLATE 10 +#define BOX_TEMPLATE 11 +#define FL_SETTINGS 12 +#define CB_SWITCH 13 +#define FL_CONTENT 15 +#define CB_WORD 16 + +#endif + +// ********************************************************************** EOF diff --git a/sw/source/ui/chrdlg/drpcps.src b/sw/source/ui/chrdlg/drpcps.src new file mode 100644 index 000000000000..af8a0d920375 --- /dev/null +++ b/sw/source/ui/chrdlg/drpcps.src @@ -0,0 +1,226 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + // #include ***************************************************************** +#include "globals.hrc" +#include "chrdlg.hrc" +#include "drpcps.hrc" +#include "helpid.h" + // TabDialog **************************************************************** +TabDialog DLG_DROPCAPS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Drop Caps" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_DROPCAPS ; + Text [ en-US ] = "Drop Caps" ; + PageResID = TP_DROPCAPS ; + }; + }; + }; +}; + // TabPage ****************************************************************** +TabPage TP_DROPCAPS +{ + HelpID = HID_DROPCAPS ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + CheckBox CB_SWITCH + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "Display drop caps" ; + }; + CheckBox CB_WORD + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "~Whole word" ; + }; + FixedText FT_DROPCAPS + { + Pos = MAP_APPFONT ( 12 , 44 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Number of ~characters:" ; + }; + NumericField FLD_DROPCAPS + { + Border = TRUE ; + First = 1 ; + Last = 9 ; + Left = TRUE ; + Maximum = 9 ; + Minimum = 1 ; + Pos = MAP_APPFONT ( 89 , 42 ) ; + Repeat = TRUE ; + Size = MAP_APPFONT ( 36 , 12 ) ; + Spin = TRUE ; + TabStop = TRUE ; + }; + FixedText TXT_LINES + { + Left = TRUE ; + Pos = MAP_APPFONT ( 12 , 60 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "~Lines" ; + }; + NumericField FLD_LINES + { + Border = TRUE ; + First = 2 ; + Last = 9 ; + Left = TRUE ; + Maximum = 9 ; + Minimum = 2 ; + Pos = MAP_APPFONT ( 89 , 58 ) ; + Repeat = TRUE ; + Size = MAP_APPFONT ( 36 , 12 ) ; + Spin = TRUE ; + TabStop = TRUE ; + }; + FixedText TXT_DISTANCE + { + Left = TRUE ; + Pos = MAP_APPFONT ( 12 , 76 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Space to text" ; + }; + MetricField FLD_DISTANCE + { + Border = TRUE ; + DecimalDigits = 2 ; + First = 0 ; + Last = 200 ; + Left = TRUE ; + Maximum = 200 ; + Minimum = 0 ; + Pos = MAP_APPFONT ( 89 , 74 ) ; + Repeat = TRUE ; + Size = MAP_APPFONT ( 36 , 12 ) ; + Spin = TRUE ; + SpinSize = 10 ; + TabStop = TRUE ; + Unit = FUNIT_CM ; + }; + FixedLine FL_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 125 , 8 ) ; + Text [ en-US ] = "Settings" ; + }; + Control CNT_PICT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 143 , 7 ) ; + Size = MAP_APPFONT ( 105 , 80 ) ; + }; + FixedText TXT_TEXT + { + Left = TRUE ; + Pos = MAP_APPFONT ( 12 , 102 ) ; + Size = MAP_APPFONT ( 125 , 8 ) ; + Text [ en-US ] = "~Text" ; + }; + Edit EDT_TEXT + { + Border = TRUE ; + Left = TRUE ; + Pos = MAP_APPFONT ( 143 , 100 ) ; + Size = MAP_APPFONT ( 105 , 12 ) ; + TabStop = TRUE ; + MaxTextLength = 9 ; + }; + FixedText TXT_TEMPLATE + { + Left = TRUE ; + Pos = MAP_APPFONT ( 12 , 118 ) ; + Size = MAP_APPFONT ( 125 , 8 ) ; + Text [ en-US ] = "Character St~yle" ; + }; + ListBox BOX_TEMPLATE + { + Border = TRUE ; + DropDown = TRUE ; + Pos = MAP_APPFONT ( 143 , 116 ) ; + Size = MAP_APPFONT ( 105 , 61 ) ; + TabStop = TRUE ; + }; + FixedLine FL_CONTENT + { + Pos = MAP_APPFONT ( 6 , 89 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Contents" ; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/makefile.mk b/sw/source/ui/chrdlg/makefile.mk new file mode 100644 index 000000000000..42aad1aeddf1 --- /dev/null +++ b/sw/source/ui/chrdlg/makefile.mk @@ -0,0 +1,69 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=sw +TARGET=chrdlg +LIBTARGET=NO +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/inc$/swpre.mk +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/inc$/sw.mk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = \ + swbreak.src \ + chardlg.src \ + chrdlg.src \ + drpcps.src \ + ccoll.src \ + paradlg.src \ + numpara.src + +SLOFILES = \ + $(SLO)$/break.obj \ + $(SLO)$/chardlg.obj \ + $(SLO)$/drpcps.obj \ + $(SLO)$/ccoll.obj \ + $(SLO)$/swuiccoll.obj \ + $(SLO)$/pardlg.obj \ + $(SLO)$/tblnumfm.obj \ + $(SLO)$/numpara.obj + +LIB1TARGET = $(SLB)$/$(TARGET).lib + +LIB1OBJFILES = \ + $(SLO)$/ccoll.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx new file mode 100644 index 000000000000..f80130f475e9 --- /dev/null +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -0,0 +1,364 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#include "cmdid.h" +#include "swtypes.hxx" +#include "hintids.hxx" +#include "globals.hrc" +#include "helpid.h" +#include <sfx2/objsh.hxx> +#include <svx/htmlmode.hxx> +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> +#include <fmtline.hxx> +#include <numpara.hxx> +#include <numpara.hrc> +// --> OD 2008-04-14 #outlinelevel# +#include <app.hrc> +// <-- + +// Globals ****************************************************************** + +static USHORT __FAR_DATA aPageRg[] = { + FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, + 0 +}; +/*-----------------31.01.98 08:34------------------- + +--------------------------------------------------*/ +SwParagraphNumTabPage::SwParagraphNumTabPage(Window* pParent, + const SfxItemSet& rAttr ) : + SfxTabPage(pParent, SW_RES(TP_NUMPARA), rAttr), + aOutlineStartFL ( this, SW_RES( FL_OUTLINE_START )), + aOutlineLvFT ( this, SW_RES( FT_OUTLINE_LEVEL )), + aOutlineLvLB ( this, SW_RES( LB_OUTLINE_LEVEL )), + aNumberStyleFT ( this, SW_RES( FT_NUMBER_STYLE ) ), + aNumberStyleLB ( this, SW_RES( LB_NUMBER_STYLE ) ), + aNewStartFL ( this, SW_RES( FL_NEW_START ) ), + aNewStartCB ( this, SW_RES( CB_NEW_START ) ), + aNewStartNumberCB ( this, SW_RES( CB_NUMBER_NEW_START ) ), + aNewStartNF ( this, SW_RES( NF_NEW_START ) ), + aCountParaFL ( this, SW_RES( FL_COUNT_PARA ) ), + aCountParaCB ( this, SW_RES( CB_COUNT_PARA ) ), + aRestartParaCountCB ( this, SW_RES( CB_RESTART_PARACOUNT ) ), + aRestartFT ( this, SW_RES( FT_RESTART_NO ) ), + aRestartNF ( this, SW_RES( NF_RESTART_PARA ) ), + // --> OD 2008-04-14 #outlinelevel# + msOutlineNumbering( SW_RES( STR_OUTLINE_NUMBERING ) ), + // <-- + bModified(FALSE), + bCurNumrule(FALSE) +{ + FreeResource(); + + const SfxPoolItem* pItem; + SfxObjectShell* pObjSh; + if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, FALSE, &pItem) || + ( 0 != ( pObjSh = SfxObjectShell::Current()) && + 0 != (pItem = pObjSh->GetItem(SID_HTML_MODE)))) + { + USHORT nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue(); + if(HTMLMODE_ON & nHtmlMode) + { + aCountParaFL .Hide(); + aCountParaCB .Hide(); + aRestartParaCountCB .Hide(); + aRestartFT .Hide(); + aRestartNF .Hide(); + } + } + aNewStartCB.SetClickHdl(LINK(this, SwParagraphNumTabPage, NewStartHdl_Impl)); + aNewStartNumberCB.SetClickHdl(LINK(this, SwParagraphNumTabPage, NewStartHdl_Impl)); + aNumberStyleLB.SetSelectHdl(LINK(this, SwParagraphNumTabPage, StyleHdl_Impl)); + aCountParaCB.SetClickHdl(LINK(this, + SwParagraphNumTabPage, LineCountHdl_Impl)); + aRestartParaCountCB.SetClickHdl( + LINK(this, SwParagraphNumTabPage, LineCountHdl_Impl)); +} +/*-----------------31.01.98 08:34------------------- + +--------------------------------------------------*/ +SwParagraphNumTabPage::~SwParagraphNumTabPage() +{ +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +SfxTabPage* SwParagraphNumTabPage::Create( Window* pParent, + const SfxItemSet& rSet ) +{ + return new SwParagraphNumTabPage(pParent, rSet); +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +USHORT* SwParagraphNumTabPage::GetRanges() +{ + return aPageRg; +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +BOOL SwParagraphNumTabPage::FillItemSet( SfxItemSet& rSet ) +{ + //<-#outline level, added by zhaojianwei + if( aOutlineLvLB.GetSelectEntryPos() != aOutlineLvLB.GetSavedValue()) + { + USHORT aOutlineLv = aOutlineLvLB.GetSelectEntryPos(); + const SfxUInt16Item* pOldOutlineLv = (const SfxUInt16Item*)GetOldItem( rSet, SID_ATTR_PARA_OUTLINE_LEVEL); + SfxUInt16Item* pOutlineLv = (SfxUInt16Item*)pOldOutlineLv->Clone(); + pOutlineLv->SetValue( aOutlineLv ); + rSet.Put(*pOutlineLv); + delete pOutlineLv; + bModified = TRUE; + } + //<-end + if( aNumberStyleLB.GetSelectEntryPos() != aNumberStyleLB.GetSavedValue()) + { + String aStyle; + if(aNumberStyleLB.GetSelectEntryPos()) + aStyle = aNumberStyleLB.GetSelectEntry(); + const SfxStringItem* pOldRule = (const SfxStringItem*)GetOldItem( rSet, SID_ATTR_PARA_NUMRULE); + SfxStringItem* pRule = (SfxStringItem*)pOldRule->Clone(); + pRule->SetValue(aStyle); + rSet.Put(*pRule); + delete pRule; + bModified = TRUE; + } + if(aNewStartCB.GetState() != aNewStartCB.GetSavedValue() || + aNewStartNumberCB.GetState() != aNewStartNumberCB.GetSavedValue()|| + aNewStartNF.GetText() != aNewStartNF.GetSavedValue()) + { + bModified = TRUE; + BOOL bNewStartChecked = STATE_CHECK == aNewStartCB.GetState(); + BOOL bNumberNewStartChecked = STATE_CHECK == aNewStartNumberCB.GetState(); + rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART, bNewStartChecked)); + rSet.Put(SfxUInt16Item(FN_NUMBER_NEWSTART_AT, + bNumberNewStartChecked && bNewStartChecked ? (USHORT)aNewStartNF.GetValue() : USHRT_MAX)); + } + + if(aCountParaCB.GetSavedValue() != aCountParaCB.GetState() || + aRestartParaCountCB.GetSavedValue() != aRestartParaCountCB.GetState() || + aRestartNF.GetSavedValue() != aRestartNF.GetText() ) + { + SwFmtLineNumber aFmt; + aFmt.SetStartValue( static_cast< ULONG >(aRestartParaCountCB.GetState() == STATE_CHECK ? + aRestartNF.GetValue() : 0 )); + aFmt.SetCountLines( aCountParaCB.IsChecked() ); + rSet.Put(aFmt); + bModified = TRUE; + } + return bModified; +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +void SwParagraphNumTabPage::Reset( const SfxItemSet& rSet ) +{ + BOOL bHasNumberStyle = FALSE; + + SfxItemState eItemState = rSet.GetItemState( GetWhich(SID_ATTR_PARA_OUTLINE_LEVEL) ); + + sal_Int16 nOutlineLv; + if( eItemState >= SFX_ITEM_AVAILABLE ) + { + nOutlineLv = ((const SfxUInt16Item &)rSet.Get( GetWhich(SID_ATTR_PARA_OUTLINE_LEVEL) )).GetValue(); + aOutlineLvLB.SelectEntryPos( nOutlineLv ) ; + } + else + { + aOutlineLvLB.SetNoSelection(); + } + aOutlineLvLB.SaveValue(); + + eItemState = rSet.GetItemState( GetWhich(SID_ATTR_PARA_NUMRULE) ); + + String aStyle; + if( eItemState >= SFX_ITEM_AVAILABLE ) + { + aStyle = ((const SfxStringItem &)rSet.Get( GetWhich(SID_ATTR_PARA_NUMRULE) )).GetValue(); + if(!aStyle.Len()) + aStyle = aNumberStyleLB.GetEntry(0); + + if( aStyle.EqualsAscii("Outline"))// == String::CreateFromAscii("Outline")) //maybe need modify,zhaojianwei + { + aNumberStyleLB.InsertEntry( msOutlineNumbering ); + aNumberStyleLB.SelectEntry( msOutlineNumbering ); + aNumberStyleLB.RemoveEntry(msOutlineNumbering); + aNumberStyleLB.SaveValue(); + } + else + aNumberStyleLB.SelectEntry( aStyle ); + + bHasNumberStyle = TRUE; + } + else + { + aNumberStyleLB.SetNoSelection(); + } + + aNumberStyleLB.SaveValue(); + + eItemState = rSet.GetItemState( FN_NUMBER_NEWSTART ); + if(eItemState > SFX_ITEM_AVAILABLE ) + { + bCurNumrule = TRUE; + const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(FN_NUMBER_NEWSTART); + aNewStartCB.SetState( + rStart.GetValue() ? + STATE_CHECK : STATE_NOCHECK ); + aNewStartCB.EnableTriState(FALSE); + } + else + aNewStartCB.SetState(bHasNumberStyle ? STATE_NOCHECK : STATE_DONTKNOW); + aNewStartCB.SaveValue(); + + eItemState = rSet.GetItemState( FN_NUMBER_NEWSTART_AT); + if( eItemState > SFX_ITEM_AVAILABLE ) + { + USHORT nNewStart = ((const SfxUInt16Item&)rSet.Get(FN_NUMBER_NEWSTART_AT)).GetValue(); + aNewStartNumberCB.Check(USHRT_MAX != nNewStart); + if(USHRT_MAX == nNewStart) + nNewStart = 1; + + aNewStartNF.SetValue(nNewStart); + aNewStartNumberCB.EnableTriState(FALSE); + } + else + aNewStartCB.SetState(STATE_DONTKNOW); + NewStartHdl_Impl(&aNewStartCB); + aNewStartNF.SaveValue(); + aNewStartNumberCB.SaveValue(); + StyleHdl_Impl(&aNumberStyleLB); + if( SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_LINENUMBER)) + { + SwFmtLineNumber& rNum = (SwFmtLineNumber&)rSet.Get(RES_LINENUMBER); + ULONG nStartValue = rNum.GetStartValue(); + BOOL bCount = rNum.IsCount(); + aCountParaCB.SetState( bCount ? STATE_CHECK : STATE_NOCHECK ); + aRestartParaCountCB.SetState( 0 != nStartValue ? STATE_CHECK : STATE_NOCHECK ); + aRestartNF.SetValue(nStartValue == 0 ? 1 : nStartValue); + LineCountHdl_Impl(&aCountParaCB); + aCountParaCB.EnableTriState(FALSE); + aRestartParaCountCB.EnableTriState(FALSE); + } + else + { + aCountParaCB.SetState(STATE_DONTKNOW); + aRestartParaCountCB.SetState(STATE_DONTKNOW); + } + aCountParaCB.SaveValue(); + aRestartParaCountCB.SaveValue(); + aRestartNF.SaveValue(); + + bModified = FALSE; +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +void SwParagraphNumTabPage::DisableOutline() +{ + aOutlineLvFT.Disable(); + aOutlineLvLB.Disable(); +} +void SwParagraphNumTabPage::DisableNumbering() +{ + aNumberStyleFT.Disable(); + aNumberStyleLB.Disable(); +} + +/*-----------------31.01.98 08:38------------------- + +--------------------------------------------------*/ +void SwParagraphNumTabPage::EnableNewStart() +{ + aNewStartCB.Show(); + aNewStartNumberCB.Show(); + aNewStartNF.Show(); +} + +/*-----------------31.01.98 08:56------------------- + +--------------------------------------------------*/ +IMPL_LINK( SwParagraphNumTabPage, NewStartHdl_Impl, CheckBox*, EMPTYARG ) +{ + BOOL bEnable = aNewStartCB.IsChecked(); + aNewStartNumberCB.Enable(bEnable); + aNewStartNF.Enable(bEnable && aNewStartNumberCB.IsChecked()); + return 0; +} + +/*-----------------05.02.98 10:01------------------- + +--------------------------------------------------*/ +IMPL_LINK( SwParagraphNumTabPage, LineCountHdl_Impl, CheckBox* , EMPTYARG) +{ + aRestartParaCountCB.Enable(aCountParaCB.IsChecked()); + + BOOL bEnableRestartValue = aRestartParaCountCB.IsEnabled() && + aRestartParaCountCB.IsChecked(); + aRestartFT.Enable(bEnableRestartValue); + aRestartNF.Enable(bEnableRestartValue); + + return 0; +} + +/*-----------------05.02.98 13:39------------------- + +--------------------------------------------------*/ +IMPL_LINK( SwParagraphNumTabPage, StyleHdl_Impl, ListBox*, pBox ) +{ +// String dd=aNumberStyleLB.GetSavedValue(); +// if( msOutlineNumbering == dd) + { + } + BOOL bEnable = bCurNumrule || pBox->GetSelectEntryPos() > 0; + aNewStartCB.Enable(bEnable); + NewStartHdl_Impl(&aNewStartCB); + + return 0; +} + + diff --git a/sw/source/ui/chrdlg/numpara.hrc b/sw/source/ui/chrdlg/numpara.hrc new file mode 100644 index 000000000000..536dc8d935dd --- /dev/null +++ b/sw/source/ui/chrdlg/numpara.hrc @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _NUMPARA_HRC +#define _NUMPARA_HRC + +// #define ****************************************************************** + +#define LB_NUMBER_STYLE 1 +#define FT_NUMBER_STYLE 2 +#define CB_NEW_START 3 +#define CB_NUMBER_NEW_START 4 +#define FL_NEW_START 5 +#define NF_NEW_START 6 +#define FL_COUNT_PARA 7 +#define CB_COUNT_PARA 8 +#define CB_RESTART_PARACOUNT 9 +#define FT_RESTART_NO 10 +#define NF_RESTART_PARA 11 +#define FL_OUTLINE_START 12 +#define LB_OUTLINE_LEVEL 13 +#define FT_OUTLINE_LEVEL 14 +// ********************************************************************** + +#endif + + + + diff --git a/sw/source/ui/chrdlg/numpara.src b/sw/source/ui/chrdlg/numpara.src new file mode 100644 index 000000000000..2c384d5dc7a8 --- /dev/null +++ b/sw/source/ui/chrdlg/numpara.src @@ -0,0 +1,229 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #pragma ****************************************************************** + + // #include ***************************************************************** +#include "globals.hrc" +#include "chrdlg.hrc" +#include "numpara.hrc" +#include "helpid.h" + // TabPage ****************************************************************** +TabPage TP_NUMPARA +{ + HelpID = HID_NUMPARA ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_OUTLINE_START + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Outline" ; + }; + FixedText FT_OUTLINE_LEVEL + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 112 , 8 ) ; + Text [ en-US ] = "Outline level" ; + }; + ListBox LB_OUTLINE_LEVEL + { + Pos = MAP_APPFONT ( 130 , 14 ) ; + Size = MAP_APPFONT ( 118 , 65 ) ; + DropDown = TRUE ; + Border = TRUE ; + StringList [ en-US ] = + { + < "Body text" ; > ; + < "Level 1" ; >; + < "Level 2" ; >; + < "Level 3" ; >; + < "Level 4" ; >; + < "Level 5" ; >; + < "Level 6" ; >; + < "Level 7" ; >; + < "Level 8" ; >; + < "Level 9" ; >; + < "Level 10" ; >; + }; + StringList [ x-comment ] = + { + < "Level 0" ; > ; + < "Level 1" ; >; + < "Level 2" ; >; + < "Level 3" ; >; + < "Level 4" ; >; + < "Level 5" ; >; + < "Level 6" ; >; + < "Level 7" ; >; + < "Level 8" ; >; + < "Level 9" ; >; + < "Level 10" ; >; + }; + }; + FixedLine FL_NEW_START + { + Pos = MAP_APPFONT ( 6 , 32 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Numbering" ; + }; + FixedText FT_NUMBER_STYLE + { + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 112 , 8 ) ; + Text [ en-US ] = "Numbering Style" ; + }; + ListBox LB_NUMBER_STYLE + { + Pos = MAP_APPFONT ( 130 , 41 ) ; + Size = MAP_APPFONT ( 118 , 65 ) ; + DropDown = TRUE ; + Border = TRUE ; + StringList [ en-US ] = + { + < "None" ; > ; + }; + }; + TriStateBox CB_NEW_START + { + Pos = MAP_APPFONT ( 12 , 58 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + Hide = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "R~estart at this paragraph" ; + }; + TriStateBox CB_NUMBER_NEW_START + { + Pos = MAP_APPFONT ( 21 , 73 ) ; + Size = MAP_APPFONT ( 103 , 10 ) ; + Hide = TRUE ; + Disable = TRUE ; + Text [ en-US ] = "S~tart with" ; + }; + NumericField NF_NEW_START + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 72 ) ; + Size = MAP_APPFONT ( 26 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 9999 ; + Value = 0 ; + First = 0 ; + Last = 9999 ; + Hide = TRUE ; + Disable = TRUE ; + }; + FixedLine FL_COUNT_PARA + { + Pos = MAP_APPFONT ( 6 , 89 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Line numbering" ; + }; + TriStateBox CB_COUNT_PARA + { + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Include this paragraph in line numbering" ; + }; + TriStateBox CB_RESTART_PARACOUNT + { + Pos = MAP_APPFONT ( 12 , 116 ) ; + Size = MAP_APPFONT ( 160 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Rest~art at this paragraph" ; + }; + FixedText FT_RESTART_NO + { + Pos = MAP_APPFONT ( 21 , 132 ) ; + Size = MAP_APPFONT ( 103 , 8 ) ; + Disable = TRUE ; + Text [ en-US ] = "~Start with" ; + }; + NumericField NF_RESTART_PARA + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 130 ) ; + Size = MAP_APPFONT ( 26 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 65000 ; + Value = 1 ; + First = 1 ; + Last = 65000 ; + Disable = TRUE ; + }; +}; + // ********************************************************************** EOF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/paradlg.hrc b/sw/source/ui/chrdlg/paradlg.hrc new file mode 100644 index 000000000000..e8e48dfaa956 --- /dev/null +++ b/sw/source/ui/chrdlg/paradlg.hrc @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define TAB_CONTROL 55 +#define INDENT_FRM 1 +#define LEFT_LABEL 2 +#define FLINE_LABEL 3 +#define RIGHT_LABEL 4 +#define LEFT_INDENT 5 +#define FLINE_INDENT 6 +#define RIGHT_INDENT 7 +#define DIST_FRM 8 +#define TOP_LABEL 9 +#define TOP_DIST 10 +#define BOTTOM_LABEL 11 +#define BOTTOM_DIST 12 +#define ALG_LEFT 13 +#define ALG_RIGHT 50 +#define ALG_CENTER 51 +#define ALG_JUSTIFY 52 +#define ALG_FRM 14 +#define LINEDIST_FRM 15 +#define LINEDIST_BOX 16 +#define LINEDIST_AT_LABEL 17 +#define LINEDIST_AT_PERCENTBOX 18 +#define LINEDIST_AT_METRICBOX 19 +#define HYPHEN_FRM 21 +#define HYPHEN_BOX_AFTER 44 +#define HYPHEN_BOX_BEFORE 22 +#define EXTHYPHEN_BOX_AFTER 42 +#define EXTHYPHEN_BOX_BEFORE 23 +#define HYPHEN_LABEL_AFTER 43 +#define HYPHEN_LABEL_BEFORE 24 +#define EXTEND_FRM 25 +#define PAGEBREAK_BOX 26 +#define PAGEBREAK_DAVOR 27 +#define PAGEBREAK_DAHINTER 28 +#define KEEP_TOGETHER_BOX 29 +#define WIDOW_BOX 31 +#define WIDOW_ROW_NO 32 +#define WIDOW_ROW_LABEL 33 +#define ORPHAN_BOX 34 +#define ORPHAN_ROW_NO 35 +#define ORPHAN_ROW_LABEL 36 +#define PAGE_COLL_BTN 40 +#define PAGE_COLL_BOX 41 +#define OK_BTN 50 +#define CANCEL_BTN 51 diff --git a/sw/source/ui/chrdlg/paradlg.src b/sw/source/ui/chrdlg/paradlg.src new file mode 100644 index 000000000000..1384e4ae8fa3 --- /dev/null +++ b/sw/source/ui/chrdlg/paradlg.src @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "globals.hrc" +#include "chrdlg.hrc" +#include "paradlg.hrc" +#define HelpText "error - hier keine HelpTexte HelpText" + // #define DLG_PARA 256 +TabDialog DLG_PARA +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Paragraph" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_PARA_STD ; + /* ### ACHTUNG: Neuer Text in Resource? Einzüge und Abstände : Einz³ge und Abstõnde */ + Text [ en-US ] = "Indents & Spacing" ; + PageResID = TP_PARA_STD ; + }; + PageItem + { + Identifier = TP_PARA_ALIGN ; + PageResID = TP_PARA_ALIGN ; + Text [ en-US ] = "Alignment" ; + }; + PageItem + { + Identifier = TP_PARA_EXT ; + /* ### ACHTUNG: Neuer Text in Resource? Textflu?: Textflu?*/ + Text [ en-US ] = "Text Flow" ; + PageResID = TP_PARA_EXT ; + }; + PageItem + { + Identifier = TP_PARA_ASIAN; + Text [ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = TP_NUMPARA ; + Text [ en-US ] = "Outline & Numbering" ; + }; + PageItem + { + Identifier = TP_TABULATOR ; + Text [ en-US ] = "Tabs" ; + PageResID = TP_TABULATOR ; + }; + PageItem + { + Identifier = TP_DROPCAPS ; + Text [ en-US ] = "Drop Caps" ; + PageResID = TP_DROPCAPS ; + }; + PageItem + { + Identifier = TP_BORDER ; + Text [ en-US ] = "Borders" ; + PageResID = TP_BORDER ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + PageResID = TP_BACKGROUND ; + }; + }; + }; +}; +TabDialog DLG_DRAWPARA +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Paragraph" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_PARA_STD ; + /* ### ACHTUNG: Neuer Text in Resource? Einzüge und Abstände : Einz³ge und Abstõnde */ + Text [ en-US ] = "Indents & Spacing" ; + PageResID = TP_PARA_STD ; + }; + PageItem + { + Identifier = TP_PARA_ALIGN ; + PageResID = TP_PARA_ALIGN ; + Text [ en-US ] = "Alignment" ; + }; + PageItem + { + Identifier = TP_PARA_ASIAN; + Text [ en-US ] = "Asian Typography"; + }; + PageItem + { + Identifier = TP_TABULATOR ; + Text [ en-US ] = "Tabs" ; + PageResID = TP_TABULATOR ; + }; + }; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx new file mode 100644 index 000000000000..0976c7fbf5aa --- /dev/null +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -0,0 +1,269 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include "hintids.hxx" +#include <svx/htmlmode.hxx> +#include <svl/style.hxx> + +#include <svtools/htmlcfg.hxx> + +#ifndef _SVSTDARR_STRINGSSORTDTOR +#define _SVSTDARR_STRINGSSORTDTOR +#include <svl/svstdarr.hxx> +#endif +#include <svl/cjkoptions.hxx> +#include "docsh.hxx" +#include "wrtsh.hxx" +#include "frmatr.hxx" +#include "view.hxx" +#include "globals.hrc" +#include "swuipardlg.hxx" +#include "pagedesc.hxx" +#include "paratr.hxx" +#include "drpcps.hxx" +#include "uitool.hxx" +#include "viewopt.hxx" +#include <numpara.hxx> +#include "chrdlg.hrc" +#include "poolfmt.hrc" +#include <svx/svxids.hrc> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svx/svxdlg.hxx> +#include <svx/dialogs.hrc> +#include <svx/flagsdef.hxx> +// STATIC DATA ----------------------------------------------------------- + + +SwParaDlg::SwParaDlg(Window *pParent, + SwView& rVw, + const SfxItemSet& rCoreSet, + BYTE nDialogMode, + const String *pTitle, + BOOL bDraw, + UINT16 nDefPage): + + SfxTabDialog(pParent, bDraw ? SW_RES(DLG_DRAWPARA) : SW_RES(DLG_PARA), + &rCoreSet, 0 != pTitle), + + rView(rVw), + nDlgMode(nDialogMode), + bDrawParaDlg(bDraw) + +{ + FreeResource(); + + nHtmlMode = ::GetHtmlMode(rVw.GetDocShell()); + BOOL bHtmlMode = static_cast< BOOL >(nHtmlMode & HTMLMODE_ON); + if(pTitle) + { + // Update des Titels + String aTmp( GetText() ); + aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER); + aTmp += *pTitle; + aTmp += ')'; + SetText(aTmp); + } + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + + DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!"); + AddTabPage( TP_PARA_STD, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) ); + + DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!"); + AddTabPage( TP_PARA_ALIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) ); + + SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); + if (!bDrawParaDlg && (!bHtmlMode || pHtmlOpt->IsPrintLayoutExtension())) + { + DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!"); + AddTabPage( TP_PARA_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) ); + + } + else + RemoveTabPage(TP_PARA_EXT); + + SvtCJKOptions aCJKOptions; + if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled()) + { + DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!"); + AddTabPage( TP_PARA_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) ); + } + else + RemoveTabPage(TP_PARA_ASIAN); + + USHORT nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE)); + BOOL bLRValid = SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(nWhich); + if(bHtmlMode || !bLRValid) + RemoveTabPage(TP_TABULATOR); + else + { + DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!"); + AddTabPage( TP_TABULATOR, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) ); + + } + if (!bDrawParaDlg) + { + if(!(nDlgMode & DLG_ENVELOP)) + AddTabPage(TP_NUMPARA, SwParagraphNumTabPage::Create,SwParagraphNumTabPage::GetRanges); + else + RemoveTabPage(TP_NUMPARA); + if(!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) + { + AddTabPage(TP_DROPCAPS, SwDropCapsPage::Create, SwDropCapsPage::GetRanges); + } + else + { + RemoveTabPage(TP_DROPCAPS); + } + if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES))) + { + DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + } + else + { + RemoveTabPage(TP_BACKGROUND); + } + if(!bHtmlMode || (nHtmlMode & HTMLMODE_PARA_BORDER)) + { + DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); + DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!"); + AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); + } + else + RemoveTabPage(TP_BORDER); + } + + if (nDefPage) + SetCurPageId(nDefPage); +} + + +__EXPORT SwParaDlg::~SwParaDlg() +{ +} + + +void __EXPORT SwParaDlg::PageCreated(USHORT nId, SfxTabPage& rPage) +{ + SwWrtShell& rSh = rView.GetWrtShell(); + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + + // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden + if (nId == TP_BORDER) + { + aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA)); + rPage.PageCreated(aSet); + } + else if( nId == TP_PARA_STD ) + { + aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, + static_cast< UINT16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) )); + + if (!bDrawParaDlg) + { + aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E)); + aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10)); + + } + rPage.PageCreated(aSet); + } + else if( TP_PARA_ALIGN == nId) + { + if (!bDrawParaDlg) + { + aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,TRUE)); + rPage.PageCreated(aSet); + } + } + else if( TP_PARA_EXT == nId ) + { + // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in + // einer Tabelle steht + const USHORT eType = rSh.GetFrmType(0,TRUE); + if( !(FRMTYPE_BODY & eType) || + rSh.GetSelectionType() & nsSelectionType::SEL_TBL ) + { + aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,TRUE)); + rPage.PageCreated(aSet); + } + } + else if( TP_DROPCAPS == nId ) + { + ((SwDropCapsPage&)rPage).SetFormat(FALSE); + } + else if( TP_BACKGROUND == nId ) + { + if(!( nHtmlMode & HTMLMODE_ON ) || + nHtmlMode & HTMLMODE_SOME_STYLES) + { + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); + rPage.PageCreated(aSet); + } + } + else if( TP_NUMPARA == nId) + { + //-->#outline level,added by zhaojianwei + SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl(); + if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() ) + { + ((SwParagraphNumTabPage&)rPage).DisableOutline() ; + }//<-end + + ((SwParagraphNumTabPage&)rPage).EnableNewStart(); + ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox(); + SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool(); + pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL); + const SfxStyleSheetBase* pBase = pPool->First(); + SvStringsSortDtor aNames; + while(pBase) + { + aNames.Insert(new String(pBase->GetName())); + pBase = pPool->Next(); + } + for(USHORT i = 0; i < aNames.Count(); i++) + rBox.InsertEntry(*aNames.GetObject(i)); + } + +} + + + diff --git a/sw/source/ui/chrdlg/swbreak.src b/sw/source/ui/chrdlg/swbreak.src new file mode 100644 index 000000000000..8c6cee69d440 --- /dev/null +++ b/sw/source/ui/chrdlg/swbreak.src @@ -0,0 +1,172 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "chrdlg.hrc" +#include "break.hrc" +#include "cmdid.h" +#include "helpid.h" + // #define DLG_BREAK 256 +ModalDialog DLG_BREAK +{ + HelpID = FN_INSERT_BREAK_DLG ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 161 , 114 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Umbruch einfügen : Umbruch einf³gen */ + Text [ en-US ] = "Insert Break" ; + Moveable = TRUE ; + OKButton BT_OK + { + Pos = MAP_APPFONT ( 105 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + DefButton = TRUE ; + }; + CancelButton BT_CANCEL + { + Pos = MAP_APPFONT ( 105 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + }; + HelpButton BT_HELP + { + Pos = MAP_APPFONT ( 105 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Group = TRUE ; + }; + RadioButton RB_LINE + { + Pos = MAP_APPFONT ( 12 , 15 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + Text [ en-US ] = "~Line break" ; + TabStop = TRUE ; + Group = TRUE ; + }; + RadioButton RB_PAGE + { + Pos = MAP_APPFONT ( 12 , 39 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + Text [ en-US ] = "~Page break" ; + TabStop = TRUE ; + Check = TRUE ; + }; + RadioButton RB_COL + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 69 , 10 ) ; + Text [ en-US ] = "~Column break" ; + TabStop = TRUE ; + }; + FixedLine FL_BREAK + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 93 , 8 ) ; + Text [ en-US ] = "Type" ; + }; + FixedText FT_COLL + { + Pos = MAP_APPFONT ( 12 , 51 ) ; + Size = MAP_APPFONT ( 69 , 8 ) ; + Text [ en-US ] = "~Style" ; + Group = TRUE ; + Left = TRUE ; + }; + ListBox LB_COLL + { + Pos = MAP_APPFONT ( 12 , 62 ) ; + Size = MAP_APPFONT ( 75 , 50 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + StringList [ en-US ] = + { + < "[None]" ; > ; + }; + }; + CheckBox CB_PAGENUM + { + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 84 , 10 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Seitennummer ~ändern : Seitennummer ~õndern */ + Text [ en-US ] = "Change page ~number" ; + TabStop = TRUE ; + }; + NumericField ED_PAGENUM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 94 ) ; + Size = MAP_APPFONT ( 31 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 9999 ; + Value = 1 ; + First = 1 ; + Last = 9999 ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx new file mode 100644 index 000000000000..a9d90a4c02e4 --- /dev/null +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#include "cmdid.h" +#include <tools/list.hxx> +#include "swmodule.hxx" +#include "view.hxx" +#include "wrtsh.hxx" +#include "globals.hrc" +#include "helpid.h" + + +#include <sfx2/styfitem.hxx> + +#include "uitool.hxx" +#include "ccoll.hxx" +#include "fmtcol.hxx" +#include "hintids.hxx" +#include "docsh.hxx" +#include "docstyle.hxx" +#include "hints.hxx" + +#include "chrdlg.hrc" +#include "ccoll.hrc" +#include <vcl/svapp.hxx> + +#include "swuiccoll.hxx" + +static USHORT __FAR_DATA aPageRg[] = { + FN_COND_COLL, FN_COND_COLL, + 0 +}; + +// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert +static long nTabs[] = + { 2, // Number of Tabs + 0, 100 + }; + +/**************************************************************************** +Page: Ctor +****************************************************************************/ + + +SwCondCollPage::SwCondCollPage(Window *pParent, const SfxItemSet &rSet) + + : SfxTabPage(pParent, SW_RES(TP_CONDCOLL), rSet), + aConditionFL( this, SW_RES( FL_CONDITION )), + aConditionCB( this, SW_RES( CB_CONDITION ) ), + aContextFT ( this, SW_RES( FT_CONTEXT ) ), + aUsedFT ( this, SW_RES( FT_USED ) ), + aTbLinks( this, SW_RES( TB_CONDCOLLS ) ), + aStyleFT ( this, SW_RES( FT_STYLE ) ), + aStyleLB ( this, SW_RES( LB_STYLE ) ), + aFilterLB ( this, SW_RES( LB_FILTER ) ), + aRemovePB ( this, SW_RES( PB_REMOVE ) ), + aAssignPB ( this, SW_RES( PB_ASSIGN ) ), + sNoTmpl ( SW_RES( STR_NOTEMPL ) ), + aStrArr ( SW_RES( STR_REGIONS ) ), + rSh(::GetActiveView()->GetWrtShell()), + pCmds( SwCondCollItem::GetCmds() ), + pFmt(0), + + bNewTemplate(FALSE) +{ + FreeResource(); + SetExchangeSupport(); + + // Handler installieren + aConditionCB.SetClickHdl( LINK(this, SwCondCollPage, OnOffHdl)); + aTbLinks.SetDoubleClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl )); + aStyleLB.SetDoubleClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl )); + aRemovePB.SetClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl )); + aAssignPB.SetClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl )); + aTbLinks.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl)); + aStyleLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl)); + aFilterLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl)); + + aTbLinks.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aTbLinks.SetSelectionMode( SINGLE_SELECTION ); + aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT ); + aTbLinks.Resize(); // OS: Hack fuer richtige Selektion + aTbLinks.SetSpaceBetweenEntries( 0 ); + aTbLinks.SetHelpId(HID_COND_COLL_TABLIST); + + SfxStyleFamilies aFamilies(SW_RES(DLG_STYLE_DESIGNER)); + const SfxStyleFamilyItem* pFamilyItem = 0; + USHORT nCount = aFamilies.Count(); + USHORT i; + + for( i = 0; i < nCount; ++i) + { + if(SFX_STYLE_FAMILY_PARA == (USHORT)(pFamilyItem = aFamilies.GetObject(i))->GetFamily()) + break; + } + + const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList(); + for( i = 0; i < rFilterList.Count(); ++i) + { + aFilterLB.InsertEntry(rFilterList.GetObject(i)->aName); + USHORT* pFilter = new USHORT(rFilterList.GetObject(i)->nFlags); + aFilterLB.SetEntryData(i, pFilter); + } + aFilterLB.SelectEntryPos(1); + + aTbLinks.Show(); + +} + +/**************************************************************************** +Page: Dtor +****************************************************************************/ + + +__EXPORT SwCondCollPage::~SwCondCollPage() +{ + for(USHORT i = 0; i < aFilterLB.GetEntryCount(); ++i) + delete (USHORT*)aFilterLB.GetEntryData(i); + +} + + +int __EXPORT SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) +{ + if( _pSet ) + FillItemSet(*_pSet); + + return LEAVE_PAGE; +} + +/**************************************************************************** +Page: Factory +****************************************************************************/ + + +SfxTabPage* __EXPORT SwCondCollPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwCondCollPage(pParent, rSet); +} + +/**************************************************************************** +Page: FillItemSet-Overload +****************************************************************************/ + + +BOOL __EXPORT SwCondCollPage::FillItemSet(SfxItemSet &rSet) +{ + BOOL bModified = TRUE; + SwCondCollItem aCondItem; + for(USHORT i = 0; i < aStrArr.Count(); i++) + { + String sEntry = aTbLinks.GetEntryText(i, 1); + aCondItem.SetStyle( &sEntry, i); + } + rSet.Put(aCondItem); + return bModified; +} + +/**************************************************************************** +Page: Reset-Overload +****************************************************************************/ + + +void __EXPORT SwCondCollPage::Reset(const SfxItemSet &/*rSet*/) +{ + if(bNewTemplate) + aConditionCB.Enable(); + if(RES_CONDTXTFMTCOLL == pFmt->Which()) + aConditionCB.Check(); + OnOffHdl(&aConditionCB); + + aTbLinks.Clear(); + + SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool(); + pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL); + aStyleLB.Clear(); + const SfxStyleSheetBase* pBase = pPool->First(); + while( pBase ) + { + if(!pFmt || pBase->GetName() != pFmt->GetName()) + aStyleLB.InsertEntry(pBase->GetName()); + pBase = pPool->Next(); + } + aStyleLB.SelectEntryPos(0); + + for( USHORT n = 0; n < aStrArr.Count(); n++) + { + String aEntry( aStrArr.GetString(n) ); + aEntry += '\t'; + + const SwCollCondition* pCond = 0; + if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() && + 0 != ( pCond = ((SwConditionTxtFmtColl*)pFmt)-> + HasCondition( SwCollCondition( 0, pCmds[n].nCnd, pCmds[n].nSubCond ) ) ) + && pCond->GetTxtFmtColl() ) + { + aEntry += pCond->GetTxtFmtColl()->GetName(); + } + + SvLBoxEntry* pE = aTbLinks.InsertEntryToColumn( aEntry, n ); + if(0 == n) + aTbLinks.Select(pE); + } + +} + +/**************************************************************************** + +****************************************************************************/ + + +USHORT* __EXPORT SwCondCollPage::GetRanges() +{ + return aPageRg; +} + + +/**************************************************************************** + +****************************************************************************/ + + +IMPL_LINK( SwCondCollPage, OnOffHdl, CheckBox*, pBox ) +{ + const BOOL bEnable = pBox->IsChecked(); + aContextFT.Enable( bEnable ); + aUsedFT .Enable( bEnable ); + aTbLinks .EnableList( bEnable != FALSE ); + aStyleFT .Enable( bEnable ); + aStyleLB .Enable( bEnable ); + aFilterLB .Enable( bEnable ); + aRemovePB .Enable( bEnable ); + aAssignPB .Enable( bEnable ); + if( bEnable ) + SelectHdl(0); + return 0; +} + +/**************************************************************************** + +****************************************************************************/ + + +IMPL_LINK( SwCondCollPage, AssignRemoveHdl, PushButton*, pBtn) +{ + SvLBoxEntry* pE = aTbLinks.FirstSelected(); + ULONG nPos; + if( !pE || LISTBOX_ENTRY_NOTFOUND == + ( nPos = aTbLinks.GetModel()->GetAbsPos( pE ) ) ) + { + ASSERT( pE, "wo kommt der leere Eintrag her?" ); + return 0; + } + + String sSel = aStrArr.GetString( USHORT(nPos) ); + sSel += '\t'; + + const BOOL bAssEnabled = pBtn != &aRemovePB && aAssignPB.IsEnabled(); + aAssignPB.Enable( !bAssEnabled ); + aRemovePB.Enable( bAssEnabled ); + if ( bAssEnabled ) + sSel += aStyleLB.GetSelectEntry(); + + aTbLinks.SetUpdateMode(FALSE); + aTbLinks.GetModel()->Remove(pE); + pE = aTbLinks.InsertEntryToColumn(sSel, nPos); + aTbLinks.Select(pE); + aTbLinks.MakeVisible(pE); + aTbLinks.SetUpdateMode(TRUE); + return 0; +} + +/**************************************************************************** + +****************************************************************************/ + + +IMPL_LINK( SwCondCollPage, SelectHdl, ListBox*, pBox) +{ + if(pBox == &aFilterLB) + { + aStyleLB.Clear(); + USHORT nSearchFlags = pBox->GetSelectEntryPos(); + nSearchFlags = *(USHORT*)aFilterLB.GetEntryData(nSearchFlags); + SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool(); + pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, nSearchFlags); + const SfxStyleSheetBase* pBase = pPool->First(); + while( pBase ) + { + if(!pFmt || pBase->GetName() != pFmt->GetName()) + aStyleLB.InsertEntry(pBase->GetName()); + pBase = pPool->Next(); + } + aStyleLB.SelectEntryPos(0); + SelectHdl(&aStyleLB); + + } + else + { + String sTbEntry; + SvLBoxEntry* pE = aTbLinks.FirstSelected(); + if(pE) + sTbEntry = aTbLinks.GetEntryText(pE); + sTbEntry = sTbEntry.GetToken(1, '\t'); + String sStyle = aStyleLB.GetSelectEntry(); + + aAssignPB.Enable( sStyle != sTbEntry && aConditionCB.IsChecked() ); + + if(pBox != &aStyleLB) + aRemovePB.Enable( aConditionCB.IsChecked() && sTbEntry.Len() ); + } + return 0; +} + +/**************************************************************************** + +****************************************************************************/ + + +void SwCondCollPage::SetCollection( SwFmt* pFormat, BOOL bNew ) +{ + pFmt = pFormat; + bNewTemplate = bNew; +} diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx new file mode 100644 index 000000000000..263cb9703ef5 --- /dev/null +++ b/sw/source/ui/chrdlg/tblnumfm.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + + +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include <svx/numinf.hxx> +#include <swtypes.hxx> +#include <tblnumfm.hxx> + +#ifndef _CHRDLG_HRC +#include <chrdlg.hrc> +#endif + +#include <svx/svxdlg.hxx> +#include <svx/dialogs.hrc> +#include <svl/itemset.hxx> +#include <sfx2/tabdlg.hxx> + +SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet) + : SfxSingleTabDialog( pParent, rSet, 0 ) +{ + // TabPage erzeugen + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ); + if ( fnCreatePage ) + { + SfxTabPage* pNewPage = (*fnCreatePage)( this, rSet ); + SfxAllItemSet aSet(*(rSet.GetPool())); + aSet.Put ( SvxNumberInfoItem( (const SvxNumberInfoItem&)pNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO ))); + pNewPage->PageCreated(aSet); + SetTabPage(pNewPage); + } +} + + +SwNumFmtDlg::~SwNumFmtDlg() +{ +} + + |