diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:58 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:57:58 +0100 |
commit | 32835b23716bb48eb6457dd8bbda235eda6a9968 (patch) | |
tree | 9e9f67205cd5b72f1031721273e1534a3a1e5b0f /sw/source/ui/misc | |
parent | ba7c4b7bde85c5eb34ab64698dc9b7df88762319 (diff) |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'sw/source/ui/misc')
49 files changed, 0 insertions, 14798 deletions
diff --git a/sw/source/ui/misc/autocorr.src b/sw/source/ui/misc/autocorr.src deleted file mode 100644 index 3c5ab355aa..0000000000 --- a/sw/source/ui/misc/autocorr.src +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -/* StarView ressource file */ - - diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx deleted file mode 100644 index 74750396ef..0000000000 --- a/sw/source/ui/misc/bookmark.cxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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> -#include <vcl/msgbox.hxx> - - -#include "view.hxx" -#include "basesh.hxx" -#include "wrtsh.hxx" // -#include "cmdid.h" -#include "bookmark.hxx" // SwInsertBookmarkDlg -#include "IMark.hxx" -#include "bookmark.hrc" -#include "misc.hrc" - -const String BookmarkCombo::aForbiddenChars = String::CreateFromAscii("/\\@:*?\";,.#"); - -IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox ) -{ - sal_Bool bSelEntries = pBox->GetSelectEntryCount() != 0; - // if a string has been pasted from the clipboard then - // there may be illegal characters in the box - if(!bSelEntries) - { - String sTmp = pBox->GetText(); - sal_uInt16 nLen = sTmp.Len(); - String sMsg; - for(sal_uInt16 i = 0; i < BookmarkCombo::aForbiddenChars.Len(); i++) - { - sal_uInt16 nTmpLen = sTmp.Len(); - sTmp.EraseAllChars(BookmarkCombo::aForbiddenChars.GetChar(i)); - if(sTmp.Len() != nTmpLen) - sMsg += BookmarkCombo::aForbiddenChars.GetChar(i); - } - if(sTmp.Len() != nLen) - { - pBox->SetText(sTmp); - String sWarning(sRemoveWarning); - sWarning += sMsg; - InfoBox(this, sWarning).Execute(); - } - - - } - - aOkBtn.Enable(!bSelEntries); // new text mark - aDeleteBtn.Enable(bSelEntries); // deletable? - - return 0; -} - -/*------------------------------------------------------------------------ - Description: callback to delete a text mark - -----------------------------------------------------------------------*/ -IMPL_LINK( SwInsertBookmarkDlg, DeleteHdl, Button *, EMPTYARG ) -{ - // remove text marks from the ComboBox - - for (sal_uInt16 i = aBookmarkBox.GetSelectEntryCount(); i; i-- ) - aBookmarkBox.RemoveEntry(aBookmarkBox.GetSelectEntryPos(i - 1)); - - aBookmarkBox.SetText(aEmptyStr); - aDeleteBtn.Enable(sal_False); // no further entries there - - aOkBtn.Enable(); // the OK handler deletes - return 0; -} - -/*------------------------------------------------------------------------ - Description: callback for OKButton. Inserts a new text mark to the - current position. Deleted text marks are also deleted in the model. - -----------------------------------------------------------------------*/ -void SwInsertBookmarkDlg::Apply() -{ - //at first remove deleted bookmarks to prevent multiple bookmarks with the same - //name - for (sal_uInt16 nCount = aBookmarkBox.GetRemovedCount(); nCount > 0; nCount--) - { - String sRemoved = aBookmarkBox.GetRemovedEntry( nCount -1 ).GetName(); - IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); - pMarkAccess->deleteMark( pMarkAccess->findMark(sRemoved) ); - SfxRequest aReq( rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK ); - aReq.AppendItem( SfxStringItem( FN_DELETE_BOOKMARK, sRemoved ) ); - aReq.Done(); - } - - // insert text mark - sal_uInt16 nLen = aBookmarkBox.GetText().Len(); - SwBoxEntry aTmpEntry(aBookmarkBox.GetText(), 0 ); - - if ( nLen && (aBookmarkBox.GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) - { - String sEntry(aBookmarkBox.GetText()); - sEntry.EraseAllChars(aBookmarkBox.GetMultiSelectionSeparator()); - - rSh.SetBookmark( KeyCode(), sEntry, aEmptyStr ); - rReq.AppendItem( SfxStringItem( FN_INSERT_BOOKMARK, sEntry ) ); - rReq.Done(); - } - - if ( !rReq.IsDone() ) - rReq.Ignore(); - -} - -/*------------------------------------------------------------------------ - Description: CTOR - -----------------------------------------------------------------------*/ -SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRequest& rRequest ) : - - SvxStandardDialog(pParent,SW_RES(DLG_INSERT_BOOKMARK)), - aBookmarkFl(this,SW_RES(FL_BOOKMARK)), - aBookmarkBox(this,SW_RES(CB_BOOKMARK)), - aOkBtn(this,SW_RES(BT_OK)), - aCancelBtn(this,SW_RES(BT_CANCEL)), - aDeleteBtn(this,SW_RES(BT_DELETE)), - rSh( rS ), - rReq( rRequest ) -{ - aBookmarkBox.SetModifyHdl(LINK(this, SwInsertBookmarkDlg, ModifyHdl)); - aBookmarkBox.EnableMultiSelection(sal_True); - aBookmarkBox.EnableAutocomplete( sal_True, sal_True ); - - aDeleteBtn.SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl)); - - // fill Combobox with existing bookmarks - IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); - sal_uInt16 nId = 0; - for( IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); - ppBookmark != pMarkAccess->getBookmarksEnd(); - ppBookmark++) - { - if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) - aBookmarkBox.InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) ); - } - FreeResource(); - sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING)); -} - -SwInsertBookmarkDlg::~SwInsertBookmarkDlg() -{ -} - -BookmarkCombo::BookmarkCombo( Window* pWin, const ResId& rResId ) : - SwComboBox(pWin, rResId) -{ -} - -sal_uInt16 BookmarkCombo::GetFirstSelEntryPos() const -{ - return GetSelEntryPos(0); -} - -sal_uInt16 BookmarkCombo::GetNextSelEntryPos(sal_uInt16 nPos) const -{ - return GetSelEntryPos(nPos + 1); -} - -sal_uInt16 BookmarkCombo::GetSelEntryPos(sal_uInt16 nPos) const -{ - sal_Unicode cSep = GetMultiSelectionSeparator(); - - sal_uInt16 nCnt = GetText().GetTokenCount(cSep); - - for (; nPos < nCnt; nPos++) - { - String sEntry(GetText().GetToken(nPos, cSep)); - sEntry.EraseLeadingChars(); - sEntry.EraseTrailingChars(); - if (GetEntryPos(sEntry) != COMBOBOX_ENTRY_NOTFOUND) - return nPos; - } - - return COMBOBOX_ENTRY_NOTFOUND; -} - -sal_uInt16 BookmarkCombo::GetSelectEntryCount() const -{ - sal_uInt16 nCnt = 0; - - sal_uInt16 nPos = GetFirstSelEntryPos(); - while (nPos != COMBOBOX_ENTRY_NOTFOUND) - { - nPos = GetNextSelEntryPos(nPos); - nCnt++; - } - - return nCnt; -} - -/*------------------------------------------------------------------------ - Description: position inside of the listbox (the ComboBox) - -----------------------------------------------------------------------*/ -sal_uInt16 BookmarkCombo::GetSelectEntryPos( sal_uInt16 nSelIndex ) const -{ - sal_uInt16 nCnt = 0; - sal_uInt16 nPos = GetFirstSelEntryPos(); - - while (nPos != COMBOBOX_ENTRY_NOTFOUND) - { - if (nSelIndex == nCnt) - { - sal_Unicode cSep = GetMultiSelectionSeparator(); - String sEntry(GetText().GetToken(nPos, cSep)); - sEntry.EraseLeadingChars(); - sEntry.EraseTrailingChars(); - - return GetEntryPos(sEntry); - } - nPos = GetNextSelEntryPos(nPos); - nCnt++; - } - - return COMBOBOX_ENTRY_NOTFOUND; -} - -long BookmarkCombo::PreNotify( NotifyEvent& rNEvt ) -{ - long nHandled = 0; - if( EVENT_KEYINPUT == rNEvt.GetType() && - rNEvt.GetKeyEvent()->GetCharCode() ) - { - String sKey( rNEvt.GetKeyEvent()->GetCharCode() ); - if(STRING_NOTFOUND != aForbiddenChars.Search(sKey)) - nHandled = 1; - } - if(!nHandled) - nHandled = SwComboBox::PreNotify( rNEvt ); - return nHandled; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/bookmark.hrc b/sw/source/ui/misc/bookmark.hrc deleted file mode 100644 index ce808a6fa5..0000000000 --- a/sw/source/ui/misc/bookmark.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * 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 CB_BOOKMARK 1 -#define FL_BOOKMARK 2 - -#define BT_OK 20 -#define BT_CANCEL 21 -#define BT_DELETE 22 diff --git a/sw/source/ui/misc/bookmark.src b/sw/source/ui/misc/bookmark.src deleted file mode 100644 index bdf00f0636..0000000000 --- a/sw/source/ui/misc/bookmark.src +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "bookmark.hrc" -#include "cmdid.h" -#include "helpid.h" -ModalDialog DLG_INSERT_BOOKMARK -{ - HelpID = CMD_FN_INSERT_BOOKMARK ; - OUTPUTSIZE = TRUE ; - Size = MAP_APPFONT ( 179 , 96 ) ; - Text [ en-US ] = "Insert Bookmark" ; - MOVEABLE = TRUE ; - SVLOOK = TRUE ; - OkButton BT_OK - { - DISABLE = TRUE ; - Pos = MAP_APPFONT ( 123 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 123 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - }; - ComboBox CB_BOOKMARK - { - HelpID = "sw:ComboBox:DLG_INSERT_BOOKMARK:CB_BOOKMARK"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 99 , 76 ) ; - TABSTOP = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - }; - PushButton BT_DELETE - { - HelpID = "sw:PushButton:DLG_INSERT_BOOKMARK:BT_DELETE"; - Pos = MAP_APPFONT ( 123 , 40 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TABSTOP = TRUE ; - DISABLE = TRUE ; - }; - FixedLine FL_BOOKMARK - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 111 , 8 ) ; - Text [ en-US ] = "Bookmarks" ; - }; -}; -String STR_REMOVE_WARNING -{ - Text [ en-US ] = "The following characters are not valid and have been removed: "; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx deleted file mode 100644 index 6eccde9ff6..0000000000 --- a/sw/source/ui/misc/docfnote.cxx +++ /dev/null @@ -1,480 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <svl/style.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <docsh.hxx> -#include <docfnote.hxx> -#include <impfnote.hxx> -#include <ftninfo.hxx> -#include <fmtcol.hxx> -#include <pagedesc.hxx> -#include <charfmt.hxx> -#include <docstyle.hxx> -#include <wdocsh.hxx> -#include <uitool.hxx> -#include <poolfmt.hxx> -#include <swstyle.h> -#include <helpid.h> -#include <misc.hrc> -#include <docfnote.hrc> -#include <frmui.hrc> -#include <SwStyleNameMapper.hxx> - -SwFootNoteOptionDlg::SwFootNoteOptionDlg( Window *pParent, SwWrtShell &rS ) : - SfxTabDialog( pParent, SW_RES(DLG_DOC_FOOTNOTE) ), - rSh( rS ) -{ - FreeResource(); - RemoveResetButton(); - - aOldOkHdl = GetOKButton().GetClickHdl(); - GetOKButton().SetClickHdl( LINK( this, SwFootNoteOptionDlg, OkHdl ) ); - - AddTabPage( TP_FOOTNOTEOPTION, SwFootNoteOptionPage::Create, 0 ); - AddTabPage( TP_ENDNOTEOPTION, SwEndNoteOptionPage::Create, 0 ); -} - -void SwFootNoteOptionDlg::PageCreated( sal_uInt16 /*nId*/, SfxTabPage &rPage ) -{ - ((SwEndNoteOptionPage&)rPage).SetShell( rSh ); -} - -SwFootNoteOptionDlg::~SwFootNoteOptionDlg() -{ -} - -IMPL_LINK( SwFootNoteOptionDlg, OkHdl, Button *, pBtn ) -{ - SfxItemSet aDummySet(rSh.GetAttrPool(), 1, 1 ); - SfxTabPage *pPage = GetTabPage( TP_FOOTNOTEOPTION ); - if ( pPage ) - pPage->FillItemSet( aDummySet ); - pPage = GetTabPage( TP_ENDNOTEOPTION ); - if ( pPage ) - pPage->FillItemSet( aDummySet ); - aOldOkHdl.Call( pBtn ); - return 0; -} - - -//---------------------------------------------------------------------- - - -SwEndNoteOptionPage::SwEndNoteOptionPage( Window *pParent, sal_Bool bEN, - const SfxItemSet &rSet ) : - SfxTabPage( pParent, SW_RES(bEN ? TP_ENDNOTEOPTION : TP_FOOTNOTEOPTION), rSet ), - aNumFL (this, SW_RES( FL_NUM )), - - aNumTypeFT (this, SW_RES( FT_NUMTYPE )), - aNumViewBox (this, SW_RES( LB_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), - aOffsetLbl (this, SW_RES( FT_OFFSET )), - aOffsetFld (this, SW_RES( FLD_OFFSET )), - aNumCountFT (this, SW_RES( FT_NUMCOUNT )), - aNumCountBox (this, SW_RES( LB_NUMCOUNT )), - aPrefixFT (this, SW_RES( FT_PREFIX )), - aPrefixED (this, SW_RES( ED_PREFIX )), - aSuffixFT (this, SW_RES( FT_SUFFIX )), - aSuffixED (this, SW_RES( ED_SUFFIX )), - aPosFT (this, SW_RES( FT_POS )), - aPosPageBox (this, SW_RES( RB_POS_PAGE )), - aPosChapterBox (this, SW_RES( RB_POS_CHAPTER)), - - aTemplFL (this, SW_RES( FL_TEMPL )), - aParaTemplLbl (this, SW_RES( FT_PARA_TEMPL)), - aParaTemplBox (this, SW_RES( LB_PARA_TEMPL)), - aPageTemplLbl (this, SW_RES( FT_PAGE_TEMPL)), - aPageTemplBox (this, SW_RES( LB_PAGE_TEMPL)), - - aCharTemplFL( this, SW_RES(FL_CHAR_TEMPL)), - aFtnCharAnchorTemplLbl( this, SW_RES( FT_ANCHR_CHARFMT)), - aFtnCharAnchorTemplBox( this, SW_RES( LB_ANCHR_CHARFMT)), - aFtnCharTextTemplLbl( this, SW_RES( FT_TEXT_CHARFMT)), - aFtnCharTextTemplBox( this, SW_RES( LB_TEXT_CHARFMT)), - - aContFL (this, SW_RES( FL_CONT )), - aContLbl (this, SW_RES( FT_CONT )), - aContEdit (this, SW_RES( ED_CONT )), - aContFromLbl (this, SW_RES( FT_CONT_FROM )), - aContFromEdit (this, SW_RES( ED_CONT_FROM )), - - aNumDoc(aNumCountBox.GetEntry(FTNNUM_DOC)), - aNumPage(aNumCountBox.GetEntry(FTNNUM_PAGE)), - aNumChapter(aNumCountBox.GetEntry(FTNNUM_CHAPTER)), - pSh( 0 ), - bPosDoc(sal_False), - bEndNote( bEN ) -{ - FreeResource(); - - aPosPageBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosPageHdl)); - aPosChapterBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosChapterHdl)); - aNumCountBox.SetSelectHdl(LINK(this, SwEndNoteOptionPage, NumCountHdl)); - - aPosPageBox.SetAccessibleRelationMemberOf(&aPosFT); - aPosChapterBox.SetAccessibleRelationMemberOf(&aPosFT); -} - -void SwEndNoteOptionPage::Reset( const SfxItemSet& ) -{ - SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() ) - : new SwFtnInfo( pSh->GetFtnInfo() ); - SfxObjectShell * pDocSh = SfxObjectShell::Current(); - sal_uInt16 i; - - if(PTR_CAST(SwWebDocShell, pDocSh)) - { - aParaTemplLbl .Hide(); - aParaTemplBox .Hide(); - aPageTemplLbl .Hide(); - aPageTemplBox .Hide(); - aFtnCharTextTemplLbl.Hide(); - aFtnCharTextTemplBox.Hide(); - aFtnCharAnchorTemplLbl.Hide(); - aFtnCharAnchorTemplBox.Hide(); - aCharTemplFL .Hide(); - aTemplFL .Hide(); - } - if ( bEndNote ) - { - aPosPageBox.Hide(); - aPosChapterBox.Hide(); - aNumCountBox.Hide(); - aContLbl.Hide(); - aContEdit.Hide(); - aContFromLbl.Hide(); - aContFromEdit.Hide(); - aContFL.Hide(); - bPosDoc = sal_True; - } - else - { - const SwFtnInfo &rInf = pSh->GetFtnInfo(); - // set position (page, chapter) - if ( rInf.ePos == FTNPOS_PAGE ) - { - aPosPageBox.Check(); - aPageTemplLbl.Enable(sal_False); - aPageTemplBox.Enable(sal_False); - } - else - { - aPosChapterBox.Check(); - aNumCountBox.RemoveEntry(aNumPage); - aNumCountBox.RemoveEntry(aNumChapter); - bPosDoc = sal_True; - } - // reference tests - aContEdit.SetText(rInf.aQuoVadis); - aContFromEdit.SetText(rInf.aErgoSum); - - // collected - SelectNumbering(rInf.eNum); - } - - // numbering - // art - aNumViewBox.SelectNumberingType( pInf->aFmt.GetNumberingType()); - aOffsetFld.SetValue(pInf->nFtnOffset + 1); - aPrefixED.SetText(pInf->GetPrefix()); - aSuffixED.SetText(pInf->GetSuffix()); - - const SwCharFmt* pCharFmt = pInf->GetCharFmt( - *pSh->GetView().GetDocShell()->GetDoc()); - aFtnCharTextTemplBox.SelectEntry(pCharFmt->GetName()); - aFtnCharTextTemplBox.SaveValue(); - - pCharFmt = pInf->GetAnchorCharFmt( *pSh->GetDoc() ); - aFtnCharAnchorTemplBox.SelectEntry( pCharFmt->GetName() ); - aFtnCharAnchorTemplBox.SaveValue(); - - // styles special regions - // paragraph - SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA); - SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); - while(pStyle) - { - aParaTemplBox.InsertEntry(pStyle->GetName()); - pStyle = pStyleSheetPool->Next(); - } - - String sStr; - SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(bEndNote ? RES_POOLCOLL_ENDNOTE - : RES_POOLCOLL_FOOTNOTE), sStr ); - if(LISTBOX_ENTRY_NOTFOUND == aParaTemplBox.GetEntryPos( sStr ) ) - aParaTemplBox.InsertEntry( sStr ); - - SwTxtFmtColl* pColl = pInf->GetFtnTxtColl(); - if( !pColl ) - aParaTemplBox.SelectEntry( sStr ); // Default - else - { - OSL_ENSURE(!pColl->IsDefault(), "default style for footnotes is wrong"); - const sal_uInt16 nPos = aParaTemplBox.GetEntryPos(pColl->GetName()); - if( LISTBOX_ENTRY_NOTFOUND != nPos ) - aParaTemplBox.SelectEntryPos( nPos ); - else - { - aParaTemplBox.InsertEntry(pColl->GetName()); - aParaTemplBox.SelectEntry(pColl->GetName()); - } - } - - // page - for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i ) - aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr )); - - sal_uInt16 nCount = pSh->GetPageDescCnt(); - for(i = 0; i < nCount; ++i) - { - const SwPageDesc &rPageDesc = pSh->GetPageDesc(i); - if(LISTBOX_ENTRY_NOTFOUND == aPageTemplBox.GetEntryPos(rPageDesc.GetName())) - aPageTemplBox.InsertEntry(rPageDesc.GetName()); - } - - aPageTemplBox.SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName()); - delete pInf; -} - -SwEndNoteOptionPage::~SwEndNoteOptionPage() -{ -} - -SfxTabPage *SwEndNoteOptionPage::Create( Window *pParent, const SfxItemSet &rSet ) -{ - return new SwEndNoteOptionPage( pParent, sal_True, rSet ); -} - -/*------------------------------------------------------------------------ - Description: Different kinds of numbering; because the Listbox has - varying numbers of entries, here are functions to - set and query the intended kind of numbering. -------------------------------------------------------------------------*/ -void SwEndNoteOptionPage::SelectNumbering(int eNum) -{ - String sSelect; - switch(eNum) - { - case FTNNUM_DOC: - sSelect = aNumDoc; - break; - case FTNNUM_PAGE: - sSelect = aNumPage; - break; - case FTNNUM_CHAPTER: - sSelect = aNumChapter; - break; -#if OSL_DEBUG_LEVEL > 1 - default: - OSL_FAIL("Which numbering type?"); -#endif - } - aNumCountBox.SelectEntry(sSelect); - NumCountHdl( &aNumCountBox ); -} - - - -int SwEndNoteOptionPage::GetNumbering() const -{ - const sal_uInt16 nPos = aNumCountBox.GetSelectEntryPos(); - return (int) bPosDoc? nPos + 1: nPos; -} - -void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell ) -{ - pSh = &rShell; - // collect character templates - aFtnCharTextTemplBox.Clear(); - aFtnCharAnchorTemplBox.Clear(); - ::FillCharStyleListBox(aFtnCharTextTemplBox, - pSh->GetView().GetDocShell()); - - ::FillCharStyleListBox(aFtnCharAnchorTemplBox, - pSh->GetView().GetDocShell()); -} - -/*------------------------------------------------------------------------ - Description: Handler behind the button to collect the footnote at the - page. In this case all kinds of numbering can be used. -------------------------------------------------------------------------*/ - - -IMPL_LINK( SwEndNoteOptionPage, PosPageHdl, Button *, EMPTYARG ) -{ - const SwFtnNum eNum = (const SwFtnNum)GetNumbering(); - bPosDoc = sal_False; - if(LISTBOX_ENTRY_NOTFOUND == aNumCountBox.GetEntryPos(aNumPage)) - { - aNumCountBox.InsertEntry(aNumPage, FTNNUM_PAGE); - aNumCountBox.InsertEntry(aNumChapter, FTNNUM_CHAPTER); - SelectNumbering(eNum); - } - aPageTemplLbl.Enable(sal_False); - aPageTemplBox.Enable(sal_False); - - return 0; -} - -IMPL_LINK( SwEndNoteOptionPage, NumCountHdl, ListBox*, EMPTYARG ) -{ - sal_Bool bEnable = sal_True; - if( aNumCountBox.GetEntryCount() - 1 != aNumCountBox.GetSelectEntryPos() ) - { - bEnable = sal_False; - aOffsetFld.SetValue(1); - } - aOffsetLbl.Enable(bEnable); - aOffsetFld.Enable(bEnable); - return 0; -} - -/*------------------------------------------------------------------------ - Description: Handler behind the button to collect the footnote at the - chapter or end of the document. In this case no pagewise - numbering can be used. -------------------------------------------------------------------------*/ - - -IMPL_LINK_INLINE_START( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG ) -{ - if ( !bPosDoc ) - SelectNumbering(FTNNUM_DOC); - - bPosDoc = sal_True; - aNumCountBox.RemoveEntry(aNumPage); - aNumCountBox.RemoveEntry(aNumChapter); - aPageTemplLbl.Enable(); - aPageTemplBox.Enable(); - return 0; -} -IMPL_LINK_INLINE_END( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG ) - -SwCharFmt* lcl_GetCharFormat( SwWrtShell* pSh, const String& rCharFmtName ) -{ - SwCharFmt* pFmt = 0; - sal_uInt16 nChCount = pSh->GetCharFmtCount(); - for(sal_uInt16 i = 0; i< nChCount; i++) - { - SwCharFmt& rChFmt = pSh->GetCharFmt(i); - if(rChFmt.GetName() == rCharFmtName ) - { - pFmt = &rChFmt; - break; - } - } - if(!pFmt) - { - SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - SfxStyleSheetBase* pBase; - pBase = pPool->Find(rCharFmtName, SFX_STYLE_FAMILY_CHAR); - if(!pBase) - pBase = &pPool->Make(rCharFmtName, SFX_STYLE_FAMILY_CHAR); - pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); - } - return pFmt; -} - -sal_Bool SwEndNoteOptionPage::FillItemSet( SfxItemSet & ) -{ - SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo() : new SwFtnInfo(); - - pInf->nFtnOffset = static_cast< sal_uInt16 >(aOffsetFld.GetValue() -1); - pInf->aFmt.SetNumberingType(aNumViewBox.GetSelectedNumberingType() ); - pInf->SetPrefix(aPrefixED.GetText()); - pInf->SetSuffix(aSuffixED.GetText()); - - pInf->SetCharFmt( lcl_GetCharFormat( pSh, - aFtnCharTextTemplBox.GetSelectEntry() ) ); - pInf->SetAnchorCharFmt( lcl_GetCharFormat( pSh, - aFtnCharAnchorTemplBox.GetSelectEntry() ) ); - - // paragraph template - sal_uInt16 nPos = aParaTemplBox.GetSelectEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) - { - const String aFmtName( aParaTemplBox.GetSelectEntry() ); - SwTxtFmtColl *pColl = pSh->GetParaStyle(aFmtName, SwWrtShell::GETSTYLE_CREATEANY); - OSL_ENSURE(pColl, "paragraph style not found"); - pInf->SetFtnTxtColl(*pColl); - } - - // page template - pInf->ChgPageDesc( pSh->FindPageDescByName( - aPageTemplBox.GetSelectEntry(), sal_True ) ); - - if ( bEndNote ) - { - if ( !(*pInf == pSh->GetEndNoteInfo()) ) - pSh->SetEndNoteInfo( *pInf ); - } - else - { - SwFtnInfo *pI = (SwFtnInfo*)pInf; - pI->ePos = aPosPageBox.IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER; - pI->eNum = (SwFtnNum)GetNumbering(); - pI->aQuoVadis = aContEdit.GetText(); - pI->aErgoSum = aContFromEdit.GetText(); - if ( !(*pI == pSh->GetFtnInfo()) ) - pSh->SetFtnInfo( *pI ); - } - delete pInf; - return sal_True; -} - -SwFootNoteOptionPage::SwFootNoteOptionPage( Window *pParent, const SfxItemSet &rSet ) : - SwEndNoteOptionPage( pParent, sal_False, rSet ) -{ -} - -SwFootNoteOptionPage::~SwFootNoteOptionPage() -{ -} - -SfxTabPage *SwFootNoteOptionPage::Create(Window *pParent, const SfxItemSet &rSet ) -{ - return new SwFootNoteOptionPage( pParent, rSet ); -} - - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/docfnote.hrc b/sw/source/ui/misc/docfnote.hrc deleted file mode 100644 index fc40676715..0000000000 --- a/sw/source/ui/misc/docfnote.hrc +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * 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_POS_PAGE 1 -#define RB_POS_CHAPTER 2 -#define FT_POS 3 -#define FT_NUMTYPE 4 -#define FT_NUMCOUNT 5 - -#define LB_NUMVIEW 10 -#define LB_NUMCOUNT 11 -#define FLD_OFFSET 12 -#define FT_OFFSET 13 -#define FL_NUM 14 - -#define LB_PARA_TEMPL 30 -#define LB_PAGE_TEMPL 31 -#define FT_PARA_TEMPL 32 -#define FT_PAGE_TEMPL 33 -#define FL_TEMPL 34 - -#define FT_CONT 40 -#define ED_CONT 41 -#define FT_CONT_FROM 42 -#define ED_CONT_FROM 43 -#define FL_CONT 44 - -#define FT_PREFIX 45 -#define ED_PREFIX 46 -#define FT_SUFFIX 47 -#define ED_SUFFIX 48 -#define FT_TEXT_CHARFMT 49 -#define LB_TEXT_CHARFMT 50 -#define FT_ANCHR_CHARFMT 51 -#define FL_CHAR_TEMPL 52 -#define LB_ANCHR_CHARFMT 53 - diff --git a/sw/source/ui/misc/docfnote.src b/sw/source/ui/misc/docfnote.src deleted file mode 100644 index 606c76f2e0..0000000000 --- a/sw/source/ui/misc/docfnote.src +++ /dev/null @@ -1,562 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "docfnote.hrc" -#include "helpid.h" -#include "cmdid.h" -#include "frmui.hrc" -TabDialog DLG_DOC_FOOTNOTE -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Footnotes/Endnotes Settings" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = TP_FOOTNOTEOPTION ; - PageResID = TP_FOOTNOTEOPTION ; - Text [ en-US ] = "Footnotes" ; - }; - PageItem - { - Identifier = TP_ENDNOTEOPTION ; - PageResID = TP_ENDNOTEOPTION ; - Text [ en-US ] = "Endnotes" ; - }; - }; - }; -}; -TabPage TP_FOOTNOTEOPTION -{ - SVLook = TRUE ; - Hide = TRUE; - HelpID = HID_FOOTNOTE_OPTIONS ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_NUM - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "AutoNumbering" ; - Group = TRUE ; - }; - FixedText FT_NUMTYPE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 51 , 8 ) ; - Text [ en-US ] = "Num~bering"; - }; - ListBox LB_NUMVIEW - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_NUMVIEW"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 14 ) ; - Size = MAP_APPFONT ( 59 , 72 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_OFFSET - { - Pos = MAP_APPFONT ( 130 , 16 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Start at" ; - }; - NumericField FLD_OFFSET - { - HelpID = "sw:NumericField:TP_FOOTNOTEOPTION:FLD_OFFSET"; - Pos = MAP_APPFONT ( 189 , 14 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - Last = 9999 ; - Maximum = 9999 ; - TabStop = TRUE ; - Border = TRUE ; - }; - FixedText FT_NUMCOUNT - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 51 , 8 ) ; - Text [ en-US ] = "~Counting"; - }; - ListBox LB_NUMCOUNT - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_NUMCOUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 29 ) ; - Size = MAP_APPFONT ( 59 , 50 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Per page" ; > ; - < "Per chapter" ; > ; - < "Per document" ; > ; - }; - }; - FixedText FT_PREFIX - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - Text [ en-US ] = "~Before" ; - Left = TRUE ; - }; - Edit ED_PREFIX - { - HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_PREFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 44 ) ; - Size = MAP_APPFONT ( 59 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_SUFFIX - { - Pos = MAP_APPFONT ( 130 , 46 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - Text [ en-US ] = "~After" ; - Left = TRUE ; - }; - Edit ED_SUFFIX - { - HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_SUFFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 189 , 44 ) ; - Size = MAP_APPFONT ( 59 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_POS - { - Pos = MAP_APPFONT ( 12 , 63 ) ; - Size = MAP_APPFONT ( 36 , 8 ) ; - Text [ en-US ] = "Position" ; - }; - RadioButton RB_POS_PAGE - { - HelpID = "sw:RadioButton:TP_FOOTNOTEOPTION:RB_POS_PAGE"; - Pos = MAP_APPFONT ( 65 , 62 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text [ en-US ] = "~End of page" ; - TabStop = TRUE ; - Group = TRUE ; - }; - RadioButton RB_POS_CHAPTER - { - HelpID = "sw:RadioButton:TP_FOOTNOTEOPTION:RB_POS_CHAPTER"; - Pos = MAP_APPFONT ( 65 , 75 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - Text [ en-US ] = "En~d of document" ; - }; - FixedLine FL_TEMPL - { - Pos = MAP_APPFONT ( 6 , 89 ) ; - Size = MAP_APPFONT ( 103 , 8 ) ; - Text [ en-US ] = "Styles" ; - }; - FixedText FT_PARA_TEMPL - { - Pos = MAP_APPFONT ( 12 , 102 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "Pa~ragraph" ; - Left = TRUE ; - }; - ListBox LB_PARA_TEMPL - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_PARA_TEMPL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 48 , 100 ) ; - Size = MAP_APPFONT ( 58 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - Sort = TRUE ; - }; - FixedText FT_PAGE_TEMPL - { - Pos = MAP_APPFONT ( 12 , 118 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Page" ; - Left = TRUE ; - }; - ListBox LB_PAGE_TEMPL - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_PAGE_TEMPL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 48 , 116) ; - Size = MAP_APPFONT ( 58 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedLine FL_CHAR_TEMPL - { - Pos = MAP_APPFONT ( 113 , 89 ) ; - Size = MAP_APPFONT ( 141 , 8 ) ; - - Text [ en-US ] = "Character Styles"; - }; - FixedText FT_ANCHR_CHARFMT - { - Pos = MAP_APPFONT ( 117 , 102 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Te~xt area" ; - }; - ListBox LB_ANCHR_CHARFMT - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_ANCHR_CHARFMT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 186 , 100 ) ; - Size = MAP_APPFONT ( 65 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_TEXT_CHARFMT - { - Pos = MAP_APPFONT ( 117 , 118 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Footnote area" ; - }; - ListBox LB_TEXT_CHARFMT - { - HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_TEXT_CHARFMT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 186 , 116 ) ; - Size = MAP_APPFONT ( 65 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedLine FL_CONT - { - Pos = MAP_APPFONT ( 6 , 134 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Continuation notice" ; - }; - FixedText FT_CONT - { - Pos = MAP_APPFONT ( 12 , 148 ) ; - Size = MAP_APPFONT ( 73 , 8 ) ; - Text [ en-US ] = "End ~of footnote" ; - Left = TRUE ; - }; - Edit ED_CONT - { - HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_CONT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 88, 145 ) ; - Size = MAP_APPFONT ( 160 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 30 ; - }; - FixedText FT_CONT_FROM - { - Pos = MAP_APPFONT ( 12 , 163 ) ; - Size = MAP_APPFONT ( 73 , 8 ) ; - Text [ en-US ] = "Star~t of next page" ; - Left = TRUE ; - }; - Edit ED_CONT_FROM - { - HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_CONT_FROM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 88 , 161 ) ; - Size = MAP_APPFONT ( 160 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 30 ; - }; -}; -TabPage TP_ENDNOTEOPTION -{ - SVLook = TRUE ; - Hide = TRUE; - HelpID = HID_ENDNOTE_OPTIONS ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_NUM - { - Pos = MAP_APPFONT ( 6 , 2 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "AutoNumbering" ; - Group = TRUE ; - }; - FixedText FT_NUMTYPE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 51 , 8 ) ; - Text [ en-US ] = "~Numbering"; - }; - ListBox LB_NUMVIEW - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_NUMVIEW"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 14 ) ; - Size = MAP_APPFONT ( 59 , 72 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList = - { - "A, B, C" ; - "a, b, c" ; - "I, II, III" ; - "i, ii, iii" ; - "1, 2, 3" ; - "A, .., AA, .., AAA" ; - "a, .., aa, .., aaa" ; - }; - }; - FixedText FT_OFFSET - { - Pos = MAP_APPFONT ( 130 , 16 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Start at" ; - }; - NumericField FLD_OFFSET - { - HelpID = "sw:NumericField:TP_ENDNOTEOPTION:FLD_OFFSET"; - Pos = MAP_APPFONT ( 189 , 14 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - Last = 9999 ; - Maximum = 9999 ; - TabStop = TRUE ; - Border = TRUE ; - }; - FixedText FT_NUMCOUNT - { - Pos = MAP_APPFONT ( 82 , 14 ) ; - Size = MAP_APPFONT ( 36 , 8 ) ; - Hide = TRUE; - }; - ListBox LB_NUMCOUNT - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_NUMCOUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 62 , 72 ) ; - Hide = TRUE; - }; - FixedText FT_PREFIX - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - - Text [ en-US ] = "~Before" ; - Left = TRUE ; - }; - Edit ED_PREFIX - { - HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_PREFIX"; - Pos = MAP_APPFONT ( 65 , 30 ) ; - Size = MAP_APPFONT ( 59 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_SUFFIX - { - Pos = MAP_APPFONT ( 130 , 32 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - Text [ en-US ] = "~After" ; - Left = TRUE ; - }; - Edit ED_SUFFIX - { - HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_SUFFIX"; - Pos = MAP_APPFONT ( 189 , 30 ) ; - Size = MAP_APPFONT ( 59 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_POS - { - Pos = MAP_APPFONT ( 82 , 14 ) ; - Size = MAP_APPFONT ( 36 , 8 ) ; - Hide = TRUE; - }; - RadioButton RB_POS_PAGE - { - HelpID = "sw:RadioButton:TP_ENDNOTEOPTION:RB_POS_PAGE"; - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "End ~of page" ; - TabStop = TRUE ; - Group = TRUE ; - }; - RadioButton RB_POS_CHAPTER - { - HelpID = "sw:RadioButton:TP_ENDNOTEOPTION:RB_POS_CHAPTER"; - Pos = MAP_APPFONT ( 12 , 118 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "End of ~document" ; - }; - FixedLine FL_TEMPL - { - Pos = MAP_APPFONT ( 6 , 46 ) ; - Size = MAP_APPFONT ( 115 , 8 ) ; - Text [ en-US ] = "Styles" ; - }; - FixedText FT_PARA_TEMPL - { - Pos = MAP_APPFONT ( 12 , 58 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Text [ en-US ] = "Pa~ragraph" ; - Left = TRUE ; - }; - ListBox LB_PARA_TEMPL - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_PARA_TEMPL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 51 , 56 ) ; - Size = MAP_APPFONT ( 67 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - Sort = TRUE ; - }; - FixedText FT_PAGE_TEMPL - { - Pos = MAP_APPFONT ( 12 , 74 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Text [ en-US ] = "~Page" ; - Left = TRUE ; - }; - ListBox LB_PAGE_TEMPL - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_PAGE_TEMPL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 51 , 72 ) ; - Size = MAP_APPFONT ( 67 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedLine FL_CHAR_TEMPL - { - Pos = MAP_APPFONT ( 125 , 46 ) ; - Size = MAP_APPFONT ( 129 , 8 ) ; - Text [ en-US ] = "Character Styles"; - }; - FixedText FT_ANCHR_CHARFMT - { - Pos = MAP_APPFONT ( 129 , 58 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Te~xt area" ; - }; - ListBox LB_ANCHR_CHARFMT - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_ANCHR_CHARFMT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 186 , 56 ) ; - Size = MAP_APPFONT ( 65 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_TEXT_CHARFMT - { - Pos = MAP_APPFONT ( 129 , 74 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Endnote area" ; - }; - ListBox LB_TEXT_CHARFMT - { - HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_TEXT_CHARFMT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 186 , 72 ) ; - Size = MAP_APPFONT ( 65 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedLine FL_CONT - { - Pos = MAP_APPFONT ( 80 , 91 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "Continuation notice" ; - }; - FixedText FT_CONT - { - Pos = MAP_APPFONT ( 86 , 103 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Text [ en-US ] = "~Following page" ; - Left = TRUE ; - }; - Edit ED_CONT - { - HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_CONT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 137 , 101 ) ; - Size = MAP_APPFONT ( 114 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 30 ; - }; - FixedText FT_CONT_FROM - { - Pos = MAP_APPFONT ( 86 , 118 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Text [ en-US ] = "~Start" ; - Left = TRUE ; - }; - Edit ED_CONT_FROM - { - HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_CONT_FROM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 137 , 116 ) ; - Size = MAP_APPFONT ( 114 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 30 ; - }; -}; diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx deleted file mode 100644 index 52dfd5e5ca..0000000000 --- a/sw/source/ui/misc/glosbib.cxx +++ /dev/null @@ -1,530 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - - - -#define _SVSTDARR_STRINGS -#include <tools/urlobj.hxx> -#include <tools/stream.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/help.hxx> -#include <unotools/transliterationwrapper.hxx> -#include <unotools/tempfile.hxx> - -#include <svl/svstdarr.hxx> -#include <unotools/pathoptions.hxx> -#include <swtypes.hxx> -#include <glosbib.hxx> -#include <gloshdl.hxx> -#include <actctrl.hxx> -#include <glossary.hxx> -#include <glosdoc.hxx> -#include <swunohelper.hxx> - -#include <glosbib.hrc> -#include <misc.hrc> -#include <helpid.h> - - -#define PATH_CASE_SENSITIVE 0x01 -#define PATH_READONLY 0x02 - -#define RENAME_TOKEN_DELIM (sal_Unicode)1 - -SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent, - const SvStrings* pPathArr, - SwGlossaryHdl *pHdl) : - SvxStandardDialog(pParent, SW_RES(DLG_BIB_BASE)), - aBibFT( this, SW_RES(FT_BIB)), - aNameED( this, SW_RES(ED_NAME)), - aPathFT( this, SW_RES(FT_PATH)), - aPathLB( this, SW_RES(LB_PATH)), - aSelectFT( this, SW_RES(FT_SELECT)), - aGroupTLB( this, SW_RES(TLB_GROUPS)), - - aOkPB( this, SW_RES(BT_OK)), - aCancelPB( this, SW_RES(BT_CANCEL)), - aHelpPB( this, SW_RES(BT_HELP)), - aNewPB( this, SW_RES(PB_NEW)), - aDelPB( this, SW_RES(PB_DELETE)), - aRenamePB( this, SW_RES(PB_RENAME)), - - pRemovedArr(0), - pInsertedArr(0), - pRenamedArr(0), - pGlosHdl(pHdl) -{ - sal_uInt16 i; - - FreeResource(); - - long nTabs[] = - { 2, // Number of Tabs - 0, 160 - }; - - aGroupTLB.SetHelpId(HID_GLOS_GROUP_TREE); - aGroupTLB.SetTabs( &nTabs[0], MAP_APPFONT ); - aGroupTLB.SetStyle(aGroupTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN|WB_SORT); - aGroupTLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, SelectHdl)); - aGroupTLB.GetModel()->SetSortMode(SortAscending); - aNewPB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, NewHdl)); - aDelPB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, DeleteHdl)); - aNameED.SetModifyHdl(LINK(this, SwGlossaryGroupDlg, ModifyHdl)); - aPathLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, ModifyHdl)); - aRenamePB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, RenameHdl)); - for( i = 0; i < pPathArr->Count(); i++) - { - String sPath(*(*pPathArr)[i]); - INetURLObject aTempURL(sPath); - sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET ); - aPathLB.InsertEntry(sPath); - sal_uLong nCaseReadonly = 0; - utl::TempFile aTempFile(&sPath); - aTempFile.EnableKillingFile(); - if(!aTempFile.IsValid()) - nCaseReadonly |= PATH_READONLY; - else if( SWUnoHelper::UCB_IsCaseSensitiveFileName( aTempFile.GetURL())) - nCaseReadonly |= PATH_CASE_SENSITIVE; - aPathLB.SetEntryData(i, (void*)nCaseReadonly); - } - aPathLB.SelectEntryPos(0); - aPathLB.Enable(sal_True); - - const sal_uInt16 nCount = pHdl->GetGroupCnt(); - for(i = 0; i < nCount; ++i) - { - String sTitle; - String sGroup = pHdl->GetGroupName(i, &sTitle); - if(!sGroup.Len()) - continue; - GlosBibUserData* pData = new GlosBibUserData; - pData->sGroupName = sGroup; - pData->sGroupTitle = sTitle; - String sTemp(sTitle); - sTemp += '\t'; - pData->sPath = aPathLB.GetEntry((sal_uInt16)sGroup.GetToken(1, GLOS_DELIM).ToInt32()); - sTemp += pData->sPath; - SvLBoxEntry* pEntry = aGroupTLB.InsertEntry(sTemp); - pEntry->SetUserData(pData); - - } - aGroupTLB.GetModel()->Resort(); -} - -SwGlossaryGroupDlg::~SwGlossaryGroupDlg() -{ - - if(pInsertedArr) - { - pInsertedArr->DeleteAndDestroy(0, pInsertedArr->Count()); - delete pInsertedArr; - } - if(pRemovedArr) - { - pRemovedArr->DeleteAndDestroy(0, pRemovedArr->Count()); - delete pRemovedArr; - } - if(pRenamedArr) - { - pRenamedArr->DeleteAndDestroy(0, pRenamedArr->Count()); - delete pRenamedArr; - } - -} - -void SwGlossaryGroupDlg::Apply() -{ - if(aNewPB.IsEnabled()) - NewHdl(&aNewPB); - - String aActGroup = SwGlossaryDlg::GetCurrGroup(); - - if(pRemovedArr && pRemovedArr->Count()) - { - sal_uInt16 nCount = pRemovedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - const String* pDelEntry = (*pRemovedArr)[i]; - const String sDelGroup = pDelEntry->GetToken(0, '\t'); - if( sDelGroup == aActGroup ) - { - //when the current group is deleted, the current group has to be relocated - if(aGroupTLB.GetEntryCount()) - { - SvLBoxEntry* pFirst = aGroupTLB.First(); - GlosBibUserData* pUserData = (GlosBibUserData*)pFirst->GetUserData(); - pGlosHdl->SetCurGroup(pUserData->sGroupName); - } - } - String sMsg(SW_RES(STR_QUERY_DELETE_GROUP1)); - String sTitle(pDelEntry->GetToken(1, '\t')); - if(sTitle.Len()) - sMsg += sTitle; - else - sDelGroup.GetToken(1, GLOS_DELIM); - sMsg += SW_RESSTR(STR_QUERY_DELETE_GROUP2); - QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); - if(RET_YES == aQuery.Execute()) - pGlosHdl->DelGroup( sDelGroup ); - } - - } - //don't rename before there was one - if(pRenamedArr && pRenamedArr->Count()) - { - sal_uInt16 nCount = pRenamedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - String * pEntry = (*pRenamedArr)[i]; - xub_StrLen nStrSttPos = 0; - String sOld( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos ) ); - String sNew( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos) ); - String sTitle( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos) ); - pGlosHdl->RenameGroup(sOld, sNew, sTitle); - if(!i) - sCreatedGroup = sNew; - } - } - if(pInsertedArr && pInsertedArr->Count()) - { - sal_uInt16 nCount = pInsertedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - String sNewGroup = *(*pInsertedArr)[i]; - String sNewTitle = sNewGroup.GetToken(0, GLOS_DELIM); - if( *(*pInsertedArr)[i] != aActGroup ) - { - pGlosHdl->NewGroup(sNewGroup, sNewTitle); - if(!sCreatedGroup.Len()) - sCreatedGroup = sNewGroup; - } - } - } -} - -IMPL_LINK( SwGlossaryGroupDlg, SelectHdl, SvTabListBox*, EMPTYARG ) -{ - aNewPB.Enable(sal_False); - SvLBoxEntry* pFirstEntry = aGroupTLB.FirstSelected(); - if(pFirstEntry) - { - GlosBibUserData* pUserData = (GlosBibUserData*)pFirstEntry->GetUserData(); - String sEntry(pUserData->sGroupName); - String sName(aNameED.GetText()); - sal_Bool bExists = sal_False; - sal_uLong nPos = aGroupTLB.GetEntryPos(sName, 0); - if( 0xffffffff > nPos) - { - SvLBoxEntry* pEntry = aGroupTLB.GetEntry(nPos); - GlosBibUserData* pFoundData = (GlosBibUserData*)pEntry->GetUserData(); - String sGroup = pFoundData->sGroupName; - bExists = sGroup == sEntry; - } - - aRenamePB.Enable(!bExists && sName.Len()); - aDelPB.Enable(IsDeleteAllowed(sEntry)); - } - return 0; -} - -IMPL_LINK( SwGlossaryGroupDlg, NewHdl, Button*, EMPTYARG ) -{ - String sGroup(aNameED.GetText()); - sGroup += GLOS_DELIM; - sGroup += String::CreateFromInt32(aPathLB.GetSelectEntryPos()); - OSL_ENSURE(!pGlosHdl->FindGroupName(sGroup), "group already available!"); - if(!pInsertedArr) - pInsertedArr = new SvStrings; - pInsertedArr->Insert(new String(sGroup), pInsertedArr->Count()); - String sTemp(aNameED.GetText()); - sTemp += '\t'; - sTemp += aPathLB.GetSelectEntry(); - SvLBoxEntry* pEntry = aGroupTLB.InsertEntry(sTemp); - GlosBibUserData* pData = new GlosBibUserData; - pData->sPath = aPathLB.GetSelectEntry(); - pData->sGroupName = sGroup; - pData->sGroupTitle = aNameED.GetText(); - pEntry->SetUserData(pData); - aGroupTLB.Select(pEntry); - aGroupTLB.MakeVisible(pEntry); - aGroupTLB.GetModel()->Resort(); - - return 0; -} - -IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, pButton ) -{ - SvLBoxEntry* pEntry = aGroupTLB.FirstSelected(); - if(!pEntry) - { - pButton->Enable(sal_False); - return 0; - } - GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData(); - String sEntry(pUserData->sGroupName); - // if the name to be deleted is among the new ones - get rid of it - sal_Bool bDelete = sal_True; - if(pInsertedArr && pInsertedArr->Count()) - { - sal_uInt16 nCount = pInsertedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - const String* pTemp = (*pInsertedArr)[i]; - if(*pTemp == sEntry) - { - pInsertedArr->Remove(i); - bDelete = sal_False; - break; - } - - } - } - // it should probably be renamed? - if(bDelete) - { - if(pRenamedArr && pRenamedArr->Count()) - { - sal_uInt16 nCount = pRenamedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - const String* pTemp = (*pRenamedArr)[i]; - String sTemp( pTemp->GetToken(0, RENAME_TOKEN_DELIM )); - if(sTemp == sEntry) - { - pRenamedArr->Remove(i); - bDelete = sal_False; - break; - } - } - } - } - if(bDelete) - { - if(!pRemovedArr) - pRemovedArr = new SvStrings; - String sGroupEntry(pUserData->sGroupName); - sGroupEntry += '\t'; - sGroupEntry += pUserData->sGroupTitle; - pRemovedArr->Insert(new String(sGroupEntry), pRemovedArr->Count()); - } - delete pUserData; - aGroupTLB.GetModel()->Remove(pEntry); - if(!aGroupTLB.First()) - pButton->Enable(sal_False); - //the content must be deleted - otherwise the new handler would be called in Apply() - aNameED.SetText(aEmptyStr); - return 0; -} - -IMPL_LINK( SwGlossaryGroupDlg, RenameHdl, Button *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = aGroupTLB.FirstSelected(); - GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData(); - String sEntryText(aGroupTLB.GetEntryText(pEntry)); - String sEntry(pUserData->sGroupName); - - String sNewName(aNameED.GetText()); - String sNewTitle(sNewName); - - sNewName += GLOS_DELIM; - sNewName += String::CreateFromInt32(aPathLB.GetSelectEntryPos()); - OSL_ENSURE(!pGlosHdl->FindGroupName(sNewName), "group already available!"); - - // if the name to be renamed is among the new ones - replace - sal_Bool bDone = sal_False; - if(pInsertedArr && pInsertedArr->Count()) - { - sal_uInt16 nCount = pInsertedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - const String* pTemp = (*pInsertedArr)[i]; - if(*pTemp == sEntry) - { - pInsertedArr->Remove(i); - pInsertedArr->Insert(new String(sNewName), pInsertedArr->Count()); - bDone = sal_True; - break; - } - } - } - if(!bDone) - { - if(!pRenamedArr) - pRenamedArr = new SvStrings; - sEntry += RENAME_TOKEN_DELIM; - sEntry += sNewName; - sEntry += RENAME_TOKEN_DELIM; - sEntry += sNewTitle; - pRenamedArr->Insert(new String(sEntry), pRenamedArr->Count()); - } - delete (GlosBibUserData*)pEntry->GetUserData(); - aGroupTLB.GetModel()->Remove(pEntry); - String sTemp(aNameED.GetText()); - sTemp += '\t'; - sTemp += aPathLB.GetSelectEntry(); - pEntry = aGroupTLB.InsertEntry(sTemp); - GlosBibUserData* pData = new GlosBibUserData; - pData->sPath = aPathLB.GetSelectEntry(); - pData->sGroupName = sNewName; - pData->sGroupTitle = sNewTitle; - pEntry->SetUserData(pData); - aGroupTLB.Select(pEntry); - aGroupTLB.MakeVisible(pEntry); - aGroupTLB.GetModel()->Resort(); - return 0; -} - -IMPL_LINK( SwGlossaryGroupDlg, ModifyHdl, Edit*, EMPTYARG ) -{ - String sEntry(aNameED.GetText()); - sal_Bool bEnableNew = sal_True; - sal_Bool bEnableDel = sal_False; - sal_uLong nCaseReadonly = - (sal_uLong)aPathLB.GetEntryData(aPathLB.GetSelectEntryPos()); - sal_Bool bDirReadonly = 0 != (nCaseReadonly&PATH_READONLY); - - if(!sEntry.Len() || bDirReadonly) - bEnableNew = sal_False; - else if(sEntry.Len()) - { - sal_uLong nPos = 0xffffffff; - - - nPos = aGroupTLB.GetEntryPos(sEntry, 0); - //if it's not case sensitive you have to search for yourself - if( 0xffffffff == nPos) - { - const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); - for(sal_uInt16 i = 0; i < aGroupTLB.GetEntryCount(); i++) - { - String sTemp = aGroupTLB.GetEntryText( i, 0 ); - nCaseReadonly = (sal_uLong)aPathLB.GetEntryData( - aPathLB.GetEntryPos(aGroupTLB.GetEntryText(i,1))); - sal_Bool bCase = 0 != (nCaseReadonly & PATH_CASE_SENSITIVE); - - if( !bCase && rSCmp.isEqual( sTemp, sEntry )) - { - nPos = i; - break; - } - } - } - if( 0xffffffff > nPos) - { - bEnableNew = sal_False; - aGroupTLB.Select(aGroupTLB.GetEntry( nPos )); - aGroupTLB.MakeVisible(aGroupTLB.GetEntry( nPos )); - } - } - SvLBoxEntry* pEntry = aGroupTLB.FirstSelected(); - if(pEntry) - { - GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData(); - bEnableDel = IsDeleteAllowed(pUserData->sGroupName); - } - - aDelPB.Enable(bEnableDel); - aNewPB.Enable(bEnableNew); - aRenamePB.Enable(bEnableNew && pEntry); - return 0; -} - -sal_Bool SwGlossaryGroupDlg::IsDeleteAllowed(const String &rGroup) -{ - sal_Bool bDel = (!pGlosHdl->IsReadOnly(&rGroup)); - - // OM: if the name is among the new region name, it is deletable - // as well! Because for non existing region names ReadOnly issues - // sal_True. - - if(pInsertedArr && pInsertedArr->Count()) - { - sal_uInt16 nCount = pInsertedArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - const String* pTemp = (*pInsertedArr)[i]; - if(*pTemp == rGroup) - { - bDel = sal_True; - break; - } - } - } - - return bDel; -} - -void FEdit::KeyInput( const KeyEvent& rKEvent ) -{ - KeyCode aCode = rKEvent.GetKeyCode(); - if( KEYGROUP_CURSOR == aCode.GetGroup() || - ( KEYGROUP_MISC == aCode.GetGroup() && - KEY_DELETE >= aCode.GetCode() ) || - SVT_SEARCHPATH_DELIMITER != rKEvent.GetCharCode() ) - Edit::KeyInput( rKEvent ); -} - -void SwGlossaryGroupTLB::RequestHelp( const HelpEvent& rHEvt ) -{ - Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); - SvLBoxEntry* pEntry = GetEntry( aPos ); - if(pEntry) - { - SvLBoxTab* pTab; - SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab ); - if(pItem) - { - aPos = GetEntryPosition( pEntry ); - Size aSize(pItem->GetSize( this, pEntry )); - aPos.X() = GetTabPos( pEntry, pTab ); - - if((aPos.X() + aSize.Width()) > GetSizePixel().Width()) - aSize.Width() = GetSizePixel().Width() - aPos.X(); - aPos = OutputToScreenPixel(aPos); - Rectangle aItemRect( aPos, aSize ); - String sMsg; - GlosBibUserData* pData = (GlosBibUserData*)pEntry->GetUserData(); - sMsg = pData->sPath; - sMsg += INET_PATH_TOKEN; - sMsg += pData->sGroupName.GetToken(0, GLOS_DELIM); - sMsg += SwGlossaries::GetExtension(); - - Help::ShowQuickHelp( this, aItemRect, sMsg, - QUICKHELP_LEFT|QUICKHELP_VCENTER ); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glosbib.hrc b/sw/source/ui/misc/glosbib.hrc deleted file mode 100644 index 2322dc63f2..0000000000 --- a/sw/source/ui/misc/glosbib.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * 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 FT_BIB 1 -#define FT_PATH 2 -#define FT_SELECT 3 -#define CO_NAME 2 -#define PB_NEW 3 -#define PB_DELETE 4 -#define BT_OK 5 -#define BT_CANCEL 6 -#define BT_HELP 7 -#define LB_PATH 8 -#define TLB_GROUPS 9 -#define ED_NAME 10 -#define PB_RENAME 11 - diff --git a/sw/source/ui/misc/glosbib.src b/sw/source/ui/misc/glosbib.src deleted file mode 100644 index 011bfce073..0000000000 --- a/sw/source/ui/misc/glosbib.src +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * 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 "glosbib.hrc" -#include "misc.hrc" -#include "helpid.h" -ModalDialog DLG_BIB_BASE -{ - HelpID = HID_BIB_BASE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 349 , 121 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Edit Categories" ; - PushButton PB_NEW - { - HelpID = "sw:PushButton:DLG_BIB_BASE:PB_NEW"; - Disable = TRUE ; - Pos = MAP_APPFONT ( 293 , 66 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~New" ; - TabStop = TRUE ; - }; - PushButton PB_DELETE - { - HelpID = "sw:PushButton:DLG_BIB_BASE:PB_DELETE"; - Pos = MAP_APPFONT ( 293 , 83 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - Disable = TRUE ; - }; - PushButton PB_RENAME - { - HelpID = "sw:PushButton:DLG_BIB_BASE:PB_RENAME"; - Disable = TRUE ; - Pos = MAP_APPFONT ( 293 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Rename" ; - TabStop = TRUE ; - }; - FixedText FT_BIB - { - Pos = MAP_APPFONT ( 12 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Category" ; - }; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 293 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 293 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 293 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Edit ED_NAME - { - HelpID = "sw:Edit:DLG_BIB_BASE:ED_NAME"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 159 , 12 ) ; - TabStop = TRUE ; - Border = TRUE ; - MaxTextLength = 256 ; - }; - FixedText FT_PATH - { - Pos = MAP_APPFONT ( 174 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Path"; - }; - ListBox LB_PATH - { - HelpID = "sw:ListBox:DLG_BIB_BASE:LB_PATH"; - Pos = MAP_APPFONT ( 174 , 14 ) ; - Size = MAP_APPFONT ( 107 , 50 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_SELECT - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Selection list"; - }; - Control TLB_GROUPS - { - Pos = MAP_APPFONT ( 12 , 41 ) ; - Size = MAP_APPFONT ( 269 , 73 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - /* ComboBox CO_NAME - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 89 , 76 ) ; - TabStop = TRUE ; -#ifdef WIN - MaxTextLength = 8 ; -#else - MaxTextLength = 32 ; -#endif - Sort = TRUE ; - };*/ -}; -/* -String STR_GLOSSARY_BIB_DLG -{ - Text [ en-US ] = "Edit Categories" ; -};*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx deleted file mode 100644 index 9917a22bd5..0000000000 --- a/sw/source/ui/misc/glosdoc.cxx +++ /dev/null @@ -1,761 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <memory> - -#include <com/sun/star/container/XNamed.hpp> - -#define _SVSTDARR_STRINGS -#include <unotools/transliterationwrapper.hxx> - -#include <svl/svstdarr.hxx> - -#ifndef __RSC //autogen -#include <tools/errinf.hxx> -#endif -#include <osl/diagnose.h> -#include <svl/urihelper.hxx> -#include <svl/fstathelper.hxx> -#include <unotools/pathoptions.hxx> -#include <unotools/tempfile.hxx> -#include <swtypes.hxx> -#include <uitool.hxx> -#include <glosdoc.hxx> -#include <shellio.hxx> -#include <swunohelper.hxx> - -#include <unoatxt.hxx> -#include <swerror.h> -#include <globals.hrc> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -// PUBLIC METHODES ------------------------------------------------------- -String lcl_CheckFileName( const String& rNewFilePath, - const String& rNewGroupName ) -{ - String sRet; - //group name should contain only A-Z and a-z and spaces - for( xub_StrLen i = 0; i < rNewGroupName.Len(); i++ ) - { - sal_Unicode cChar = rNewGroupName.GetChar(i); - if( (cChar >= 'A' && cChar <= 'Z') || - (cChar >= 'a' && cChar <= 'z') || - (cChar >= '0' && cChar <= '9') || - cChar == '_' || cChar == 0x20 ) - { - sRet += cChar; - } - } - sRet.EraseLeadingChars(); - sRet.EraseTrailingChars(); - - sal_Bool bOk = sal_False; - if( sRet.Len() ) - { - String sTmpDir(rNewFilePath); - sTmpDir += INET_PATH_TOKEN; - sTmpDir += sRet; - sTmpDir += SwGlossaries::GetExtension(); - bOk = !FStatHelper::IsDocument( sTmpDir ); - } - - if( !bOk ) - { - String rSG = SwGlossaries::GetExtension(); - //generate generic name - utl::TempFile aTemp( - String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "group" )), - &rSG, &rNewFilePath ); - aTemp.EnableKillingFile(); - - INetURLObject aTempURL( aTemp.GetURL() ); - sRet = aTempURL.GetBase(); - } - return sRet; -} - -/*------------------------------------------------------------------------ - Description: supplies the default group's name -------------------------------------------------------------------------*/ -String SwGlossaries::GetDefName() -{ - return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "standard" )); - -} - -/*------------------------------------------------------------------------ - Description: supplies the number of text block groups -------------------------------------------------------------------------*/ -sal_uInt16 SwGlossaries::GetGroupCnt() -{ - return GetNameList()->Count(); -} - -/*------------------------------------------------------------------------ - Description: supplies the group's name -------------------------------------------------------------------------*/ -sal_Bool SwGlossaries::FindGroupName(String & rGroup) -{ - // if the group name doesn't contain a path, a suitable group entry - // can the searched for here; - sal_uInt16 nCount = GetGroupCnt(); - sal_uInt16 i; - for(i= 0; i < nCount; i++) - { - String sTemp(GetGroupName(i)); - if(rGroup.Equals( sTemp.GetToken(0, GLOS_DELIM))) - { - rGroup = sTemp; - return sal_True; - } - } - // you can search two times because for more directories the case sensitive - // name could occur multiple times - const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); - for(i = 0; i < nCount; i++) - { - String sTemp( GetGroupName( i )); - sal_uInt16 nPath = (sal_uInt16)sTemp.GetToken(1, GLOS_DELIM).ToInt32(); - - if( !SWUnoHelper::UCB_IsCaseSensitiveFileName( *(*m_pPathArr)[nPath] ) - && rSCmp.isEqual( rGroup, sTemp.GetToken( 0, GLOS_DELIM) ) ) - { - rGroup = sTemp; - return sal_True; - } - } - return sal_False; -} - -String SwGlossaries::GetGroupName(sal_uInt16 nGroupId) -{ - OSL_ENSURE(nGroupId < m_pGlosArr->Count(), "Textbausteinarray ueberindiziert"); - return *(*m_pGlosArr)[nGroupId]; -} - -String SwGlossaries::GetGroupTitle( const String& rGroupName ) -{ - String sRet; - String sGroup(rGroupName); - if(STRING_NOTFOUND == sGroup.Search(GLOS_DELIM)) - FindGroupName(sGroup); - SwTextBlocks* pGroup = GetGroupDoc(sGroup, sal_False); - if(pGroup) - { - sRet = pGroup->GetName(); - PutGroupDoc( pGroup ); - } - return sRet; -} - -/*------------------------------------------------------------------------ - Description: supplies the group rName's text block document -------------------------------------------------------------------------*/ -SwTextBlocks* SwGlossaries::GetGroupDoc(const String &rName, - sal_Bool bCreate) const -{ - // insert to the list of text blocks if applicable - if(bCreate && m_pGlosArr) - { - const String aName(rName); - const sal_uInt16 nCount = m_pGlosArr->Count(); - sal_uInt16 i; - - for( i = 0; i < nCount; ++i) - { - const String *pName = (*m_pGlosArr)[i]; - if(*pName == aName) - break; - } - if(i == nCount) - { // block not in the list - String *pTmp = new String(aName); - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); - } - } - return GetGlosDoc( rName, bCreate ); -} - -/*------------------------------------------------------------------------ - Description: delete a text block -------------------------------------------------------------------------*/ -void SwGlossaries::PutGroupDoc(SwTextBlocks *pBlock) { - delete pBlock; -} - -/*------------------------------------------------------------------------ - Description: Creates a new document with the group name. temporarly - also created as file so that groups remain there later - (without access). -------------------------------------------------------------------------*/ -sal_Bool SwGlossaries::NewGroupDoc(String& rGroupName, const String& rTitle) -{ - sal_uInt16 nNewPath = (sal_uInt16)rGroupName.GetToken(1, GLOS_DELIM).ToInt32(); - String sNewFilePath(*(*m_pPathArr)[nNewPath]); - String sNewGroup = lcl_CheckFileName(sNewFilePath, rGroupName.GetToken(0, GLOS_DELIM)); - sNewGroup += GLOS_DELIM; - sNewGroup += rGroupName.GetToken(1, GLOS_DELIM); - SwTextBlocks *pBlock = GetGlosDoc( sNewGroup ); - if(pBlock) - { - String *pTmp = - new String(sNewGroup); - SvStrings* pList = GetNameList(); - pList->Insert(pTmp, pList->Count()); - pBlock->SetName(rTitle); - PutGroupDoc(pBlock); - rGroupName = sNewGroup; - return sal_True; - } - return sal_False; -} - -sal_Bool SwGlossaries::RenameGroupDoc( - const String& rOldGroup, String& rNewGroup, const String& rNewTitle ) -{ - sal_Bool bRet = sal_False; - sal_uInt16 nOldPath = (sal_uInt16)rOldGroup.GetToken(1, GLOS_DELIM).ToInt32(); - if(nOldPath < m_pPathArr->Count()) - { - String sOldFileURL(*(*m_pPathArr)[nOldPath]); - sOldFileURL += INET_PATH_TOKEN; - sOldFileURL += rOldGroup.GetToken(0, GLOS_DELIM); - sOldFileURL += SwGlossaries::GetExtension(); - sal_Bool bExist = FStatHelper::IsDocument( sOldFileURL ); - OSL_ENSURE(bExist, "group doesn't exist!"); - if(bExist) - { - sal_uInt16 nNewPath = (sal_uInt16)rNewGroup.GetToken(1, GLOS_DELIM).ToInt32(); - if( nNewPath < m_pPathArr->Count()) - { - String sNewFilePath(*(*m_pPathArr)[nNewPath]); - String sNewFileName = lcl_CheckFileName( - sNewFilePath, rNewGroup.GetToken(0, GLOS_DELIM)); - const sal_uInt16 nFileNameLen = sNewFileName.Len(); - sNewFileName += SwGlossaries::GetExtension(); - String sTempNewFilePath(sNewFilePath); - sTempNewFilePath += INET_PATH_TOKEN; - sTempNewFilePath += sNewFileName ; - bExist = FStatHelper::IsDocument( sTempNewFilePath ); - OSL_ENSURE(!bExist, "group already exists!"); - if(!bExist) - { - sal_Bool bCopyCompleted = SWUnoHelper::UCB_CopyFile( - sOldFileURL, sTempNewFilePath, sal_True ); - if(bCopyCompleted) - { - bRet = sal_True; - RemoveFileFromList( rOldGroup ); - - rNewGroup = sNewFileName.Copy(0, nFileNameLen); - rNewGroup += GLOS_DELIM; - rNewGroup += String::CreateFromInt32(nNewPath); - String *pTmp = new String(rNewGroup); - if(!m_pGlosArr) - GetNameList(); - else - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); - - sNewFilePath += INET_PATH_TOKEN; - sNewFilePath += sNewFileName ; - SwTextBlocks* pNewBlock = new SwTextBlocks( sNewFilePath ); - pNewBlock->SetName(rNewTitle); - delete pNewBlock; - } - } - } - } - } - return bRet; -} - -/*------------------------------------------------------------------------ - Description: Deletes a text block group -------------------------------------------------------------------------*/ -sal_Bool SwGlossaries::DelGroupDoc(const String &rName) -{ - sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32(); - if(nPath >= m_pPathArr->Count()) - return sal_False; - String sFileURL(*(*m_pPathArr)[nPath]); - String aTmp( rName.GetToken(0, GLOS_DELIM)); - String aName(aTmp); - aName += GLOS_DELIM; - aName += String::CreateFromInt32(nPath); - - aTmp += SwGlossaries::GetExtension(); - sFileURL += INET_PATH_TOKEN; - sFileURL += aTmp; - // Even if the file doesn't exist it hast to be deleted from - // the list of text block regions - // no && because of CFfront - sal_Bool bRemoved = SWUnoHelper::UCB_DeleteFile( sFileURL ); - OSL_ENSURE(bRemoved, "file has not been removed"); - RemoveFileFromList( aName ); - return bRemoved; -} - -/*------------------------------------------------------------------------ - Description: DTOR -------------------------------------------------------------------------*/ -SwGlossaries::~SwGlossaries() -{ - sal_uInt16 nCount = m_pGlosArr? m_pGlosArr->Count() : 0; - sal_uInt16 i; - - for( i = 0; i < nCount; ++i) - { - String *pTmp = (*m_pGlosArr)[i]; - delete pTmp; - } - nCount = m_pPathArr? m_pPathArr->Count() : 0; - for(i = 0; i < nCount; ++i) - { - String *pTmp = (*m_pPathArr)[i]; - delete pTmp; - } - delete m_pGlosArr; - delete m_pPathArr; - - InvalidateUNOOjects(); -} - -/*------------------------------------------------------------------------ - Description: read a block document -------------------------------------------------------------------------*/ -SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) const -{ - sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32(); - SwTextBlocks *pTmp = 0; - if(nPath < m_pPathArr->Count()) - { - String sFileURL(*(*m_pPathArr)[nPath]); - String aTmp( rName.GetToken(0, GLOS_DELIM)); - aTmp += SwGlossaries::GetExtension(); - sFileURL += INET_PATH_TOKEN; - sFileURL += aTmp; - - sal_Bool bExist = sal_False; - if(!bCreate) - bExist = FStatHelper::IsDocument( sFileURL ); - - if (bCreate || bExist) - { - pTmp = new SwTextBlocks( sFileURL ); - sal_Bool bOk = sal_True; - if( pTmp->GetError() ) - { - ErrorHandler::HandleError( pTmp->GetError() ); - bOk = !IsError( pTmp->GetError() ); - } - - if( bOk && !pTmp->GetName().Len() ) - pTmp->SetName( rName ); - } - } - - return pTmp; -} - -/*------------------------------------------------------------------------ - Description: access to the list of names; read in if applicable -------------------------------------------------------------------------*/ -SvStrings* SwGlossaries::GetNameList() -{ - if( !m_pGlosArr ) - { - m_pGlosArr = new SvStrings; - String sExt( SwGlossaries::GetExtension() ); - for( sal_uInt16 i = 0; i < m_pPathArr->Count(); i++ ) - { - SvStrings aFiles( 16, 16 ); - - SWUnoHelper::UCB_GetFileListOfFolder( *(*m_pPathArr)[i], aFiles, - &sExt ); - for( sal_uInt16 nFiles = 0, nFEnd = aFiles.Count(); - nFiles < nFEnd; ++nFiles ) - { - String* pTitle = aFiles[ nFiles ]; - String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() )); - sName += GLOS_DELIM; - sName += String::CreateFromInt32( i ); - m_pGlosArr->Insert( new String(sName), m_pGlosArr->Count() ); - - // don't need any more these pointers - delete pTitle; - } - } - if(!m_pGlosArr->Count()) - { - // the standard block is inside of the path's first part - String *pTmp = new String( SwGlossaries::GetDefName() ); - (*pTmp) += GLOS_DELIM; - (*pTmp) += '0'; - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); - } - } - return m_pGlosArr; -} - -/*------------------------------------------------------------------------ - Description: CTOR -------------------------------------------------------------------------*/ -SwGlossaries::SwGlossaries() : - m_pPathArr(0), - m_pGlosArr(0) -{ - m_pPathArr = new SvStrings; - UpdateGlosPath(sal_True); -} - -/*------------------------------------------------------------------------ - Description: set new path and recreate internal array -------------------------------------------------------------------------*/ - -/* -------------------------------------------------- -* #61050# double paths cause irritation - get rid of it - * --------------------------------------------------*/ -sal_Bool lcl_FindSameEntry(const SvStrings& rDirArr, const String& rEntryURL) -{ - for(sal_uInt16 i = 0; i < rDirArr.Count(); i++) - if(rEntryURL == (*rDirArr.GetObject(i))) - return sal_True; - return sal_False; -} - -void SwGlossaries::UpdateGlosPath(sal_Bool bFull) -{ - SvtPathOptions aPathOpt; - String aNewPath( aPathOpt.GetAutoTextPath() ); - sal_Bool bPathChanged = m_aPath != aNewPath; - if (bFull || bPathChanged) - { - m_aPath = aNewPath; - sal_uInt16 nCount = m_pPathArr? m_pPathArr->Count() : 0; - sal_uInt16 i; - - for( i = nCount; i; --i) - { - String *pTmp = (*m_pPathArr)[i - 1]; - m_pPathArr->Remove(i - 1); - delete pTmp; - } - sal_uInt16 nTokenCount = m_aPath.GetTokenCount(SVT_SEARCHPATH_DELIMITER); - SvStrings aDirArr; - for( i = 0; i < nTokenCount; i++ ) - { - String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER)); - sPth = URIHelper::SmartRel2Abs( - INetURLObject(), sPth, URIHelper::GetMaybeFileHdl()); - - if(i && lcl_FindSameEntry(aDirArr, sPth)) - { - continue; - } - aDirArr.Insert(new String(sPth), aDirArr.Count()); - if( !FStatHelper::IsFolder( sPth ) ) - { - if( m_sErrPath.Len() ) - m_sErrPath += SVT_SEARCHPATH_DELIMITER; - INetURLObject aTemp( sPth ); - m_sErrPath += String(aTemp.GetFull()); - } - else - m_pPathArr->Insert(new String(sPth), m_pPathArr->Count()); - } - aDirArr.DeleteAndDestroy(0, aDirArr.Count()); - - if(!nTokenCount || - (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) ) - { - m_sOldErrPath = m_sErrPath; - // wrong path, that means AutoText directory doesn't exist - - ErrorHandler::HandleError( *new StringErrorInfo( - ERR_AUTOPATH_ERROR, m_sErrPath, - ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR )); - m_bError = sal_True; - } - else - m_bError = sal_False; - - if(m_pGlosArr) - { - for(i = 0; i < m_pGlosArr->Count(); ++i) - { - delete (String *)(*m_pGlosArr)[i]; - } - DELETEZ(m_pGlosArr); - GetNameList(); - } - } -} - -void SwGlossaries::ShowError() -{ - sal_uInt32 nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR, - m_sErrPath, ERRCODE_BUTTON_OK ); - ErrorHandler::HandleError( nPathError ); -} - -String SwGlossaries::GetExtension() -{ - return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( ".bau" )); -} - -void SwGlossaries::RemoveFileFromList( const String& rGroup ) -{ - if(m_pGlosArr) - { - const sal_uInt16 nCount = m_pGlosArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - String *pTmp = (*m_pGlosArr)[i]; - if(*pTmp == rGroup) - { - rtl::OUString aUName = rGroup; - { - // tell the UNO AutoTextGroup object that it's not valid anymore - for ( UnoAutoTextGroups::iterator aLoop = m_aGlossaryGroups.begin(); - aLoop != m_aGlossaryGroups.end(); - ++aLoop - ) - { - Reference< container::XNamed > xNamed( aLoop->get(), UNO_QUERY ); - if ( xNamed.is() && ( xNamed->getName() == aUName ) ) - { - static_cast< SwXAutoTextGroup* >( xNamed.get() )->Invalidate(); - // note that this static_cast works because we know that the array only - // contains SwXAutoTextGroup implementation - m_aGlossaryGroups.erase( aLoop ); - break; - } - } - } - - { - // tell all our UNO AutoTextEntry objects that they're not valid anymore - for ( UnoAutoTextEntries::iterator aLoop = m_aGlossaryEntries.begin(); - aLoop != m_aGlossaryEntries.end(); - ) - { - Reference< lang::XUnoTunnel > xEntryTunnel( aLoop->get(), UNO_QUERY ); - - SwXAutoTextEntry* pEntry = NULL; - if ( xEntryTunnel.is() ) - pEntry = reinterpret_cast< SwXAutoTextEntry* >( - xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) ); - - if ( pEntry && ( pEntry->GetGroupName() == rGroup ) ) - { - pEntry->Invalidate(); - aLoop = m_aGlossaryEntries.erase( aLoop ); - } - else - ++aLoop; - } - } - - m_pGlosArr->Remove(i); - delete pTmp; - break; - } - } - } -} - -String SwGlossaries::GetCompleteGroupName( const rtl::OUString& GroupName ) -{ - sal_uInt16 nCount = GetGroupCnt(); - // when the group name was created internally the path is here as well - String sGroup(GroupName); - String sGroupName(sGroup.GetToken(0, GLOS_DELIM)); - String sPath = sGroup.GetToken(1, GLOS_DELIM); - sal_Bool bPathLen = sPath.Len() > 0; - for ( sal_uInt16 i = 0; i < nCount; i++ ) - { - String sGrpName = GetGroupName(i); - if(bPathLen ? sGroup == sGrpName : sGroupName == sGrpName.GetToken(0, GLOS_DELIM)) - { - return sGrpName; - } - } - return aEmptyStr; -} - -void SwGlossaries::InvalidateUNOOjects() -{ - // invalidate all the AutoTextGroup-objects - for ( UnoAutoTextGroups::iterator aGroupLoop = m_aGlossaryGroups.begin(); - aGroupLoop != m_aGlossaryGroups.end(); - ++aGroupLoop - ) - { - Reference< text::XAutoTextGroup > xGroup( aGroupLoop->get(), UNO_QUERY ); - if ( xGroup.is() ) - static_cast< SwXAutoTextGroup* >( xGroup.get() )->Invalidate(); - } - UnoAutoTextGroups aTmpg = UnoAutoTextGroups(); - m_aGlossaryGroups.swap( aTmpg ); - - // invalidate all the AutoTextEntry-objects - for ( UnoAutoTextEntries::const_iterator aEntryLoop = m_aGlossaryEntries.begin(); - aEntryLoop != m_aGlossaryEntries.end(); - ++aEntryLoop - ) - { - Reference< lang::XUnoTunnel > xEntryTunnel( aEntryLoop->get(), UNO_QUERY ); - SwXAutoTextEntry* pEntry = NULL; - if ( xEntryTunnel.is() ) - pEntry = reinterpret_cast< SwXAutoTextEntry* >( - xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) ); - - if ( pEntry ) - pEntry->Invalidate(); - } - UnoAutoTextEntries aTmpe = UnoAutoTextEntries(); - m_aGlossaryEntries.swap( aTmpe ); -} - -Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const ::rtl::OUString& _rGroupName, bool _bCreate ) -{ - // first, find the name with path-extension - String sCompleteGroupName = GetCompleteGroupName( _rGroupName ); - - Reference< text::XAutoTextGroup > xGroup; - - // look up the group in the cache - UnoAutoTextGroups::iterator aSearch = m_aGlossaryGroups.begin(); - for ( ; aSearch != m_aGlossaryGroups.end(); ) - { - Reference< lang::XUnoTunnel > xGroupTunnel( aSearch->get(), UNO_QUERY ); - - SwXAutoTextGroup* pSwGroup = 0; - if ( xGroupTunnel.is() ) - pSwGroup = reinterpret_cast< SwXAutoTextGroup* >( xGroupTunnel->getSomething( SwXAutoTextGroup::getUnoTunnelId() ) ); - - if ( !pSwGroup ) - { - // the object is dead in the meantime -> remove from cache - aSearch = m_aGlossaryGroups.erase( aSearch ); - continue; - } - - if ( _rGroupName == pSwGroup->getName() ) - { // the group is already cached - if ( sCompleteGroupName.Len() ) - { // the group still exists -> return it - xGroup = pSwGroup; - break; - } - else - { - // this group does not exist (anymore) -> release the cached UNO object for it - aSearch = m_aGlossaryGroups.erase( aSearch ); - // so it won't be created below - _bCreate = sal_False; - break; - } - } - - ++aSearch; - } - - if ( !xGroup.is() && _bCreate ) - { - xGroup = new SwXAutoTextGroup( sCompleteGroupName, this ); - // cache it - m_aGlossaryGroups.push_back( AutoTextGroupRef( xGroup ) ); - } - - return xGroup; -} - -Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& _rCompleteGroupName, const ::rtl::OUString& _rGroupName, const ::rtl::OUString& _rEntryName, - bool _bCreate ) -{ - //standard must be created - sal_Bool bCreate = ( _rCompleteGroupName == GetDefName() ); - ::std::auto_ptr< SwTextBlocks > pGlosGroup( GetGroupDoc( _rCompleteGroupName, bCreate ) ); - - if ( pGlosGroup.get() && !pGlosGroup->GetError() ) - { - sal_uInt16 nIdx = pGlosGroup->GetIndex( _rEntryName ); - if ( USHRT_MAX == nIdx ) - throw container::NoSuchElementException(); - } - else - throw lang::WrappedTargetException(); - - Reference< text::XAutoTextEntry > xReturn; - String sGroupName( _rGroupName ); - String sEntryName( _rEntryName ); - - UnoAutoTextEntries::iterator aSearch( m_aGlossaryEntries.begin() ); - for ( ; aSearch != m_aGlossaryEntries.end(); ) - { - Reference< lang::XUnoTunnel > xEntryTunnel( aSearch->get(), UNO_QUERY ); - - SwXAutoTextEntry* pEntry = NULL; - if ( xEntryTunnel.is() ) - pEntry = reinterpret_cast< SwXAutoTextEntry* >( xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) ); - else - { - // the object is dead in the meantime -> remove from cache - aSearch = m_aGlossaryEntries.erase( aSearch ); - continue; - } - - if ( pEntry - && ( COMPARE_EQUAL == pEntry->GetGroupName().CompareTo( sGroupName ) ) - && ( COMPARE_EQUAL == pEntry->GetEntryName().CompareTo( sEntryName ) ) - ) - { - xReturn = pEntry; - break; - } - - ++aSearch; - } - - if ( !xReturn.is() && _bCreate ) - { - xReturn = new SwXAutoTextEntry( this, sGroupName, sEntryName ); - // cache it - m_aGlossaryEntries.push_back( AutoTextEntryRef( xReturn ) ); - } - - return xReturn; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx deleted file mode 100644 index 9c8fd1bd03..0000000000 --- a/sw/source/ui/misc/glossary.cxx +++ /dev/null @@ -1,1227 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - -#define _SVSTDARR_STRINGSDTOR -#define _SVSTDARR_STRINGS -#include <hintids.hxx> - -#include <vcl/menu.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/help.hxx> -#include <svl/svstdarr.hxx> -#include <svl/stritem.hxx> -#include <unotools/pathoptions.hxx> -#include <unotools/lingucfg.hxx> -#include <sfx2/request.hxx> -#include <sfx2/fcontnr.hxx> - -#include <svx/svxdlg.hxx> -#include <svx/dialogs.hrc> -#include <editeng/acorrcfg.hxx> -#include <sfx2/viewfrm.hxx> -#include <unocrsr.hxx> -#include <unotools.hxx> -#include <comphelper/processfactory.hxx> -#include <ucbhelper/content.hxx> -#include <com/sun/star/ui/dialogs/XFilePicker.hpp> -#include <com/sun/star/ui/dialogs/XFilterManager.hpp> -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <svl/urihelper.hxx> -#include <unotools/charclass.hxx> -#include <swwait.hxx> -#include <swtypes.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <basesh.hxx> -#include <glossary.hxx> -#include <gloshdl.hxx> -#include <glosbib.hxx> -#include <initui.hxx> // for ::GetGlossaries() -#include <glosdoc.hxx> -#include <macassgn.hxx> -#include <swevent.hxx> -#include <docsh.hxx> -#include <shellio.hxx> - -#include <cmdid.h> -#include <helpid.h> -#include <swerror.h> -#include <globals.hrc> -#include <misc.hrc> -#include <glossary.hrc> -#include <swmodule.hxx> -#include <sfx2/filedlghelper.hxx> - -#include "access.hrc" - -#define LONG_LENGTH 60 -#define SHORT_LENGTH 30 - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::comphelper; -using namespace ::ucbhelper; -using ::rtl::OUString; -using namespace ::sfx2; - -String lcl_GetValidShortCut( const String& rName ) -{ - const sal_uInt16 nSz = rName.Len(); - - if ( 0 == nSz ) - return rName; - - sal_uInt16 nStart = 1; - while( rName.GetChar( nStart-1 ) == ' ' && nStart < nSz ) - nStart++; - - String aBuf( rName.GetChar( nStart-1 )); - - for( ; nStart < nSz; ++nStart ) - { - if( rName.GetChar( nStart-1 ) == ' ' && rName.GetChar( nStart ) != ' ') - aBuf += rName.GetChar( nStart ); - } - return aBuf; -} - -struct GroupUserData -{ - String sGroupName; - sal_uInt16 nPathIdx; - sal_Bool bReadonly; - - GroupUserData() - : nPathIdx(0), - bReadonly(sal_False) {} -}; - -/*------------------------------------------------------------------------ - Description: dialog for new block name -------------------------------------------------------------------------*/ -class SwNewGlosNameDlg : public ModalDialog -{ - FixedText aNNFT; - Edit aNewName; - FixedText aNSFT; - NoSpaceEdit aNewShort; - OKButton aOk; - CancelButton aCancel; - FixedText aONFT; - Edit aOldName; - FixedText aOSFT; - Edit aOldShort; - FixedLine aFL; - -protected: - DECL_LINK( Modify, Edit * ); - DECL_LINK( Rename, Button * ); - -public: - SwNewGlosNameDlg( Window* pParent, - const String& rOldName, - const String& rOldShort ); - - String GetNewName() const { return aNewName.GetText(); } - String GetNewShort() const { return aNewShort.GetText(); } -}; - -SwNewGlosNameDlg::SwNewGlosNameDlg(Window* pParent, - const String& rOldName, - const String& rOldShort ) : - ModalDialog( pParent, SW_RES( DLG_RENAME_GLOS ) ), - aNNFT (this, SW_RES( FT_NN )), - aNewName(this, SW_RES( ED_NN )), - aNSFT (this, SW_RES( FT_NS )), - aNewShort(this,SW_RES( ED_NS )), - aOk (this, SW_RES( BT_OKNEW)), - aCancel (this, SW_RES( BT_CANCEL)), - aONFT (this, SW_RES( FT_ON )), - aOldName(this, SW_RES( ED_ON )), - aOSFT (this, SW_RES( FT_OS )), - aOldShort(this,SW_RES( ED_OS )), - aFL (this, SW_RES( FL_NN )) - -{ - FreeResource(); - aOldName.SetText( rOldName ); - aOldShort.SetText( rOldShort ); - aNewShort.SetMaxTextLen(SHORT_LENGTH); - aNewName.SetMaxTextLen(LONG_LENGTH); - aNewName.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify )); - aNewShort.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify )); - aOk.SetClickHdl(LINK(this, SwNewGlosNameDlg, Rename )); - aNewName.GrabFocus(); -} - -/*------------------------------------------------------------------------ - Description: query / set currently set group -------------------------------------------------------------------------*/ -String SwGlossaryDlg::GetCurrGroup() -{ - if( ::GetCurrGlosGroup() && ::GetCurrGlosGroup()->Len() ) - return *(::GetCurrGlosGroup()); - return SwGlossaries::GetDefName(); -} - -void SwGlossaryDlg::SetActGroup(const String &rGrp) -{ - if( !::GetCurrGlosGroup() ) - ::SetCurrGlosGroup( new String ); - *(::GetCurrGlosGroup()) = rGrp; -} - -SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, - SwGlossaryHdl * pGlosHdl, SwWrtShell *pWrtShell) : - - SvxStandardDialog(&pViewFrame->GetWindow(), SW_RES(DLG_GLOSSARY)), - - aInsertTipCB (this, SW_RES(CB_INSERT_TIP)), - aNameLbl (this, SW_RES(FT_NAME)), - aNameED (this, SW_RES(ED_NAME)), - aShortNameLbl (this, SW_RES(FT_SHORTNAME)), - aShortNameEdit(this, SW_RES(ED_SHORTNAME)), - aCategoryBox (this, SW_RES(LB_BIB)), - aRelativeFL (this, SW_RES(FL_RELATIVE)), - aFileRelCB (this, SW_RES(CB_FILE_REL)), - aNetRelCB (this, SW_RES(CB_NET_REL)), - aExampleWIN (this, SW_RES(WIN_EXAMPLE )), - aExampleDummyWIN(this, SW_RES(WIN_EXAMPLE_DUMMY )), - aShowExampleCB(this, SW_RES(CB_SHOW_EXAMPLE )), - aInsertBtn (this, SW_RES(PB_INSERT)), - aCloseBtn (this, SW_RES(PB_CLOSE)), - aHelpBtn (this, SW_RES(PB_HELP)), - aEditBtn (this, SW_RES(PB_EDIT)), - aBibBtn (this, SW_RES(PB_BIB)), - aPathBtn (this, SW_RES(PB_PATH)), - - sReadonlyPath (SW_RES(ST_READONLY_PATH)), - pExampleFrame(0), - - pMenu (new PopupMenu(SW_RES(MNU_EDIT))), - pGlossaryHdl (pGlosHdl), - - bResume(sal_False), - - bSelection( pWrtShell->IsSelection() ), - bReadOnly( sal_False ), - bIsOld( sal_False ), - bIsDocReadOnly(sal_False), - - pSh (pWrtShell) -{ - SvtLinguConfig aLocalLinguConfig; - - // initialise static-pointer - if( !::GetCurrGlosGroup() ) - ::SetCurrGlosGroup(new String);//(SwGlossaries::GetDefName()); - - pMenu->SetActivateHdl(LINK(this,SwGlossaryDlg,EnableHdl)); - pMenu->SetSelectHdl(LINK(this,SwGlossaryDlg,MenuHdl)); - aEditBtn.SetPopupMenu(pMenu); - aEditBtn.SetSelectHdl(LINK(this,SwGlossaryDlg,EditHdl)); - aPathBtn.SetClickHdl(LINK(this, SwGlossaryDlg, PathHdl)); - - aNameED.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify)); - aShortNameEdit.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify)); - - aCategoryBox.SetDoubleClickHdl(LINK(this,SwGlossaryDlg, NameDoubleClick)); - aCategoryBox.SetSelectHdl(LINK(this,SwGlossaryDlg,GrpSelect)); - aBibBtn.SetClickHdl(LINK(this,SwGlossaryDlg,BibHdl)); - aShowExampleCB.SetClickHdl(LINK(this, SwGlossaryDlg, ShowPreviewHdl)); - - aShortNameEdit.SetMaxTextLen(SHORT_LENGTH); - aNameED.SetMaxTextLen(LONG_LENGTH); - FreeResource(); - - const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - - aShowExampleCB.Check( rCfg.IsAutoTextPreview()); - ShowPreviewHdl(&aShowExampleCB); - - bIsDocReadOnly = pSh->GetView().GetDocShell()->IsReadOnly() || - pSh->HasReadonlySel(); - if( bIsDocReadOnly ) - aInsertBtn.Enable(sal_False); - aNameED.GrabFocus(); - aCategoryBox.SetHelpId(HID_MD_GLOS_CATEGORY); - aCategoryBox.SetStyle(aCategoryBox.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL|WB_VSCROLL|WB_CLIPCHILDREN|WB_SORT); - aCategoryBox.GetModel()->SetSortMode(SortAscending); - aCategoryBox.SetHighlightRange(); // select over full width - aCategoryBox.SetNodeDefaultImages( ); - aCategoryBox.SetAccessibleName(SW_RES(STR_ACCESS_SW_CATEGORY)); - aCategoryBox.SetAccessibleRelationLabeledBy(&aInsertTipCB); - - Init(); -} - -SwGlossaryDlg::~SwGlossaryDlg() -{ - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - rCfg.SetAutoTextPreview(aShowExampleCB.IsChecked()) ; - - aCategoryBox.Clear(); - aEditBtn.SetPopupMenu(0); - delete pMenu; - delete pExampleFrame; -} - -/*------------------------------------------------------------------------ - Description: select new group -------------------------------------------------------------------------*/ -IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox ) -{ - SvLBoxEntry* pEntry = pBox->FirstSelected(); - if(!pEntry) - return 0; - SvLBoxEntry* pParent = pBox->GetParent(pEntry) ? pBox->GetParent(pEntry) : pEntry; - GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData(); - String *pGlosGroup = ::GetCurrGlosGroup(); - (*pGlosGroup) = pGroupData->sGroupName; - (*pGlosGroup) += GLOS_DELIM; - (*pGlosGroup) += String::CreateFromInt32(pGroupData->nPathIdx); - pGlossaryHdl->SetCurGroup(*pGlosGroup); - // set current text block - bReadOnly = pGlossaryHdl->IsReadOnly(); - EnableShortName( !bReadOnly ); - aEditBtn.Enable(!bReadOnly); - bIsOld = pGlossaryHdl->IsOld(); - if( pParent != pEntry) - { - String aName(pBox->GetEntryText(pEntry)); - aNameED.SetText(aName); - aShortNameEdit.SetText(*(String*)pEntry->GetUserData()); - pEntry = pBox->GetParent(pEntry); - aInsertBtn.Enable( !bIsDocReadOnly); - ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText()); - } - else - ShowAutoText(aEmptyStr, aEmptyStr); - // update controls - NameModify(&aShortNameEdit); - if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) ) - { - SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY ); - String sTemp(*::GetCurrGlosGroup()); - // the zeroth path is not being recorded! - if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0)) - sTemp = sTemp.GetToken(0, GLOS_DELIM); - aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, sTemp)); - aReq.Done(); - } - return 0; -} - -void SwGlossaryDlg::Apply() -{ - const String aGlosName(aShortNameEdit.GetText()); - if(aGlosName.Len()) pGlossaryHdl->InsertGlossary(aGlosName); - if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) ) - { - SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY ); - String sTemp(*::GetCurrGlosGroup()); - // the zeroth path is not being recorded! - if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0)) - sTemp = sTemp.GetToken(0, GLOS_DELIM); - aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, sTemp)); - aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName)); - aReq.Done(); - } -} - -/* inline */ void SwGlossaryDlg::EnableShortName(sal_Bool bOn) -{ - aShortNameLbl.Enable(bOn); - aShortNameEdit.Enable(bOn); -} - -/* -------------------------------------------------- - * does the title exist in the selected group? - * --------------------------------------------------*/ -SvLBoxEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock, - const String& rShort) -{ - // look for possible entry in TreeListBox - SvLBoxEntry* pEntry = aCategoryBox.FirstSelected(); - if(pEntry) - { - if(aCategoryBox.GetParent(pEntry)) - pEntry = aCategoryBox.GetParent(pEntry); - sal_uInt32 nChildCount = aCategoryBox.GetChildCount( pEntry ); - for(sal_uInt32 i = 0; i < nChildCount; i++) - { - SvLBoxEntry* pChild = aCategoryBox.GetEntry( pEntry, i ); - if(rBlock == aCategoryBox.GetEntryText(pChild) && - (!rShort.Len() || rShort == *(String*)pChild->GetUserData())) - { - return pChild; - } - } - } - return 0; -} - -IMPL_LINK( SwGlossaryDlg, NameModify, Edit *, pEdit ) -{ - String aName(aNameED.GetText()); - sal_Bool bNameED = pEdit == &aNameED; - if( !aName.Len() ) - { - if(bNameED) - aShortNameEdit.SetText(aName); - aInsertBtn.Enable(sal_False); - return 0; - } - String sShortSearch; - if(!bNameED) - sShortSearch = pEdit->GetText(); - sal_Bool bNotFound = !DoesBlockExist(aName, sShortSearch); - if(bNameED) - { - // did the text get in to the Listbbox in the Edit with a click? - if(bNotFound) - { - aShortNameEdit.SetText( lcl_GetValidShortCut( aName ) ); - EnableShortName(); - } - else - { - aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aName)); - EnableShortName(!bReadOnly); - } - aInsertBtn.Enable(!bNotFound && !bIsDocReadOnly); - } - else - { - //ShortNameEdit - if(!bNotFound) - { - sal_Bool bEnable = !bNotFound; - bEnable &= !bIsDocReadOnly; - aInsertBtn.Enable(bEnable); - } - } - return 0; -} - -IMPL_LINK_INLINE_START( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, pBox ) -{ - SvLBoxEntry* pEntry = pBox->FirstSelected(); - if(pBox->GetParent(pEntry) && !bIsDocReadOnly) - EndDialog( RET_OK ); - return 0; -} -IMPL_LINK_INLINE_END( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, EMPTYARG ) - -IMPL_LINK( SwGlossaryDlg, EnableHdl, Menu *, pMn ) -{ - const String aEditText(aNameED.GetText()); - const sal_Bool bHasEntry = aEditText.Len() && aShortNameEdit.GetText().Len(); - const sal_Bool bExists = 0 != DoesBlockExist(aEditText, aShortNameEdit.GetText()); - pMn->EnableItem(FN_GL_DEFINE, bSelection && bHasEntry && !bExists); - pMn->EnableItem(FN_GL_DEFINE_TEXT, bSelection && bHasEntry && !bExists); - pMn->EnableItem(FN_GL_COPY_TO_CLIPBOARD, bExists); - pMn->EnableItem(FN_GL_REPLACE, bSelection && bExists && !bIsOld ); - pMn->EnableItem(FN_GL_REPLACE_TEXT, bSelection && bExists && !bIsOld ); - pMn->EnableItem(FN_GL_EDIT, bExists ); - pMn->EnableItem(FN_GL_RENAME, bExists ); - pMn->EnableItem(FN_GL_DELETE, bExists ); - pMn->EnableItem(FN_GL_MACRO, bExists && !bIsOld && - !pGlossaryHdl->IsReadOnly() ); - - SvLBoxEntry* pEntry = aCategoryBox.FirstSelected(); - sal_Bool bEnable = sal_False; - if ( pEntry ) - bEnable = !aCategoryBox.GetParent( pEntry ) && !bIsOld && !pGlossaryHdl->IsReadOnly(); - pMn->EnableItem( FN_GL_IMPORT, bEnable ); - return 1; -} - -IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) -{ - sal_Bool bNoAttr = sal_False; - - switch(pMn->GetCurItemId()) - { - case FN_GL_REPLACE: - case FN_GL_REPLACE_TEXT: - pGlossaryHdl->NewGlossary( aNameED.GetText(), - aShortNameEdit.GetText(), - sal_False, - pMn->GetCurItemId() == FN_GL_REPLACE_TEXT); - break; - case FN_GL_DEFINE_TEXT: - bNoAttr = sal_True; - // no break!!! - case FN_GL_DEFINE: - { - const String aStr(aNameED.GetText()); - const String aShortName(aShortNameEdit.GetText()); - if(pGlossaryHdl->HasShortName(aShortName)) - { - InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute(); - aShortNameEdit.SetSelection(Selection(0, SELECTION_MAX)); - aShortNameEdit.GrabFocus(); - break; - } - if(pGlossaryHdl->NewGlossary(aStr, aShortName, sal_False, bNoAttr )) - { - SvLBoxEntry* pEntry = aCategoryBox.FirstSelected(); - if(aCategoryBox.GetParent(pEntry)) - pEntry = aCategoryBox.GetParent(pEntry); - - SvLBoxEntry* pChild = aCategoryBox.InsertEntry(aStr, pEntry); - pChild->SetUserData(new String(aShortName)); - aNameED.SetText(aStr); - aShortNameEdit.SetText(aShortName); - NameModify(&aNameED); // for toggling the buttons - - if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) ) - { - SfxRequest aReq(pSh->GetView().GetViewFrame(), FN_NEW_GLOSSARY); - String sTemp(*::GetCurrGlosGroup()); - // the zeroth path is not being recorded! - if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0)) - sTemp = sTemp.GetToken(0, GLOS_DELIM); - aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, sTemp)); - aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName)); - aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr)); - aReq.Done(); - } - } - } - break; - case FN_GL_COPY_TO_CLIPBOARD : - { - pGlossaryHdl->CopyToClipboard(*pSh, aShortNameEdit.GetText()); - } - break; - case FN_GL_EDIT: - break; - case FN_GL_RENAME: - { - aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aNameED.GetText())); - SwNewGlosNameDlg* pNewNameDlg = new SwNewGlosNameDlg(this, aNameED.GetText(), - aShortNameEdit.GetText() ); - if( RET_OK == pNewNameDlg->Execute() && - pGlossaryHdl->Rename( aShortNameEdit.GetText(), - pNewNameDlg->GetNewShort(), - pNewNameDlg->GetNewName())) - { - SvLBoxEntry* pEntry = aCategoryBox.FirstSelected(); - SvLBoxEntry* pNewEntry = aCategoryBox.InsertEntry( - pNewNameDlg->GetNewName(), aCategoryBox.GetParent(pEntry)); - pNewEntry->SetUserData(new String(pNewNameDlg->GetNewShort())); - delete (String*)pEntry->GetUserData(); - aCategoryBox.GetModel()->Remove(pEntry); - aCategoryBox.Select(pNewEntry); - aCategoryBox.MakeVisible(pNewEntry); - } - GrpSelect( &aCategoryBox ); - delete pNewNameDlg; - } - break; - case FN_GL_DELETE: - { - QueryBox aQuery(this, SW_RES(MSG_QUERY_DELETE)); - if(RET_YES == aQuery.Execute()) - { - const String aShortName(aShortNameEdit.GetText()); - const String aTitle(aNameED.GetText()); - if(aTitle.Len() && pGlossaryHdl->DelGlossary(aShortName)) - { - SvLBoxEntry* pChild = DoesBlockExist(aTitle, aShortName); - OSL_ENSURE(pChild, "entry not found!"); - SvLBoxEntry* pParent = aCategoryBox.GetParent(pChild); - aCategoryBox.Select(pParent); - - aCategoryBox.GetModel()->Remove(pChild); - aNameED.SetText( aEmptyStr ); - NameModify(&aNameED); - } - } - } - break; - case FN_GL_MACRO: - { - SfxItemSet aSet( pSh->GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); - - SvxMacro aStart(aEmptyStr, aEmptyStr, STARBASIC); - SvxMacro aEnd(aEmptyStr, aEmptyStr, STARBASIC); - pGlossaryHdl->GetMacros(aShortNameEdit.GetText(), aStart, aEnd ); - - SvxMacroItem aItem(RES_FRMMACRO); - if( aStart.GetMacName().Len() ) - aItem.SetMacro( SW_EVENT_START_INS_GLOSSARY, aStart ); - if( aEnd.GetMacName().Len() ) - aItem.SetMacro( SW_EVENT_END_INS_GLOSSARY, aEnd ); - - aSet.Put( aItem ); - aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_AUTOTEXT ) ); - - const SfxPoolItem* pItem; - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, - pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG ); - if ( pMacroDlg && pMacroDlg->Execute() == RET_OK && - SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) ) - { - const SvxMacroTableDtor& rTbl = ((SvxMacroItem*)pItem)->GetMacroTable(); - pGlossaryHdl->SetMacros( aShortNameEdit.GetText(), - rTbl.Get( SW_EVENT_START_INS_GLOSSARY ), - rTbl.Get( SW_EVENT_END_INS_GLOSSARY ) ); - } - - delete pMacroDlg; - } - break; - - case FN_GL_IMPORT: - { - // call the FileOpenDialog do find WinWord - Files with templates - FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 ); - uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); - - SvtPathOptions aPathOpt; - xFP->setDisplayDirectory(aPathOpt.GetWorkPath() ); - String sWW8( C2S( FILTER_WW8 ) ); - - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); - SfxFilterMatcher aMatcher( String::CreateFromAscii(SwDocShell::Factory().GetShortName()) ); - SfxFilterMatcherIter aIter( aMatcher ); - const SfxFilter* pFilter = aIter.First(); - while ( pFilter ) - { - if( pFilter->GetUserData() == sWW8 ) - { - xFltMgr->appendFilter( pFilter->GetUIName(), - ((WildCard&)pFilter->GetWildcard()).GetWildCard() ); - xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ; - } - - pFilter = aIter.Next(); - } - - if( aDlgHelper.Execute() == ERRCODE_NONE ) - { - if( pGlossaryHdl->ImportGlossaries( xFP->getFiles().getConstArray()[0] )) - Init(); - else - { - InfoBox(this, SW_RES( MSG_NO_GLOSSARIES )).Execute(); - } - } - } - break; - - default: - return 0; - } - return 1; -} - -/*-------------------------------------------------------------------- - Description: dialog manage regions - --------------------------------------------------------------------*/ -IMPL_LINK( SwGlossaryDlg, BibHdl, Button *, EMPTYARG ) -{ - SwGlossaries* pGloss = ::GetGlossaries(); - if( pGloss->IsGlosPathErr() ) - pGloss->ShowError(); - else - { - //check if at least one glossary path is write enabled - SvtPathOptions aPathOpt; - String sGlosPath( aPathOpt.GetAutoTextPath() ); - sal_uInt16 nPaths = sGlosPath.GetTokenCount(';'); - sal_Bool bIsWritable = sal_False; - for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++) - { - String sPath = URIHelper::SmartRel2Abs( - INetURLObject(), sGlosPath.GetToken(nPath, ';'), - URIHelper::GetMaybeFileHdl()); - try - { - Content aTestContent( sPath, - uno::Reference< XCommandEnvironment >()); - Any aAny = aTestContent.getPropertyValue( C2U("IsReadOnly") ); - if(aAny.hasValue()) - { - bIsWritable = !*(sal_Bool*)aAny.getValue(); - } - } - catch(Exception&) - {} - if(bIsWritable) - break; - } - if(bIsWritable) - { - - SwGlossaryGroupDlg *pDlg = new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl ); - if ( RET_OK == pDlg->Execute() ) - { - Init(); - //if new groups were created - select one of them - String sNewGroup = pDlg->GetCreatedGroupName(); - SvLBoxEntry* pEntry = aCategoryBox.First(); - while(sNewGroup.Len() && pEntry) - { - if(!aCategoryBox.GetParent(pEntry)) - { - GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); - String sGroup = pGroupData->sGroupName; - sGroup += GLOS_DELIM; - sGroup += String::CreateFromInt32(pGroupData->nPathIdx); - if(sGroup == sNewGroup) - { - aCategoryBox.Select(pEntry); - aCategoryBox.MakeVisible(pEntry); - GrpSelect(&aCategoryBox); - break; - } - } - pEntry = aCategoryBox.Next(pEntry); - } - - } - delete pDlg; - } - else - { - QueryBox aBox(this, WB_YES_NO, sReadonlyPath); - if(RET_YES == aBox.Execute()) - PathHdl(&aPathBtn); - } - } - return 0; -} - -/*------------------------------------------------------------------------ - Description: initialisation; from Ctor and after editing regions -------------------------------------------------------------------------*/ -void SwGlossaryDlg::Init() -{ - aCategoryBox.SetUpdateMode( sal_False ); - aCategoryBox.Clear(); - // display text block regions - const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt(); - SvLBoxEntry* pSelEntry = 0; - const String sSelStr(::GetCurrGlosGroup()->GetToken(0, GLOS_DELIM)); - const sal_uInt16 nSelPath = static_cast< sal_uInt16 >(::GetCurrGlosGroup()->GetToken(1, GLOS_DELIM).ToInt32()); - // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated - const String sMyAutoTextEnglish(RTL_CONSTASCII_USTRINGPARAM("My AutoText")); - const String sMyAutoTextTranslated(SW_RESSTR(STR_MY_AUTOTEXT)); - for(sal_uInt16 nId = 0; nId < nCnt; ++nId ) - { - String sTitle; - String sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle)); - if(!sGroupName.Len()) - continue; - if(!sTitle.Len()) - sTitle = sGroupName.GetToken( 0, GLOS_DELIM ); - if(sTitle == sMyAutoTextEnglish) - sTitle = sMyAutoTextTranslated; - SvLBoxEntry* pEntry = aCategoryBox.InsertEntry( sTitle ); - sal_uInt16 nPath = static_cast< sal_uInt16 >(sGroupName.GetToken( 1, GLOS_DELIM ).ToInt32()); - - GroupUserData* pData = new GroupUserData; - pData->sGroupName = sGroupName.GetToken(0, GLOS_DELIM); - pData->nPathIdx = nPath; - pData->bReadonly = pGlossaryHdl->IsReadOnly(&sGroupName); - - pEntry->SetUserData(pData); - if(sSelStr == pData->sGroupName && nSelPath == nPath) - pSelEntry = pEntry; - - // fill entries for the groups - { - pGlossaryHdl->SetCurGroup(sGroupName, sal_False, sal_True); - const sal_uInt16 nCount = pGlossaryHdl->GetGlossaryCnt(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - String sGroupTitle(pGlossaryHdl->GetGlossaryName(i)); - SvLBoxEntry* pChild = aCategoryBox.InsertEntry( - sGroupTitle, pEntry); - pChild->SetUserData(new String(pGlossaryHdl->GetGlossaryShortName(i))); - } - } - } - // set current group and display text blocks - if(!pSelEntry) - { - //find a non-readonly group - SvLBoxEntry* pSearch = aCategoryBox.First(); - while(pSearch) - { - if(!aCategoryBox.GetParent(pSearch)) - { - GroupUserData* pData = (GroupUserData*)pSearch->GetUserData(); - if(!pData->bReadonly) - { - pSelEntry = pSearch; - break; - } - } - pSearch = aCategoryBox.Next(pSearch); - } - if(!pSelEntry) - pSelEntry = aCategoryBox.GetEntry(0); - } - if(pSelEntry) - { - aCategoryBox.Expand(pSelEntry); - aCategoryBox.Select(pSelEntry); - aCategoryBox.MakeVisible(pSelEntry); - GrpSelect(&aCategoryBox); - } - //JP 16.11.99: the SvxTreeListBox has a Bug. The Box dont recalc the - // outputsize, when all entries are insertet. The result is, that - // the Focus/Highlight rectangle is to large and paintet over the - // HScrollbar. -> Fix: call the resize - aCategoryBox.Resize(); - - aCategoryBox.GetModel()->Resort(); - aCategoryBox.SetUpdateMode( sal_True ); - aCategoryBox.Update(); - - const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - aFileRelCB.Check( rCfg.IsSaveRelFile() ); - aFileRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl)); - aNetRelCB.Check( rCfg.IsSaveRelNet() ); - aNetRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl)); - aInsertTipCB.Check( rCfg.IsAutoTextTip() ); - aInsertTipCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl)); -} - -IMPL_LINK_INLINE_START( SwGlossaryDlg, EditHdl, Button *, EMPTYARG ) -{ -// EndDialog must not be called in MenuHdl - if(aEditBtn.GetCurItemId() == FN_GL_EDIT ) - { - SwTextBlocks *pGroup = ::GetGlossaries()->GetGroupDoc ( GetCurrGrpName () ); - sal_Bool bRet = pGlossaryHdl->ConvertToNew ( *pGroup ); - delete pGroup; - if ( bRet ) - EndDialog(RET_EDIT); - } - return 0; -} -IMPL_LINK_INLINE_END( SwGlossaryDlg, EditHdl, Button *, EMPTYARG ) - -/*------------------------------------------------------------------------ - Description: KeyInput for ShortName - Edits without Spaces -------------------------------------------------------------------------*/ -IMPL_LINK( SwNewGlosNameDlg, Modify, Edit *, pBox ) -{ - String aName(aNewName.GetText()); - SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent(); - - if( pBox == &aNewName ) - aNewShort.SetText( lcl_GetValidShortCut( aName ) ); - - sal_Bool bEnable = aName.Len() && aNewShort.GetText().Len() && - (!pDlg->DoesBlockExist(aName, aNewShort.GetText()) - || aName == aOldName.GetText()); - aOk.Enable(bEnable); - return 0; -} - -IMPL_LINK( SwNewGlosNameDlg, Rename, Button *, EMPTYARG ) -{ - SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent(); - String sNew = aNewShort.GetText(); - GetAppCharClass().toUpper(sNew); - if( pDlg->pGlossaryHdl->HasShortName(aNewShort.GetText()) - && sNew != aOldShort.GetText() ) - { - InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute(); - aNewShort.GrabFocus(); - } - else - EndDialog(sal_True); - return 0; -} - -IMPL_LINK( SwGlossaryDlg, CheckBoxHdl, CheckBox *, pBox ) -{ - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - sal_Bool bCheck = pBox->IsChecked(); - if( pBox == &aInsertTipCB ) - rCfg.SetAutoTextTip(bCheck); - else if(pBox == &aFileRelCB) - rCfg.SetSaveRelFile(bCheck); - else - rCfg.SetSaveRelNet(bCheck); - return 0; -} - -/* -------------------------------------------------- - * TreeListBox for groups and blocks - * --------------------------------------------------*/ -SwGlTreeListBox::SwGlTreeListBox(Window* pParent, const ResId& rResId) : - SvTreeListBox(pParent, rResId), - sReadonly (SW_RES(ST_READONLY)), - pDragEntry(0) -{ - FreeResource(); - SetDragDropMode( SV_DRAGDROP_CTRL_MOVE|SV_DRAGDROP_CTRL_COPY ); -} - -void SwGlTreeListBox::Clear() -{ - SvLBoxEntry* pEntry = First(); - while(pEntry) - { - if(GetParent(pEntry)) - delete (String*)pEntry->GetUserData(); - else - delete (GroupUserData*)pEntry->GetUserData(); - pEntry = Next(pEntry); - } - SvTreeListBox::Clear(); -} - -void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt ) -{ - Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); - SvLBoxEntry* pEntry = GetEntry( aPos ); - // there's only help for groups' names - if(pEntry) - { - SvLBoxTab* pTab; - SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab ); - if(pItem) - { - aPos = GetEntryPosition( pEntry ); - Size aSize(pItem->GetSize( this, pEntry )); - aPos.X() = GetTabPos( pEntry, pTab ); - - if((aPos.X() + aSize.Width()) > GetSizePixel().Width()) - aSize.Width() = GetSizePixel().Width() - aPos.X(); - aPos = OutputToScreenPixel(aPos); - Rectangle aItemRect( aPos, aSize ); - String sMsg; - if(!GetParent(pEntry)) - { - GroupUserData* pData = (GroupUserData*)pEntry->GetUserData(); - const SvStrings* pPathArr = ::GetGlossaries()->GetPathArray(); - if(pPathArr->Count()) - { - sMsg = (*(*pPathArr)[pData->nPathIdx]); - sMsg += INET_PATH_TOKEN; - sMsg += pData->sGroupName; - sMsg += SwGlossaries::GetExtension(); - INetURLObject aTmp(sMsg); - sMsg = aTmp.GetPath(); - - if(pData->bReadonly) - { - sMsg += ' '; - sMsg += '('; - sMsg += sReadonly; - sMsg += ')'; - } - - - } - } - else - sMsg = *(String*)pEntry->GetUserData(); - Help::ShowQuickHelp( this, aItemRect, sMsg, - QUICKHELP_LEFT|QUICKHELP_VCENTER ); - } - } -} - -DragDropMode SwGlTreeListBox::NotifyStartDrag( - TransferDataContainer& /*rContainer*/, - SvLBoxEntry* pEntry ) -{ - DragDropMode eRet; - pDragEntry = pEntry; - if(!GetParent(pEntry)) - eRet = SV_DRAGDROP_NONE; - else - { - SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent(); - SvLBoxEntry* pParent = GetParent(pEntry); - - GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData(); - String sEntry(pGroupData->sGroupName); - sEntry += GLOS_DELIM; - sEntry += String::CreateFromInt32(pGroupData->nPathIdx); - sal_Int8 nDragOption = DND_ACTION_COPY; - eRet = SV_DRAGDROP_CTRL_COPY; - if(!pDlg->pGlossaryHdl->IsReadOnly(&sEntry)) - { - eRet |= SV_DRAGDROP_CTRL_MOVE; - nDragOption |= DND_ACTION_MOVE; - } - SetDragOptions( nDragOption ); - } - return eRet; -} - -sal_Bool SwGlTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry) -{ - // TODO: Readonly - check still missing! - SvLBoxEntry* pSrcParent = GetParent(pEntry) ? GetParent(pEntry) : pEntry; - SvLBoxEntry* pDestParent = - GetParent(pDragEntry ) ? GetParent(pDragEntry ) : pDragEntry ; - return pDestParent != pSrcParent; - -} - -sal_Bool SwGlTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, - SvLBoxEntry* pEntry, - SvLBoxEntry*& /*rpNewParent*/, - sal_uLong& /*rNewChildPos*/ - ) -{ - pDragEntry = 0; - if(!pTarget) // move to the beginning - { - pTarget = GetEntry(0); - } - // 1. move to different groups? - // 2. allowed to write in both groups? - SvLBoxEntry* pSrcParent = GetParent(pEntry); - SvLBoxEntry* pDestParent = - GetParent(pTarget) ? GetParent(pTarget) : pTarget; - sal_Bool bRet = sal_False; - if(pDestParent != pSrcParent) - { - SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent(); - SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True ); - - GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData(); - String sSourceGroup(pGroupData->sGroupName); - sSourceGroup += GLOS_DELIM; - sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx); - pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup); - String sTitle(GetEntryText(pEntry)); - String sShortName(*(String*)pEntry->GetUserData()); - - GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData(); - String sDestName = pDestData->sGroupName; - sDestName += GLOS_DELIM; - sDestName += String::CreateFromInt32(pDestData->nPathIdx); - bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName, - sDestName, sTitle, sal_True ); - if(bRet) - { - SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent); - pChild->SetUserData(new String(sShortName)); - GetModel()->Remove(pEntry); - } - } - return sal_False; // otherwise the entry is being set automatically -} - -sal_Bool SwGlTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, - SvLBoxEntry* pEntry, - SvLBoxEntry*& /*rpNewParent*/, - sal_uLong& /*rNewChildPos*/ - ) -{ - pDragEntry = 0; - // 1. move in different groups? - // 2. allowed to write to both groups? - if(!pTarget) // move to the beginning - { - pTarget = GetEntry(0); - } - SvLBoxEntry* pSrcParent = GetParent(pEntry); - SvLBoxEntry* pDestParent = - GetParent(pTarget) ? GetParent(pTarget) : pTarget; - sal_Bool bRet = sal_False; - if(pDestParent != pSrcParent) - { - SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent(); - SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True ); - - GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData(); - String sSourceGroup(pGroupData->sGroupName); - sSourceGroup += GLOS_DELIM; - sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx); - - pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup); - String sTitle(GetEntryText(pEntry)); - String sShortName(*(String*)pEntry->GetUserData()); - - GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData(); - String sDestName = pDestData->sGroupName; - sDestName += GLOS_DELIM; - sDestName += String::CreateFromInt32(pDestData->nPathIdx); - - bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName, - sDestName, sTitle, sal_False ); - if(bRet) - { - SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent); - pChild->SetUserData(new String(sShortName)); - } - } - return sal_False; // otherwise the entry is being set automatically -} - -String SwGlossaryDlg::GetCurrGrpName() const -{ - SvLBoxEntry* pEntry = aCategoryBox.FirstSelected(); - String sRet; - if(pEntry) - { - pEntry = - aCategoryBox.GetParent(pEntry) ? aCategoryBox.GetParent(pEntry) : pEntry; - GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); - sRet = pGroupData->sGroupName; - sRet += GLOS_DELIM; - sRet += String::CreateFromInt32(pGroupData->nPathIdx); - } - return sRet; -} - -IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn ) -{ - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn ); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); - SvtPathOptions aPathOpt; - String sGlosPath( aPathOpt.GetAutoTextPath() ); - pDlg->SetPath(sGlosPath); - if(RET_OK == pDlg->Execute()) - { - String sTmp(pDlg->GetPath()); - if(sTmp != sGlosPath) - { - aPathOpt.SetAutoTextPath( sTmp ); - ::GetGlossaries()->UpdateGlosPath( sal_True ); - Init(); - } - } - delete pDlg; - } - return 0; -} - -IMPL_LINK( SwGlossaryDlg, ShowPreviewHdl, CheckBox *, pBox ) -{ - sal_Bool bCreated = sal_False; - if(pBox->IsChecked()) - { - //create example - if(!pExampleFrame) - { - Link aLink(LINK(this, SwGlossaryDlg, PreviewLoadedHdl)); - pExampleFrame = new SwOneExampleFrame( aExampleWIN, - EX_SHOW_ONLINE_LAYOUT, &aLink ); - bCreated = sal_True; - } - } - - sal_Bool bShow = pBox->IsChecked() && !bCreated; - aExampleWIN.Show( bShow ); - aExampleDummyWIN.Show(!bShow); - if( ::GetCurrGlosGroup() ) - ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText()); - - return 0; -}; - -IMPL_LINK( SwGlossaryDlg, PreviewLoadedHdl, void *, EMPTYARG ) -{ - sal_Bool bShow = aShowExampleCB.IsChecked(); - aExampleWIN.Show( bShow ); - aExampleDummyWIN.Show(!bShow); - ResumeShowAutoText(); - return 0; -} - -void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) -{ - if(aExampleWIN.IsVisible()) - { - SetResumeData(rGroup, rShortName); - //try to make an Undo() - pExampleFrame->ClearDocument( sal_True ); - } -} - -void SwGlossaryDlg::ResumeShowAutoText() -{ - String sGroup, sShortName; - if(GetResumeData(sGroup, sShortName) && aExampleWIN.IsVisible()) - { - if(!_xAutoText.is()) - { - uno::Reference< lang::XMultiServiceFactory > - xMgr = getProcessServiceFactory(); - //now the AutoText ListBoxes have to be filled - - uno::Reference< uno::XInterface > xAText = xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") ); - _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); - } - - uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); - if(xCrsr.is()) - { - if(sShortName.Len()) - { - uno::Any aGroup = _xAutoText->getByName(sGroup); - uno::Reference< XAutoTextGroup > xGroup; - OUString uShortName(sShortName); - if((aGroup >>= xGroup) && xGroup->hasByName(uShortName)) - { - uno::Any aEntry(xGroup->getByName(uShortName)); - uno::Reference< XAutoTextEntry > xEntry; - aEntry >>= xEntry; - uno::Reference< XTextRange > xRange(xCrsr, uno::UNO_QUERY); - xEntry->applyTo(xRange); - } - } - } - } - ResetResumeData(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glossary.hrc b/sw/source/ui/misc/glossary.hrc deleted file mode 100644 index 8f439370c3..0000000000 --- a/sw/source/ui/misc/glossary.hrc +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - - -// Box text blocks -#define FT_SHORTNAME 1 -#define ED_SHORTNAME 2 -#define FT_NAME 3 -//#define DCB_NAME 4 -#define ED_NAME 4 -#define CB_INSERT_TIP 5 - -//#define FT_BIB 10 - -#define PB_INSERT 50 -#define PB_EDIT 52 -#define PB_BIB 54 -#define PB_CLOSE 55 -#define PB_PATH 56 -#define PB_HELP 57 - -#define MNU_EDIT 60 -#define FN_GL_DEFINE 61 -#define FN_GL_DEFINE_TEXT 62 -#define FN_GL_REPLACE 63 -#define FN_GL_EDIT 64 -#define FN_GL_DELETE 65 -#define FN_GL_RENAME 66 -#define FN_GL_MACRO 67 -#define CB_FILE_REL 68 -#define CB_NET_REL 69 -#define FL_RELATIVE 70 -#define WIN_EXAMPLE 72 -#define CB_SHOW_EXAMPLE 73 -#define FN_GL_COPY_TO_CLIPBOARD 74 -#define FN_GL_IMPORT 75 -#define ST_READONLY 76 -#define ST_READONLY_PATH 77 -#define FN_GL_REPLACE_TEXT 78 -#define WIN_EXAMPLE_DUMMY 79 - -// Box library text blocks -#define FL_EDIT 1 -#define FL_BIB 2 -#define ED_BIB 3 - -#define PB_NEW 10 -#define PB_DELETE 11 - -#define BT_OK 100 - -// both -#define LB_BIB 80 - -// Dialog name changing -#define FT_ON 1 -#define FT_OS 2 -#define FT_NN 3 -#define FT_NS 4 -#define ED_ON 5 -#define ED_OS 6 -#define ED_NN 7 -#define ED_NS 8 -#define FL_NN 9 -#define BT_CANCEL 10 -#define BT_OKNEW 11 - diff --git a/sw/source/ui/misc/glossary.src b/sw/source/ui/misc/glossary.src deleted file mode 100644 index 721b36522c..0000000000 --- a/sw/source/ui/misc/glossary.src +++ /dev/null @@ -1,392 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "glossary.hrc" -#include "cmdid.h" -#include "helpid.h" -#include "access.hrc" - - // #define DLG_GLOSSARY 256 -ModalDialog DLG_GLOSSARY -{ - HelpID = CMD_FN_GLOSSARY_DLG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 375 , 164 ) ; - Text [ en-US ] = "AutoText" ; - Moveable = TRUE ; - CheckBox CB_INSERT_TIP - { - HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_INSERT_TIP"; - Pos = MAP_APPFONT ( 12 , 12 ) ; - Size = MAP_APPFONT ( 200 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Display remainder of name as suggestion while typing" ; - }; - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Name" ; - Left = TRUE ; - }; - Edit ED_NAME - { - HelpID = "sw:Edit:DLG_GLOSSARY:ED_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 29 ) ; - Size = MAP_APPFONT ( 85 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; - FixedText FT_SHORTNAME - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 143 , 31 ) ; - Size = MAP_APPFONT ( 57 , 8 ) ; - Text [ en-US ] = "~Shortcut" ; - Right = TRUE ; - }; - Edit ED_SHORTNAME - { - HelpID = "sw:Edit:DLG_GLOSSARY:ED_SHORTNAME"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 203 , 29 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; - Control LB_BIB - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 212 , 84 ) ; - TabStop = TRUE ; - // Sort = TRUE ; - // CurPos = 0 ; - String ST_READONLY - { - Text [ en-US ] = "read-only"; - }; - }; - FixedLine FL_RELATIVE - { - Pos = MAP_APPFONT ( 6 , 134 ) ; - Size = MAP_APPFONT ( 221 , 8 ) ; - Text [ en-US ] = "Save links relative to"; - }; - CheckBox CB_FILE_REL - { - HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_FILE_REL"; - Pos = MAP_APPFONT ( 14 , 145 ) ; - Size = MAP_APPFONT ( 90 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~File system" ; - }; - CheckBox CB_NET_REL - { - HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_NET_REL"; - Pos = MAP_APPFONT ( 109 , 145 ) ; - Size = MAP_APPFONT ( 90 , 12 ) ; - Text [ en-US ] = "Inte~rnet" ; - }; - Window WIN_EXAMPLE - { - Pos = MAP_APPFONT ( 231 , 14 ) ; - Size = MAP_APPFONT ( 82 , 124 ) ; - }; - Window WIN_EXAMPLE_DUMMY - { - Pos = MAP_APPFONT ( 231 , 14 ) ; - Size = MAP_APPFONT ( 82 , 124 ) ; - Border = TRUE; - }; - CheckBox CB_SHOW_EXAMPLE - { - HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_SHOW_EXAMPLE"; - Pos = MAP_APPFONT ( 231 , 145 ) ; - Size = MAP_APPFONT ( 82 , 12 ) ; - Text [ en-US ] = "Sho~w preview"; - }; - OKButton PB_INSERT - { - Pos = MAP_APPFONT ( 319 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Insert" ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CLOSE - { - Pos = MAP_APPFONT ( 319 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Close" ; - TabStop = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 319 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - MenuButton PB_EDIT - { - HelpID = "sw:MenuButton:DLG_GLOSSARY:PB_EDIT"; - Pos = MAP_APPFONT ( 319 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "AutoTe~xt" ; - TabStop = TRUE ; - }; - PushButton PB_BIB - { - HelpID = "sw:PushButton:DLG_GLOSSARY:PB_BIB"; - Pos = MAP_APPFONT ( 319 , 77 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "C~ategories..." ; - TabStop = TRUE ; - }; - PushButton PB_PATH - { - HelpID = "sw:PushButton:DLG_GLOSSARY:PB_PATH"; - Pos = MAP_APPFONT ( 319 , 94 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Path..." ; - }; - String ST_READONLY_PATH - { - Text [ en-US ] = "The 'AutoText' directories are read-only. Do you want to call the path settings dialog?"; - }; - Menu MNU_EDIT - { - ItemList = - { - MenuItem - { - Identifier = FN_GL_DEFINE ; - HelpID = HID_MD_GLOS_DEFINE ; - Text [ en-US ] = "~New" ; - }; - MenuItem - { - Identifier = FN_GL_DEFINE_TEXT ; - HelpID = HID_MD_GLOS_DEFINE_TEXT ; - Text [ en-US ] = "New (text only)" ; - }; - MenuItem - { - Identifier = FN_GL_COPY_TO_CLIPBOARD; - HelpID = HID_MD_COPY_TO_CLIPBOARD; - Text [ en-US ] = "~Copy"; - }; - MenuItem - { - Identifier = FN_GL_REPLACE ; - HelpID = HID_MD_GLOS_REPLACE ; - Text [ en-US ] = "Replace" ; - }; - MenuItem - { - Identifier = FN_GL_REPLACE_TEXT; - HelpID = HID_MD_GLOS_REPLACE; - Text [ en-US ] = "Rep~lace (text only)" ; - }; - MenuItem - { - Identifier = FN_GL_RENAME ; - HelpID = HID_MD_GLOS_RENAME ; - Text [ en-US ] = "Rename..." ; - }; - MenuItem - { - Identifier = FN_GL_DELETE ; - HelpID = HID_MD_GLOS_DELETE ; - Text [ en-US ] = "~Delete" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = FN_GL_EDIT ; - HelpID = HID_MD_GLOS_EDIT ; - Text [ en-US ] = "~Edit" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = FN_GL_MACRO ; - HelpID = HID_MD_GLOS_MACRO ; - Text [ en-US ] = "~Macro..." ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = FN_GL_IMPORT; - HelpID = HID_MD_GLOS_IMPORT ; - Text [ en-US ] = "~Import..."; - }; - }; - }; -}; -InfoBox MSG_DOUBLE_SHORTNAME -{ - Message [ en-US ] = "Shortcut name already exists. Please choose another name." ; -}; -QueryBox MSG_QUERY_DELETE -{ - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; - Message [ en-US ] = "Delete AutoText?" ; -}; -String STR_QUERY_DELETE_GROUP1 -{ - Text [ en-US ] = "Delete the category " ; -}; -String STR_QUERY_DELETE_GROUP2 -{ - Text [ en-US ] = "?" ; -}; -String STR_GLOSSARY -{ - Text [ en-US ] = "AutoText :" ; -}; -/*IAccessibility2 Implementation 2009-----*/ -String STR_ACCESS_SW_CATEGORY -{ - Text [ en-US ] = "Category" ; -}; -/*-----IAccessibility2 Implementation 2009*/ -ModalDialog DLG_RENAME_GLOS -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 287 , 47 ) ; - Moveable = TRUE ; - HelpID = HID_RENAME_GLOSSARY ; - OKButton BT_OKNEW - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 231 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - TabStop = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 231 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_ON - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Na~me" ; - }; - Edit ED_ON - { - HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_ON"; - ReadOnly = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 44 , 12 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; - Left = TRUE ; - }; - FixedText FT_OS - { - Pos = MAP_APPFONT ( 147 , 14 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "Short~cut" ; - }; - Edit ED_OS - { - HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_OS"; - ReadOnly = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 200 , 12 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - Left = TRUE ; - }; - FixedText FT_NN - { - Pos = MAP_APPFONT ( 12 , 29 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "~New" ; - }; - Edit ED_NN - { - HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_NN"; - TabStop = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 44 , 27 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; - Left = TRUE ; - }; - FixedText FT_NS - { - Pos = MAP_APPFONT ( 147 , 29 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Shortcut" ; - }; - Edit ED_NS - { - HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_NS"; - TabStop = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 200 , 27 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - Left = TRUE ; - }; - FixedLine FL_NN - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 219 , 8 ) ; - }; - Text [ en-US ] = "Rename AutoText" ; -}; -String STR_SAVE_GLOSSARY -{ - Text[ en-US ] = "Save AutoText"; -}; -InfoBox MSG_NO_GLOSSARIES -{ - Message [ en-US ] = "There is no AutoText in this file."; -}; - -String STR_MY_AUTOTEXT -{ - Text[ en-US ] = "My AutoText"; -}; diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx deleted file mode 100644 index df8465fc54..0000000000 --- a/sw/source/ui/misc/glshell.cxx +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <com/sun/star/frame/XTitle.hpp> - -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/request.hxx> -#include <sfx2/sfxsids.hrc> -#include <svl/srchitem.hxx> -#include <svl/macitem.hxx> -#include <gloshdl.hxx> - -#include <editeng/acorrcfg.hxx> -#include <sfx2/app.hxx> -#include <sfx2/objface.hxx> -#include <sfx2/viewfrm.hxx> -#include <uitool.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <glshell.hxx> -#include <doc.hxx> -#include <IDocumentUndoRedo.hxx> -#include <glosdoc.hxx> -#include <shellio.hxx> -#include <initui.hxx> // for ::GetGlossaries() -#include <cmdid.h> -#include <swerror.h> -#include <misc.hrc> - -#define SwWebGlosDocShell -#define SwGlosDocShell - -#include <sfx2/msg.hxx> -#include <swslots.hxx> - -using namespace ::com::sun::star; - -SFX_IMPL_INTERFACE( SwGlosDocShell, SwDocShell, SW_RES(0) ) -{ -} - -SFX_IMPL_INTERFACE( SwWebGlosDocShell, SwWebDocShell, SW_RES(0) ) -{ -} - -TYPEINIT1( SwGlosDocShell, SwDocShell ); -TYPEINIT1( SwWebGlosDocShell, SwWebDocShell ); - -void lcl_Execute( SwDocShell& rSh, SfxRequest& rReq ) -{ - if ( rReq.GetSlot() == SID_SAVEDOC ) - { - if( !rSh.HasName() ) - { - rReq.SetReturnValue( SfxBoolItem( 0, rSh.Save() ) ); - } - else - { - const SfxBoolItem* pRes = ( const SfxBoolItem* ) - rSh.ExecuteSlot( rReq, - rSh.SfxObjectShell::GetInterface() ); - if( pRes->GetValue() ) - rSh.GetDoc()->ResetModified(); - } - } -} - -void lcl_GetState( SwDocShell& rSh, SfxItemSet& rSet ) -{ - if( SFX_ITEM_AVAILABLE >= rSet.GetItemState( SID_SAVEDOC, sal_False )) - { - if( !rSh.GetDoc()->IsModified() ) - rSet.DisableItem( SID_SAVEDOC ); - else - rSet.Put( SfxStringItem( SID_SAVEDOC, SW_RESSTR(STR_SAVE_GLOSSARY))); - } -} - -sal_Bool lcl_Save( SwWrtShell& rSh, const String& rGroupName, - const String& rShortNm, const String& rLongNm ) -{ - const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - SwTextBlocks * pBlock = ::GetGlossaries()->GetGroupDoc( rGroupName ); - - SvxMacro aStart(aEmptyStr, aEmptyStr); - SvxMacro aEnd(aEmptyStr, aEmptyStr); - SwGlossaryHdl* pGlosHdl; - - pGlosHdl = rSh.GetView().GetGlosHdl(); - pGlosHdl->GetMacros( rShortNm, aStart, aEnd, pBlock ); - - sal_uInt16 nRet = rSh.SaveGlossaryDoc( *pBlock, rLongNm, rShortNm, - rCfg.IsSaveRelFile(), - pBlock->IsOnlyTextBlock( rShortNm ) ); - - if(aStart.GetMacName().Len() || aEnd.GetMacName().Len() ) - { - SvxMacro* pStart = aStart.GetMacName().Len() ? &aStart : 0; - SvxMacro* pEnd = aEnd.GetMacName().Len() ? &aEnd : 0; - pGlosHdl->SetMacros( rShortNm, pStart, pEnd, pBlock ); - } - - rSh.EnterStdMode(); - if( USHRT_MAX != nRet ) - rSh.ResetModified(); - delete pBlock; - return nRet != USHRT_MAX; -} - -SwGlosDocShell::SwGlosDocShell(sal_Bool bNewShow) - : SwDocShell( (bNewShow) - ? SFX_CREATE_MODE_STANDARD : SFX_CREATE_MODE_INTERNAL ) - , bShow ( bNewShow ) -{ - SetHelpId(SW_GLOSDOCSHELL); -} - -SwGlosDocShell::~SwGlosDocShell( ) -{ -} - -void SwGlosDocShell::Execute( SfxRequest& rReq ) -{ - ::lcl_Execute( *this, rReq ); -} - -void SwGlosDocShell::GetState( SfxItemSet& rSet ) -{ - ::lcl_GetState( *this, rSet ); -} - -sal_Bool SwGlosDocShell::Save() -{ - // In case of an API object which holds this document, it is possible that the WrtShell is already - // dead. For instance, if the doc is modified via this API object, and then, upon office shutdown, - // the document's view is closed (by the SFX framework) _before_ the API object is release and - // tries to save the doc, again. - // 96380 - 2002-03-03 - fs@openoffice.org - if ( GetWrtShell() ) - return ::lcl_Save( *GetWrtShell(), aGroupName, aShortName, aLongName ); - else - { - SetModified( sal_False ); - return sal_False; - } -} - -SwWebGlosDocShell::SwWebGlosDocShell() - : SwWebDocShell( SFX_CREATE_MODE_STANDARD ) -{ - SetHelpId(SW_WEBGLOSDOCSHELL); -} - -SwWebGlosDocShell::~SwWebGlosDocShell( ) -{ -} - -void SwWebGlosDocShell::Execute( SfxRequest& rReq ) -{ - ::lcl_Execute( *this, rReq ); -} - -void SwWebGlosDocShell::GetState( SfxItemSet& rSet ) -{ - ::lcl_GetState( *this, rSet ); -} - -sal_Bool SwWebGlosDocShell::Save() -{ - // same comment as in SwGlosDocShell::Save - see there - if ( GetWrtShell() ) - return ::lcl_Save( *GetWrtShell(), aGroupName, aShortName, aLongName ); - else - { - SetModified( sal_False ); - return sal_False; - } -} - -SV_IMPL_REF ( SwDocShell ) - -SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rShortName, sal_Bool bShow ) -{ - SwDocShellRef xDocSh; - - SwTextBlocks* pGroup = GetGroupDoc( rGroup ); - if( pGroup && pGroup->GetCount() ) - { - // query which view is registered. In WebWriter there is no normal view - sal_uInt16 nViewId = 0 != &SwView::Factory() ? 2 : 6; - String sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName )); - - if( 6 == nViewId ) - { - SwWebGlosDocShell* pDocSh = new SwWebGlosDocShell(); - xDocSh = pDocSh; - pDocSh->DoInitNew( 0 ); - pDocSh->SetLongName( sLongName ); - pDocSh->SetShortName( rShortName); - pDocSh->SetGroupName( rGroup ); - } - else - { - SwGlosDocShell* pDocSh = new SwGlosDocShell(bShow); - xDocSh = pDocSh; - pDocSh->DoInitNew( 0 ); - pDocSh->SetLongName( sLongName ); - pDocSh->SetShortName( rShortName ); - pDocSh->SetGroupName( rGroup ); - } - - // set document title - SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId ); - String aDocTitle(SW_RES( STR_GLOSSARY )); - aDocTitle += ' '; - aDocTitle += sLongName; - - bool const bDoesUndo = - xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo(); - xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( false ); - - xDocSh->GetWrtShell()->InsertGlossary( *pGroup, rShortName ); - if( !xDocSh->GetDoc()->getPrinter( false ) ) - { - // we create a default SfxPrinter. - // ItemSet is deleted by Sfx! - SfxItemSet *pSet = new SfxItemSet( xDocSh->GetDoc()->GetAttrPool(), - FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER, - SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, - SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, - 0 ); - SfxPrinter* pPrinter = new SfxPrinter( pSet ); - - // and append it to the document. - xDocSh->GetDoc()->setPrinter( pPrinter, true, true ); - } - - xDocSh->SetTitle( aDocTitle ); - try - { - // set the UI-title - uno::Reference< frame::XTitle > xTitle( xDocSh->GetModel(), uno::UNO_QUERY_THROW ); - xTitle->setTitle( aDocTitle ); - } - catch( uno::Exception& ) - {} - - xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( bDoesUndo ); - xDocSh->GetDoc()->ResetModified(); - if ( bShow ) - pFrame->GetFrame().Appear(); - - delete pGroup; - } - return xDocSh; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx deleted file mode 100644 index 5516b3e3e9..0000000000 --- a/sw/source/ui/misc/impfnote.hxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 _IMPFNOTE_HXX -#define _IMPFNOTE_HXX - -#include <sfx2/tabdlg.hxx> -#include <vcl/button.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <numberingtypelistbox.hxx> - -class SwWrtShell; - -class SwEndNoteOptionPage : public SfxTabPage -{ - FixedLine aNumFL; - FixedText aNumTypeFT; - SwNumberingTypeListBox aNumViewBox; - FixedText aOffsetLbl; - NumericField aOffsetFld; - FixedText aNumCountFT; - ListBox aNumCountBox; - FixedText aPrefixFT; - Edit aPrefixED; - FixedText aSuffixFT; - Edit aSuffixED; - FixedText aPosFT; - RadioButton aPosPageBox; - RadioButton aPosChapterBox; - - FixedLine aTemplFL; - FixedText aParaTemplLbl; - ListBox aParaTemplBox; - FixedText aPageTemplLbl; - ListBox aPageTemplBox; - - FixedLine aCharTemplFL; - FixedText aFtnCharAnchorTemplLbl; - ListBox aFtnCharAnchorTemplBox; - FixedText aFtnCharTextTemplLbl; - ListBox aFtnCharTextTemplBox; - - FixedLine aContFL; - FixedText aContLbl; - Edit aContEdit; - FixedText aContFromLbl; - Edit aContFromEdit; - - String aNumDoc; - String aNumPage; - String aNumChapter; - SwWrtShell *pSh; - sal_Bool bPosDoc; - sal_Bool bEndNote; - - inline void SelectNumbering(int eNum); - int GetNumbering() const; - - DECL_LINK( PosPageHdl, Button * ); - DECL_LINK( PosChapterHdl, Button * ); - DECL_LINK( NumCountHdl, ListBox * ); - - -public: - SwEndNoteOptionPage( Window *pParent, sal_Bool bEndNote, - const SfxItemSet &rSet ); - ~SwEndNoteOptionPage(); - - static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet); - virtual sal_Bool FillItemSet(SfxItemSet &rSet); - virtual void Reset( const SfxItemSet& ); - - void SetShell( SwWrtShell &rShell ); -}; - -class SwFootNoteOptionPage : public SwEndNoteOptionPage -{ - SwFootNoteOptionPage( Window *pParent, const SfxItemSet &rSet ); - ~SwFootNoteOptionPage(); - -public: - static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet); -}; - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx deleted file mode 100644 index 14eea457d0..0000000000 --- a/sw/source/ui/misc/insfnote.cxx +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <sfx2/request.hxx> -#include <editeng/fontitem.hxx> -#include <vcl/msgbox.hxx> -#include <fmtftn.hxx> -#include <swundo.hxx> -#include <cmdid.h> -#include <wrtsh.hxx> -#include <view.hxx> -#include <basesh.hxx> -#include <insfnote.hxx> -#include <crsskip.hxx> -#include <misc.hrc> -#include <insfnote.hrc> -#include <svx/svxdlg.hxx> -#include <svx/dialogs.hrc> -#include <sfx2/viewfrm.hxx> - -static sal_Bool bFootnote = sal_True; - -/*------------------------------------------------------------------------ - Description: inserting a footnote with OK -------------------------------------------------------------------------*/ - -void SwInsFootNoteDlg::Apply() -{ - String aStr; - - if ( aNumberCharBtn.IsChecked() ) - aStr = aNumberCharEdit.GetText(); - - if ( bEdit ) - { - rSh.StartAction(); - rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); - rSh.StartUndo( UNDO_START ); - SwFmtFtn aNote( aEndNoteBtn.IsChecked() ); - aNote.SetNumStr( aStr ); - - if( rSh.SetCurFtn( aNote ) && bExtCharAvailable ) - { - rSh.Right(CRSR_SKIP_CHARS, sal_True, 1, sal_False ); - SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT ); - rSh.GetCurAttr( aSet ); - SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); - SvxFontItem aFont( rFont.GetFamily(), aFontName, - rFont.GetStyleName(), rFont.GetPitch(), - eCharSet, RES_CHRATR_FONT ); - aSet.Put( aFont ); - rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND ); - rSh.ResetSelect(0, sal_False); - rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); - } - rSh.EndUndo( UNDO_END ); - rSh.EndAction(); - } - else - { - - } - - bFootnote = aFtnBtn.IsChecked(); -} - -IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberCharHdl, Button *, EMPTYARG ) -{ - aNumberCharEdit.GrabFocus(); - aOkBtn.Enable( aNumberCharEdit.GetText().Len() || bExtCharAvailable ); - return 0; -} -IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberCharHdl, Button *, EMPTYARG ) - -IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberEditHdl, void *, EMPTYARG ) -{ - aNumberCharBtn.Check( sal_True ); - aOkBtn.Enable( 0 != aNumberCharEdit.GetText().Len() ); - - return 0; -} -IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberEditHdl, void *, EMPTYARG ) - -IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberAutoBtnHdl, Button *, EMPTYARG ) -{ - aOkBtn.Enable( sal_True ); - return 0; -} -IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberAutoBtnHdl, Button *, EMPTYARG ) - -IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG ) -{ - aNumberCharBtn.Check( sal_True ); - - SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT ); - rSh.GetCurAttr( aSet ); - const SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); - - SfxAllItemSet aAllSet( rSh.GetAttrPool() ); - aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); - aAllSet.Put( rFont ); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet, - rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); - if (RET_OK == pDlg->Execute()) - { - SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, sal_False ); - SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); - if ( pItem ) - { - String sExtChars(pItem->GetValue()); - aNumberCharEdit.SetText( sExtChars ); - - if ( pFontItem ) - { - aFontName = pFontItem->GetFamilyName(); - eCharSet = pFontItem->GetCharSet(); - Font aFont( aFontName, pFontItem->GetStyleName(), aNumberCharEdit.GetFont().GetSize() ); - aFont.SetCharSet( pFontItem->GetCharSet() ); - aFont.SetPitch( pFontItem->GetPitch() ); - aNumberCharEdit.SetFont( aFont ); - } - - bExtCharAvailable = sal_True; - aOkBtn.Enable(0 != aNumberCharEdit.GetText().Len()); - } - } - delete pDlg; - - return 0; -} - -IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, Button *, pBtn ) -{ - Apply(); - - // go to the next foot/endnote here - rSh.ResetSelect(0, sal_False); - if (pBtn == &aNextBT) - rSh.GotoNextFtnAnchor(); - else - rSh.GotoPrevFtnAnchor(); - - Init(); - - return 0; -} - -SwInsFootNoteDlg::SwInsFootNoteDlg(Window *pParent, SwWrtShell &rShell, sal_Bool bEd) : - - SvxStandardDialog(pParent,SW_RES(DLG_INS_FOOTNOTE)), - - rSh(rShell), - bExtCharAvailable(sal_False), - bEdit(bEd), - aNumberFL (this,SW_RES(FL_NUMBER)), - aNumberAutoBtn (this,SW_RES(RB_NUMBER_AUTO)), - aNumberCharBtn (this,SW_RES(RB_NUMBER_CHAR)), - aNumberCharEdit (this,SW_RES(ED_NUMBER_CHAR)), - aNumberExtChar (this,SW_RES(BT_NUMBER_CHAR)), - - aTypeFL (this,SW_RES(FL_TYPE)), - aFtnBtn (this,SW_RES(RB_TYPE_FTN)), - aEndNoteBtn (this,SW_RES(RB_TYPE_ENDNOTE)), - - aOkBtn (this,SW_RES(BT_OK)), - aCancelBtn (this,SW_RES(BT_CANCEL)), - aHelpBtn (this,SW_RES(BT_HELP)), - aPrevBT (this,SW_RES(BT_PREV)), - aNextBT (this,SW_RES(BT_NEXT)) -{ - aNumberCharEdit.SetAccessibleName(String(SW_RES(STR_CHAR))); - aNumberExtChar.SetAccessibleRelationMemberOf(&aNumberFL); - aNumberCharEdit.SetAccessibleRelationLabeledBy(&aNumberCharBtn); - - aNumberAutoBtn.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl)); - aNumberExtChar.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl)); - aNumberCharBtn.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberCharHdl)); - aNumberCharEdit.SetModifyHdl(LINK(this,SwInsFootNoteDlg,NumberEditHdl)); - aNumberCharEdit.SetMaxTextLen(10); - aNumberCharEdit.Enable(); - - aPrevBT.SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - aNextBT.SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - - FreeResource(); - rSh.SetCareWin(this); - - if (bEdit) - { - Init(); - - aPrevBT.Show(); - aNextBT.Show(); - } -} - -SwInsFootNoteDlg::~SwInsFootNoteDlg() -{ - rSh.SetCareWin(0); - - if (bEdit) - rSh.ResetSelect(0, sal_False); -} - -void SwInsFootNoteDlg::Init() -{ - SwFmtFtn aFtnNote; - String sNumStr; - Font aFont; - bExtCharAvailable = sal_False; - - rSh.StartAction(); - - if( rSh.GetCurFtn( &aFtnNote )) - { - if(aFtnNote.GetNumStr().Len()) - { - sNumStr = aFtnNote.GetNumStr(); - - rSh.Right(CRSR_SKIP_CHARS, sal_True, 1, sal_False ); - SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT ); - rSh.GetCurAttr( aSet ); - const SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); - - aFont = aNumberCharEdit.GetFont(); - aFontName = rFont.GetFamilyName(); - eCharSet = rFont.GetCharSet(); - aFont.SetName(aFontName); - aFont.SetCharSet(eCharSet); - bExtCharAvailable = sal_True; - rSh.Left( CRSR_SKIP_CHARS, sal_False, 1, sal_False ); - } - bFootnote = !aFtnNote.IsEndNote(); - } - aNumberCharEdit.SetFont(aFont); - - sal_Bool bNumChar = sNumStr.Len() != 0; - - aNumberCharEdit.SetText(sNumStr); - aNumberCharBtn.Check(bNumChar); - aNumberAutoBtn.Check(!bNumChar); - if (bNumChar) - aNumberCharEdit.GrabFocus(); - - if (bFootnote) - aFtnBtn.Check(); - else - aEndNoteBtn.Check(); - - sal_Bool bNext = rSh.GotoNextFtnAnchor(); - - if (bNext) - rSh.GotoPrevFtnAnchor(); - - sal_Bool bPrev = rSh.GotoPrevFtnAnchor(); - - if (bPrev) - rSh.GotoNextFtnAnchor(); - - aPrevBT.Enable(bPrev); - aNextBT.Enable(bNext); - - rSh.Right(CRSR_SKIP_CHARS, sal_True, 1, sal_False ); - - rSh.EndAction(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/insfnote.hrc b/sw/source/ui/misc/insfnote.hrc deleted file mode 100644 index c3649748f0..0000000000 --- a/sw/source/ui/misc/insfnote.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * 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_NUMBER_AUTO 1 -#define RB_NUMBER_CHAR 2 -#define ED_NUMBER_CHAR 3 -#define BT_NUMBER_CHAR 4 -#define FL_NUMBER 5 -#define FL_TYPE 6 -#define RB_TYPE_FTN 7 -#define RB_TYPE_ENDNOTE 8 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 -#define BT_PREV 103 -#define BT_NEXT 104 - -//IAccessibility2 Implementation 2009----- -#define STR_CHAR 105 -//-----IAccessibility2 Implementation 2009 diff --git a/sw/source/ui/misc/insfnote.src b/sw/source/ui/misc/insfnote.src deleted file mode 100644 index 0081513666..0000000000 --- a/sw/source/ui/misc/insfnote.src +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "insfnote.hrc" -#include "helpid.h" - // #define DLG_INS_FOOTNOTE 257 -ModalDialog DLG_INS_FOOTNOTE -{ - HelpID = "sw:ModalDialog:DLG_INS_FOOTNOTE"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 160 , 100 ) ; - Text [ en-US ] = "Insert Footnote/Endnote" ; - Moveable = TRUE ; - Edit ED_NUMBER_CHAR - { - HelpID = "sw:Edit:DLG_INS_FOOTNOTE:ED_NUMBER_CHAR"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 69 , 27 ) ; - Size = MAP_APPFONT ( 23 , 12 ) ; - TabStop = TRUE ; - Group = TRUE ; - Left = TRUE ; - }; - //IAccessibility2 Implementation 2009----- - String STR_CHAR - { - Text [ en-US ] = "Character" ; - }; - //-----IAccessibility2 Implementation 2009 - OKButton BT_OK - { - Pos = MAP_APPFONT ( 104 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 104 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 104 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - ImageButton BT_PREV - { - HelpID = "sw:ImageButton:DLG_INS_FOOTNOTE:BT_PREV"; - Pos = MAP_APPFONT ( 104 , 82 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - TabStop = TRUE ; - Hide = TRUE ; - SYMBOL = IMAGEBUTTON_PREV ; - }; - ImageButton BT_NEXT - { - HelpID = "sw:ImageButton:DLG_INS_FOOTNOTE:BT_NEXT"; - Pos = MAP_APPFONT ( 130 , 82 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - TabStop = TRUE ; - Hide = TRUE ; - SYMBOL = IMAGEBUTTON_NEXT ; - }; - RadioButton RB_NUMBER_AUTO - { - HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_NUMBER_AUTO"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 79 , 10 ) ; - Text [ en-US ] = "~Automatic" ; - TabStop = TRUE ; - Group = TRUE ; - Check = TRUE ; - }; - RadioButton RB_NUMBER_CHAR - { - HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_NUMBER_CHAR"; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "~Character" ; - }; - FixedLine FL_NUMBER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 92 , 8 ) ; - Text [ en-US ] = "Numbering" ; - }; - PushButton BT_NUMBER_CHAR - { - HelpID = "sw:PushButton:DLG_INS_FOOTNOTE:BT_NUMBER_CHAR"; - Pos = MAP_APPFONT ( 69 , 42 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "..." ; - }; - RadioButton RB_TYPE_FTN - { - HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_TYPE_FTN"; - Pos = MAP_APPFONT ( 12 , 70 ) ; - Size = MAP_APPFONT ( 79 , 10 ) ; - TabStop = TRUE ; - Group = TRUE ; - Check = TRUE ; - Text [ en-US ] = "~Footnote" ; - }; - RadioButton RB_TYPE_ENDNOTE - { - HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_TYPE_ENDNOTE"; - Pos = MAP_APPFONT ( 12 , 83 ) ; - Size = MAP_APPFONT ( 79 , 10 ) ; - Text [ en-US ] = "~Endnote" ; - }; - FixedLine FL_TYPE - { - Pos = MAP_APPFONT ( 6 , 60 ) ; - Size = MAP_APPFONT ( 92 , 8 ) ; - Text [ en-US ] = "Type" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/insrule.cxx b/sw/source/ui/misc/insrule.cxx deleted file mode 100644 index 170187bdc0..0000000000 --- a/sw/source/ui/misc/insrule.cxx +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/gallery.hxx> -#include <vcl/msgbox.hxx> -#include <editeng/brshitem.hxx> -#include <svl/urihelper.hxx> -#include <vcl/graph.hxx> - -#include "swtypes.hxx" -#include "docsh.hxx" -#include "insrule.hxx" -#include "swvset.hxx" -#include "insrule.hrc" -#include "misc.hrc" -#include "helpid.h" - -SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) : - SfxModalDialog(pParent, SW_RES(DLG_INSERT_RULER)), - aSelectionFL(this, SW_RES(FL_SEL )), - aOkPB (this, SW_RES(PB_OK )), - aCancelPB (this, SW_RES(PB_CANCEL )), - aHelpPB (this, SW_RES(PB_HELP )), - - sSimple (SW_RES(ST_SIMPLE)), - nSelPos(USHRT_MAX), - pExampleVS (new SwRulerValueSet(this, SW_RES(VS_EXAMPLE ))) -{ - FreeResource(); - pExampleVS->SetLineCount(6); - pExampleVS->SetColCount(1); - pExampleVS->SetSelectHdl(LINK(this, SwInsertGrfRulerDlg, SelectHdl)); - pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl)); - pExampleVS->GrabFocus(); - - // determine graphic name - GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS); - GalleryExplorer::FillObjList( GALLERY_THEME_RULERS, aGrfNames ); - pExampleVS->SetHelpId(HID_VS_RULER); - Color aColor(COL_WHITE); - pExampleVS->InsertItem( 1, 1); - pExampleVS->SetItemText( 1, sSimple); - - for(sal_uInt16 i = 1; i <= aGrfNames.size(); i++) - { - pExampleVS->InsertItem( i + 1, i); - pExampleVS->SetItemText( i + 1, aGrfNames[i-1]); - } - pExampleVS->Show(); - -} - -SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg() -{ - GalleryExplorer::EndLocking(GALLERY_THEME_RULERS); - delete pExampleVS; -} - -String SwInsertGrfRulerDlg::GetGraphicName() -{ - String sRet; - sal_uInt16 nSel = nSelPos - 2; //align selection position with ValueSet index - if(nSel < aGrfNames.size()) - sRet = URIHelper::SmartRel2Abs( - INetURLObject(), aGrfNames[nSel], - URIHelper::GetMaybeFileHdl()); - return sRet; -} - -IMPL_LINK(SwInsertGrfRulerDlg, SelectHdl, ValueSet*, pVS) -{ - nSelPos = pVS->GetSelectItemId(); - aOkPB.Enable(); - return 0; -} - -SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) : - SvxBmpNumValueSet(pParent, rResId) -{ - SetStyle( GetStyle() & ~WB_ITEMBORDER ); -} - -SwRulerValueSet::~SwRulerValueSet() -{ -} - -void SwRulerValueSet::UserDraw( const UserDrawEvent& rUDEvt ) -{ - Rectangle aRect = rUDEvt.GetRect(); - OutputDevice* pDev = rUDEvt.GetDevice(); - sal_uInt16 nItemId = rUDEvt.GetItemId(); - Point aBLPos = aRect.TopLeft(); - - // item count starts with 1 and the 1st is the simple line - if(nItemId > 1) - { - Graphic aGraphic; - if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_RULERS, nItemId - 2, - &aGraphic)) - { - Size aGrfSize = aGraphic.GetPrefSize(); - if(aGrfSize.Width() && aGrfSize.Height()) - { - int nRelGrf = aGrfSize.Height() * 100 / aGrfSize.Width(); - Size aWinSize = aRect.GetSize(); - Size aPaintSize = aWinSize; - int nRelWin = aWinSize.Height() * 100 / aWinSize.Width(); - if(nRelGrf > nRelWin) - { - aPaintSize.Width() = aWinSize.Height() * 100 / nRelGrf; - aBLPos.X() += (aWinSize.Width() - aPaintSize.Width()) /2; - } - else - { - aPaintSize.Height() = aWinSize.Width() * nRelGrf/100; - aBLPos.Y() += (aWinSize.Height() - aPaintSize.Height()) /2; - } - aBLPos.X() -= aPaintSize.Width() /2; - aBLPos.Y() -= aPaintSize.Height() /2; - - aPaintSize.Width() *= 2; - aPaintSize.Height() *= 2; - if(aPaintSize.Height() < 2) - aPaintSize.Height() = 2; - Region aRegion = pDev->GetClipRegion(); - pDev->SetClipRegion(aRect); - aGraphic.Draw(pDev, aBLPos, aPaintSize); - pDev->SetClipRegion(aRegion); - } - } - else - { - SetGrfNotFound(sal_True); - } - } - else - { - // paint text for simple line - Font aOldFont = pDev->GetFont(); - Font aFont = pDev->GetFont(); - Size aSize = aFont.GetSize(); - int nRectHeight = aRect.GetHeight(); - aSize.Height() = nRectHeight * 2 / 3; - aFont.SetSize(aSize); - pDev->SetFont(aFont); - String aText(GetItemText(nItemId)); - aSize.Width() = pDev->GetTextWidth(aText); - aSize.Height() = pDev->GetTextHeight(); - Point aPos(aBLPos); - aPos.Y() += (nRectHeight - aSize.Height()) / 2; - aPos.X() += (aRect.GetWidth() - aSize.Width()) / 2; - pDev->DrawText(aPos, aText); - - pDev->SetFont(aOldFont); - } -} - -IMPL_LINK(SwInsertGrfRulerDlg, DoubleClickHdl, ValueSet*, EMPTYARG) -{ - EndDialog(RET_OK); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/insrule.hrc b/sw/source/ui/misc/insrule.hrc deleted file mode 100644 index 8e2477bc34..0000000000 --- a/sw/source/ui/misc/insrule.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" - -#define FL_SEL 1 -#define VS_EXAMPLE 2 -#define PB_OK 3 -#define PB_CANCEL 4 -#define PB_HELP 5 -#define ST_SIMPLE 6 diff --git a/sw/source/ui/misc/insrule.src b/sw/source/ui/misc/insrule.src deleted file mode 100644 index 41e10db226..0000000000 --- a/sw/source/ui/misc/insrule.src +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * - * 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 "insrule.hrc" -#include "helpid.h" -ModalDialog DLG_INSERT_RULER -{ - HelpID = HID_RULER_DIALOG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 242 , 124 ) ; - Moveable = TRUE ; - FixedLine FL_SEL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - Control VS_EXAMPLE - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 168 , 104 ) ; - Hide = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Group = TRUE ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 186 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Disable = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 186 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 186 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - String ST_SIMPLE - { - Text [ en-US ] = "Plain" ; - }; - Text [ en-US ] = "Insert Horizontal Rule" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx deleted file mode 100644 index 7f6eb4d564..0000000000 --- a/sw/source/ui/misc/linenum.cxx +++ /dev/null @@ -1,295 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/viewfrm.hxx> -#include <svl/style.hxx> -#include <vcl/msgbox.hxx> -#include <view.hxx> -#include <wrtsh.hxx> -#include <docsh.hxx> -#include <charfmt.hxx> - -#include <docstyle.hxx> - -#include "fldbas.hxx" -#include "lineinfo.hxx" -#include "globals.hrc" -#include "linenum.hrc" -#include "linenum.hxx" -#include "uitool.hxx" - -#include <IDocumentStylePoolAccess.hxx> - -SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) : - SfxSingleTabDialog(&pVw->GetViewFrame()->GetWindow(), 0, 0), - pSh(pVw->GetWrtShellPtr()) -{ - // create TabPage - SetTabPage(SwLineNumberingPage::Create(this, *(SfxItemSet*)0)); - - GetOKButton()->SetClickHdl(LINK(this, SwLineNumberingDlg, OKHdl)); -} - -SwLineNumberingDlg::~SwLineNumberingDlg() -{ -} - -IMPL_LINK( SwLineNumberingDlg, OKHdl, Button *, EMPTYARG ) -{ - if (GetOKButton()->IsEnabled()) - { - SfxTabPage* pCurPage = GetTabPage(); - if( pCurPage ) - pCurPage->FillItemSet(*(SfxItemSet*)0); - - EndDialog( RET_OK ); - } - - return 0; -} - -SwLineNumberingPage::SwLineNumberingPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, SW_RES(TP_LINENUMBERING), rSet), - aNumberingOnCB ( this, SW_RES( CB_NUMBERING_ON )), - aDisplayFL ( this, SW_RES( FL_DISPLAY )), - aCharStyleFT ( this, SW_RES( FT_CHAR_STYLE )), - aCharStyleLB ( this, SW_RES( LB_CHAR_STYLE )), - aFormatFT ( this, SW_RES( FT_FORMAT )), - aFormatLB ( this, SW_RES( LB_FORMAT ), INSERT_NUM_EXTENDED_TYPES), - aPosFT ( this, SW_RES( FT_POS )), - aPosLB ( this, SW_RES( LB_POS )), - aOffsetFT ( this, SW_RES( FT_OFFSET )), - aOffsetMF ( this, SW_RES( MF_OFFSET )), - aNumIntervalFT ( this, SW_RES( FT_NUM_INVERVAL )), - aNumIntervalNF ( this, SW_RES( NF_NUM_INVERVAL )), - aNumRowsFT ( this, SW_RES( FT_NUM_ROWS )), - aDivisorFL ( this, SW_RES( FL_DIVISOR )), - aDivisorFT ( this, SW_RES( FT_DIVISOR )), - aDivisorED ( this, SW_RES( ED_DIVISOR )), - aDivIntervalFT ( this, SW_RES( FT_DIV_INTERVAL )), - aDivIntervalNF ( this, SW_RES( NF_DIV_INTERVAL )), - aDivRowsFT ( this, SW_RES( FT_DIV_ROWS )), - aCountFL ( this, SW_RES( FL_COUNT )), - aCountEmptyLinesCB ( this, SW_RES( CB_COUNT_EMPTYLINES )), - aCountFrameLinesCB ( this, SW_RES( CB_COUNT_FRAMELINES )), - aRestartEachPageCB ( this, SW_RES( CB_RESTART_PAGE )) - -{ - String sIntervalName = aDivIntervalFT.GetAccessibleName(); - sIntervalName += String::CreateFromAscii("("); - sIntervalName += aDivRowsFT.GetAccessibleName(); - sIntervalName += String::CreateFromAscii(")"); - aDivIntervalNF.SetAccessibleName(sIntervalName); - sIntervalName = aNumIntervalFT.GetAccessibleName(); - sIntervalName += String::CreateFromAscii("("); - sIntervalName += aNumRowsFT.GetAccessibleName(); - sIntervalName += String::CreateFromAscii(")"); - aNumIntervalNF.SetAccessibleName(sIntervalName); - - FreeResource(); - SwLineNumberingDlg *pDlg = (SwLineNumberingDlg *)GetParent(); - pSh = pDlg->GetWrtShell(); - // char styles - ::FillCharStyleListBox(aCharStyleLB, pSh->GetView().GetDocShell()); -} - -SwLineNumberingPage::~SwLineNumberingPage() -{ -} - -SfxTabPage* SwLineNumberingPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SwLineNumberingPage( pParent, rSet ); -} - -void SwLineNumberingPage::Reset( const SfxItemSet& ) -{ - const SwLineNumberInfo &rInf = pSh->GetLineNumberInfo(); - IDocumentStylePoolAccess* pIDSPA = pSh->getIDocumentStylePoolAccess(); - - String sStyleName(rInf.GetCharFmt( *pIDSPA )->GetName()); - const sal_uInt16 nPos = aCharStyleLB.GetEntryPos(sStyleName); - - if (nPos != LISTBOX_ENTRY_NOTFOUND) - aCharStyleLB.SelectEntryPos(nPos); - else - { - if (sStyleName.Len()) - { - aCharStyleLB.InsertEntry(sStyleName); - aCharStyleLB.SelectEntry(sStyleName); - } - } - - // format - sal_uInt16 nSelFmt = rInf.GetNumType().GetNumberingType(); - - aFormatLB.SelectNumberingType(nSelFmt); - - // position - aPosLB.SelectEntryPos((sal_uInt16)rInf.GetPos()); - - // offset - sal_uInt16 nOffset = rInf.GetPosFromLeft(); - if (nOffset == USHRT_MAX) - nOffset = 0; - - aOffsetMF.SetValue(aOffsetMF.Normalize(nOffset), FUNIT_TWIP); - - // numbering offset - aNumIntervalNF.SetValue(rInf.GetCountBy()); - - // divider - aDivisorED.SetText(rInf.GetDivider()); - - // divider offset - aDivIntervalNF.SetValue(rInf.GetDividerCountBy()); - - // count - aCountEmptyLinesCB.Check(rInf.IsCountBlankLines()); - aCountFrameLinesCB.Check(rInf.IsCountInFlys()); - aRestartEachPageCB.Check(rInf.IsRestartEachPage()); - - aNumberingOnCB.Check(rInf.IsPaintLineNumbers()); - - aNumberingOnCB.SetClickHdl(LINK(this, SwLineNumberingPage, LineOnOffHdl)); - aDivisorED.SetModifyHdl(LINK(this, SwLineNumberingPage, ModifyHdl)); - ModifyHdl(); - LineOnOffHdl(); -} - -/*-------------------------------------------------------------------- - Description: modify - --------------------------------------------------------------------*/ -IMPL_LINK( SwLineNumberingPage, ModifyHdl, Edit *, EMPTYARG ) -{ - sal_Bool bHasValue = aDivisorED.GetText().Len() != 0; - - aDivIntervalFT.Enable(bHasValue); - aDivIntervalNF.Enable(bHasValue); - aDivRowsFT.Enable(bHasValue); - - return 0; -} - -/*-------------------------------------------------------------------- - Description: On/Off - --------------------------------------------------------------------*/ -IMPL_LINK( SwLineNumberingPage, LineOnOffHdl, CheckBox *, EMPTYARG ) -{ - sal_Bool bEnable = aNumberingOnCB.IsChecked(); - - aCharStyleFT.Enable(bEnable); - aCharStyleLB.Enable(bEnable); - aFormatFT.Enable(bEnable); - aFormatLB.Enable(bEnable); - aPosFT.Enable(bEnable); - aPosLB.Enable(bEnable); - aOffsetFT.Enable(bEnable); - aOffsetMF.Enable(bEnable); - aNumIntervalFT.Enable(bEnable); - aNumIntervalNF.Enable(bEnable); - aNumRowsFT.Enable(bEnable); - aDisplayFL.Enable(bEnable); - aDivisorFT.Enable(bEnable); - aDivisorED.Enable(bEnable); - aDivIntervalFT.Enable(bEnable); - aDivIntervalNF.Enable(bEnable); - aDivRowsFT.Enable(bEnable); - aDivisorFL.Enable(bEnable); - aCountEmptyLinesCB.Enable(bEnable); - aCountFrameLinesCB.Enable(bEnable); - aRestartEachPageCB.Enable(bEnable); - aCountFL.Enable(bEnable); - - return 0; -} - -sal_Bool SwLineNumberingPage::FillItemSet( SfxItemSet& ) -{ - SwLineNumberInfo aInf(pSh->GetLineNumberInfo()); - - // char styles - String sCharFmtName(aCharStyleLB.GetSelectEntry()); - SwCharFmt *pCharFmt = pSh->FindCharFmtByName(sCharFmtName); - - if (!pCharFmt) - { - SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - SfxStyleSheetBase* pBase; - pBase = pPool->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR); - if(!pBase) - pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR); - pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); - } - - if (pCharFmt) - aInf.SetCharFmt(pCharFmt); - - // format - SvxNumberType aType; - aType.SetNumberingType(aFormatLB.GetSelectedNumberingType()); - aInf.SetNumType(aType); - - // position - aInf.SetPos((LineNumberPosition)aPosLB.GetSelectEntryPos()); - - // offset - aInf.SetPosFromLeft((sal_uInt16)aOffsetMF.Denormalize(aOffsetMF.GetValue(FUNIT_TWIP))); - - // numbering offset - aInf.SetCountBy((sal_uInt16)aNumIntervalNF.GetValue()); - - // divider - aInf.SetDivider(aDivisorED.GetText()); - - // divider offset - aInf.SetDividerCountBy((sal_uInt16)aDivIntervalNF.GetValue()); - - // count - aInf.SetCountBlankLines(aCountEmptyLinesCB.IsChecked()); - aInf.SetCountInFlys(aCountFrameLinesCB.IsChecked()); - aInf.SetRestartEachPage(aRestartEachPageCB.IsChecked()); - - aInf.SetPaintLineNumbers(aNumberingOnCB.IsChecked()); - - pSh->SetLineNumberInfo(aInf); - - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/linenum.hrc b/sw/source/ui/misc/linenum.hrc deleted file mode 100644 index 93e17b64eb..0000000000 --- a/sw/source/ui/misc/linenum.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * 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 CB_NUMBERING_ON 1 -#define FT_CHAR_STYLE 2 -#define LB_CHAR_STYLE 3 -#define FT_FORMAT 4 -#define LB_FORMAT 5 -#define FT_POS 6 -#define LB_POS 7 -#define FT_OFFSET 8 -#define MF_OFFSET 9 -#define FT_NUM_INVERVAL 10 -#define NF_NUM_INVERVAL 11 -#define FT_NUM_ROWS 12 -#define FL_DISPLAY 13 -#define FT_DIVISOR 14 -#define ED_DIVISOR 15 -#define FT_DIV_INTERVAL 16 -#define NF_DIV_INTERVAL 17 -#define FT_DIV_ROWS 18 -#define FL_DIVISOR 19 -#define CB_COUNT_EMPTYLINES 20 -#define CB_COUNT_FRAMELINES 21 -#define FL_COUNT 22 -#define CB_RESTART_PAGE 23 - diff --git a/sw/source/ui/misc/linenum.src b/sw/source/ui/misc/linenum.src deleted file mode 100644 index feb17ca5bb..0000000000 --- a/sw/source/ui/misc/linenum.src +++ /dev/null @@ -1,279 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -/* StarView ressource file */ - -#ifndef _SFX_HRC -#include <sfx2/sfx.hrc> -#endif -#ifndef _SVX_DIALOGS_HRC -#include <svx/dialogs.hrc> -#endif -#include "globals.hrc" -#include "misc.hrc" -#include "linenum.hrc" -#include "helpid.h" -/**************************************************************************/ -/* */ -/**************************************************************************/ -TabPage TP_LINENUMBERING -{ - HelpID = HID_LINENUMBERING ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - CheckBox CB_NUMBERING_ON - { - HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_NUMBERING_ON"; - Pos = MAP_APPFONT ( 12 , 6 ) ; - Size = MAP_APPFONT ( 242 , 8 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Show numbering" ; - }; - FixedText FT_CHAR_STYLE - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "~Character Style" ; - }; - ListBox LB_CHAR_STYLE - { - HelpID = "sw:ListBox:TP_LINENUMBERING:LB_CHAR_STYLE"; - Pos = MAP_APPFONT ( 100 , 30 ) ; - Size = MAP_APPFONT ( 148 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORMAT - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "F~ormat" ; - }; - ListBox LB_FORMAT - { - HelpID = "sw:ListBox:TP_LINENUMBERING:LB_FORMAT"; - Pos = MAP_APPFONT ( 100 , 44 ) ; - Size = MAP_APPFONT ( 148 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_POS - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Position" ; - }; - ListBox LB_POS - { - HelpID = "sw:ListBox:TP_LINENUMBERING:LB_POS"; - Pos = MAP_APPFONT ( 100 , 60 ) ; - Size = MAP_APPFONT ( 148 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Left" ; > ; - < "Right" ; > ; - < "Inner" ; > ; - < "Outer" ; > ; - }; - }; - FixedText FT_OFFSET - { - Pos = MAP_APPFONT ( 12 , 78 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Spacing" ; - }; - MetricField MF_OFFSET - { - HelpID = "sw:MetricField:TP_LINENUMBERING:MF_OFFSET"; - Pos = MAP_APPFONT ( 100 , 76 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_NUM_INVERVAL - { - Pos = MAP_APPFONT ( 12 , 94 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Interval" ; - }; - NumericField NF_NUM_INVERVAL - { - HelpID = "sw:NumericField:TP_LINENUMBERING:NF_NUM_INVERVAL"; - Pos = MAP_APPFONT ( 100 , 92 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 1000 ; - First = 1 ; - Last = 1000 ; - SpinSize = 1 ; - }; - FixedText FT_NUM_ROWS - { - Pos = MAP_APPFONT ( 136 , 94 ) ; - Size = MAP_APPFONT ( 80 , 10 ) ; - Text [ en-US ] = "lines" ; - }; - FixedLine FL_DISPLAY - { - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "View" ; - }; - FixedText FT_DIVISOR - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Text" ; - }; - Edit ED_DIVISOR - { - HelpID = "sw:Edit:TP_LINENUMBERING:ED_DIVISOR"; - Pos = MAP_APPFONT ( 45 , 121 ) ; - Size = MAP_APPFONT ( 76 , 12 ) ; - Left = TRUE ; - Border = TRUE ; - }; - FixedText FT_DIV_INTERVAL - { - Pos = MAP_APPFONT ( 12 , 139 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - // Disable = TRUE ; - Text [ en-US ] = "Every" ; - }; - NumericField NF_DIV_INTERVAL - { - HelpID = "sw:NumericField:TP_LINENUMBERING:NF_DIV_INTERVAL"; - Pos = MAP_APPFONT ( 45 , 137 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1000 ; - First = 0 ; - Last = 1000 ; - SpinSize = 1 ; - // Disable = TRUE ; - }; - FixedText FT_DIV_ROWS - { - Pos = MAP_APPFONT ( 78 , 139 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "Lines" ; - }; - FixedLine FL_DIVISOR - { - Pos = MAP_APPFONT ( 6 , 110 ) ; - Size = MAP_APPFONT ( 121 , 8 ) ; - Text [ en-US ] = "Separator" ; - }; - CheckBox CB_COUNT_EMPTYLINES - { - HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_COUNT_EMPTYLINES"; - Pos = MAP_APPFONT ( 139 , 121 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Blank lines" ; - }; - CheckBox CB_COUNT_FRAMELINES - { - HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_COUNT_FRAMELINES"; - Pos = MAP_APPFONT ( 139 , 135 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Lines in text frames" ; - }; - CheckBox CB_RESTART_PAGE - { - HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_RESTART_PAGE"; - Pos = MAP_APPFONT ( 139 , 149 ); - Size = MAP_APPFONT ( 110 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "~Restart every new page"; - }; - FixedLine FL_COUNT - { - Pos = MAP_APPFONT ( 133 , 110 ) ; - Size = MAP_APPFONT ( 121 , 8 ) ; - Text [ en-US ] = "Count" ; - }; - Text [ en-US ] = "Line Numbering" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx deleted file mode 100644 index c24f3976fd..0000000000 --- a/sw/source/ui/misc/num.cxx +++ /dev/null @@ -1,1031 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - - - -#define USE_NUMTABPAGES -#define _NUM_CXX -#include <hintids.hxx> - -#include <vcl/msgbox.hxx> -#include <tools/urlobj.hxx> -#include <sfx2/app.hxx> -#include <sfx2/imgmgr.hxx> -#include <svx/gallery.hxx> -#include <editeng/brshitem.hxx> -#include <editeng/lrspitem.hxx> -#include <editeng/numitem.hxx> -#include <swvset.hxx> -#include <swmodule.hxx> -#include <wrtsh.hxx> -#include <docsh.hxx> -#include <wview.hxx> -#include <uitool.hxx> -#include <wdocsh.hxx> -#include <uiitems.hxx> -#include <docstyle.hxx> -#include <charfmt.hxx> -#include <uinums.hxx> -#include <poolfmt.hxx> -#include <shellres.hxx> -#include <outline.hxx> -#include <num.hxx> -#include <viewopt.hxx> -#include <frmmgr.hxx> - -#include <misc.hrc> -#include <frmui.hrc> -#include <num.hrc> -#include <globals.hrc> -#include <helpid.h> -#include <SwStyleNameMapper.hxx> -#include <svx/svxids.hrc> -#include <svx/dialogs.hrc> -#include <svl/stritem.hxx> -#include <svl/aeitem.hxx> -#include <svl/slstitm.hxx> - -static sal_Bool bLastRelative = sal_False; - -SwNumPositionTabPage::SwNumPositionTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, SW_RES( TP_NUM_POSITION ), rSet ), - aLevelFL( this, SW_RES(FL_LEVEL )), - aLevelLB( this, SW_RES(LB_LEVEL )), - aPositionFL( this, SW_RES(FL_POSITION )), - - aDistBorderFT( this, SW_RES(FT_BORDERDIST )), - aDistBorderMF( this, SW_RES(MF_BORDERDIST )), - aRelativeCB( this, SW_RES(CB_RELATIVE )), - aIndentFT( this, SW_RES(FT_INDENT )), - aIndentMF( this, SW_RES(MF_INDENT )), - aDistNumFT( this, SW_RES(FT_NUMDIST )), - aDistNumMF( this, SW_RES(MF_NUMDIST )), - aAlignFT( this, SW_RES(FT_ALIGN )), - aAlignLB( this, SW_RES(LB_ALIGN )), - aLabelFollowedByFT( this, SW_RES(FT_LABEL_FOLLOWED_BY) ), - aLabelFollowedByLB( this, SW_RES(LB_LABEL_FOLLOWED_BY) ), - aListtabFT( this, SW_RES(FT_LISTTAB) ), - aListtabMF( this, SW_RES(MF_LISTTAB) ), - aAlign2FT( this, SW_RES(FT_ALIGN_2) ), - aAlign2LB( this, SW_RES(LB_ALIGN_2) ), - aAlignedAtFT( this, SW_RES(FT_ALIGNED_AT) ), - aAlignedAtMF( this, SW_RES(MF_ALIGNED_AT) ), - aIndentAtFT( this, SW_RES(FT_INDENT_AT) ), - aIndentAtMF( this, SW_RES(MF_INDENT_AT) ), - aStandardPB( this, SW_RES(PB_STANDARD )), - - aPreviewWIN( this, SW_RES(WIN_PREVIEW )), - - pActNum(0), - pSaveNum(0), - pWrtSh(0), - pOutlineDlg(0), - bPreset( sal_False ), - bInInintControl(sal_False), - bLabelAlignmentPosAndSpaceModeActive( false ) -{ - FreeResource(); - SetExchangeSupport(); - aPreviewWIN.SetBackground(Wallpaper(Color(COL_TRANSPARENT))); - - aStandardPB.SetAccessibleRelationMemberOf(&aPositionFL); - - - aRelativeCB.Check(); - aAlignLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl)); - aAlign2LB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl)); - for ( sal_uInt16 i = 0; i < aAlignLB.GetEntryCount(); ++i ) - { - aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) ); - } - aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() ); - aAlign2FT.SetText( aAlignFT.GetText() ); - - Link aLk = LINK(this, SwNumPositionTabPage, DistanceHdl); - aDistBorderMF.SetUpHdl(aLk); - aDistNumMF.SetUpHdl(aLk); - aIndentMF.SetUpHdl(aLk); - aDistBorderMF.SetDownHdl(aLk); - aDistNumMF.SetDownHdl(aLk); - aIndentMF.SetDownHdl(aLk); - aDistBorderMF.SetLoseFocusHdl(aLk); - aDistNumMF.SetLoseFocusHdl(aLk); - aIndentMF.SetLoseFocusHdl(aLk); - - aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() ); - aLabelFollowedByLB.SetSelectHdl( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) ); - - aLk = LINK(this, SwNumPositionTabPage, ListtabPosHdl_Impl); - aListtabMF.SetUpHdl(aLk); - aListtabMF.SetDownHdl(aLk); - aListtabMF.SetLoseFocusHdl(aLk); - - aLk = LINK(this, SwNumPositionTabPage, AlignAtHdl_Impl); - aAlignedAtMF.SetUpHdl(aLk); - aAlignedAtMF.SetDownHdl(aLk); - aAlignedAtMF.SetLoseFocusHdl(aLk); - - aLk = LINK(this, SwNumPositionTabPage, IndentAtHdl_Impl); - aIndentAtMF.SetUpHdl(aLk); - aIndentAtMF.SetDownHdl(aLk); - aIndentAtMF.SetLoseFocusHdl(aLk); - - aLevelLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, LevelHdl)); - aRelativeCB.SetClickHdl(LINK(this, SwNumPositionTabPage, RelativeHdl)); - aStandardPB.SetClickHdl(LINK(this, SwNumPositionTabPage, StandardHdl)); - - // insert levels - for(sal_uInt16 i = 1; i <= MAXLEVEL; i++) - aLevelLB.InsertEntry(String::CreateFromInt32(i)); - String sEntry(String::CreateFromAscii("1 - ")); - sEntry += String::CreateFromInt32(MAXLEVEL); - aLevelLB.InsertEntry(sEntry); - aLevelLB.SelectEntry(sEntry); - - aRelativeCB.Check(bLastRelative); - aPreviewWIN.SetPositionMode(); -} - -SwNumPositionTabPage::~SwNumPositionTabPage() -{ - delete pActNum; -} - -void SwNumPositionTabPage::InitControls() -{ - bInInintControl = sal_True; - const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && - aRelativeCB.IsEnabled() && aRelativeCB.IsChecked(); - const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && - USHRT_MAX != nActNumLvl; - - aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); - aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative || pOutlineDlg != 0 ) ); - - bool bSetDistEmpty = false; - bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameAdjust = true; - - bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive; - bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive; - bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive; - bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive; - - const SwNumFmt* aNumFmtArr[MAXLEVEL]; - sal_uInt16 nMask = 1; - sal_uInt16 nLvl = USHRT_MAX; - long nFirstBorderTextRelative = -1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - aNumFmtArr[i] = &pActNum->Get(i); - if(nActNumLvl & nMask) - { - if(USHRT_MAX == nLvl) - { - nLvl = i; - } - - if( i > nLvl) - { - bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); - if ( !bLabelAlignmentPosAndSpaceModeActive ) - { - if(bRelative) - { - if(nFirstBorderTextRelative == -1) - nFirstBorderTextRelative = - (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - - aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); - else - bSameDistBorderNum &= nFirstBorderTextRelative == - (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - - aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); - - } - else - { - bSameDistBorderNum &= - aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() == - aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset(); - } - - bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance(); - bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset(); - } - else - { - bSameLabelFollowedBy &= - aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy(); - bSameListtab &= - aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos(); - bSameAlignAt &= - ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() ) - == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) ); - bSameIndentAt &= - aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt(); - } - } - } - nMask <<= 1; - - } - if(bSameDistBorderNum) - { - long nDistBorderNum; - if(bRelative) - { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); - if(nLvl) - nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); - } - else - { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); - } - aDistBorderMF.SetValue(aDistBorderMF.Normalize(nDistBorderNum),FUNIT_TWIP); - } - else - bSetDistEmpty = sal_True; - - if(bSameDist) - aDistNumMF .SetValue(aDistNumMF.Normalize(aNumFmtArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP); - else - aDistNumMF.SetText(aEmptyStr); - if(bSameIndent) - aIndentMF.SetValue(aIndentMF.Normalize(-aNumFmtArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP); - else - aIndentMF.SetText(aEmptyStr); - - if(bSameAdjust) - { - sal_uInt16 nPos = 1; // centered - if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) - nPos = 0; - else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) - nPos = 2; - aAlignLB.SelectEntryPos(nPos); - aAlign2LB.SelectEntryPos( nPos ); - } - else - { - aAlignLB.SetNoSelection(); - aAlign2LB.SetNoSelection(); - } - - if ( bSameLabelFollowedBy ) - { - sal_uInt16 nPos = 0; // LISTTAB - if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE ) - { - nPos = 1; - } - else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING ) - { - nPos = 2; - } - aLabelFollowedByLB.SelectEntryPos( nPos ); - } - else - { - aLabelFollowedByLB.SetNoSelection(); - } - - if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB ) - { - aListtabFT.Enable( true ); - aListtabMF.Enable( true ); - if ( bSameListtab ) - { - aListtabMF.SetValue(aListtabMF.Normalize(aNumFmtArr[nLvl]->GetListtabPos()),FUNIT_TWIP); - } - else - { - aListtabMF.SetText(aEmptyStr); - } - } - else - { - aListtabFT.Enable( false ); - aListtabMF.Enable( false ); - aListtabMF.SetText(aEmptyStr); - } - - if ( bSameAlignAt ) - { - aAlignedAtMF.SetValue( - aAlignedAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt() + - aNumFmtArr[nLvl]->GetFirstLineIndent()), - FUNIT_TWIP ); - } - else - { - aAlignedAtMF.SetText(aEmptyStr); - } - - if ( bSameIndentAt ) - { - aIndentAtMF.SetValue( - aIndentAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt()), FUNIT_TWIP ); - } - else - { - aIndentAtMF.SetText(aEmptyStr); - } - - if(sal_True == bSetDistEmpty) - aDistBorderMF.SetText(aEmptyStr); - - bInInintControl = sal_False; -} - -void SwNumPositionTabPage::ActivatePage(const SfxItemSet& ) -{ - const SfxPoolItem* pItem; - sal_uInt16 nTmpNumLvl = - pOutlineDlg ? pOutlineDlg->GetActNumLevel() : 0; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, sal_False, &pItem)) - { - bPreset = ((const SfxBoolItem*)pItem)->GetValue(); - } - bModified = (!pActNum->GetNumFmt( 0 ) || bPreset); - if(*pActNum != *pSaveNum || - nActNumLvl != nTmpNumLvl ) - { - *pActNum = *pSaveNum; - nActNumLvl = nTmpNumLvl; - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - aLevelLB.SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX); - if(nActNumLvl != USHRT_MAX) - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1 ; - } - aLevelLB.SetUpdateMode(sal_True); - - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - - InitControls(); - } - aRelativeCB.Enable(1 != nActNumLvl); - aPreviewWIN.Invalidate(); -} - -int SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - SwOutlineTabDialog::SetActNumLevel(nActNumLvl); - if(_pSet) - FillItemSet(*_pSet); - return sal_True; - -} - -sal_Bool SwNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if(pOutlineDlg) - *pOutlineDlg->GetNumRule() = *pActNum; - else if(bModified && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SwUINumRuleItem( *pSaveNum )); - rSet.Put(SfxBoolItem(FN_PARAM_NUM_PRESET, sal_False)); - } - return bModified; -} - -void SwNumPositionTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - if(pOutlineDlg) - { - pSaveNum = pOutlineDlg->GetNumRule(); - aLevelLB.EnableMultiSelection(sal_False); - } - else if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_ACT_NUMBER, sal_False, &pItem)) - pSaveNum = ((SwUINumRuleItem*)pItem)->GetNumRule(); - - nActNumLvl = SwOutlineTabDialog::GetActNumLevel(); - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - if(nActNumLvl == USHRT_MAX) - { - aLevelLB.SelectEntryPos( MAXLEVEL, sal_True); - } - else - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1; - } - aLevelLB.SetUpdateMode(sal_True); - - if(!pActNum) - pActNum = new SwNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; - aPreviewWIN.SetNumRule(pActNum); - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - InitControls(); - bModified = sal_False; -} - -void SwNumPositionTabPage::InitPosAndSpaceMode() -{ - if ( pActNum == 0 ) - { - OSL_FAIL( "<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" ); - return; - } - - SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode = - SvxNumberFormat::LABEL_ALIGNMENT; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt( pActNum->Get(i) ); - ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode(); - if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) - { - break; - } - } - nMask <<= 1; - } - - bLabelAlignmentPosAndSpaceModeActive = - ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT; -} - -void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() -{ - aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive ); - - aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive ); - aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); - aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); -} - -SfxTabPage* SwNumPositionTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SwNumPositionTabPage(pParent, rAttrSet); -} - -void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh) -{ - pWrtSh = pSh; - - const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width(); - - aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_TWIP ); - aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_TWIP ); - aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_TWIP ); - aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_TWIP ); - aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_TWIP ); - aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_TWIP ); - const SwTwips nLast2 = nWidth /2; - aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_TWIP ); - aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_TWIP ); - aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_TWIP ); - aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_TWIP ); - aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_TWIP ); - aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_TWIP ); - - const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE); - aPreviewWIN.SetPageWidth(rPrtRect.Width()); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView())); - if(eMetric == FUNIT_MM) - { - aDistBorderMF .SetDecimalDigits(1); - aDistNumMF .SetDecimalDigits(1); - aIndentMF .SetDecimalDigits(1); - aListtabMF.SetDecimalDigits(1); - aAlignedAtMF.SetDecimalDigits(1); - aIndentAtMF.SetDecimalDigits(1); - } - aDistBorderMF .SetUnit( eMetric ); - aDistNumMF .SetUnit( eMetric ); - aIndentMF .SetUnit( eMetric ); - aListtabMF.SetUnit( eMetric ); - aAlignedAtMF.SetUnit( eMetric ); - aIndentAtMF.SetUnit( eMetric ); -} - -IMPL_LINK( SwNumPositionTabPage, EditModifyHdl, Edit *, EMPTYARG ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - { - SwNumFmt aNumFmt(pActNum->Get(i)); - - const sal_uInt16 nPos = aAlignLB.IsVisible() - ? aAlignLB.GetSelectEntryPos() - : aAlign2LB.GetSelectEntryPos(); - SvxAdjust eAdjust = SVX_ADJUST_CENTER; - if(nPos == 0) - eAdjust = SVX_ADJUST_LEFT; - else if(nPos == 2) - eAdjust = SVX_ADJUST_RIGHT; - aNumFmt.SetNumAdjust( eAdjust ); - pActNum->Set(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox *, pBox ) -{ - sal_uInt16 nSaveNumLvl = nActNumLvl; - nActNumLvl = 0; - if(pBox->IsEntryPosSelected( MAXLEVEL ) && - (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) - { - nActNumLvl = 0xFFFF; - pBox->SetUpdateMode(sal_False); - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) - pBox->SelectEntryPos( i, sal_False ); - pBox->SetUpdateMode(sal_True); - } - else if(pBox->GetSelectEntryCount()) - { - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) - { - if(pBox->IsEntryPosSelected( i )) - nActNumLvl |= nMask; - nMask <<= 1; - } - pBox->SelectEntryPos( MAXLEVEL, sal_False ); - } - else - { - nActNumLvl = nSaveNumLvl; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) - { - if(nActNumLvl & nMask) - { - pBox->SelectEntryPos(i); - break; - } - nMask <<=1; - } - } - aRelativeCB.Enable(1 != nActNumLvl); - SetModified(); - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - InitControls(); - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld ) -{ - if(bInInintControl) - return 0; - long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP))); - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - { - SwNumFmt aNumFmt( pActNum->Get( i ) ); - if(pFld == &aDistBorderMF) - { - - if(aRelativeCB.IsChecked() && aRelativeCB.IsEnabled()) - { - if(0 == i) - { - long nTmp = aNumFmt.GetFirstLineOffset(); - aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp)); - } - else - { - long nTmp = pActNum->Get( i - 1 ).GetAbsLSpace() + - pActNum->Get( i - 1 ).GetFirstLineOffset() - - pActNum->Get( i ).GetFirstLineOffset(); - - aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp)); - } - } - else - { - aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); - } - } - else if(pFld == &aDistNumMF) - { - aNumFmt.SetCharTextDistance( (short)nValue ); - } - else if(pFld == &aIndentMF) - { - // now AbsLSpace also has to be modified by FirstLineOffset - long nDiff = nValue + aNumFmt.GetFirstLineOffset(); - long nAbsLSpace = aNumFmt.GetAbsLSpace(); - aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff)); - aNumFmt.SetFirstLineOffset( -(short)nValue ); - } - - pActNum->Set( i, aNumFmt ); - } - nMask <<= 1; - } - - SetModified(); - if(!aDistBorderMF.IsEnabled()) - aDistBorderMF.SetText(aEmptyStr); - - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, RelativeHdl, CheckBox *, pBox ) -{ - sal_Bool bOn = pBox->IsChecked(); - sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl; - sal_Bool bSetValue = sal_False; - long nValue = 0; - if(bOn || bSingleSelection) - { - sal_uInt16 nMask = 1; - sal_Bool bFirst = sal_True; - bSetValue = sal_True; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - { - const SwNumFmt &rNumFmt = pActNum->Get(i); - if(bFirst) - { - nValue = rNumFmt.GetAbsLSpace(); - if(bOn && i) - nValue -= pActNum->Get(i - 1).GetAbsLSpace(); - } - else - bSetValue = nValue == rNumFmt.GetAbsLSpace() - pActNum->Get(i - 1).GetAbsLSpace(); - bFirst = sal_False; - } - nMask <<= 1; - } - - } - if(bSetValue) - aDistBorderMF.SetValue(aDistBorderMF.Normalize(nValue), FUNIT_TWIP); - else - aDistBorderMF.SetText(aEmptyStr); - aDistBorderMF.Enable(bOn || bSingleSelection||0 != pOutlineDlg); - bLastRelative = bOn; - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG ) -{ - // determine value to be set at the chosen list levels - SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy = - SvxNumberFormat::LISTTAB; - { - const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos(); - if ( nPos == 1 ) - { - eLabelFollowedBy = SvxNumberFormat::SPACE; - } - else if ( nPos == 2 ) - { - eLabelFollowedBy = SvxNumberFormat::NOTHING; - } - } - - // set value at the chosen list levels - bool bSameListtabPos = true; - sal_uInt16 nFirstLvl = USHRT_MAX; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) - { - if ( nActNumLvl & nMask ) - { - SwNumFmt aNumFmt( pActNum->Get(i) ); - aNumFmt.SetLabelFollowedBy( eLabelFollowedBy ); - pActNum->Set( i, aNumFmt ); - - if ( nFirstLvl == USHRT_MAX ) - { - nFirstLvl = i; - } - else - { - bSameListtabPos &= aNumFmt.GetListtabPos() == - pActNum->Get( nFirstLvl ).GetListtabPos(); - } - } - nMask <<= 1; - } - - // enable/disable metric field for list tab stop position depending on - // selected item following the list label. - aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); - aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); - if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB ) - { - aListtabMF.SetValue( - aListtabMF.Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ), - FUNIT_TWIP ); - } - else - { - aListtabMF.SetText( String() ); - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP))); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) - { - if ( nActNumLvl & nMask ) - { - SwNumFmt aNumFmt( pActNum->Get(i) ); - aNumFmt.SetListtabPos( nValue ); - pActNum->Set( i, aNumFmt ); - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP))); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) - { - if ( nActNumLvl & nMask ) - { - SwNumFmt aNumFmt( pActNum->Get(i) ); - const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt(); - aNumFmt.SetFirstLineIndent( nFirstLineIndent ); - pActNum->Set( i, aNumFmt ); - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP))); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) - { - if ( nActNumLvl & nMask ) - { - SwNumFmt aNumFmt( pActNum->Get(i) ); - const long nAlignedAt = aNumFmt.GetIndentAt() + - aNumFmt.GetFirstLineIndent(); - aNumFmt.SetIndentAt( nValue ); - const long nNewFirstLineIndent = nAlignedAt - nValue; - aNumFmt.SetFirstLineIndent( nNewFirstLineIndent ); - pActNum->Set( i, aNumFmt ); - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SwNumPositionTabPage, StandardHdl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActNumLvl & nMask) - { - SwNumFmt aNumFmt( pActNum->Get( i ) ); - SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(), - aNumFmt.GetPositionAndSpaceMode(), - pOutlineDlg ? OUTLINE_RULE : NUM_RULE ); - SwNumFmt aTempFmt(aTmpNumRule.Get( i )); - aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() ); - if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace()); - aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() ); - aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() ); - } - else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() ); - aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() ); - aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() ); - aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() ); - aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() ); - } - pActNum->Set( i, aNumFmt ); - } - nMask <<= 1; - } - - InitControls(); - SetModified(); - return 0; -} - -#if OSL_DEBUG_LEVEL > 1 -void SwNumPositionTabPage::SetModified(sal_Bool bRepaint) -{ - bModified = sal_True; - if(bRepaint) - { - aPreviewWIN.SetLevel(nActNumLvl); - aPreviewWIN.Invalidate(); - } -} - -#endif - -SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent, - const SfxItemSet* pSwItemSet, SwWrtShell & rSh) : - SfxTabDialog(pParent, SW_RES(DLG_SVXTEST_NUM_BULLET), pSwItemSet, sal_False, &aEmptyStr), - rWrtSh(rSh), - sRemoveText(SW_RES(ST_RESET)), - nRetOptionsDialog(USHRT_MAX) -{ - FreeResource(); - GetUserButton()->SetText(sRemoveText); - GetUserButton()->SetHelpId(HID_NUM_RESET); - GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl)); - if(!rWrtSh.GetCurNumRule()) - GetUserButton()->Enable(sal_False); - AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM ); - AddTabPage( RID_SVXPAGE_PICK_BULLET ); - AddTabPage( RID_SVXPAGE_PICK_NUM ); - AddTabPage( RID_SVXPAGE_PICK_BMP ); - AddTabPage( RID_SVXPAGE_NUM_OPTIONS ); - AddTabPage( RID_SVXPAGE_NUM_POSITION ); - -} - -SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog() -{ -} - -void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) -{ - // set styles' names and metric - String sNumCharFmt, sBulletCharFmt; - SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt ); - SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt ); - - switch ( nPageId ) - { - case RID_SVXPAGE_PICK_NUM: - { - SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); - aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); - rPage.PageCreated(aSet); - } - break; - case RID_SVXPAGE_PICK_BULLET : - { - SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); - rPage.PageCreated(aSet); - } - break; - - case RID_SVXPAGE_NUM_OPTIONS: - { - SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); - aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); - // collect char styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone ); - SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); - - std::vector<String> aList; - for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( String(rCharFmtLB.GetEntry(j))); - - aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; - - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell)); - aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) ); - rPage.PageCreated(aSet); - } - break; - case RID_SVXPAGE_NUM_POSITION: - { - SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell)); - SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) ); - rPage.PageCreated(aSet); - } - break; - } -} - -short SwSvxNumBulletTabDialog::Ok() -{ - short nRet = SfxTabDialog::Ok(); - pExampleSet->ClearItem(SID_PARAM_NUM_PRESET); - return nRet; -} - -IMPL_LINK(SwSvxNumBulletTabDialog, RemoveNumberingHdl, PushButton*, EMPTYARG) -{ - EndDialog(RET_USER); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/num.hrc b/sw/source/ui/misc/num.hrc deleted file mode 100644 index 6156208ff9..0000000000 --- a/sw/source/ui/misc/num.hrc +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * 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 FL_LEVEL 1 -#define LB_LEVEL 2 -#define FL_POSITION 3 -#define FT_BORDERDIST 4 -#define MF_BORDERDIST 5 -#define CB_RELATIVE 6 -#define FT_INDENT 7 -#define MF_INDENT 8 -#define FT_NUMDIST 9 -#define MF_NUMDIST 10 -#define FT_ALIGN 11 -#define LB_ALIGN 12 -#define PB_STANDARD 13 -#define WIN_PREVIEW 15 -#define ST_RESET 16 - -#define FT_LABEL_FOLLOWED_BY 17 -#define LB_LABEL_FOLLOWED_BY 18 -#define FT_LISTTAB 19 -#define MF_LISTTAB 20 -#define FT_ALIGN_2 21 -#define LB_ALIGN_2 22 -#define FT_ALIGNED_AT 23 -#define MF_ALIGNED_AT 24 -#define FT_INDENT_AT 25 -#define MF_INDENT_AT 26 - diff --git a/sw/source/ui/misc/num.src b/sw/source/ui/misc/num.src deleted file mode 100644 index a0540c97c8..0000000000 --- a/sw/source/ui/misc/num.src +++ /dev/null @@ -1,373 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -/* StarView ressource file */ - - -#include "globals.hrc" -#include "misc.hrc" -#include "num.hrc" -#include "cmdid.h" -#include "helpid.h" -#include "svx/dialogs.hrc" - -/**************************************************************************/ -/* */ -/* TabPage positions */ -/* */ -/**************************************************************************/ -TabPage TP_NUM_POSITION -{ - HelpID = HID_NUM_POSITION ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_LEVEL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "Level" ; - }; - MultiListBox LB_LEVEL - { - HelpID = "sw:MultiListBox:TP_NUM_POSITION:LB_LEVEL"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 26 , 163 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - Border = TRUE ; - SimpleMode = TRUE ; - }; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 47 , 3 ) ; - Size = MAP_APPFONT ( 207 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Position and spacing" ; - }; - FixedText FT_BORDERDIST - { - Pos = MAP_APPFONT ( 50 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "Indent" ; - }; - MetricField MF_BORDERDIST - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_BORDERDIST"; - Pos = MAP_APPFONT ( 198 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - CheckBox CB_RELATIVE - { - HelpID = "sw:CheckBox:TP_NUM_POSITION:CB_RELATIVE"; - Pos = MAP_APPFONT ( 198 , 41 ) ; - Size = MAP_APPFONT ( 52 , 10 ) ; - Text [ en-US ] = "Relati~ve" ; - }; - FixedText FT_INDENT - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Width of numbering" ; - }; - MetricField MF_INDENT - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_INDENT"; - Pos = MAP_APPFONT ( 198 , 57 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - FixedText FT_NUMDIST - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Minimum space numbering <-> text" ; - }; - MetricField MF_NUMDIST - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_NUMDIST"; - Pos = MAP_APPFONT ( 198 , 73 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_ALIGN - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "N~umbering alignment" ; - }; - ListBox LB_ALIGN - { - HelpID = "sw:ListBox:TP_NUM_POSITION:LB_ALIGN"; - Pos = MAP_APPFONT ( 198 , 89 ) ; - Size = MAP_APPFONT ( 40 , 40 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Left" ; > ; - < "Centered" ; > ; - < "Right" ; > ; - }; - }; - FixedText FT_LABEL_FOLLOWED_BY - { - Pos = MAP_APPFONT ( 50 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "Numbering followed by" ; - }; - ListBox LB_LABEL_FOLLOWED_BY - { - HelpID = "sw:ListBox:TP_NUM_POSITION:LB_LABEL_FOLLOWED_BY"; - Pos = MAP_APPFONT ( 198 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Tab stop" ; > ; - < "Space" ; > ; - < "Nothing" ; > ; - }; - }; - FixedText FT_LISTTAB - { - Pos = MAP_APPFONT ( 50 , 43 ) ; - Size = MAP_APPFONT ( 143 , 10 ) ; - Right = TRUE ; - Text [ en-US ] = "at" ; - }; - MetricField MF_LISTTAB - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_LISTTAB"; - Pos = MAP_APPFONT ( 198 , 41 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - FixedText FT_ALIGN_2 - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - }; - ListBox LB_ALIGN_2 - { - HelpID = "sw:ListBox:TP_NUM_POSITION:LB_ALIGN_2"; - Pos = MAP_APPFONT ( 198 , 57 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_ALIGNED_AT - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Aligned at" ; - }; - MetricField MF_ALIGNED_AT - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_ALIGNED_AT"; - Pos = MAP_APPFONT ( 198 , 73 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_INDENT_AT - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Indent at" ; - }; - MetricField MF_INDENT_AT - { - HelpID = "sw:MetricField:TP_NUM_POSITION:MF_INDENT_AT"; - Pos = MAP_APPFONT ( 198 , 89 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_STANDARD - { - HelpID = "sw:PushButton:TP_NUM_POSITION:PB_STANDARD"; - Pos = MAP_APPFONT ( 198 , 165 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Default" ; - }; - Window WIN_PREVIEW - { - Pos = MAP_APPFONT ( 50 , 113 ) ; - Size = MAP_APPFONT ( 143 , 67 ) ; - Border = TRUE ; - }; -}; - -/**************************************************************************/ -/* */ -/* dialog for Svx-implementation's test */ -/* */ -/**************************************************************************/ -TabDialog DLG_SVXTEST_NUM_BULLET -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Bullets and Numbering"; - Moveable = TRUE ; - TabControl 1 - { - SVLook = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_PICK_BULLET ; - Text [ en-US ] = "Bullets" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ; - Text [ en-US ] = "Numbering type" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PICK_NUM ; - Text [ en-US ] = "Outline" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PICK_BMP ; - Text [ en-US ] = "Graphics" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_NUM_POSITION ; - Text [ en-US ] = "Position" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_NUM_OPTIONS ; - Text [ en-US ] = "Options" ; - }; - }; - }; - String ST_RESET - { - Text [ en-US ] = "~Remove" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/numberingtypelistbox.cxx b/sw/source/ui/misc/numberingtypelistbox.cxx deleted file mode 100644 index dea81c9b96..0000000000 --- a/sw/source/ui/misc/numberingtypelistbox.cxx +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <numberingtypelistbox.hxx> -#include <misc.hrc> -#include <cnttab.hxx> -#include <com/sun/star/style/NumberingType.hpp> -#include <com/sun/star/text/XDefaultNumberingProvider.hpp> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/text/XNumberingTypeInfo.hpp> - -#include <unomid.h> - -using namespace com::sun::star; - -using ::rtl::OUString; - -struct SwNumberingTypeListBox_Impl -{ - uno::Reference<text::XNumberingTypeInfo> xInfo; -}; - -SwNumberingTypeListBox::SwNumberingTypeListBox( Window* pWin, const ResId& rResId, - sal_uInt16 nTypeFlags ) : - ListBox(pWin, rResId), - pImpl(new SwNumberingTypeListBox_Impl) -{ - uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < uno::XInterface > xI = xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DefaultNumberingProvider")) ); - uno::Reference<text::XDefaultNumberingProvider> xDefNum(xI, uno::UNO_QUERY); - OSL_ENSURE(xDefNum.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); - - pImpl->xInfo = uno::Reference<text::XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY); - Reload(nTypeFlags); -} - -SwNumberingTypeListBox::~SwNumberingTypeListBox() -{ - delete pImpl; -} - -void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags) -{ - Clear(); - uno::Sequence<sal_Int16> aTypes; - const sal_Int16* pTypes = NULL; - if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) ) - { - if(pImpl->xInfo.is()) - { - aTypes = pImpl->xInfo->getSupportedNumberingTypes(); - pTypes = aTypes.getConstArray(); - } - } - SwOLENames aNames(SW_RES(STRRES_NUMTYPES)); - ResStringArray& rNames = aNames.GetNames(); - for(sal_uInt16 i = 0; i < rNames.Count(); i++) - { - long nValue = rNames.GetValue(i); - sal_Bool bInsert = sal_True; - sal_uInt16 nPos = LISTBOX_APPEND; - switch(nValue) - { - case style::NumberingType::NUMBER_NONE: - bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_NO_NUMBERING); - nPos = 0; - break; - case style::NumberingType::CHAR_SPECIAL: bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BULLET); break; - case style::NumberingType::PAGE_DESCRIPTOR:bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING); break; - case style::NumberingType::BITMAP:bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BITMAP ); break; - default: - if (nValue > style::NumberingType::CHARS_LOWER_LETTER_N) - { - // Insert only if offered by i18n framework per configuration. - bInsert = sal_False; - if (pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - if (pTypes[nType] == nValue) - { - bInsert = sal_True; - break; // for - } - } - } - } - } - if(bInsert) - { - sal_uInt16 nEntry = InsertEntry(rNames.GetString(i), nPos); - SetEntryData( nEntry, (void*)nValue ); - } - } - if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) ) - { - if(pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - sal_Int16 nCurrent = pTypes[nType]; - if(nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) - { - if(LISTBOX_ENTRY_NOTFOUND == GetEntryPos((void*)(sal_uLong)nCurrent)) - { - OUString aIdent = pImpl->xInfo->getNumberingIdentifier( nCurrent ); - sal_uInt16 nPos = InsertEntry(aIdent); - SetEntryData(nPos,(void*)(sal_uLong)nCurrent); - } - } - } - } - SelectEntryPos(0); - } -} - -sal_Int16 SwNumberingTypeListBox::GetSelectedNumberingType() -{ - sal_Int16 nRet = 0; - sal_uInt16 nSelPos = GetSelectEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - nRet = (sal_Int16)(sal_uLong)GetEntryData(nSelPos); -#if OSL_DEBUG_LEVEL > 1 - else - OSL_FAIL("SwNumberingTypeListBox not selected"); -#endif - return nRet; -} - -sal_Bool SwNumberingTypeListBox::SelectNumberingType(sal_Int16 nType) -{ - sal_uInt16 nPos = GetEntryPos((void*)(sal_uLong)nType); - SelectEntryPos( nPos ); - return LISTBOX_ENTRY_NOTFOUND != nPos; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/numberingtypelistbox.src b/sw/source/ui/misc/numberingtypelistbox.src deleted file mode 100644 index ff8de9aa4d..0000000000 --- a/sw/source/ui/misc/numberingtypelistbox.src +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" - -Resource STRRES_NUMTYPES -{ - StringArray 1 - { - - ItemList [ en-US ] = - { - < "1, 2, 3, ..." ; 4/*SVX_NUM_ARABIC */; > ; - < "A, B, C, ..." ; 0/*SVX_NUM_CHARS_UPPER_LETTER */; > ; - < "a, b, c, ..." ; 1/*SVX_NUM_CHARS_LOWER_LETTER */; > ; - < "I, II, III, ..." ; 2/*SVX_NUM_ROMAN_UPPER */; > ; - < "i, ii, iii, ..." ; 3/*SVX_NUM_ROMAN_LOWER */; > ; - < "A, .., AA, .., AAA, ..." ; 9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ; - < "a, .., aa, .., aaa, ..." ; 10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ; - < "Bullet" ; 6/*SVX_NUM_CHAR_SPECIAL */; > ; - < "Graphics" ; 8/*SVX_NUM_BITMAP */; > ; - < "None" ; 5/*SVX_NUM_NUMBER_NONE */; > ; - < "Native Numbering" ; 12 /*NATIVE_NUMBERING */; > ; - < "А, Б, .., Аа, Аб, ... (Bulgarian)" ; 38 /*CHARS_CYRILLIC_UPPER_LETTER_BG */; > ; - < "а, б, .., аа, аб, ... (Bulgarian)" ; 39 /*CHARS_CYRILLIC_LOWER_LETTER_BG */; > ; - < "А, Б, .., Аа, Бб, ... (Bulgarian)" ; 40 /*CHARS_CYRILLIC_UPPER_LETTER_N_BG */; > ; - < "а, б, .., аа, бб, ... (Bulgarian)" ; 41 /*CHARS_CYRILLIC_LOWER_LETTER_N_BG */; > ; - < "А, Б, .., Аа, Аб, ... (Russian)" ; 42 /*CHARS_CYRILLIC_UPPER_LETTER_RU */; > ; - < "а, б, .., аа, аб, ... (Russian)" ; 43 /*CHARS_CYRILLIC_LOWER_LETTER_RU */; > ; - < "А, Б, .., Аа, Бб, ... (Russian)" ; 44 /*CHARS_CYRILLIC_UPPER_LETTER_N_RU */; > ; - < "а, б, .., аа, бб, ... (Russian)" ; 45 /*CHARS_CYRILLIC_LOWER_LETTER_N_RU */; > ; - < "А, Б, .., Аа, Аб, ... (Serbian)" ; 48 /*CHARS_CYRILLIC_UPPER_LETTER_SR */; > ; - < "а, б, .., аа, аб, ... (Serbian)" ; 49 /*CHARS_CYRILLIC_LOWER_LETTER_SR */; > ; - < "А, Б, .., Аа, Бб, ... (Serbian)" ; 50 /*CHARS_CYRILLIC_UPPER_LETTER_N_SR */; > ; - < "а, б, .., аа, бб, ... (Serbian)" ; 51 /*CHARS_CYRILLIC_LOWER_LETTER_N_SR */; > ; - < "Α, Β, Γ, ... (Greek Upper Letter)"; 52 /*CHARS_GREEK_UPPER_LETTER */; > ; - < "α, β, γ, ... (Greek Lower Letter)"; 53 /*CHARS_GREEK_LOWER_LETTER */; > ; - }; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx deleted file mode 100644 index 89477a2693..0000000000 --- a/sw/source/ui/misc/outline.cxx +++ /dev/null @@ -1,1183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <tools/shl.hxx> -#include <vcl/menu.hxx> -#include <vcl/msgbox.hxx> -#include <sfx2/tabdlg.hxx> -#include <editeng/brshitem.hxx> -#include <unotools/configmgr.hxx> -#include <SwStyleNameMapper.hxx> - -#ifndef _NUM_HXX //autogen -#define USE_NUMTABPAGES -#include <num.hxx> -#endif -#include <view.hxx> -#include <docsh.hxx> -#include <uitool.hxx> -#include <wrtsh.hxx> -#include <swmodule.hxx> -#include <fmtcol.hxx> -#include <outline.hxx> -#include <uinums.hxx> -#include <poolfmt.hxx> -#include <shellres.hxx> -#include <svl/style.hxx> -#include <charfmt.hxx> -#include <docstyle.hxx> -#include <viewopt.hxx> -#include <svtools/ctrlbox.hxx> -#include <helpid.h> -#include <globals.hrc> // for template name 'none' -#include <misc.hrc> -#include <outline.hrc> -#include <paratr.hxx> - -#include <unomid.h> - -#include <IDocumentOutlineNodes.hxx> -#include <app.hrc> - -#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_ -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#endif - -using namespace ::com::sun::star; - -DBG_NAME(outlinehdl) - -class SwNumNamesDlg: public ModalDialog -{ - FixedLine aFormFL; - Edit aFormEdit; - ListBox aFormBox; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - DECL_LINK( ModifyHdl, Edit * ); - DECL_LINK( SelectHdl, ListBox * ); - DECL_LINK( DoubleClickHdl, ListBox * ); - -public: - SwNumNamesDlg(Window *pParent); - ~SwNumNamesDlg(); - void SetUserNames(const String *pList[]); - String GetName() const { return aFormEdit.GetText(); } - sal_uInt16 GetCurEntryPos() const { return aFormBox.GetSelectEntryPos(); } -}; - -/*------------------------------------------------------------------------ - Description: remember selected entry -------------------------------------------------------------------------*/ -IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox ) -{ - aFormEdit.SetText(pBox->GetSelectEntry()); - aFormEdit.SetSelection(Selection(0, SELECTION_MAX)); - return 0; -} -IMPL_LINK_INLINE_END( SwNumNamesDlg, SelectHdl, ListBox *, pBox ) - -/*------------------------------------------------------------------------ - Description: set user defined names - Parameter: list of user defined names; - unknown positions for the user are 0. -------------------------------------------------------------------------*/ -void SwNumNamesDlg::SetUserNames(const String *pList[]) -{ - sal_uInt16 nSelect = 0; - for(sal_uInt16 i = 0; i < SwBaseNumRules::nMaxRules; ++i) - { - if(pList[i]) - { - aFormBox.RemoveEntry(i); - aFormBox.InsertEntry(*pList[i], i); - if(i == nSelect && nSelect < SwBaseNumRules::nMaxRules) - nSelect++; - } - } - aFormBox.SelectEntryPos(nSelect); - SelectHdl(&aFormBox); -} - -/*------------------------------------------------------------------------ - Description: unlock OK-Button when text is in Edit -------------------------------------------------------------------------*/ -IMPL_LINK_INLINE_START( SwNumNamesDlg, ModifyHdl, Edit *, pBox ) -{ - aOKBtn.Enable(0 != pBox->GetText().Len()); - return 0; -} -IMPL_LINK_INLINE_END( SwNumNamesDlg, ModifyHdl, Edit *, pBox ) - -/*------------------------------------------------------------------------ - Description: DoubleClickHdl -------------------------------------------------------------------------*/ -IMPL_LINK_INLINE_START( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG ) -{ - EndDialog(RET_OK); - return 0; -} -IMPL_LINK_INLINE_END( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG ) - -SwNumNamesDlg::SwNumNamesDlg(Window *pParent) - : ModalDialog(pParent, SW_RES(DLG_NUM_NAMES)), - aFormFL(this, SW_RES(FL_FORM)), - aFormEdit(this, SW_RES(ED_FORM)), - aFormBox(this, SW_RES(LB_FORM)), - aOKBtn(this, SW_RES(BT_OK)), - aCancelBtn(this, SW_RES(BT_CANCEL)), - aHelpBtn(this, SW_RES(BT_HELP)) -{ - FreeResource(); - aFormEdit.SetModifyHdl(LINK(this, SwNumNamesDlg, ModifyHdl)); - aFormBox.SetSelectHdl(LINK(this, SwNumNamesDlg, SelectHdl)); - aFormBox.SetDoubleClickHdl(LINK(this, SwNumNamesDlg, DoubleClickHdl)); - SelectHdl(&aFormBox); -} - -SwNumNamesDlg::~SwNumNamesDlg() {} - -sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel) -{ - sal_uInt16 nTmp = nActLevel; - sal_uInt16 nTmpLevel = 0; - while( 0 != (nTmp >>= 1) ) - nTmpLevel++; - return nTmpLevel; -} - -sal_uInt16 SwOutlineTabDialog::nNumLevel = 1; -SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent, - const SfxItemSet* pSwItemSet, - SwWrtShell &rSh) : - // the UserString is set correctly afterwards - SfxTabDialog(pParent, SW_RES(DLG_TAB_OUTLINE), pSwItemSet, sal_False, &aEmptyStr), - aNullStr(C2S("____")), - aFormMenu(SW_RES(MN_FORM)), - rWrtSh(rSh), - pChapterNumRules(SW_MOD()->GetChapterNumRules()), - bModified(rWrtSh.IsModified()) -{ - // --> OD 2008-04-14 #outlinelevel# - SetText( SW_RES( STR_OUTLINE_NUMBERING ) ); - PushButton* pUserButton = GetUserButton(); - pUserButton->SetText(SW_RES(ST_FORM)); - pUserButton->SetHelpId(HID_OUTLINE_FORM); - pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl)); - pUserButton->SetAccessibleRole( com::sun::star::accessibility::AccessibleRole::BUTTON_MENU ); - - FreeResource(); - pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() ); - GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl)); - - AddTabPage(TP_NUM_POSITION , &SwNumPositionTabPage::Create, 0); - AddTabPage(TP_OUTLINE_NUM , &SwOutlineSettingsTabPage::Create, 0); - - String sHeadline; - sal_uInt16 i; - - for( i = 0; i < MAXLEVEL; ++i ) - { - // if the style wasn't created yet, it's still at this position - if( !rWrtSh.GetParaStyle( sHeadline = - SwStyleNameMapper::GetUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), - sHeadline )) ) - aCollNames[i] = sHeadline; - } - - // query the text templates' outlining levels - const sal_uInt16 nCount = rWrtSh.GetTxtFmtCollCount(); - for(i = 0; i < nCount; ++i ) - { - SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i); - if(!rTxtColl.IsDefault()) - { - //->added by zhaojianwei - if(rTxtColl.IsAssignedToListLevelOfOutlineStyle()) - { - int nOutLevel = rTxtColl.GetAssignedOutlineStyleLevel(); - aCollNames[ nOutLevel ] = rTxtColl.GetName(); - } - //<-end - } - } -} - -SwOutlineTabDialog::~SwOutlineTabDialog() -{ - delete pNumRule; -} - -void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) -{ - switch ( nPageId ) - { - case TP_NUM_POSITION: - ((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh); - ((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this); - break; - case TP_OUTLINE_NUM: - ((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh); - break; - } -} - -IMPL_LINK( SwOutlineTabDialog, CancelHdl, Button *, EMPTYARG ) -{ - if (!bModified) - rWrtSh.ResetModified(); - EndDialog(RET_CANCEL); - return 0; -} - -IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn ) -{ - // fill PopupMenu - for( sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i ) - { - const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i); - if( pRules ) - aFormMenu.SetItemText(i + MN_FORMBASE, pRules->GetName()); - } - aFormMenu.SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl)); - aFormMenu.Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN); - return 0; -} - -IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu ) -{ - sal_uInt8 nLevelNo = 0; - switch(pMenu->GetCurItemId()) - { - case MN_FORM1: nLevelNo = 1; break; - case MN_FORM2: nLevelNo = 2; break; - case MN_FORM3: nLevelNo = 3; break; - case MN_FORM4: nLevelNo = 4; break; - case MN_FORM5: nLevelNo = 5; break; - case MN_FORM6: nLevelNo = 6; break; - case MN_FORM7: nLevelNo = 7; break; - case MN_FORM8: nLevelNo = 8; break; - case MN_FORM9: nLevelNo = 9; break; - - case MN_SAVE: - { - SwNumNamesDlg *pDlg = new SwNumNamesDlg(this); - const String *aStrArr[SwChapterNumRules::nMaxRules]; - for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i) - { - const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i); - if(pRules) - aStrArr[i] = &pRules->GetName(); - else - aStrArr[i] = 0; - } - pDlg->SetUserNames(aStrArr); - if(RET_OK == pDlg->Execute()) - { - const String aName(pDlg->GetName()); - pChapterNumRules->ApplyNumRules( SwNumRulesWithName( - *pNumRule, aName ), pDlg->GetCurEntryPos() ); - pMenu->SetItemText( - pDlg->GetCurEntryPos() + MN_FORMBASE, aName); - } - delete pDlg; - return 0; - - } - - } - if( nLevelNo-- ) - { - const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo ); - if( pRules ) - { - pRules->MakeNumRule( rWrtSh, *pNumRule ); - pNumRule->SetRuleType( OUTLINE_RULE ); - } - else - *pNumRule = *rWrtSh.GetOutlineNumRule(); - } - - sal_uInt16 nPageId = GetCurPageId(); - SfxTabPage* pPage = GetTabPage( nPageId ); - pPage->Reset(*GetOutputItemSet()); - - return 0; -} - -sal_uInt16 SwOutlineTabDialog::GetLevel(const String &rFmtName) const -{ - for(sal_uInt16 i = 0; i < MAXLEVEL; ++i) - { - if(aCollNames[i] == rFmtName) - return i; - } - return MAXLEVEL;//NO_NUMBERING; //#outline level,zhaojianwei - -} - -short SwOutlineTabDialog::Ok() -{ - SfxTabDialog::Ok(); - // set levels for all created templates; has to be done in order to - // delete possibly cancelled assignments again. - - // #130443# - // encapsulate changes into a action to avoid effects on the current cursor - // position during the changes. - rWrtSh.StartAction(); - - const SwNumRule * pOutlineRule = rWrtSh.GetOutlineNumRule(); - - sal_uInt16 i, nCount = rWrtSh.GetTxtFmtCollCount(); - for( i = 0; i < nCount; ++i ) - { - SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i); - if( !rTxtColl.IsDefault() ) - { - - const SfxPoolItem & rItem = - rTxtColl.GetFmtAttr(RES_PARATR_NUMRULE, sal_False); - - if ((sal_uInt8)GetLevel(rTxtColl.GetName()) == MAXLEVEL) //add by zhaojianwei - { - if(rTxtColl.IsAssignedToListLevelOfOutlineStyle()) - { - rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); - } - if (static_cast<const SwNumRuleItem &>(rItem).GetValue() == - pOutlineRule->GetName()) - { - rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE); - } - } - else - { - rTxtColl.AssignToListLevelOfOutlineStyle(GetLevel(rTxtColl.GetName())); - - if (static_cast<const SwNumRuleItem &>(rItem).GetValue() != - pOutlineRule->GetName()) - { - SwNumRuleItem aItem(pOutlineRule->GetName()); - rTxtColl.SetFmtAttr(aItem); - } - } //<-end,zhaojianwei - } - } - - for(i = 0; i < MAXLEVEL; ++i ) - { - String sHeadline; - ::SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), - sHeadline ); - SwTxtFmtColl* pColl = rWrtSh.FindTxtFmtCollByName( sHeadline ); - if( !pColl ) - { - if(aCollNames[i] != sHeadline) - { - SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool( - static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i) ); - pTxtColl->DeleteAssignmentToListLevelOfOutlineStyle(); - pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE); - - if( aCollNames[i].Len() ) - { - pTxtColl = rWrtSh.GetParaStyle( - aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME); - if(pTxtColl) - { - pTxtColl->AssignToListLevelOfOutlineStyle(i); - SwNumRuleItem aItem(pOutlineRule->GetName()); - pTxtColl->SetFmtAttr(aItem); - } - } - } - } - } - - rWrtSh.SetOutlineNumRule( *pNumRule); - - // #i30443# - rWrtSh.EndAction(); - - return RET_OK; -} - -SwOutlineSettingsTabPage::SwOutlineSettingsTabPage(Window* pParent, const SfxItemSet& rSet) : - SfxTabPage(pParent, SW_RES(TP_OUTLINE_NUM), rSet), - aLevelFL( this, SW_RES(FL_LEVEL )), - aLevelLB( this, SW_RES(LB_LEVEL )), - aNumberFL(this, SW_RES(FL_NUMBER)), - aCollLbl(this, SW_RES(FT_COLL)), - aCollBox(this, SW_RES(LB_COLL)), - aNumberLbl(this, SW_RES(FT_NUMBER)), - aNumberBox(this, SW_RES(LB_NUMBER), INSERT_NUM_TYPE_NO_NUMBERING|INSERT_NUM_EXTENDED_TYPES), - aCharFmtFT(this, SW_RES(FT_CHARFMT)), - aCharFmtLB(this, SW_RES(LB_CHARFMT)), - aAllLevelFT( this, SW_RES(FT_ALL_LEVEL)), - aAllLevelNF( this, SW_RES(NF_ALL_LEVEL)), - aDelim(this, SW_RES(FT_DELIM)), - aPrefixFT(this, SW_RES(FT_PREFIX)), - aPrefixED(this, SW_RES(ED_PREFIX)), - aSuffixFT(this, SW_RES(FT_SUFFIX)), - aSuffixED(this, SW_RES(ED_SUFFIX)), - aStartLbl(this, SW_RES(FT_START)), - aStartEdit(this, SW_RES(ED_START)), - aPreviewWIN( this, SW_RES(WIN_PREVIEW )), - - aNoFmtName(SW_RES(ST_NO_COLL)), - pSh(0), - pCollNames(0), - nActLevel(1) -{ - FreeResource(); - SetExchangeSupport(); - - aCollBox.InsertEntry(aNoFmtName); - aLevelLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, LevelHdl)); - aAllLevelNF.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, ToggleComplete)); - aCollBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CollSelect)); - aCollBox.SetGetFocusHdl(LINK(this, SwOutlineSettingsTabPage, CollSelectGetFocus)); - aNumberBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, NumberSelect)); - aPrefixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify)); - aSuffixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify)); - aStartEdit.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, StartModified)); - aCharFmtLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CharFmtHdl)); - -} - -void SwOutlineSettingsTabPage::Update() -{ - // if a template was already selected for this level, select it in the ListBox - aCollBox.Enable(USHRT_MAX != nActLevel); - if(USHRT_MAX == nActLevel) - { - sal_Bool bSamePrefix = sal_True; - sal_Bool bSameSuffix = sal_True; - sal_Bool bSameType = sal_True; - sal_Bool bSameComplete = sal_True; - sal_Bool bSameStart = sal_True; - sal_Bool bSameCharFmt = sal_True; - - const SwNumFmt* aNumFmtArr[MAXLEVEL]; - const SwCharFmt* pFirstFmt = 0; - - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - - aNumFmtArr[ i ] = &pNumRule->Get(i); - if(i == 0) - pFirstFmt = aNumFmtArr[i]->GetCharFmt(); - else - { - bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[0]->GetNumberingType(); - bSameStart &= aNumFmtArr[i]->GetStart() == aNumFmtArr[0]->GetStart(); - bSamePrefix &= aNumFmtArr[i]->GetPrefix() == aNumFmtArr[0]->GetPrefix(); - bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix(); - bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels(); - const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt(); - bSameCharFmt &= (!pFirstFmt && !pFmt) - || (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName()); - } - } - CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType()); - if(bSameType) - aNumberBox.SelectNumberingType( aNumFmtArr[0]->GetNumberingType() ); - else - aNumberBox.SetNoSelection(); - if(bSameStart) - aStartEdit.SetValue(aNumFmtArr[0]->GetStart()); - else - aStartEdit.SetText(aEmptyStr); - if(bSamePrefix) - aPrefixED.SetText(aNumFmtArr[0]->GetPrefix()); - else - aPrefixED.SetText(aEmptyStr); - if(bSameSuffix) - aSuffixED.SetText(aNumFmtArr[0]->GetSuffix()); - else - aSuffixED.SetText(aEmptyStr); - - if(bSameCharFmt) - { - if(pFirstFmt) - aCharFmtLB.SelectEntry(pFirstFmt->GetName()); - else - aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone ); - } - else - aCharFmtLB.SetNoSelection(); - - aAllLevelFT.Enable(sal_True); - aAllLevelNF.Enable(sal_True); - aAllLevelNF.SetMax(MAXLEVEL); - if(bSameComplete) - { - aAllLevelNF.SetValue(aNumFmtArr[0]->GetIncludeUpperLevels()); - } - else - { - aAllLevelNF.SetText(aEmptyStr); - } - } - else - { - sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel); - String aColl(pCollNames[nTmpLevel]); - if(aColl.Len()) - aCollBox.SelectEntry(aColl); - else - aCollBox.SelectEntry(aNoFmtName); - const SwNumFmt &rFmt = pNumRule->Get(nTmpLevel); - - aNumberBox.SelectNumberingType( rFmt.GetNumberingType() ); - aPrefixED.SetText(rFmt.GetPrefix()); - aSuffixED.SetText(rFmt.GetSuffix()); - const SwCharFmt* pFmt = rFmt.GetCharFmt(); - if(pFmt) - aCharFmtLB.SelectEntry(pFmt->GetName()); - else - aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone ); - - if(nTmpLevel) - { - aAllLevelFT.Enable(sal_True); - aAllLevelNF.Enable(sal_True); - aAllLevelNF.SetMax(nTmpLevel + 1); - aAllLevelNF.SetValue(rFmt.GetIncludeUpperLevels()); - } - else - { - aAllLevelNF.SetText(aEmptyStr); - aAllLevelNF.Enable(sal_False); - aAllLevelFT.Enable(sal_False); - } - CheckForStartValue_Impl(rFmt.GetNumberingType()); - aStartEdit.SetValue( rFmt.GetStart() ); - } - SetModified(); -} - -IMPL_LINK( SwOutlineSettingsTabPage, LevelHdl, ListBox *, pBox ) -{ - nActLevel = 0; - if(pBox->IsEntryPosSelected( MAXLEVEL )) - { - nActLevel = 0xFFFF; - } - else - { - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) - { - if(pBox->IsEntryPosSelected( i )) - nActLevel |= nMask; - nMask <<= 1; - } - } - Update(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, ToggleComplete, NumericField *, pFld ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActLevel & nMask) - { - SwNumFmt aNumFmt(pNumRule->Get(i)); - aNumFmt.SetIncludeUpperLevels( Min( (sal_uInt8)pFld->GetValue(), - (sal_uInt8)(i + 1)) ); - pNumRule->Set(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, CollSelect, ListBox *, pBox ) -{ - sal_uInt8 i; - - const String aCollName(pBox->GetSelectEntry()); - //0xFFFF not allowed here (disable) - sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel); - String sOldName( pCollNames[nTmpLevel] ); - - for( i = 0; i < MAXLEVEL; ++i) - pCollNames[i] = aSaveCollNames[i]; - - if(aCollName == aNoFmtName) - pCollNames[nTmpLevel] = aEmptyStr; - else - { - pCollNames[nTmpLevel] = aCollName; - // template already in use? - for( i = 0; i < MAXLEVEL; ++i) - if(i != nTmpLevel && pCollNames[i] == aCollName ) - pCollNames[i] = aEmptyStr; - } - - // search the oldname and put it into the current entries - if( sOldName.Len() ) - for( i = 0; i < MAXLEVEL; ++i) - if( aSaveCollNames[ i ] == sOldName && i != nTmpLevel && - !pCollNames[ i ].Len() ) - { - sal_uInt8 n; - for( n = 0; n < MAXLEVEL; ++n ) - if( pCollNames[ n ] == sOldName ) - break; - - if( MAXLEVEL == n ) - // it was a outline leveld name and the current entries is zero. - pCollNames[ i ] = sOldName; - } - - SetModified(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, CollSelectGetFocus, ListBox *, EMPTYARG ) -{ - for( sal_uInt8 i = 0; i < MAXLEVEL; ++i) - aSaveCollNames[i] = pCollNames[i]; - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, NumberSelect, SwNumberingTypeListBox *, pBox ) -{ - sal_uInt16 nMask = 1; - sal_Int16 nNumberType = pBox->GetSelectedNumberingType(); - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActLevel & nMask) - { - SwNumFmt aNumFmt(pNumRule->Get(i)); - aNumFmt.SetNumberingType(nNumberType); - pNumRule->Set(i, aNumFmt); - CheckForStartValue_Impl(nNumberType); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, DelimModify, Edit *, EMPTYARG ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActLevel & nMask) - { - SwNumFmt aNumFmt(pNumRule->Get(i)); - aNumFmt.SetPrefix( aPrefixED.GetText() ); - aNumFmt.SetSuffix( aSuffixED.GetText() ); - pNumRule->Set(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, StartModified, NumericField *, pFld ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActLevel & nMask) - { - SwNumFmt aNumFmt(pNumRule->Get(i)); - aNumFmt.SetStart( (sal_uInt16)pFld->GetValue() ); - pNumRule->Set(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SwOutlineSettingsTabPage, CharFmtHdl, ListBox *, EMPTYARG ) -{ - String sEntry = aCharFmtLB.GetSelectEntry(); - sal_uInt16 nMask = 1; - sal_Bool bFormatNone = sEntry == ViewShell::GetShellRes()->aStrNone; - SwCharFmt* pFmt = 0; - if(!bFormatNone) - { - sal_uInt16 nChCount = pSh->GetCharFmtCount(); - for(sal_uInt16 i = 0; i < nChCount; i++) - { - SwCharFmt& rChFmt = pSh->GetCharFmt(i); - if(rChFmt.GetName() == sEntry) - { - pFmt = &rChFmt; - break; - } - } - if(!pFmt) - { - SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - SfxStyleSheetBase* pBase; - pBase = pPool->Find(sEntry, SFX_STYLE_FAMILY_CHAR); - if(!pBase) - pBase = &pPool->Make(sEntry, SFX_STYLE_FAMILY_PAGE); - pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt(); - - } - } - - for(sal_uInt16 i = 0; i < MAXLEVEL; i++) - { - if(nActLevel & nMask) - { - SwNumFmt aNumFmt(pNumRule->Get(i)); - if(bFormatNone) - aNumFmt.SetCharFmt(0); - else - aNumFmt.SetCharFmt(pFmt); - pNumRule->Set(i, aNumFmt); - } - nMask <<= 1; - } - return RET_OK; -} - -SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage() -{ -} - -void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) -{ - pSh = pShell; - // query this document's NumRules - pNumRule = ((SwOutlineTabDialog*)GetTabDialog())->GetNumRule(); - pCollNames = ((SwOutlineTabDialog*)GetTabDialog())->GetCollNames(); - - aPreviewWIN.SetNumRule(pNumRule); - aPreviewWIN.SetOutlineNames(pCollNames); - // set start value - nActLevel must be 1 here - sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel); - const SwNumFmt& rNumFmt = pNumRule->Get( nTmpLevel ); - aStartEdit.SetValue( rNumFmt.GetStart() ); - - // create pool formats for headlines - String sStr; - sal_uInt16 i; - for( i = 0; i < MAXLEVEL; ++i ) - { - aCollBox.InsertEntry( SwStyleNameMapper::GetUIName( - static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), aEmptyStr )); - aLevelLB.InsertEntry( String::CreateFromInt32(i + 1) ); - } - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " )); - sStr += String::CreateFromInt32(MAXLEVEL); - aLevelLB.InsertEntry( sStr ); - - // query the texttemplates' outlining levels - const sal_uInt16 nCount = pSh->GetTxtFmtCollCount(); - for( i = 0; i < nCount; ++i ) - { - SwTxtFmtColl &rTxtColl = pSh->GetTxtFmtColl(i); - if(!rTxtColl.IsDefault()) - { - sStr = rTxtColl.GetName(); - if(LISTBOX_ENTRY_NOTFOUND == aCollBox.GetEntryPos( sStr )) - aCollBox.InsertEntry( sStr ); - } - } - - aNumberBox.SelectNumberingType(rNumFmt.GetNumberingType()); - sal_uInt16 nOutlinePos = pSh->GetOutlinePos(MAXLEVEL); - sal_uInt16 nTmp = 0; - if(nOutlinePos != USHRT_MAX) - { - nTmp = static_cast<sal_uInt16>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos)); - } - aLevelLB.SelectEntryPos(nTmp-1);//nTmp);//#outline level,zhaojianwei - - // collect char styles - aCharFmtLB.Clear(); - aCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone ); - - // char styles - ::FillCharStyleListBox(aCharFmtLB, - pSh->GetView().GetDocShell()); - Update(); -} - -void SwOutlineSettingsTabPage::ActivatePage(const SfxItemSet& ) -{ - nActLevel = SwOutlineTabDialog::GetActNumLevel(); - if(nActLevel != USHRT_MAX) - aLevelLB.SelectEntryPos(lcl_BitToLevel(nActLevel)); - else - aLevelLB.SelectEntryPos(MAXLEVEL); - LevelHdl(&aLevelLB); -} - -int SwOutlineSettingsTabPage::DeactivatePage(SfxItemSet*) -{ - SwOutlineTabDialog::SetActNumLevel(nActLevel); - return LEAVE_PAGE; -} - -sal_Bool SwOutlineSettingsTabPage::FillItemSet( SfxItemSet& ) -{ - return sal_True; -} - -void SwOutlineSettingsTabPage::Reset( const SfxItemSet& rSet ) -{ - ActivatePage(rSet); -} - -SfxTabPage* SwOutlineSettingsTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SwOutlineSettingsTabPage(pParent, rAttrSet); -} - -void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) -{ - sal_Bool bIsNull = aStartEdit.GetValue() == 0; - sal_Bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC || - SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType || - SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType; - aStartEdit.SetMin(bNoZeroAllowed ? 1 : 0); - if(bIsNull && bNoZeroAllowed) - aStartEdit.GetModifyHdl().Call(&aStartEdit); -} - -sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev, - const SwNumFmt& rFmt, sal_uInt16 nXStart, - sal_uInt16 nYStart, const Size& rSize) -{ - Font aTmpFont(pVDev->GetFont()); - - Font aFont(*rFmt.GetBulletFont()); - aFont.SetSize(rSize); - aFont.SetTransparent(sal_True); - pVDev->SetFont( aFont ); - String aText(rFmt.GetBulletChar()); - pVDev->DrawText( Point(nXStart, nYStart), aText ); - sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText); - - pVDev->SetFont(aTmpFont); - return nRet; -} - -sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, sal_uInt16 nXStart, - sal_uInt16 nYStart, sal_uInt16 nDivision) -{ - const SvxBrushItem* pBrushItem = rFmt.GetBrush(); - sal_uInt16 nRet = 0; - if(pBrushItem) - { - const Graphic* pGrf = pBrushItem->GetGraphic(); - if(pGrf) - { - Size aGSize( rFmt.GetGraphicSize()); - aGSize.Width() /= nDivision; - nRet = (sal_uInt16)aGSize.Width(); - aGSize.Height() /= nDivision; - pGrf->Draw( pVDev, Point(nXStart,nYStart), - pVDev->PixelToLogic( aGSize ) ); - } - } - return nRet; - -} - -/*-------------------------------------------------- - paint numbering's preview ---------------------------------------------------*/ -void NumberingPreview::Paint( const Rectangle& /*rRect*/ ) -{ - Size aSize(PixelToLogic(GetOutputSizePixel())); - Rectangle aRect(Point(0,0), aSize); - - VirtualDevice* pVDev = new VirtualDevice(*this); - pVDev->SetMapMode(GetMapMode()); - pVDev->SetOutputSize( aSize ); - - // #101524# OJ - pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); - pVDev->SetLineColor( GetSettings().GetStyleSettings().GetButtonTextColor() ); - pVDev->DrawRect(aRect); - - if(pActNum) - { - sal_uInt16 nWidthRelation; - if(nPageWidth) - { - nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width()); - if(bPosition) - nWidthRelation = nWidthRelation * 2 / 3; - else - nWidthRelation = nWidthRelation / 4; - } - else - nWidthRelation = 30; // chapter dialog - - // height per level - sal_uInt16 nXStep = sal_uInt16(aSize.Width() / (3 * MAXLEVEL)); - if(MAXLEVEL < 10) - nXStep /= 2; - sal_uInt16 nYStart = 4; - sal_uInt16 nYStep = sal_uInt16((aSize.Height() - 6)/ MAXLEVEL); - aStdFont = OutputDevice::GetDefaultFont( - DEFAULTFONT_UI_SANS, (LanguageType)GetAppLanguage(), - DEFAULTFONT_FLAGS_ONLYONE, this ); - // #101524# OJ - aStdFont.SetColor( SwViewOption::GetFontColor() ); - - sal_uInt16 nFontHeight = nYStep * 6 / 10; - if(bPosition) - nFontHeight = nYStep * 15 / 10; - aStdFont.SetSize(Size( 0, nFontHeight )); - - sal_uInt16 nPreNum = pActNum->Get(0).GetStart(); - - if(bPosition) - { - sal_uInt16 nLineHeight = nFontHeight * 8 / 7; - sal_uInt8 nStart = 0; - while( !(nActLevel & (1<<nStart)) ) - { - nStart++; - } - if(nStart) // so that possible predecessors and successors are showed - nStart--; - - SwNumberTree::tNumberVector aNumVector; - sal_uInt8 nEnd = Min( (sal_uInt8)(nStart + 3), MAXLEVEL ); - for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel ) - { - const SwNumFmt &rFmt = pActNum->Get(nLevel); - aNumVector.push_back(rFmt.GetStart()); - - sal_uInt16 nXStart( 0 ); - short nTextOffset( 0 ); - sal_uInt16 nNumberXPos( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nXStart = rFmt.GetAbsLSpace() / nWidthRelation; - nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation; - nNumberXPos = nXStart; - sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation; - - if(nFirstLineOffset <= nNumberXPos) - nNumberXPos = nNumberXPos - nFirstLineOffset; - else - nNumberXPos = 0; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - const long nTmpNumberXPos( ( rFmt.GetIndentAt() + - rFmt.GetFirstLineIndent() ) / - nWidthRelation ); - if ( nTmpNumberXPos < 0 ) - { - nNumberXPos = 0; - } - else - { - nNumberXPos = static_cast<sal_uInt16>(nTmpNumberXPos); - } - } - - sal_uInt16 nBulletWidth = 0; - if( SVX_NUM_BITMAP == rFmt.GetNumberingType() ) - { - nBulletWidth = lcl_DrawGraphic(pVDev, rFmt, - nNumberXPos, - nYStart, nWidthRelation); - } - else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) - { - nBulletWidth = lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()); - } - else - { - pVDev->SetFont(aStdFont); - if(pActNum->IsContinusNum()) - aNumVector[nLevel] = nPreNum; - // #128041# - String aText(pActNum->MakeNumString( aNumVector )); - pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); - nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText); - nPreNum++; - } - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT && - rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE ) - { - pVDev->SetFont(aStdFont); - String aText(' '); - pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); - nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText); - } - - sal_uInt16 nTextXPos( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nTextXPos = nXStart; - if(nTextOffset < 0) - nTextXPos = nTextXPos + nTextOffset; - if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos ) - nTextXPos = nNumberXPos + nBulletWidth + nTextOffset; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - switch ( rFmt.GetLabelFollowedBy() ) - { - case SvxNumberFormat::LISTTAB: - { - nTextXPos = static_cast<sal_uInt16>( - rFmt.GetListtabPos() / nWidthRelation ); - if ( nTextXPos < nNumberXPos + nBulletWidth ) - { - nTextXPos = nNumberXPos + nBulletWidth; - } - } - break; - case SvxNumberFormat::SPACE: - case SvxNumberFormat::NOTHING: - { - nTextXPos = nNumberXPos + nBulletWidth; - } - break; - } - - nXStart = static_cast<sal_uInt16>( rFmt.GetIndentAt() / nWidthRelation ); - } - - - Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2)); - pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); // Color( COL_BLACK ) ); - pVDev->DrawRect( aRect1 ); - - Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2)); - pVDev->DrawRect( aRect2 ); - nYStart += 2 * nLineHeight; - } - } - else - { - SwNumberTree::tNumberVector aNumVector; - sal_uInt16 nLineHeight = nFontHeight * 3 / 2; - for( sal_uInt8 nLevel = 0; nLevel < MAXLEVEL; - ++nLevel, nYStart = nYStart + nYStep ) - { - const SwNumFmt &rFmt = pActNum->Get(nLevel); - aNumVector.push_back(rFmt.GetStart()); - sal_uInt16 nXStart( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nXStart = rFmt.GetAbsLSpace() / nWidthRelation; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - const long nTmpXStart( ( rFmt.GetIndentAt() + - rFmt.GetFirstLineIndent() ) / - nWidthRelation ); - if ( nTmpXStart < 0 ) - { - nXStart = 0; - } - else - { - nXStart = static_cast<sal_uInt16>(nTmpXStart); - } - } - nXStart /= 2; - nXStart += 2; - sal_uInt16 nTextOffset = 2 * nXStep; - if( SVX_NUM_BITMAP == rFmt.GetNumberingType() ) - { - lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation); - nTextOffset = nLineHeight + nXStep; - } - else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) - { - nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize()); - nTextOffset = nTextOffset + nXStep; - } - else - { - pVDev->SetFont(aStdFont); - if(pActNum->IsContinusNum()) - aNumVector[nLevel] = nPreNum; - // #128041# - String aText(pActNum->MakeNumString( aNumVector )); - pVDev->DrawText( Point(nXStart, nYStart), aText ); - nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText); - nTextOffset = nTextOffset + nXStep; - nPreNum++; - } - pVDev->SetFont(aStdFont); - - // Changed as per BugID 79541 Branding/Configuration - uno::Any MyAny = ::utl::ConfigManager::GetConfigManager(). - GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - ::rtl::OUString aProductName; - - MyAny >>= aProductName; - String sMsg(C2S("%PRODUCTNAME")); - sMsg.SearchAndReplaceAscii( "%PRODUCTNAME" , aProductName ); - - if(pOutlineNames) - sMsg = pOutlineNames[nLevel]; - pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg ); - } - } - } - DrawOutDev( Point(0,0), aSize, - Point(0,0), aSize, - *pVDev ); - delete pVDev; - -} - -NumberingPreview::~NumberingPreview() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/outline.hrc b/sw/source/ui/misc/outline.hrc deleted file mode 100644 index 2d24c71954..0000000000 --- a/sw/source/ui/misc/outline.hrc +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************* - * - * 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_1 1 -#define RB_2 2 -#define RB_3 3 -#define RB_4 4 -#define RB_5 5 -#define FT_1 6 -#define FT_2 7 -#define FT_3 8 -#define FT_4 9 -#define FT_5 10 -#define FI_1 11 -#define FI_2 12 -#define FI_3 13 -#define FI_4 14 -#define FI_5 15 -//#define FL_LEVEL 16 - -#define FT_COLL 20 -#define LB_COLL 21 -#define FT_NUMBER 22 -#define LB_NUMBER 23 -#define FT_DELIM 24 -#define FT_DELIM_BEVOR 25 -#define FT_DELIM_AFTER 26 -#define ED_DELIM_BEVOR 27 -#define ED_DELIM_AFTER 28 -#define CB_COMPLETE 29 -#define FL_NUMBER 30 - -#define LB_ALIGN 31 -#define FL_ALIGN 33 - -#define FT_START 40 -#define ED_START 41 -#define FL_START 42 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 -#define BT_FORM 103 -#define BT_RESET 104 -#define FL_FORM 105 -#define LB_FORM 106 -#define ED_FORM 107 -#define FT_ALL_LEVEL 108 -#define NF_ALL_LEVEL 109 - -#define MN_FORM 110 -#define MN_FORM1 111 -#define MN_FORMBASE MN_FORM1 -#define MN_FORM2 112 -#define MN_FORM3 113 -#define MN_FORM4 114 -#define MN_FORM5 115 -#define MN_FORM6 116 -#define MN_FORM7 117 -#define MN_FORM8 118 -#define MN_FORM9 119 -#define MN_SAVE 120 - -#define FL_LEVEL 130 -#define LB_LEVEL 131 -#define WIN_PREVIEW 132 -#define FT_SUFFIX 134 -#define ED_SUFFIX 135 -#define FT_PREFIX 136 -#define ED_PREFIX 137 -#define ST_NO_COLL 138 - -#define ST_FORM 140 -#define FT_CHARFMT 141 -#define LB_CHARFMT 141 diff --git a/sw/source/ui/misc/outline.src b/sw/source/ui/misc/outline.src deleted file mode 100644 index 7a427ba9db..0000000000 --- a/sw/source/ui/misc/outline.src +++ /dev/null @@ -1,382 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "outline.hrc" -#include "globals.hrc" -#include "cmdid.h" -#include "helpid.h" -ModalDialog DLG_NUM_NAMES -{ - HelpID = HID_NUM_NAMES ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 164 , 82 ) ; - Text [ en-US ] = "Save As"; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 108 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 108 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 108 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_FORM - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Format" ; - }; - ListBox LB_FORM - { - HelpID = "sw:ListBox:DLG_NUM_NAMES:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 29 ) ; - Size = MAP_APPFONT ( 84 , 42 ) ; - TabStop = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Untitled 1" ; > ; - < "Untitled 2" ; > ; - < "Untitled 3" ; > ; - < "Untitled 4" ; > ; - < "Untitled 5" ; > ; - < "Untitled 6" ; > ; - < "Untitled 7" ; > ; - < "Untitled 8" ; > ; - < "Untitled 9" ; > ; - }; - }; - Edit ED_FORM - { - HelpID = "sw:Edit:DLG_NUM_NAMES:ED_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 84 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; -}; -/**************************************************************************/ -/* */ -/* */ -/* */ -/**************************************************************************/ -TabDialog DLG_TAB_OUTLINE -{ - OutputSize = TRUE ; - SVLook = TRUE ; - // --> OD 2008-04-14 #outlinelevel# - // dialog title is now given by resource STR_OUTLINE_NUMBERING -// Text [ en-US ] = "Outline Numbering" ; - Moveable = TRUE ; - TabControl 1 - { - SVLook = TRUE ; - PageList = - { - PageItem - { - Identifier = TP_OUTLINE_NUM ; - Text [ en-US ] = "Numbering" ; - }; - PageItem - { - Identifier = TP_NUM_POSITION ; - Text [ en-US ] = "Position" ; - }; - }; - }; - String ST_FORM - { - Text [ en-US ] = "~Format" ; - }; - Menu MN_FORM - { - ItemList = - { - MenuItem - { - Identifier = MN_FORM1 ; - Text [ en-US ] = "Untitled 1" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM2 ; - Text [ en-US ] = "Untitled 2" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM3 ; - Text [ en-US ] = "Untitled 3" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM4 ; - Text [ en-US ] = "Untitled 4" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM5 ; - Text [ en-US ] = "Untitled 5" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM6 ; - Text [ en-US ] = "Untitled 6" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM7 ; - Text [ en-US ] = "Untitled 7" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM8 ; - Text [ en-US ] = "Untitled 8" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Identifier = MN_FORM9 ; - Text [ en-US ] = "Untitled 9" ; - HelpID = HID_NUM_OUTL_NAMED_NUMS ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = MN_SAVE ; - Text [ en-US ] = "Save ~As..."; - HelpID = HID_NUM_OUTL_NUM_SAVEAS ; - }; - }; - }; -}; -/**************************************************************************/ -/* */ -/* TabPage */ -/* */ -/**************************************************************************/ -TabPage TP_OUTLINE_NUM -{ - HelpID = HID_TP_OUTLINE_NUM ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - ListBox LB_LEVEL - { - HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_LEVEL"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 23 , 129 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - Border = TRUE ; - }; - FixedLine FL_LEVEL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 32 , 8 ) ; - Text [ en-US ] = "Level" ; - }; - FixedText FT_COLL - { - Pos = MAP_APPFONT ( 50 , 14 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Paragraph Style" ; - Group = TRUE ; - Left = TRUE ; - }; - ListBox LB_COLL - { - HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_COLL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 25 ) ; - Size = MAP_APPFONT ( 120 , 75 ) ; - TabStop = TRUE ; - Group = TRUE ; - Sort = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - }; - FixedText FT_NUMBER - { - Pos = MAP_APPFONT ( 50 , 43 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Number" ; - Left = TRUE ; - }; - ListBox LB_NUMBER - { - HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_NUMBER"; - Pos = MAP_APPFONT ( 104 , 41 ) ; - Size = MAP_APPFONT ( 66 , 65 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - }; - FixedText FT_CHARFMT - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Character Style" ; - }; - ListBox LB_CHARFMT - { - HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_CHARFMT"; - TabStop = TRUE ; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 104 , 57 ) ; - Size = MAP_APPFONT ( 66 , 65 ) ; - }; - FixedText FT_ALL_LEVEL - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "Sho~w sublevels" ; - }; - NumericField NF_ALL_LEVEL - { - HelpID = "sw:NumericField:TP_OUTLINE_NUM:NF_ALL_LEVEL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 104 , 73 ) ; - Size = MAP_APPFONT ( 66 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 10 ; - Value = 1 ; - First = 1 ; - Last = 10 ; - }; - FixedText FT_DELIM - { - Pos = MAP_APPFONT ( 50 , 89 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "Separator" ; - Left = TRUE ; - }; - FixedText FT_PREFIX - { - Pos = MAP_APPFONT ( 56 , 102 ) ; - Size = MAP_APPFONT ( 46 , 8 ) ; - Text [ en-US ] = "~Before" ; - Left = TRUE ; - }; - Edit ED_PREFIX - { - HelpID = "sw:Edit:TP_OUTLINE_NUM:ED_PREFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 104 , 100 ) ; - Size = MAP_APPFONT ( 66 , 12 ) ; - TabStop = TRUE ; - Group = TRUE ; - Left = TRUE ; - }; - FixedText FT_SUFFIX - { - Pos = MAP_APPFONT ( 56 , 117 ) ; - Size = MAP_APPFONT ( 46 , 8 ) ; - Text [ en-US ] = "~After" ; - Left = TRUE ; - }; - Edit ED_SUFFIX - { - HelpID = "sw:Edit:TP_OUTLINE_NUM:ED_SUFFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 104 , 115 ) ; - Size = MAP_APPFONT ( 66 , 12 ) ; - TabStop = TRUE ; - Group = TRUE ; - Left = TRUE ; - }; - FixedText FT_START - { - Pos = MAP_APPFONT ( 50 , 133 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Start at" ; - Left = TRUE ; - }; - NumericField ED_START - { - HelpID = "sw:NumericField:TP_OUTLINE_NUM:ED_START"; - Border = TRUE ; - Pos = MAP_APPFONT ( 104 , 131 ) ; - Size = MAP_APPFONT ( 66 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - Maximum = 999 ; - Value = 0 ; - First = 0 ; - Last = 99 ; - SpinSize = 1 ; - }; - FixedLine FL_NUMBER - { - Pos = MAP_APPFONT ( 44 , 3 ) ; - Size = MAP_APPFONT ( 210 , 8 ) ; - Text [ en-US ] = "Numbering" ; - Group = TRUE ; - }; - Window WIN_PREVIEW - { - Pos = MAP_APPFONT ( 179 , 14 ) ; - Size = MAP_APPFONT ( 72 , 129 ) ; - }; - String ST_NO_COLL - { - Text [ en-US ] = "(none)" ; - }; -}; - diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx deleted file mode 100644 index 4abda6dd57..0000000000 --- a/sw/source/ui/misc/pgfnote.cxx +++ /dev/null @@ -1,398 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <hintids.hxx> -#include <tools/ref.hxx> -#include <svx/dialogs.hrc> -#include <svx/drawitem.hxx> -#include <svx/xtable.hxx> // XColorTable -#include <sal/macros.h> -#include <vcl/field.hxx> -#include <vcl/svapp.hxx> -#include <unotools/localedatawrapper.hxx> -#include <unotools/syslocale.hxx> -#include <editeng/borderline.hxx> -#include <editeng/sizeitem.hxx> -#include <svx/pageitem.hxx> -#include <svl/eitem.hxx> -#include <editeng/ulspitem.hxx> -#include <uitool.hxx> -#include <pagedesc.hxx> -#include <pgfnote.hxx> -#include <uiitems.hxx> -#include <sfx2/objsh.hxx> - -#include <globals.hrc> -#include <misc.hrc> -#include <pgfnote.hrc> - -static sal_uInt16 aPageRg[] = { - FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO, - 0 -}; - -/*------------------------------------------------------------------------ - Description: handler to switch between the different possibilities - how the footnote region's height can be set. -------------------------------------------------------------------------*/ -IMPL_LINK_INLINE_START( SwFootNotePage, HeightPage, Button *, EMPTYARG ) -{ - aMaxHeightEdit.Enable(sal_False); - return 0; -} -IMPL_LINK_INLINE_END( SwFootNotePage, HeightPage, Button *, EMPTYARG ) - - -IMPL_LINK_INLINE_START( SwFootNotePage, HeightMetric, Button *, EMPTYARG ) -{ - aMaxHeightEdit.Enable(); - aMaxHeightEdit.GrabFocus(); - return 0; -} -IMPL_LINK_INLINE_END( SwFootNotePage, HeightMetric, Button *, EMPTYARG ) - -/*------------------------------------------------------------------------ - Description: handler limit values -------------------------------------------------------------------------*/ -IMPL_LINK( SwFootNotePage, HeightModify, MetricField *, EMPTYARG ) -{ - aMaxHeightEdit.SetMax(aMaxHeightEdit.Normalize(lMaxHeight - - (aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP)) + - aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))), - FUNIT_TWIP); - if(aMaxHeightEdit.GetValue() < 0) - aMaxHeightEdit.SetValue(0); - aDistEdit.SetMax(aDistEdit.Normalize(lMaxHeight - - (aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP)) + - aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))), - FUNIT_TWIP); - if(aDistEdit.GetValue() < 0) - aDistEdit.SetValue(0); - aLineDistEdit.SetMax(aLineDistEdit.Normalize(lMaxHeight - - (aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP)) + - aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP)))), - FUNIT_TWIP); - return 0; -} - -IMPL_LINK( SwFootNotePage, LineWidthChanged_Impl, void *, EMPTYARG ) -{ - sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - aLineWidthEdit.GetValue( ), - aLineWidthEdit.GetDecimalDigits( ), - aLineWidthEdit.GetUnit(), MAP_TWIP )); - aLineTypeBox.SetWidth( nVal ); - - return 0; -} - -IMPL_LINK( SwFootNotePage, LineColorSelected_Impl, void *, EMPTYARG ) -{ - aLineTypeBox.SetColor( aLineColorBox.GetSelectEntryColor() ); - return 0; -} - -// CTOR / DTOR ----------------------------------------------------------- - -SwFootNotePage::SwFootNotePage(Window *pParent, const SfxItemSet &rSet) : - - SfxTabPage(pParent, SW_RES(TP_FOOTNOTE_PAGE), rSet), - aPosHeader(this, SW_RES(FL_FOOTNOTE_SIZE)), - aMaxHeightPageBtn(this, SW_RES(RB_MAXHEIGHT_PAGE)), - aMaxHeightBtn(this, SW_RES(RB_MAXHEIGHT)), - aMaxHeightEdit(this, SW_RES(ED_MAXHEIGHT)), - aDistLbl(this, SW_RES(FT_DIST)), - aDistEdit(this, SW_RES(ED_DIST)), - - aLineHeader(this, SW_RES(FL_LINE)), - aLinePosLbl(this, SW_RES(FT_LINEPOS)), - aLinePosBox(this, SW_RES(DLB_LINEPOS)), - aLineTypeLbl(this, SW_RES(FT_LINETYPE)), - aLineTypeBox(this, SW_RES(DLB_LINETYPE)), - aLineWidthLbl(this, SW_RES(FT_LINEWIDTH)), - aLineWidthEdit(this, SW_RES(ED_LINEWIDTH)), - aLineColorLbl(this, SW_RES(FT_LINECOLOR)), - aLineColorBox(this, SW_RES(DLB_LINECOLOR)), - aLineLengthLbl(this, SW_RES(FT_LINELENGTH)), - aLineLengthEdit(this, SW_RES(ED_LINELENGTH)), - aLineDistLbl(this, SW_RES(FT_LINEDIST)), - aLineDistEdit(this, SW_RES(ED_LINEDIST)) - { - FreeResource(); - - SetExchangeSupport(); - FieldUnit aMetric = ::GetDfltMetric(sal_False); - SetMetric( aMaxHeightEdit, aMetric ); - SetMetric( aDistEdit, aMetric ); - SetMetric( aLineDistEdit, aMetric ); - MeasurementSystem eSys = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - long nHeightValue = MEASURE_METRIC != eSys ? 1440 : 1134; - aMaxHeightEdit.SetValue(aMaxHeightEdit.Normalize(nHeightValue),FUNIT_TWIP);; - aMaxHeightEdit.SetAccessibleRelationLabeledBy(&aMaxHeightBtn); -} - -SwFootNotePage::~SwFootNotePage() -{ -} - -SfxTabPage* SwFootNotePage::Create(Window *pParent, const SfxItemSet &rSet) -{ - return new SwFootNotePage(pParent, rSet); -} - -void SwFootNotePage::Reset(const SfxItemSet &rSet) -{ - // if no example exists, otherwise Init here in Activate - SwPageFtnInfo* pDefFtnInfo = 0; - const SwPageFtnInfo* pFtnInfo; - const SfxPoolItem* pItem = SfxTabPage::GetItem(rSet, FN_PARAM_FTN_INFO); - if( pItem ) - { - pFtnInfo = &((const SwPageFtnInfoItem*)pItem)->GetPageFtnInfo(); - } - else - { - // when "standard" is being activated the footnote item is deleted, - // that's why a footnote structure has to be created here - pDefFtnInfo = new SwPageFtnInfo(); - pFtnInfo = pDefFtnInfo; - } - // footnote area's height - SwTwips lHeight = pFtnInfo->GetHeight(); - if(lHeight) - { - aMaxHeightEdit.SetValue(aMaxHeightEdit.Normalize(lHeight),FUNIT_TWIP); - aMaxHeightBtn.Check(sal_True); - } - else - { - aMaxHeightPageBtn.Check(sal_True); - aMaxHeightEdit.Enable(sal_False); - } - aMaxHeightPageBtn.SetClickHdl(LINK(this,SwFootNotePage,HeightPage)); - aMaxHeightBtn.SetClickHdl(LINK(this,SwFootNotePage,HeightMetric)); - Link aLk = LINK(this, SwFootNotePage, HeightModify); - aMaxHeightEdit.SetLoseFocusHdl( aLk ); - aDistEdit.SetLoseFocusHdl( aLk ); - aLineDistEdit.SetLoseFocusHdl( aLk ); - - // Separator width - aLineWidthEdit.SetModifyHdl( LINK( this, SwFootNotePage, LineWidthChanged_Impl ) ); - - sal_Int64 nWidthPt = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( - sal_Int64( pFtnInfo->GetLineWidth() ), aLineWidthEdit.GetDecimalDigits(), - MAP_TWIP, aLineWidthEdit.GetUnit( ) )); - aLineWidthEdit.SetValue( nWidthPt ); - - // Separator style - aLineTypeBox.SetSourceUnit( FUNIT_TWIP ); - - aLineTypeBox.SetNone( String( SW_RES( STR_NONE ) ) ); - aLineTypeBox.InsertEntry( ::editeng::SvxBorderLine::getWidthImpl( ::editeng::SOLID ), ::editeng::SOLID ); - aLineTypeBox.InsertEntry( ::editeng::SvxBorderLine::getWidthImpl( ::editeng::DOTTED ), ::editeng::DOTTED ); - aLineTypeBox.InsertEntry( ::editeng::SvxBorderLine::getWidthImpl( ::editeng::DASHED ), ::editeng::DASHED ); - aLineTypeBox.SetWidth( pFtnInfo->GetLineWidth( ) ); - aLineTypeBox.SelectEntry( pFtnInfo->GetLineStyle() ); - - // Separator Color - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pColorItem = NULL; - XColorTable* pColorTable = NULL; - - OSL_ENSURE( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - pColorItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pColorItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pColorItem )->GetColorTable(); - } - - OSL_ENSURE( pColorTable, "ColorTable not found!" ); - - if ( pColorTable ) - { - aLineColorBox.SetUpdateMode( sal_False ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - XColorEntry* pEntry = pColorTable->GetColor(i); - aLineColorBox.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - aLineColorBox.SetUpdateMode( sal_True ); - } - - // select color in the list or add it as a user color - sal_uInt16 nSelPos = aLineColorBox.GetEntryPos( pFtnInfo->GetLineColor() ); - if( nSelPos == LISTBOX_ENTRY_NOTFOUND ) - nSelPos = aLineColorBox.InsertEntry( pFtnInfo->GetLineColor(), - String( SW_RES( RID_SVXSTR_COLOR_USER ) ) ); - - aLineColorBox.SetSelectHdl( LINK( this, SwFootNotePage, LineColorSelected_Impl ) ); - aLineColorBox.SelectEntryPos( nSelPos ); - aLineTypeBox.SetColor( pFtnInfo->GetLineColor() ); - - - // position - aLinePosBox.SelectEntryPos( static_cast< sal_uInt16 >(pFtnInfo->GetAdj()) ); - - // width - Fraction aTmp( 100, 1 ); - aTmp *= pFtnInfo->GetWidth(); - aLineLengthEdit.SetValue( static_cast<long>(aTmp) ); - - // gap footnote area - aDistEdit.SetValue(aDistEdit.Normalize(pFtnInfo->GetTopDist()),FUNIT_TWIP); - aLineDistEdit.SetValue( - aLineDistEdit.Normalize(pFtnInfo->GetBottomDist()), FUNIT_TWIP); - ActivatePage( rSet ); - delete pDefFtnInfo; -} - -/*-------------------------------------------------------------------- - Description: stuff attributes into the set, when OK - --------------------------------------------------------------------*/ -sal_Bool SwFootNotePage::FillItemSet(SfxItemSet &rSet) -{ - SwPageFtnInfoItem aItem((const SwPageFtnInfoItem&)GetItemSet().Get(FN_PARAM_FTN_INFO)); - - // that's the original - SwPageFtnInfo &rFtnInfo = aItem.GetPageFtnInfo(); - - // footnote area's height - if(aMaxHeightBtn.IsChecked()) - rFtnInfo.SetHeight( static_cast< SwTwips >( - aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP)))); - else - rFtnInfo.SetHeight(0); - - // gap footnote area - rFtnInfo.SetTopDist( static_cast< SwTwips >( - aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP)))); - rFtnInfo.SetBottomDist( static_cast< SwTwips >( - aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))); - - // Separator style - rFtnInfo.SetLineStyle( ::editeng::SvxBorderStyle( aLineTypeBox.GetSelectEntryStyle() ) ); - - // Separator width - long nWidth = static_cast<long>(MetricField::ConvertDoubleValue( - aLineWidthEdit.GetValue( ), - aLineWidthEdit.GetDecimalDigits( ), - aLineWidthEdit.GetUnit(), MAP_TWIP )); - rFtnInfo.SetLineWidth( nWidth ); - - // Separator color - rFtnInfo.SetLineColor( aLineColorBox.GetSelectEntryColor() ); - - // Position - rFtnInfo.SetAdj((SwFtnAdj)aLinePosBox.GetSelectEntryPos()); - - // Breite - rFtnInfo.SetWidth(Fraction( static_cast< long >(aLineLengthEdit.GetValue()), 100)); - - const SfxPoolItem* pOldItem; - if(0 == (pOldItem = GetOldItem( rSet, FN_PARAM_FTN_INFO )) || - aItem != *pOldItem ) - rSet.Put(aItem); - - return sal_True; -} - -void SwFootNotePage::ActivatePage(const SfxItemSet& rSet) -{ - const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( RES_FRM_SIZE ); - lMaxHeight = rSize.GetSize().Height(); - - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_HEADERSET), sal_False, &pItem ) ) - { - const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet(); - const SfxBoolItem& rHeaderOn = - (const SfxBoolItem&)rHeaderSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_ON ) ); - - if ( rHeaderOn.GetValue() ) - { - const SvxSizeItem& rSizeItem = - (const SvxSizeItem&)rHeaderSet.Get(rSet.GetPool()->GetWhich(SID_ATTR_PAGE_SIZE)); - lMaxHeight -= rSizeItem.GetSize().Height(); - } - } - - if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_FOOTERSET), - sal_False, &pItem ) ) - { - const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet(); - const SfxBoolItem& rFooterOn = - (const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON ); - - if ( rFooterOn.GetValue() ) - { - const SvxSizeItem& rSizeItem = - (const SvxSizeItem&)rFooterSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_SIZE ) ); - lMaxHeight -= rSizeItem.GetSize().Height(); - } - } - - if ( rSet.GetItemState( RES_UL_SPACE , sal_False ) == SFX_ITEM_SET ) - { - const SvxULSpaceItem &rUL = (const SvxULSpaceItem&)rSet.Get( RES_UL_SPACE ); - lMaxHeight -= rUL.GetUpper() + rUL.GetLower(); - } - - lMaxHeight *= 8; - lMaxHeight /= 10; - - // set maximum values - HeightModify(0); -} - -int SwFootNotePage::DeactivatePage( SfxItemSet* _pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - - return sal_True; -} - -sal_uInt16* SwFootNotePage::GetRanges() -{ - return aPageRg; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/pgfnote.hrc b/sw/source/ui/misc/pgfnote.hrc deleted file mode 100644 index 2a69c4542f..0000000000 --- a/sw/source/ui/misc/pgfnote.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * 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_MAXHEIGHT_PAGE 1 -#define RB_MAXHEIGHT 2 -#define ED_MAXHEIGHT 3 -#define FT_DIST 4 -#define ED_DIST 5 -#define FL_FOOTNOTE_SIZE 10 - -#define FT_LINETYPE 20 -#define DLB_LINETYPE 21 -#define FT_LINEPOS 22 -#define DLB_LINEPOS 23 -#define FT_LINELENGTH 24 -#define ED_LINELENGTH 25 -#define FT_LINEDIST 26 -#define ED_LINEDIST 27 -#define FL_LINE 30 -#define FT_LINEWIDTH 31 -#define ED_LINEWIDTH 32 -#define FT_LINECOLOR 33 -#define DLB_LINECOLOR 34 diff --git a/sw/source/ui/misc/pgfnote.src b/sw/source/ui/misc/pgfnote.src deleted file mode 100644 index 9b325fe973..0000000000 --- a/sw/source/ui/misc/pgfnote.src +++ /dev/null @@ -1,242 +0,0 @@ -/************************************************************************* - * - * 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 "pgfnote.hrc" -#include "helpid.h" -TabPage TP_FOOTNOTE_PAGE -{ - HelpID = HID_FOOTNOTE_PAGE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - RadioButton RB_MAXHEIGHT_PAGE - { - HelpID = "sw:RadioButton:TP_FOOTNOTE_PAGE:RB_MAXHEIGHT_PAGE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 132 , 10 ) ; - Text [ en-US ] = "~Not larger than page area" ; - TabStop = TRUE ; - Group = TRUE ; - }; - RadioButton RB_MAXHEIGHT - { - HelpID = "sw:RadioButton:TP_FOOTNOTE_PAGE:RB_MAXHEIGHT"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 132 , 10 ) ; - Text [ en-US ] = "Maximum footnote ~height" ; - }; - MetricField ED_MAXHEIGHT - { - HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_MAXHEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 26 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 50 ; - Maximum = 99999 ; - DecimalDigits = 2 ; - Value = 200 ; - Unit = FUNIT_CM ; - First = 10 ; - Last = 99999 ; - SpinSize = 10 ; - }; - FixedText FT_DIST - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Text [ en-US ] = "Space to text" ; - Left = TRUE ; - }; - MetricField ED_DIST - { - HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_DIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 42 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 999 ; - DecimalDigits = 2 ; - Value = 10 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 99999 ; - SpinSize = 10 ; - }; - FixedLine FL_FOOTNOTE_SIZE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Footnote area" ; - }; - FixedText FT_LINEPOS - { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Position" ; - }; - ListBox DLB_LINEPOS - { - HelpID = "sw:ListBox:TP_FOOTNOTE_PAGE:DLB_LINEPOS"; - Pos = MAP_APPFONT ( 148 , 71 ) ; - Size = MAP_APPFONT ( 57 , 40 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Left" ; Default ; > ; - < "Centered" ; Default ; > ; - < "Right" ; Default ; > ; - }; - }; - FixedText FT_LINETYPE - { - Pos = MAP_APPFONT ( 12 , 89 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ en-US ] = "~Style" ; - }; - ListBox DLB_LINETYPE - { - HelpID = "sw:ListBox:TP_FOOTNOTE_PAGE:DLB_LINETYPE"; - Pos = MAP_APPFONT ( 148 , 87 ) ; - Size = MAP_APPFONT ( 57 , 50 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_LINEWIDTH - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ en-US ] = "~Thickness" ; - }; - MetricField ED_LINEWIDTH - { - HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_LINEWIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 103 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 25 ; - First = 25 ; - Last = 900 ; - Maximum = 900 ; - Minimum = 25 ; - DecimalDigits = 2 ; - Unit = FUNIT_POINT ; - TabStop = TRUE ; - Left = TRUE ; - }; - FixedText FT_LINECOLOR - { - Pos = MAP_APPFONT ( 12 , 121 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ en-US ] = "~Color" ; - }; - ListBox DLB_LINECOLOR - { - Pos = MAP_APPFONT ( 148 , 119 ) ; - Size = MAP_APPFONT ( 57 , 50 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - Border = TRUE ; - }; - - FixedText FT_LINELENGTH - { - Pos = MAP_APPFONT ( 12 , 137 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Length" ; - }; - MetricField ED_LINELENGTH - { - Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 135 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Value = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 10 ; - Last = 100 ; - }; - FixedText FT_LINEDIST - { - Pos = MAP_APPFONT ( 12 , 153 ) ; - Size = MAP_APPFONT ( 132 , 8 ) ; - Text [ en-US ] = "~Spacing to footnote contents" ; - Left = TRUE ; - }; - MetricField ED_LINEDIST - { - HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_LINEDIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 151 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 999 ; - DecimalDigits = 2 ; - Value = 10 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 99999 ; - SpinSize = 10 ; - }; - FixedLine FL_LINE - { - Pos = MAP_APPFONT ( 6 , 60 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Separator line" ; - }; -}; diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx deleted file mode 100644 index 4f00f428be..0000000000 --- a/sw/source/ui/misc/pggrid.cxx +++ /dev/null @@ -1,537 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/app.hxx> - -#include <cmdid.h> -#include <hintids.hxx> -#include <swtypes.hxx> -#include <globals.hrc> -#include <svx/xtable.hxx> -#include <uitool.hxx> -#include <editeng/sizeitem.hxx> -#include <editeng/lrspitem.hxx> -#include <editeng/ulspitem.hxx> -#include <editeng/boxitem.hxx> -#include <editeng/frmdiritem.hxx> -#include <svx/ruler.hxx> -#include <pggrid.hxx> -#include <tgrditem.hxx> -#include <pggrid.hrc> - -#include "wrtsh.hxx" -#include "doc.hxx" -#include "uiitems.hxx" -#include "swmodule.hxx" -#include "view.hxx" - -SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) : - SfxTabPage(pParent, SW_RES(TP_TEXTGRID_PAGE), rSet), - aGridTypeFL (this, SW_RES(FL_GRID_TYPE )), - aNoGridRB (this, SW_RES(RB_NOGRID )), - aLinesGridRB (this, SW_RES(RB_LINESGRID )), - aCharsGridRB (this, SW_RES(RB_CHARSGRID )), - aSnapToCharsCB (this, SW_RES(CB_SNAPTOCHARS )), - aExampleWN (this, SW_RES(WN_EXAMPLE )), - aLayoutFL (this, SW_RES(FL_LAYOUT )), - aLinesPerPageFT (this, SW_RES(FT_LINESPERPAGE )), - aLinesPerPageNF (this, SW_RES(NF_LINESPERPAGE )), - aLinesRangeFT (this, SW_RES(FT_LINERANGE )), - aTextSizeFT (this, SW_RES(FT_TEXTSIZE )), - aTextSizeMF (this, SW_RES(MF_TEXTSIZE )), - aCharsPerLineFT (this, SW_RES(FT_CHARSPERLINE )), - aCharsPerLineNF (this, SW_RES(NF_CHARSPERLINE )), - aCharsRangeFT (this, SW_RES(FT_CHARRANGE )), - aCharWidthFT (this, SW_RES(FT_CHARWIDTH )), - aCharWidthMF (this, SW_RES(MF_CHARWIDTH )), - aRubySizeFT (this, SW_RES(FT_RUBYSIZE )), - aRubySizeMF (this, SW_RES(MF_RUBYSIZE )), - aRubyBelowCB (this, SW_RES(CB_RUBYBELOW )), - aDisplayFL (this, SW_RES(FL_DISPLAY )), - aDisplayCB (this, SW_RES(CB_DISPLAY )), - aPrintCB (this, SW_RES(CB_PRINT )), - aColorFT (this, SW_RES(FT_COLOR )), - aColorLB (this, SW_RES(LB_COLOR )), - m_nRubyUserValue(0), - m_bRubyUserValue(sal_False), - m_aPageSize(MM50, MM50), - m_bVertical(sal_False), - m_bSquaredMode(sal_False), - m_bHRulerChanged( sal_False ), - m_bVRulerChanged( sal_False ) -{ - FreeResource(); - - aControls[0] =&aLayoutFL; - aControls[1] =&aLinesPerPageFT; - aControls[2] =&aLinesPerPageNF; - aControls[3] =&aTextSizeFT; - aControls[4] =&aTextSizeMF; - aControls[5] =&aCharsPerLineFT; - aControls[6] =&aCharsPerLineNF; - aControls[7] =&aCharWidthFT; - aControls[8] =&aCharWidthMF; - aControls[9] =&aRubySizeFT; - aControls[10] =&aRubySizeMF; - aControls[11] =&aRubyBelowCB; - aControls[12] =&aDisplayFL; - aControls[13] =&aDisplayCB; - aControls[14] =&aPrintCB; - aControls[15] =&aColorFT; - aControls[16] =&aColorLB; - aControls[17] =&aLinesRangeFT; - aControls[18] =&aCharsRangeFT; - aControls[19] =0; - - Link aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl); - aCharsPerLineNF.SetUpHdl(aLink); - aCharsPerLineNF.SetDownHdl(aLink); - aCharsPerLineNF.SetLoseFocusHdl(aLink); - aLinesPerPageNF.SetUpHdl(aLink); - aLinesPerPageNF.SetDownHdl(aLink); - aLinesPerPageNF.SetLoseFocusHdl(aLink); - - Link aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl); - aTextSizeMF.SetUpHdl(aSizeLink); - aTextSizeMF.SetDownHdl(aSizeLink); - aTextSizeMF.SetLoseFocusHdl(aSizeLink); - aRubySizeMF.SetUpHdl(aSizeLink); - aRubySizeMF.SetDownHdl(aSizeLink); - aRubySizeMF.SetLoseFocusHdl(aSizeLink); - aCharWidthMF.SetUpHdl(aSizeLink); - aCharWidthMF.SetDownHdl(aSizeLink); - aCharWidthMF.SetLoseFocusHdl(aSizeLink); - - Link aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl); - aNoGridRB .SetClickHdl(aGridTypeHdl); - aLinesGridRB.SetClickHdl(aGridTypeHdl); - aCharsGridRB.SetClickHdl(aGridTypeHdl); - - Link aModifyLk = LINK(this, SwTextGridPage, GridModifyHdl); - aColorLB.SetSelectHdl(aModifyLk); - aPrintCB.SetClickHdl(aModifyLk); - aRubyBelowCB.SetClickHdl(aModifyLk); - - aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl)); - - XColorTable& rColorTbl = XColorTable::GetStdColorTable(); - aColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) ); - for( sal_uInt16 i = 0; i < rColorTbl.Count(); ++i ) - { - XColorEntry* pEntry = rColorTbl.GetColor( i ); - Color aColor = pEntry->GetColor(); - String sName = pEntry->GetName(); - aColorLB.InsertEntry( aColor, sName ); - } - aColorLB.SetUpdateMode( sal_True ); - //Get the default paper mode - SwView *pView = ::GetActiveView(); - if( pView ) - { - SwWrtShell* pSh = pView->GetWrtShellPtr(); - if( pSh ) - { - m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode(); - } - } - if( m_bSquaredMode ) - { - aRubySizeFT.Show(); - aRubySizeMF.Show(); - aRubyBelowCB.Show(); - aSnapToCharsCB.Hide(); - aCharWidthFT.Hide(); - aCharWidthMF.Hide(); - } - else - { - aRubySizeFT.Hide(); - aRubySizeMF.Hide(); - aRubyBelowCB.Hide(); - aSnapToCharsCB.Show(); - aCharWidthFT.Show(); - aCharWidthMF.Show(); - } -} - -SwTextGridPage::~SwTextGridPage() -{ -} - -SfxTabPage *SwTextGridPage::Create(Window *pParent, const SfxItemSet &rSet) -{ - return new SwTextGridPage(pParent, rSet); -} - -sal_Bool SwTextGridPage::FillItemSet(SfxItemSet &rSet) -{ - sal_Bool bRet = sal_False; - if(aNoGridRB.GetSavedValue() != aNoGridRB.IsChecked()|| - aLinesGridRB.GetSavedValue() != aLinesGridRB.IsChecked()|| - aLinesPerPageNF.GetSavedValue().ToInt32() - != aLinesPerPageNF.GetValue()|| - aTextSizeMF.GetSavedValue().ToInt32() != aTextSizeMF.GetValue()|| - aCharsPerLineNF.GetSavedValue().ToInt32() - != aCharsPerLineNF.GetValue()|| - aSnapToCharsCB.GetSavedValue() != aSnapToCharsCB.IsChecked() || - aRubySizeMF.GetSavedValue().ToInt32() != aRubySizeMF.GetValue()|| - aCharWidthMF.GetSavedValue().ToInt32() != aCharWidthMF.GetValue()|| - aRubyBelowCB.GetSavedValue() != aRubyBelowCB.IsChecked()|| - aDisplayCB.GetSavedValue() != aDisplayCB.IsChecked()|| - aPrintCB.GetSavedValue() != aPrintCB.IsChecked()|| - aColorLB.GetSavedValue() != aColorLB.GetSelectEntryPos()) - { - PutGridItem(rSet); - bRet = sal_True; - } - - // draw ticks of ruler - SwView * pView = ::GetActiveView(); - if ( m_bHRulerChanged ) - pView->GetHLineal().DrawTicks(); - if ( m_bVRulerChanged ) - pView->GetVLineal().DrawTicks(); - return bRet; -} - -void SwTextGridPage::Reset(const SfxItemSet &rSet) -{ - if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, sal_True)) - { - const SwTextGridItem& rGridItem = (const SwTextGridItem&)rSet.Get(RES_TEXTGRID); - RadioButton* pButton = 0; - switch(rGridItem.GetGridType()) - { - case GRID_NONE : pButton = &aNoGridRB; break; - case GRID_LINES_ONLY : pButton = &aLinesGridRB; break; - default: pButton = &aCharsGridRB; - } - pButton->Check(); - aDisplayCB.Check(rGridItem.IsDisplayGrid()); - GridTypeHdl(pButton); - aSnapToCharsCB.Check(rGridItem.IsSnapToChars()); - aLinesPerPageNF.SetValue(rGridItem.GetLines()); - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - m_nRubyUserValue = rGridItem.GetBaseHeight(); - m_bRubyUserValue = sal_True; - aTextSizeMF.SetValue(aTextSizeMF.Normalize(m_nRubyUserValue), FUNIT_TWIP); - aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP); - aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP); - aRubyBelowCB.Check(rGridItem.IsRubyTextBelow()); - aPrintCB.Check(rGridItem.IsPrintGrid()); - aColorLB.SelectEntry(rGridItem.GetColor()); - } - UpdatePageSize(rSet); - - aNoGridRB.SaveValue(); - aLinesGridRB.SaveValue(); - aSnapToCharsCB.SaveValue(); - aLinesPerPageNF.SaveValue(); - aTextSizeMF.SaveValue(); - aCharsPerLineNF.SaveValue(); - aRubySizeMF.SaveValue(); - aCharWidthMF.SaveValue(); - aRubyBelowCB.SaveValue(); - aDisplayCB.SaveValue(); - aPrintCB.SaveValue(); - aColorLB.SaveValue(); -} - -void SwTextGridPage::ActivatePage( const SfxItemSet& rSet ) -{ - aExampleWN.Hide(); - aExampleWN.UpdateExample( rSet ); - UpdatePageSize(rSet); - aExampleWN.Show(); - aExampleWN.Invalidate(); -} - -int SwTextGridPage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} - -void SwTextGridPage::PutGridItem(SfxItemSet& rSet) -{ - SwTextGridItem aGridItem; - aGridItem.SetGridType(aNoGridRB.IsChecked() ? GRID_NONE : - aLinesGridRB.IsChecked() ? GRID_LINES_ONLY : GRID_LINES_CHARS ); - aGridItem.SetSnapToChars(aSnapToCharsCB.IsChecked()); - aGridItem.SetLines( static_cast< sal_uInt16 >(aLinesPerPageNF.GetValue()) ); - aGridItem.SetBaseHeight( static_cast< sal_uInt16 >( - m_bRubyUserValue ? m_nRubyUserValue : - aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))) ); - aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))) ); - aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))) ); - aGridItem.SetRubyTextBelow(aRubyBelowCB.IsChecked()); - aGridItem.SetSquaredMode(m_bSquaredMode); - aGridItem.SetDisplayGrid(aDisplayCB.IsChecked()); - aGridItem.SetPrintGrid(aPrintCB.IsChecked()); - aGridItem.SetColor(aColorLB.GetSelectEntryColor()); - rSet.Put(aGridItem); -/// Amelia - SwView * pView = ::GetActiveView(); - if ( aGridItem.GetGridType() != GRID_NONE ) - { - if ( aGridItem.GetGridType() == GRID_LINES_CHARS ) - { - m_bHRulerChanged = sal_True; - } - m_bVRulerChanged = sal_True; - pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7)); - pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7)); - } -} - -void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet) -{ - if( SFX_ITEM_UNKNOWN != rSet.GetItemState( RES_FRAMEDIR, sal_True )) - { - const SvxFrameDirectionItem& rDirItem = - (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR); - m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT|| - rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT; - } - - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE )) - { - const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( - SID_ATTR_PAGE_SIZE); - const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( - RES_LR_SPACE ); - const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get( - RES_UL_SPACE ); - const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX); - sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight(); - sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower(); - - sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL - - rBox.GetDistance(BOX_LINE_TOP) - - rBox.GetDistance(BOX_LINE_BOTTOM); - sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR - - rBox.GetDistance(BOX_LINE_LEFT) - - rBox.GetDistance(BOX_LINE_RIGHT); - if(m_bVertical) - { - m_aPageSize.Width() = nValue1; - m_aPageSize.Height() = nValue2; - } - else - { - m_aPageSize.Width() = nValue2; - m_aPageSize.Height() = nValue1; - } - - sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ? - m_nRubyUserValue : - aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))); - - if ( m_bSquaredMode ) - { - aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize); - aCharsPerLineNF.SetMax( aCharsPerLineNF.GetValue() ); - aLinesPerPageNF.SetMax( m_aPageSize.Height() / - ( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) + - aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP)))); - SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() ); - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - } - else - { - sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))); - aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize); - if (nTextWidth) - aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth); - else - aCharsPerLineNF.SetValue( 45 ); - SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() ); - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - } - } -} - -void SwTextGridPage::SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ) -{ - String aFieldStr = String::CreateFromAscii("( 1 -"); - aFieldStr += String::CreateFromInt32( nValue ); - aFieldStr += String::CreateFromAscii(" )"); - rField.SetText( aFieldStr ); -} - -sal_uInt16* SwTextGridPage::GetRanges() -{ - static sal_uInt16 aPageRg[] = { - RES_TEXTGRID, RES_TEXTGRID, - 0}; - return aPageRg; -} - -IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField) -{ - //if in squared mode - if ( m_bSquaredMode ) - { - if(&aCharsPerLineNF == pField) - { - long nWidth = (long)(m_aPageSize.Width() / aCharsPerLineNF.GetValue()); - aTextSizeMF.SetValue(aTextSizeMF.Normalize(nWidth), FUNIT_TWIP); - //prevent rounding errors in the MetricField by saving the used value - m_nRubyUserValue = nWidth; - m_bRubyUserValue = sal_True; - - } - //set maximum line per page - { - sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() / - ( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) + - aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP)))); - aLinesPerPageNF.SetMax(nMaxLines); - } - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() ); - } - else//in normal mode - { - if(&aLinesPerPageNF == pField) - { - long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue()); - aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP); - aRubySizeMF.SetValue(0, FUNIT_TWIP); - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - - m_nRubyUserValue = nHeight; - m_bRubyUserValue = sal_True; - } - else if (&aCharsPerLineNF == pField) - { - long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue()); - aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP); - SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() ); - } - } - GridModifyHdl(0); - return 0; -} - -IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) -{ - //if in squared mode - if( m_bSquaredMode ) - { - if (&aTextSizeMF == pField) - { - m_bRubyUserValue = sal_False; - } - //set maximum line per page - { - sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() / - ( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) + - aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP)))); - aLinesPerPageNF.SetMax(nMaxLines); - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - } - } - else - { - if (&aTextSizeMF == pField) - { - sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))); - aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize); - m_bRubyUserValue = sal_False; - SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() ); - } - else if (&aCharWidthMF == pField) - { - sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))); - sal_Int32 nMaxChar = 45 ; - if (nTextWidth) - nMaxChar = m_aPageSize.Width() / nTextWidth; - aCharsPerLineNF.SetValue( nMaxChar ); - SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() ); - } - //rubySize is disabled - } - GridModifyHdl(0); - return 0; -} - -IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton) -{ - sal_Bool bEnable = &aNoGridRB != pButton; - sal_Int32 nIndex = 0; - while(aControls[nIndex]) - aControls[nIndex++]->Enable(bEnable); - //one special case - if(bEnable) - DisplayGridHdl(&aDisplayCB); - - bEnable = &aCharsGridRB == pButton; - aSnapToCharsCB.Enable(bEnable); - - bEnable = &aLinesGridRB == pButton; - if(bEnable && !m_bSquaredMode ) - { - aCharsPerLineFT.Enable(sal_False); - aCharsPerLineNF.Enable(sal_False); - aCharsRangeFT.Enable(sal_False); - aCharWidthFT.Enable(sal_False); - aCharWidthMF.Enable(sal_False); - } - - GridModifyHdl(0); - return 0; -} - -IMPL_LINK(SwTextGridPage, DisplayGridHdl, CheckBox*, EMPTYARG) -{ - aPrintCB.Enable(aDisplayCB.IsChecked()); - return 0; -} - -IMPL_LINK(SwTextGridPage, GridModifyHdl, void*, EMPTYARG) -{ - const SfxItemSet& rOldSet = GetItemSet(); - SfxItemSet aSet(rOldSet); - const SfxItemSet* pExSet = GetTabDialog()->GetExampleSet(); - if(pExSet) - aSet.Put(*pExSet); - PutGridItem(aSet); - aExampleWN.UpdateExample(aSet); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/pggrid.hrc b/sw/source/ui/misc/pggrid.hrc deleted file mode 100644 index 567a1df33a..0000000000 --- a/sw/source/ui/misc/pggrid.hrc +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * 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 FL_GRID_TYPE 1 -#define RB_NOGRID 2 -#define RB_LINESGRID 3 -#define RB_CHARSGRID 4 -#define WN_EXAMPLE 5 -#define FL_LAYOUT 6 -#define FT_LINESPERPAGE 7 -#define NF_LINESPERPAGE 8 -#define FT_LINESPERPAGEHINT 9 -#define FT_TEXTSIZE 10 -#define MF_TEXTSIZE 11 -#define FT_CHARSPERLINE 12 -#define NF_CHARSPERLINE 13 -#define FT_CHARSPERLINEHINT 14 -#define FT_RUBYSIZE 15 -#define MF_RUBYSIZE 16 -#define CB_RUBYBELOW 17 -#define FL_DISPLAY 18 -#define CB_DISPLAY 19 -#define CB_PRINT 20 -#define FT_COLOR 21 -#define LB_COLOR 22 -#define CB_SNAPTOCHARS 23 -#define FT_CHARWIDTH 24 -#define MF_CHARWIDTH 25 -#define FT_LINERANGE 26 -#define FT_CHARRANGE 27 diff --git a/sw/source/ui/misc/pggrid.src b/sw/source/ui/misc/pggrid.src deleted file mode 100644 index f660772415..0000000000 --- a/sw/source/ui/misc/pggrid.src +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************************* - * - * 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 "pggrid.hrc" -#include "helpid.h" -TabPage TP_TEXTGRID_PAGE -{ - HelpID = HID_TEXTGRID_PAGE; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_GRID_TYPE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text [ en-US ] = "Grid" ; - }; - RadioButton RB_NOGRID - { - HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_NOGRID"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text [ en-US ] = "No grid" ; - }; - RadioButton RB_LINESGRID - { - HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_LINESGRID"; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text [ en-US ] = "Grid (lines only)" ; - }; - RadioButton RB_CHARSGRID - { - HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_CHARSGRID"; - Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text [ en-US ] = "Grid (lines and characters)" ; - }; - CheckBox CB_SNAPTOCHARS - { - HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_SNAPTOCHARS"; - Pos = MAP_APPFONT ( 14 , 53 ) ; - Size = MAP_APPFONT ( 158 , 10 ) ; - Text [ en-US ] = "~Snap to characters" ; - Text [ zh-CN ] = "文字对齐字符网格" ; - }; - Window WN_EXAMPLE - { - Pos = MAP_APPFONT ( 176 , 6 ) ; - Size = MAP_APPFONT ( 75 , 46 ) ; - }; - FixedLine FL_LAYOUT - { - Pos = MAP_APPFONT ( 6 , 69 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Grid layout" ; - }; - FixedText FT_LINESPERPAGE - { - Pos = MAP_APPFONT ( 12 , 82 ) ; - Size = MAP_APPFONT ( 59 , 8 ) ; - Text [ en-US ] = "Lines per page" ; - }; - NumericField NF_LINESPERPAGE - { - HelpID = "sw:NumericField:TP_TEXTGRID_PAGE:NF_LINESPERPAGE"; - Pos = MAP_APPFONT ( 74 , 80 ) ; - Size = MAP_APPFONT ( 25 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 154 ; - Value = 1 ; - First = 1 ; - Last = 154 ; - SpinSize = 1 ; - }; - FixedText FT_LINERANGE - { - Pos = MAP_APPFONT ( 103 , 82 ) ; - Size = MAP_APPFONT ( 25 , 8 ); - Text [ en-US ] = "( 1 - 48 )" ; - }; - FixedText FT_TEXTSIZE - { - Pos = MAP_APPFONT ( 133 , 82 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Max. base text size" ; - }; - MetricField MF_TEXTSIZE - { - HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_TEXTSIZE"; - Pos = MAP_APPFONT ( 216 , 80 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 5600 ; - DecimalDigits = 2 ; - Unit = FUNIT_POINT ; - First = 10 ; - Last = 5600 ; - SpinSize = 5 ; - }; - FixedText FT_CHARSPERLINE - { - Pos = MAP_APPFONT ( 12 , 98 ) ; - Size = MAP_APPFONT ( 59 , 8 ) ; - Text [ en-US ] = "Characters per line" ; - }; - NumericField NF_CHARSPERLINE - { - HelpID = "sw:NumericField:TP_TEXTGRID_PAGE:NF_CHARSPERLINE"; - Pos = MAP_APPFONT ( 74 , 96 ) ; - Size = MAP_APPFONT ( 25 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 233 ; - Value = 1 ; - First = 1 ; - Last = 233 ; - SpinSize = 1 ; - }; - FixedText FT_CHARWIDTH - { - Pos = MAP_APPFONT ( 133 , 98 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Character ~width" ; - Text [ zh-CN ] = "字符跨度" ; - }; - MetricField MF_CHARWIDTH - { - HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_CHARWIDTH"; - Pos = MAP_APPFONT ( 216 , 96 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 5600 ; - DecimalDigits = 2 ; - Unit = FUNIT_POINT; - First = 0 ; - Last = 5600 ; - SpinSize = 5 ; - }; - FixedText FT_CHARRANGE - { - Pos = MAP_APPFONT ( 103 , 96 ) ; - Size = MAP_APPFONT ( 25 , 8 ) ; - Text [ en-US ] = "( 1 - 45 )" ; - }; - FixedText FT_RUBYSIZE - { - Pos = MAP_APPFONT ( 133 , 98 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Max. Ruby text size" ; - }; - MetricField MF_RUBYSIZE - { - HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_RUBYSIZE"; - Pos = MAP_APPFONT ( 216 , 96 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 5600 ; - DecimalDigits = 2 ; - Unit = FUNIT_POINT; - First = 0 ; - Last = 5600 ; - SpinSize = 5 ; - }; - CheckBox CB_RUBYBELOW - { - HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_RUBYBELOW"; - Pos = MAP_APPFONT ( 14 , 112 ) ; - Size = MAP_APPFONT ( 237 , 10 ) ; - Text [ en-US ] = "Ruby text below/left from base text" ; - }; - FixedLine FL_DISPLAY - { - Pos = MAP_APPFONT ( 6 , 128 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Grid display" ; - }; - CheckBox CB_DISPLAY - { - HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_DISPLAY"; - Pos = MAP_APPFONT ( 12 , 139 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Display grid" ; - }; - CheckBox CB_PRINT - { - HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_PRINT"; - Pos = MAP_APPFONT ( 18 , 154 ) ; - Size = MAP_APPFONT ( 112 , 10 ) ; - Text [ en-US ] = "Print grid" ; - }; - FixedText FT_COLOR - { - Pos = MAP_APPFONT ( 133 , 139 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Text [ en-US ] = "Grid color" ; - }; - ListBox LB_COLOR - { - HelpID = "sw:ListBox:TP_TEXTGRID_PAGE:LB_COLOR"; - Pos = MAP_APPFONT ( 191 , 137 ) ; - Size = MAP_APPFONT ( 60 , 50 ) ; - TabStop = TRUE; - Border = TRUE; - DropDown = TRUE; - }; -}; - diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx deleted file mode 100644 index 29897ab135..0000000000 --- a/sw/source/ui/misc/redlndlg.cxx +++ /dev/null @@ -1,1258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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" - - -#define _SVSTDARR_STRINGSSORTDTOR -#define _SVSTDARR_USHORTS - - -#include <redline.hxx> -#include <tools/datetime.hxx> -#include <vcl/msgbox.hxx> -#include <svl/svstdarr.hxx> -#include <svl/eitem.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/dispatch.hxx> -#include <svx/ctredlin.hxx> -#include <svx/postattr.hxx> -#include <swtypes.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <swmodule.hxx> -#ifndef _REDLNDLG_HXX -#define _REDLNACCEPTDLG -#include <redlndlg.hxx> -#endif -#include <swwait.hxx> -#include <uitool.hxx> - -#include <helpid.h> -#include <cmdid.h> -#include <misc.hrc> -#include <redlndlg.hrc> -#include <shells.hrc> - -// -> #111827# -#include <comcore.hrc> -#include <swundo.hxx> -#include <SwRewriter.hxx> -// <- #111827# - -#include <vector> -#include <svx/svxdlg.hxx> -#include <svx/dialogs.hrc> - -#include <unomid.h> - -#include <docsh.hxx> - -#include <IDocumentRedlineAccess.hxx> - -SFX_IMPL_MODELESSDIALOG( SwRedlineAcceptChild, FN_REDLINE_ACCEPT ) - -SV_IMPL_PTRARR(SwRedlineDataParentArr, SwRedlineDataParentPtr) -SV_IMPL_OP_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr) -SV_IMPL_PTRARR(SwRedlineDataChildArr, SwRedlineDataChildPtr) -SV_IMPL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr) - -static sal_uInt16 nSortMode = 0xffff; -static sal_Bool bSortDir = sal_True; - -SwRedlineAcceptChild::SwRedlineAcceptChild( Window* _pParent, - sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo* pInfo ) : - SwChildWinWrapper( _pParent, nId ) -{ - pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent); - - ((SwModelessRedlineAcceptDlg *)pWindow)->Initialize(pInfo); -} - -/*-------------------------------------------------------------------- - Description: newly initialise dialog after document switch - --------------------------------------------------------------------*/ -sal_Bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh) -{ - sal_Bool bRet; - - if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == sal_True) // update immediately, doc switch! - ((SwModelessRedlineAcceptDlg*)GetWindow())->Activate(); - - return bRet; -} - -SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg( SfxBindings* _pBindings, - SwChildWinWrapper* pChild, - Window *_pParent) : - SfxModelessDialog(_pBindings, pChild, _pParent, SW_RES(DLG_REDLINE_ACCEPT)), - pChildWin (pChild) -{ - pImplDlg = new SwRedlineAcceptDlg(this); - - FreeResource(); -} - -void SwModelessRedlineAcceptDlg::Activate() -{ - SwView *pView = ::GetActiveView(); - - if (!pView) // can happen when switching to another app, when a Listbox in dialog - return; // had the focus previously (actually THs Bug) - - SwDocShell *pDocSh = pView->GetDocShell(); - - if (pChildWin->GetOldDocShell() != pDocSh) - { // doc-switch - SwWait aWait( *pDocSh, sal_False ); - SwWrtShell* pSh = pView->GetWrtShellPtr(); - - pChildWin->SetOldDocShell(pDocSh); // avoid recursion (using modified-Hdl) - - sal_Bool bMod = pSh->IsModified(); - SfxBoolItem aShow(FN_REDLINE_SHOW, sal_True); - pSh->GetView().GetViewFrame()->GetDispatcher()->Execute( - FN_REDLINE_SHOW, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aShow, 0L); - if (!bMod) - pSh->ResetModified(); - pImplDlg->Init(); - - return; - } - - pImplDlg->Activate(); -} - -void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo *pInfo) -{ - String aStr; - if (pInfo != NULL) - pImplDlg->Initialize(pInfo->aExtraString); - - SfxModelessDialog::Initialize(pInfo); -} - -void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const -{ - SfxModelessDialog::FillInfo(rInfo); - pImplDlg->FillInfo(rInfo.aExtraString); -} - -void SwModelessRedlineAcceptDlg::Resize() -{ - pImplDlg->Resize(); - SfxModelessDialog::Resize(); -} - -SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg() -{ - delete pImplDlg; -} - -SwRedlineAcceptDlg::SwRedlineAcceptDlg(Dialog *pParent, sal_Bool bAutoFmt) : - pParentDlg (pParent), - aTabPagesCTRL (pParent, SW_RES(CTRL_TABPAGES)), - aPopup (SW_RES(MN_REDLINE_POPUP)), - sInserted (SW_RES(STR_REDLINE_INSERTED)), - sDeleted (SW_RES(STR_REDLINE_DELETED)), - sFormated (SW_RES(STR_REDLINE_FORMATED)), - sTableChgd (SW_RES(STR_REDLINE_TABLECHG)), - sFmtCollSet (SW_RES(STR_REDLINE_FMTCOLLSET)), - sAutoFormat (SW_RES(STR_REDLINE_AUTOFMT)), - bOnlyFormatedRedlines( sal_False ), - bHasReadonlySel ( sal_False ), - bRedlnAutoFmt (bAutoFmt), - bInhibitActivate( false ) -{ - aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL); - pTPView = aTabPagesCTRL.GetViewPage(); - pTable = pTPView->GetTableControl(); - - pTPView->InsertWriterHeader(); - pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl)); - pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl)); - pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl)); - pTPView->SetRejectAllClickHdl(LINK(this, SwRedlineAcceptDlg, RejectAllHdl)); - pTPView->SetUndoClickHdl(LINK(this, SwRedlineAcceptDlg, UndoHdl)); - - aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl)); - - ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction(); - pActLB->InsertEntry(sInserted); - pActLB->InsertEntry(sDeleted); - pActLB->InsertEntry(sFormated); - pActLB->InsertEntry(sTableChgd); - - if (HasRedlineAutoFmt()) - { - pActLB->InsertEntry(sFmtCollSet); - pActLB->InsertEntry(sAutoFormat); - pTPView->ShowUndo(sal_True); - pTPView->DisableUndo(); // no UNDO events yet - } - - pActLB->SelectEntryPos(0); - - pTable->SetStyle(pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); - pTable->SetNodeDefaultImages(); - pTable->SetSelectionMode(MULTIPLE_SELECTION); - pTable->SetHighlightRange(1); - - static long aStaticTabs[]= - { - 4,10,70,120,170 - }; - - pTable->SetTabs(aStaticTabs); - - // set minimum size - Size aMinSz(aTabPagesCTRL.GetMinSizePixel()); - Point aPos(aTabPagesCTRL.GetPosPixel()); - - aMinSz.Width() += (aPos.X() * 2 - 1); - aMinSz.Height() += (aPos.Y() * 2 - 1); - pParentDlg->SetMinOutputSizePixel(aMinSz); - - if (pParentDlg->GetOutputSizePixel().Width() < aMinSz.Width()) - pParentDlg->SetOutputSizePixel(Size(aMinSz.Width(), pParentDlg->GetOutputSizePixel().Height())); - if (pParentDlg->GetOutputSizePixel().Height() < aMinSz.Height()) - pParentDlg->SetOutputSizePixel(Size(pParentDlg->GetOutputSizePixel().Width(), aMinSz.Height())); - - pTable->SortByCol(nSortMode, bSortDir); - - aOldSelectHdl = pTable->GetSelectHdl(); - aOldDeselectHdl = pTable->GetDeselectHdl(); - pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl)); - pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl)); - pTable->SetCommandHdl(LINK(this, SwRedlineAcceptDlg, CommandHdl)); - - // avoid flickering of buttons: - aDeselectTimer.SetTimeout(100); - aDeselectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl)); - - // avoid multiple selection of the same texts: - aSelectTimer.SetTimeout(100); - aSelectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, GotoHdl)); -} - -SwRedlineAcceptDlg::~SwRedlineAcceptDlg() -{ -} - -void SwRedlineAcceptDlg::Init(sal_uInt16 nStart) -{ - SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False ); - pTable->SetUpdateMode(sal_False); - aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count()); - - if (nStart) - RemoveParents(nStart, aRedlineParents.Count() - 1); - else - { - pTable->Clear(); - aRedlineChilds.DeleteAndDestroy(0, aRedlineChilds.Count()); - aRedlineParents.DeleteAndDestroy(nStart, aRedlineParents.Count() - nStart); - } - - // insert parents - InsertParents(nStart); - InitAuthors(); - - pTable->SetUpdateMode(sal_True); - // #i69618# this moves the list box to the right position, visually - SvLBoxEntry* pSelEntry = pTable->FirstSelected(); - if( pSelEntry ) - pTable->MakeVisible( pSelEntry, sal_True ); //#i70937#, force the scroll -} - -void SwRedlineAcceptDlg::InitAuthors() -{ - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - - SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage(); - - String sAuthor; - SvStringsSortDtor aStrings; - String sOldAuthor(pFilterPage->GetSelectedAuthor()); - pFilterPage->ClearAuthors(); - - String sParent; - sal_uInt16 nCount = pSh->GetRedlineCount(); - - bOnlyFormatedRedlines = sal_True; - bHasReadonlySel = sal_False; - sal_Bool bIsNotFormated = sal_False; - sal_uInt16 i; - - // determine authors - for ( i = 0; i < nCount; i++) - { - const SwRedline& rRedln = pSh->GetRedline(i); - - if( bOnlyFormatedRedlines && nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType() ) - bOnlyFormatedRedlines = sal_False; - - String *pAuthor = new String(rRedln.GetAuthorString()); - if (!aStrings.Insert(pAuthor)) - delete pAuthor; - - for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++) - { - pAuthor = new String(rRedln.GetAuthorString(nStack)); - if (!aStrings.Insert(pAuthor)) - delete pAuthor; - } - } - - for (i = 0; i < aStrings.Count(); i++) - pFilterPage->InsertAuthor(*aStrings[i]); - - if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && aStrings.Count()) - pFilterPage->SelectAuthor(*aStrings[0]); - - sal_Bool bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); - sal_Bool bSel = pTable->FirstSelected() != 0; - - SvLBoxEntry* pSelEntry = pTable->FirstSelected(); - while (pSelEntry) - { - sal_uInt16 nPos = GetRedlinePos(*pSelEntry); - const SwRedline& rRedln = pSh->GetRedline( nPos ); - - bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType(); - pSelEntry = pTable->NextSelected(pSelEntry); - } - - pTPView->EnableAccept( bEnable && bSel ); - pTPView->EnableReject( bEnable && bIsNotFormated && bSel ); - pTPView->EnableAcceptAll( bEnable && !bHasReadonlySel ); - pTPView->EnableRejectAll( bEnable && !bHasReadonlySel && - !bOnlyFormatedRedlines ); -} - -String SwRedlineAcceptDlg::GetRedlineText( const SwRedline& rRedln, - DateTime &rDateTime, sal_uInt16 nStack) -{ - String sEntry(GetActionText(rRedln, nStack)); - sEntry += '\t'; - sEntry += rRedln.GetAuthorString(nStack); - sEntry += '\t'; - - const DateTime &rDT = rRedln.GetTimeStamp(nStack); - rDateTime = rDT; - - sEntry += GetAppLangDateTimeString( rDT ); - sEntry += '\t'; - - sEntry += rRedln.GetComment(nStack); - - return sEntry; -} - -const String &SwRedlineAcceptDlg::GetActionText(const SwRedline& rRedln, sal_uInt16 nStack) -{ - switch( rRedln.GetType(nStack) ) - { - case nsRedlineType_t::REDLINE_INSERT: return sInserted; - case nsRedlineType_t::REDLINE_DELETE: return sDeleted; - case nsRedlineType_t::REDLINE_FORMAT: return sFormated; - case nsRedlineType_t::REDLINE_TABLE: return sTableChgd; - case nsRedlineType_t::REDLINE_FMTCOLL: return sFmtCollSet; - default:;//prevent warning - } - - return aEmptyStr; -} - -void SwRedlineAcceptDlg::Resize() -{ - Size aSz(pParentDlg->GetOutputSizePixel()); - - Point aPos(aTabPagesCTRL.GetPosPixel()); - - aSz.Width() -= (aPos.X() * 2 - 1); - aSz.Height() -= (aPos.Y() * 2 - 1); - - aTabPagesCTRL.SetOutputSizePixel(aSz); -} - -/*-------------------------------------------------------------------- - Description: newly initialise after activation - --------------------------------------------------------------------*/ -void SwRedlineAcceptDlg::Activate() -{ - // prevent update if flag is set (#102547#) - if( bInhibitActivate ) - return; - - SwView *pView = ::GetActiveView(); - SwWait aWait( *pView->GetDocShell(), sal_False ); - - aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count()); - - if (!pView) // can happen when switching to another app, when a Listbox in the dialog - return; // had the focus previously (actually THs Bug) - - // did something change? - SwWrtShell* pSh = pView->GetWrtShellPtr(); - sal_uInt16 nCount = pSh->GetRedlineCount(); - - // check the number of pointers - SwRedlineDataParent *pParent = 0; - sal_uInt16 i; - - for ( i = 0; i < nCount; i++) - { - const SwRedline& rRedln = pSh->GetRedline(i); - - if (i >= aRedlineParents.Count()) - { - // new entries have been appended - Init(i); - return; - } - - pParent = aRedlineParents[i]; - if (&rRedln.GetRedlineData() != pParent->pData) - { - // Redline-Parents were inserted, changed or deleted - if ((i = CalcDiff(i, sal_False)) == USHRT_MAX) - return; - continue; - } - - const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next(); - const SwRedlineDataChild *pBackupData = pParent->pNext; - - if (!pRedlineData && pBackupData) - { - // Redline-Childs were deleted - if ((i = CalcDiff(i, sal_True)) == USHRT_MAX) - return; - continue; - } - else - { - while (pRedlineData) - { - if (pRedlineData != pBackupData->pChild) - { - // Redline-Childs were inserted, changed or deleted - if ((i = CalcDiff(i, sal_True)) == USHRT_MAX) - return; - continue; - } - if (pBackupData) - pBackupData = pBackupData->pNext; - pRedlineData = pRedlineData->Next(); - } - } - } - - if (nCount != aRedlineParents.Count()) - { - // Redlines were deleted at the end - Init(nCount); - return; - } - - // check comment - for (i = 0; i < nCount; i++) - { - const SwRedline& rRedln = pSh->GetRedline(i); - pParent = aRedlineParents[i]; - - if(!rRedln.GetComment().Equals(pParent->sComment)) - { - if (pParent->pTLBParent) - { - // update only comment - String sComment(rRedln.GetComment()); - sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); - pTable->SetEntryText(sComment, pParent->pTLBParent, 3); - } - pParent->sComment = rRedln.GetComment(); - } - } - - InitAuthors(); -} - -sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, sal_Bool bChild) -{ - if (!nStart) - { - Init(); - return USHRT_MAX; - } - - pTable->SetUpdateMode(sal_False); - SwView *pView = ::GetActiveView(); - SwWrtShell* pSh = pView->GetWrtShellPtr(); - sal_uInt16 nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0; - SwRedlineDataParent *pParent = aRedlineParents[nStart]; - const SwRedline& rRedln = pSh->GetRedline(nStart); - - if (bChild) // should actually never happen, but just in case... - { - // throw away all entry's childs and initialise newly - SwRedlineDataChildPtr pBackupData = (SwRedlineDataChildPtr)pParent->pNext; - SwRedlineDataChildPtr pNext; - - while (pBackupData) - { - pNext = (SwRedlineDataChildPtr)pBackupData->pNext; - if (pBackupData->pTLBChild) - pTable->RemoveEntry(pBackupData->pTLBChild); - - aRedlineChilds.DeleteAndDestroy(aRedlineChilds.GetPos(pBackupData), 1); - pBackupData = pNext; - } - pParent->pNext = 0; - - // insert new childs - InsertChilds(pParent, rRedln, nAutoFmt); - - pTable->SetUpdateMode(sal_True); - return nStart; - } - - // have entries been deleted? - const SwRedlineData *pRedlineData = &rRedln.GetRedlineData(); - sal_uInt16 i; - for ( i = nStart + 1; i < aRedlineParents.Count(); i++) - { - if (aRedlineParents[i]->pData == pRedlineData) - { - // remove entries from nStart to i-1 - RemoveParents(nStart, i - 1); - pTable->SetUpdateMode(sal_True); - return nStart - 1; - } - } - - // entries been inserted? - sal_uInt16 nCount = pSh->GetRedlineCount(); - pRedlineData = aRedlineParents[nStart]->pData; - - for (i = nStart + 1; i < nCount; i++) - { - if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData) - { - // insert entries from nStart to i-1 - InsertParents(nStart, i - 1); - pTable->SetUpdateMode(sal_True); - return nStart - 1; - } - } - - pTable->SetUpdateMode(sal_True); - Init(nStart); // adjust all entries until the end - return USHRT_MAX; -} - -void SwRedlineAcceptDlg::InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const sal_uInt16 nAutoFmt) -{ - String sChild; - SwRedlineDataChild *pLastRedlineChild = 0; - const SwRedlineData *pRedlineData = &rRedln.GetRedlineData(); - sal_Bool bAutoFmt = (rRedln.GetRealType() & nAutoFmt) != 0; - - const String *pAction = &GetActionText(rRedln); - sal_Bool bValidParent = !sFilterAction.Len() || sFilterAction == *pAction; - bValidParent = bValidParent && pTable->IsValidEntry(&rRedln.GetAuthorString(), &rRedln.GetTimeStamp(), &rRedln.GetComment()); - if (nAutoFmt) - { - sal_uInt16 nPos; - - if (pParent->pData->GetSeqNo() && !aUsedSeqNo.Insert(pParent, nPos)) // already there - { - if (pParent->pTLBParent) - { - pTable->SetEntryText(sAutoFormat, aUsedSeqNo[nPos]->pTLBParent, 0); - pTable->RemoveEntry(pParent->pTLBParent); - pParent->pTLBParent = 0; - } - return; - } - bValidParent = bValidParent && bAutoFmt; - } - sal_Bool bValidTree = bValidParent; - - for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++) - { - pRedlineData = pRedlineData->Next(); - - SwRedlineDataChildPtr pRedlineChild = new SwRedlineDataChild; - pRedlineChild->pChild = pRedlineData; - aRedlineChilds.Insert(pRedlineChild, aRedlineChilds.Count()); - - if ( pLastRedlineChild ) - pLastRedlineChild->pNext = pRedlineChild; - else - pParent->pNext = pRedlineChild; - - pAction = &GetActionText(rRedln, nStack); - sal_Bool bValidChild = !sFilterAction.Len() || sFilterAction == *pAction; - bValidChild = bValidChild && pTable->IsValidEntry(&rRedln.GetAuthorString(nStack), &rRedln.GetTimeStamp(nStack), &rRedln.GetComment()); - if (nAutoFmt) - bValidChild = bValidChild && bAutoFmt; - bValidTree |= bValidChild; - - if (bValidChild) - { - RedlinData *pData = new RedlinData; - pData->pData = pRedlineChild; - pData->bDisabled = sal_True; - sChild = GetRedlineText(rRedln, pData->aDateTime, nStack); - - SvLBoxEntry* pChild = pTable->InsertEntry(sChild, pData, pParent->pTLBParent); - - pRedlineChild->pTLBChild = pChild; - if (!bValidParent) - pTable->Expand(pParent->pTLBParent); - } - else - pRedlineChild->pTLBChild = 0; - - pLastRedlineChild = pRedlineChild; - } - - if (pLastRedlineChild) - pLastRedlineChild->pNext = 0; - - if (!bValidTree && pParent->pTLBParent) - { - pTable->RemoveEntry(pParent->pTLBParent); - pParent->pTLBParent = 0; - if (nAutoFmt) - aUsedSeqNo.Remove(pParent); - } -} - -void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd) -{ - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - sal_uInt16 nCount = pSh->GetRedlineCount(); - - SvLBoxEntryArr aLBoxArr; - - // because of Bug of TLB that ALWAYS calls the SelectHandler at Remove: - pTable->SetSelectHdl(aOldSelectHdl); - pTable->SetDeselectHdl(aOldDeselectHdl); - sal_Bool bChildsRemoved = sal_False; - pTable->SelectAll(sal_False); - - // set the cursor after the last entry because otherwise performance problem in TLB. - // TLB would otherwise reset the cursor at every Remove (expensive) - sal_uInt16 nPos = Min((sal_uInt16)nCount, (sal_uInt16)aRedlineParents.Count()); - SvLBoxEntry *pCurEntry = NULL; - while( ( pCurEntry == NULL ) && ( nPos > 0 ) ) - { - --nPos; - pCurEntry = aRedlineParents[nPos]->pTLBParent; - } - - if (pCurEntry) - pTable->SetCurEntry(pCurEntry); - - SvLBoxTreeList* pModel = pTable->GetModel(); - - for (sal_uInt16 i = nStart; i <= nEnd; i++) - { - if (!bChildsRemoved && aRedlineParents[i]->pNext) - { - SwRedlineDataChildPtr pChildPtr = (SwRedlineDataChildPtr)aRedlineParents[i]->pNext; - sal_uInt16 nChildPos = aRedlineChilds.GetPos(pChildPtr); - - if (nChildPos != USHRT_MAX) - { - sal_uInt16 nChilds = 0; - - while (pChildPtr) - { - pChildPtr = (SwRedlineDataChildPtr)pChildPtr->pNext; - nChilds++; - } - - aRedlineChilds.DeleteAndDestroy(nChildPos, nChilds); - bChildsRemoved = sal_True; - } - } - SvLBoxEntry *pEntry = aRedlineParents[i]->pTLBParent; - if (pEntry) - { - long nIdx = aLBoxArr.Count() - 1L; - sal_uLong nAbsPos = pModel->GetAbsPos(pEntry); - while (nIdx >= 0 && - pModel->GetAbsPos(aLBoxArr[ static_cast< sal_uInt16 >(nIdx) ]) > nAbsPos) - nIdx--; - aLBoxArr.Insert( pEntry, static_cast< sal_uInt16 >(++nIdx) ); - } - } - - // clear TLB from behind - long nIdx = (long)aLBoxArr.Count() - 1L; - while (nIdx >= 0) - pTable->RemoveEntry(aLBoxArr[ static_cast< sal_uInt16 >(nIdx--) ]); - - pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl)); - pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl)); - // unfortunately by Remove it was selected from the TLB always again ... - pTable->SelectAll(sal_False); - - aRedlineParents.DeleteAndDestroy( nStart, nEnd - nStart + 1); -} - -void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) -{ - SwView *pView = ::GetActiveView(); - SwWrtShell* pSh = pView->GetWrtShellPtr(); - sal_uInt16 nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0; - - String sParent; - sal_uInt16 nCount = pSh->GetRedlineCount(); - nEnd = Min((sal_uInt16)nEnd, (sal_uInt16)(nCount - 1)); // also treats nEnd=USHRT_MAX (until the end) - - if (nEnd == USHRT_MAX) - return; // no redlines in the document - - RedlinData *pData; - SvLBoxEntry *pParent; - SwRedlineDataParentPtr pRedlineParent; - const SwRedline* pCurrRedline; - if( !nStart && !pTable->FirstSelected() ) - { - pCurrRedline = pSh->GetCurrRedline(); - if( !pCurrRedline ) - { - pSh->SwCrsrShell::Push(); - if( 0 == (pCurrRedline = pSh->SelNextRedline())) - pCurrRedline = pSh->SelPrevRedline(); - pSh->SwCrsrShell::Pop( sal_False ); - } - } - else - pCurrRedline = 0; - - for (sal_uInt16 i = nStart; i <= nEnd; i++) - { - const SwRedline& rRedln = pSh->GetRedline(i); - const SwRedlineData *pRedlineData = &rRedln.GetRedlineData(); - - pRedlineParent = new SwRedlineDataParent; - pRedlineParent->pData = pRedlineData; - pRedlineParent->pNext = 0; - String sComment(rRedln.GetComment()); - sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); - pRedlineParent->sComment = sComment; - aRedlineParents.Insert(pRedlineParent, i); - - pData = new RedlinData; - pData->pData = pRedlineParent; - pData->bDisabled = sal_False; - - sParent = GetRedlineText(rRedln, pData->aDateTime); - pParent = pTable->InsertEntry(sParent, pData, 0, i); - if( pCurrRedline == &rRedln ) - { - pTable->SetCurEntry( pParent ); - pTable->Select( pParent ); - pTable->MakeVisible( pParent ); - } - - pRedlineParent->pTLBParent = pParent; - - InsertChilds(pRedlineParent, rRedln, nAutoFmt); - } -} - -void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept ) -{ - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - SvLBoxEntry* pEntry = bSelect ? pTable->FirstSelected() : pTable->First(); - sal_uLong nPos = LONG_MAX; - - typedef std::vector<SvLBoxEntry*> ListBoxEntries_t; - ListBoxEntries_t aRedlines; - - // don't activate - OSL_ENSURE( bInhibitActivate == false, - "recursive call of CallAcceptReject?"); - bInhibitActivate = true; - - // collect redlines-to-be-accepted/rejected in aRedlines vector - while( pEntry ) - { - if( !pTable->GetParent( pEntry ) ) - { - if( bSelect && LONG_MAX == nPos ) - nPos = pTable->GetModel()->GetAbsPos( pEntry ); - - RedlinData *pData = (RedlinData *)pEntry->GetUserData(); - - if( !pData->bDisabled ) - aRedlines.push_back( pEntry ); - } - - pEntry = bSelect ? pTable->NextSelected(pEntry) : pTable->Next(pEntry); - } - - sal_Bool (SwEditShell:: *FnAccRej)( sal_uInt16 ) = &SwEditShell::AcceptRedline; - if( !bAccept ) - FnAccRej = &SwEditShell::RejectRedline; - - SwWait aWait( *pSh->GetView().GetDocShell(), sal_True ); - pSh->StartAction(); - - // #111827# - if (aRedlines.size() > 1) - { - String aTmpStr; - { - SwRewriter aRewriter; - aRewriter.AddRule(UNDO_ARG1, - String::CreateFromInt32(aRedlines.size())); - aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES))); - } - - SwRewriter aRewriter; - aRewriter.AddRule(UNDO_ARG1, aTmpStr); - - pSh->StartUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE, - &aRewriter); - } - - // accept/reject the the redlines in aRedlines. The absolute - // position may change during the process (e.g. when two redlines - // are merged in result of another one being deleted), so the - // position must be resolved late and checked before using it. - // (cf #102547#) - ListBoxEntries_t::iterator aEnd = aRedlines.end(); - for( ListBoxEntries_t::iterator aIter = aRedlines.begin(); - aIter != aEnd; - ++aIter ) - { - sal_uInt16 nPosition = GetRedlinePos( **aIter ); - if( nPosition != USHRT_MAX ) - (pSh->*FnAccRej)( nPosition ); - } - - // #111827# - if (aRedlines.size() > 1) - { - pSh->EndUndo(); - } - - pSh->EndAction(); - - bInhibitActivate = false; - Activate(); - - if( ULONG_MAX != nPos && pTable->GetEntryCount() ) - { - if( nPos >= pTable->GetEntryCount() ) - nPos = pTable->GetEntryCount() - 1; - pEntry = pTable->GetEntry( nPos ); - if( !pEntry && nPos-- ) - pEntry = pTable->GetEntry( nPos ); - if( pEntry ) - { - pTable->Select( pEntry ); - pTable->MakeVisible( pEntry ); - pTable->SetCurEntry(pEntry); - } - } - pTPView->EnableUndo(); -} - -sal_uInt16 SwRedlineAcceptDlg::GetRedlinePos( const SvLBoxEntry& rEntry ) const -{ - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - return pSh->FindRedlineOfData( *((SwRedlineDataParent*)((RedlinData *) - rEntry.GetUserData())->pData)->pData ); -} - -IMPL_LINK( SwRedlineAcceptDlg, AcceptHdl, void*, EMPTYARG) -{ - CallAcceptReject( sal_True, sal_True ); - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, AcceptAllHdl, void*, EMPTYARG ) -{ - CallAcceptReject( sal_False, sal_True ); - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, RejectHdl, void*, EMPTYARG ) -{ - CallAcceptReject( sal_True, sal_False ); - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, RejectAllHdl, void*, EMPTYARG ) -{ - CallAcceptReject( sal_False, sal_False ); - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, UndoHdl, void*, EMPTYARG ) -{ - SwView * pView = ::GetActiveView(); - pView->GetViewFrame()->GetDispatcher()-> - Execute(SID_UNDO, SFX_CALLMODE_SYNCHRON); - pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != 0); - - Activate(); - - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, FilterChangedHdl, void*, EMPTYARG ) -{ - SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage(); - - if (pFilterTP->IsAction()) - sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry(); - else - sFilterAction = aEmptyStr; - - Init(); - - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, DeselectHdl, void*, EMPTYARG ) -{ - // avoid flickering of buttons: - aDeselectTimer.Start(); - - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, SelectHdl, void*, EMPTYARG ) -{ - aDeselectTimer.Stop(); - aSelectTimer.Start(); - - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, GotoHdl, void*, EMPTYARG ) -{ - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - aSelectTimer.Stop(); - - sal_Bool bIsNotFormated = sal_False; - sal_Bool bSel = sal_False; - - //#98883# don't select redlines while the dialog is not focussed - //#107938# But not only ask pTable if it has the focus. To move - // the selection to the selected redline any child of pParentDlg - // may the focus. - SvLBoxEntry* pSelEntry = 0; - - if (pParentDlg->HasChildPathFocus()) - pSelEntry = pTable->FirstSelected(); - - if( pSelEntry ) - { - SvLBoxEntry* pActEntry = pSelEntry; - pSh->StartAction(); - pSh->EnterStdMode(); - pSh->SetCareWin(pParentDlg); - - while (pSelEntry) - { - if (pTable->GetParent(pSelEntry)) - { - pActEntry = pTable->GetParent(pSelEntry); - - if (pTable->IsSelected(pActEntry)) - { - pSelEntry = pActEntry = pTable->NextSelected(pSelEntry); - continue; // don't select twice - } - } - else - bSel = sal_True; - - // #98864# find the selected redline (ignore, if the redline is already gone) - sal_uInt16 nPos = GetRedlinePos(*pActEntry); - if( nPos != USHRT_MAX ) - { - - const SwRedline& rRedln = pSh->GetRedline( nPos ); - bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType(); - - if (pSh->GotoRedline(nPos, sal_True)) - { - pSh->SetInSelect(); - pSh->EnterAddMode(); - } - } - - pSelEntry = pActEntry = pTable->NextSelected(pSelEntry); - } - - pSh->LeaveAddMode(); - pSh->EndAction(); - pSh->SetCareWin(NULL); - } - sal_Bool bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength(); - pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); - pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ ); - pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel ); - - return 0; -} - -IMPL_LINK( SwRedlineAcceptDlg, CommandHdl, void*, EMPTYARG ) -{ - const CommandEvent aCEvt(pTable->GetCommandEvent()); - - switch ( aCEvt.GetCommand() ) - { - case COMMAND_CONTEXTMENU: - { - SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - SvLBoxEntry* pEntry = pTable->FirstSelected(); - const SwRedline *pRed = 0; - - if (pEntry) - { - SvLBoxEntry* pTopEntry = pEntry; - - if (pTable->GetParent(pEntry)) - pTopEntry = pTable->GetParent(pEntry); - - sal_uInt16 nPos = GetRedlinePos(*pTopEntry); - - // disable commenting for protected areas - if ((pRed = pSh->GotoRedline(nPos, sal_True)) != 0) - { - if( pSh->IsCrsrPtAtEnd() ) - pSh->SwapPam(); - pSh->SetInSelect(); - } - } - - aPopup.EnableItem( MN_EDIT_COMMENT, pEntry && pRed && - !pTable->GetParent(pEntry) && - !pTable->NextSelected(pEntry) -//JP 27.9.2001: make no sense if we handle readonly sections -// && pRed->HasReadonlySel() - ); - - aPopup.EnableItem( MN_SUB_SORT, pTable->First() != 0 ); - sal_uInt16 nColumn = pTable->GetSortedCol(); - if (nColumn == 0xffff) - nColumn = 4; - - PopupMenu *pSubMenu = aPopup.GetPopupMenu(MN_SUB_SORT); - if (pSubMenu) - { - for (sal_uInt16 i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++) - pSubMenu->CheckItem(i, sal_False); - - pSubMenu->CheckItem(nColumn + MN_SORT_ACTION); - } - - sal_uInt16 nRet = aPopup.Execute(pTable, aCEvt.GetMousePosPixel()); - - switch( nRet ) - { - case MN_EDIT_COMMENT: - { - String sComment; - if (pEntry) - { - if (pTable->GetParent(pEntry)) - pEntry = pTable->GetParent(pEntry); - - sal_uInt16 nPos = GetRedlinePos(*pEntry); - const SwRedline &rRedline = pSh->GetRedline(nPos); - - - /* enable again once we have redline comments in the margin - sComment = rRedline.GetComment(); - if ( !sComment.Len() ) - GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED)); - const_cast<SwRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS)); - */ - - sComment = rRedline.GetComment(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); - ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT ); - OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()"); - SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() ); - - aSet.Put(SvxPostItTextItem(sComment.ConvertLineEnd(), SID_ATTR_POSTIT_TEXT)); - aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR)); - - aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString( - rRedline.GetRedlineData().GetTimeStamp() ), - SID_ATTR_POSTIT_DATE )); - - AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, sal_False ); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); - - pDlg->HideAuthor(); - - sal_uInt16 nResId = 0; - switch( rRedline.GetType() ) - { - case nsRedlineType_t::REDLINE_INSERT: - nResId = STR_REDLINE_INSERTED; - break; - case nsRedlineType_t::REDLINE_DELETE: - nResId = STR_REDLINE_DELETED; - break; - case nsRedlineType_t::REDLINE_FORMAT: - nResId = STR_REDLINE_FORMATED; - break; - case nsRedlineType_t::REDLINE_TABLE: - nResId = STR_REDLINE_TABLECHG; - break; - default:;//prevent warning - } - String sTitle(SW_RES(STR_REDLINE_COMMENT)); - if( nResId ) - sTitle += SW_RESSTR( nResId ); - pDlg->SetText(sTitle); - - pSh->SetCareWin(pDlg->GetWindow()); - - if ( pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue()); - - // insert / change comment - pSh->SetRedlineComment(sMsg); - sMsg.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' '); - pTable->SetEntryText(sMsg, pEntry, 3); - } - - delete pDlg; - pSh->SetCareWin(NULL); - } - - } - break; - - case MN_SORT_ACTION: - case MN_SORT_AUTHOR: - case MN_SORT_DATE: - case MN_SORT_COMMENT: - case MN_SORT_POSITION: - { - bSortDir = sal_True; - if (nRet - MN_SORT_ACTION == 4 && pTable->GetSortedCol() == 0xffff) - break; // we already have it - - nSortMode = nRet - MN_SORT_ACTION; - if (nSortMode == 4) - nSortMode = 0xffff; // unsorted / sorted by position - - if (pTable->GetSortedCol() == nSortMode) - bSortDir = !pTable->GetSortDirection(); - - SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False ); - pTable->SortByCol(nSortMode, bSortDir); - if (nSortMode == 0xffff) - Init(); // newly fill everything - } - break; - } - } - break; - } - - return 0; -} - -void SwRedlineAcceptDlg::Initialize(const String& rExtraData) -{ - if (rExtraData.Len()) - { - sal_uInt16 nPos = rExtraData.Search(C2S("AcceptChgDat:")); - - // try to read the alignment string "ALIGN:(...)"; if none existing, - // it's an old version - if (nPos != STRING_NOTFOUND) - { - sal_uInt16 n1 = rExtraData.Search('(', nPos); - if (n1 != STRING_NOTFOUND) - { - sal_uInt16 n2 = rExtraData.Search(')', n1); - if (n2 != STRING_NOTFOUND) - { - // cut out the alignment string - String aStr = rExtraData.Copy(nPos, n2 - nPos + 1); - aStr.Erase(0, n1 - nPos + 1); - - if (aStr.Len()) - { - sal_uInt16 nCount = static_cast< sal_uInt16 >(aStr.ToInt32()); - - for (sal_uInt16 i = 0; i < nCount; i++) - { - sal_uInt16 n3 = aStr.Search(';'); - aStr.Erase(0, n3 + 1); - pTable->SetTab(i, aStr.ToInt32(), MAP_PIXEL); - } - } - } - } - } - } -} - -void SwRedlineAcceptDlg::FillInfo(String &rExtraData) const -{ - rExtraData.AppendAscii("AcceptChgDat:("); - - sal_uInt16 nCount = pTable->TabCount(); - - rExtraData += String::CreateFromInt32(nCount); - rExtraData += ';'; - for(sal_uInt16 i = 0; i < nCount; i++) - { - rExtraData += String::CreateFromInt32( pTable->GetTab(i) ); - rExtraData += ';'; - } - rExtraData += ')'; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/redlndlg.hrc b/sw/source/ui/misc/redlndlg.hrc deleted file mode 100644 index 927d247c79..0000000000 --- a/sw/source/ui/misc/redlndlg.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * 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 CTRL_TABPAGES 1 - -#define MN_EDIT_COMMENT 1 -#define MN_SUB_SORT 2 -#define MN_SORT_ACTION 3 -#define MN_SORT_AUTHOR 4 -#define MN_SORT_DATE 5 -#define MN_SORT_COMMENT 6 -#define MN_SORT_POSITION 7 - -#define XBORDER 3 -#define YBORDER 3 diff --git a/sw/source/ui/misc/redlndlg.src b/sw/source/ui/misc/redlndlg.src deleted file mode 100644 index eb139b6c59..0000000000 --- a/sw/source/ui/misc/redlndlg.src +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -/* StarView ressource file */ - -#include "redlndlg.hrc" -#include "misc.hrc" -#include "helpid.h" - -#define WIDTH 297 -#define HEIGHT 169 - -#define REDLNDLG \ - OutputSize = TRUE ; \ - SVLook = TRUE ; \ - Size = MAP_APPFONT ( WIDTH , HEIGHT ) ; \ - Moveable = TRUE ; \ - Closeable = TRUE ; \ - Sizeable = TRUE ; \ - Hide = TRUE ; \ - Control CTRL_TABPAGES\ - {\ - Pos = MAP_APPFONT ( XBORDER , YBORDER ) ; \ - Size = MAP_APPFONT ( WIDTH - XBORDER * 2 , HEIGHT - YBORDER * 2 ) ; \ - HelpID = HID_REDLINE_CTRL ; \ - TabStop = TRUE ; \ - }; - -ModelessDialog DLG_REDLINE_ACCEPT -{ - HelpID = HID_REDLINE_ACCEPT ; - Text [ en-US ] = "Accept or Reject Changes" ; - REDLNDLG -}; - -ModalDialog DLG_MOD_REDLINE_ACCEPT -{ - HelpID = HID_REDLINE_AUTOFMT_ACCEPT ; - REDLNDLG - Text [ en-US ] = "Accept or Reject AutoCorrect Changes"; -}; - -Menu MN_REDLINE_POPUP -{ - ItemList = - { - MenuItem - { - Identifier = MN_EDIT_COMMENT ; - HelpID = HID_EDIT_COMMENT ; - Text [ en-US ] = "Edit Comment..." ; - }; - MenuItem - { - Identifier = MN_SUB_SORT ; - RadioCheck = TRUE ; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = MN_SORT_ACTION ; - HelpID = HID_SORT_ACTION ; - RadioCheck = TRUE ; - Text [ en-US ] = "Action" ; - }; - MenuItem - { - Identifier = MN_SORT_AUTHOR ; - HelpID = HID_SORT_AUTHOR ; - RadioCheck = TRUE ; - Text [ en-US ] = "Author" ; - }; - MenuItem - { - Identifier = MN_SORT_DATE ; - HelpID = HID_SORT_DATE ; - RadioCheck = TRUE ; - Text [ en-US ] = "Date" ; - }; - MenuItem - { - Identifier = MN_SORT_COMMENT ; - HelpID = HID_SORT_COMMENT ; - RadioCheck = TRUE ; - Text [ en-US ] = "Comment" ; - }; - MenuItem - { - Identifier = MN_SORT_POSITION ; - HelpID = HID_SW_SORT_POSITION ; - RadioCheck = TRUE ; - Text [ en-US ] = "Document position" ; - }; - }; - }; - Text [ en-US ] = "Sort By" ; - }; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx deleted file mode 100644 index c115b1c194..0000000000 --- a/sw/source/ui/misc/srtdlg.cxx +++ /dev/null @@ -1,517 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 "srtdlg.hxx" - -#include <vcl/msgbox.hxx> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include <sfx2/dispatch.hxx> -#include <svx/svxids.hrc> -#include <editeng/unolingu.hxx> -#include <svx/svxdlg.hxx> -#include <svx/dialogs.hrc> -#include <unotools/collatorwrapper.hxx> -#include <svtools/collatorres.hxx> -#include <swwait.hxx> -#include <view.hxx> -#include <cmdid.h> -#include <wrtsh.hxx> -#include <misc.hrc> -#include <srtdlg.hrc> -#include <swtable.hxx> -#include <node.hxx> -#include <tblsel.hxx> -#include <sfx2/request.hxx> - -// sw/inc/tblsel.hxx -SV_IMPL_PTRARR( _FndBoxes, _FndBox* ) -SV_IMPL_PTRARR( _FndLines, _FndLine* ) - -static sal_Bool bCheck1 = sal_True; -static sal_Bool bCheck2 = sal_False; -static sal_Bool bCheck3 = sal_False; - -static sal_uInt16 nCol1 = 1; -static sal_uInt16 nCol2 = 1; -static sal_uInt16 nCol3 = 1; - -static sal_uInt16 nType1 = 0; -static sal_uInt16 nType2 = 0; -static sal_uInt16 nType3 = 0; - -static sal_uInt16 nLang = LANGUAGE_NONE; - -static sal_Bool bAsc1 = sal_True; -static sal_Bool bAsc2 = sal_True; -static sal_Bool bAsc3 = sal_True; -static sal_Bool bCol = sal_False; -static sal_Bool bCsSens= sal_False; - -static sal_Unicode cDeli = '\t'; - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; - -void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox ) -{ - void* pDel; - for( sal_uInt16 n = 0, nEnd = rLstBox.GetEntryCount(); n < nEnd; ++n ) - if( 0 != ( pDel = rLstBox.GetEntryData( n )) ) - delete (String*)pDel; - rLstBox.Clear(); -} - -/*-------------------------------------------------------------------- - Description: determine lines and columns for table selection - --------------------------------------------------------------------*/ -sal_Bool lcl_GetSelTbl( SwWrtShell &rSh, sal_uInt16& rX, sal_uInt16& rY ) -{ - const SwTableNode* pTblNd = rSh.IsCrsrInTbl(); - if( !pTblNd ) - return sal_False; - - _FndBox aFndBox( 0, 0 ); - - // look for all boxes / lines - { - SwSelBoxes aSelBoxes; - ::GetTblSel( rSh, aSelBoxes ); - _FndPara aPara( aSelBoxes, &aFndBox ); - const SwTable& rTbl = pTblNd->GetTable(); - ((SwTableLines&)rTbl.GetTabLines()).ForEach( &_FndLineCopyCol, &aPara ); - } - rX = aFndBox.GetLines().Count(); - if( !rX ) - return sal_False; - - rY = aFndBox.GetLines()[0]->GetBoxes().Count(); - return sal_True; -} - -/*-------------------------------------------------------------------- - Description: init list - --------------------------------------------------------------------*/ -SwSortDlg::SwSortDlg(Window* pParent, SwWrtShell &rShell) : - - SvxStandardDialog(pParent, SW_RES(DLG_SORTING)), - - aColLbl(this, SW_RES(FT_COL )), - aTypLbl(this, SW_RES(FT_KEYTYP)), - aDirLbl(this, SW_RES(FT_DIR )), - aSortFL(this, SW_RES(FL_SORT_2 )), - - - aKeyCB1(this, SW_RES(CB_KEY1 )), - aColEdt1(this, SW_RES(ED_KEY1 )), - aTypDLB1(this, SW_RES(DLB_KEY1 )), - aSortUpRB(this, SW_RES(RB_UP )), - aSortDnRB(this, SW_RES(RB_DN )), - - aKeyCB2(this, SW_RES(CB_KEY2 )), - aColEdt2(this, SW_RES(ED_KEY2 )), - aTypDLB2(this, SW_RES(DLB_KEY2 )), - aSortUp2RB(this, SW_RES(RB_UP2 )), - aSortDn2RB(this, SW_RES(RB_DN2 )), - - aKeyCB3(this, SW_RES(CB_KEY3 )), - aColEdt3(this, SW_RES(ED_KEY3 )), - aTypDLB3(this, SW_RES(DLB_KEY3 )), - aSortUp3RB(this, SW_RES(RB_UP3 )), - aSortDn3RB(this, SW_RES(RB_DN3 )), - aDirFL(this, SW_RES(FL_DIR )), - - aColumnRB(this, SW_RES(RB_COL )), - aRowRB(this, SW_RES(RB_ROW )), - - aDelimFL(this, SW_RES(FL_DELIM )), - aDelimTabRB(this, SW_RES(RB_TAB )), - aDelimFreeRB(this, SW_RES(RB_TABCH )), - aDelimEdt(this, SW_RES(ED_TABCH )), - aDelimPB(this, SW_RES( PB_DELIM)), - - aLangFL(this, SW_RES( FL_LANG )), - aLangLB(this, SW_RES( LB_LANG )), - - aSortOptFL(this, SW_RES( FL_SORT )), - aCaseCB(this, SW_RES( CB_CASE )), - - aOkBtn(this, SW_RES(BT_OK )), - aCancelBtn(this, SW_RES(BT_CANCEL)), - aHelpBtn(this, SW_RES(BT_HELP )), - - aColTxt( SW_RES(STR_COL)), - aRowTxt( SW_RES(STR_ROW)), - aNumericTxt( SW_RES(STR_NUMERIC)), - rSh(rShell), - pColRes( 0 ), - nX( 99 ), - nY( 99 ) -{ - aColEdt1.SetAccessibleName(aColLbl.GetText()); - aColEdt2.SetAccessibleName(aColLbl.GetText()); - aColEdt3.SetAccessibleName(aColLbl.GetText()); - aTypDLB1.SetAccessibleName(aTypLbl.GetText()); - aTypDLB2.SetAccessibleName(aTypLbl.GetText()); - aTypDLB3.SetAccessibleName(aTypLbl.GetText()); - aSortUpRB.SetAccessibleRelationMemberOf( &aKeyCB1 ); - aSortDnRB.SetAccessibleRelationMemberOf( &aKeyCB1 ); - aSortUp2RB.SetAccessibleRelationMemberOf( &aKeyCB2 ); - aSortDn2RB.SetAccessibleRelationMemberOf( &aKeyCB2 ); - aSortUp3RB.SetAccessibleRelationMemberOf( &aKeyCB3 ); - aSortDn3RB.SetAccessibleRelationMemberOf( &aKeyCB3 ); - - aDelimEdt.SetMaxTextLen( 1 ); - if(rSh.GetSelectionType() & - (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) ) - { - aColumnRB.Check(bCol); - aColLbl.SetText(bCol ? aRowTxt : aColTxt); - aRowRB.Check(!bCol); - aDelimTabRB.Enable(sal_False); - aDelimFreeRB.Enable(sal_False); - aDelimEdt.Enable(sal_False); - } - else - { - aColumnRB.Enable(sal_False); - aRowRB.Check(sal_True); - aColLbl.SetText(aColTxt); - } - - // initialise - Link aLk = LINK(this,SwSortDlg, CheckHdl); - aKeyCB1.SetClickHdl( aLk ); - aKeyCB2.SetClickHdl( aLk ); - aKeyCB3.SetClickHdl( aLk ); - aColumnRB.SetClickHdl( aLk ); - aRowRB.SetClickHdl( aLk ); - - aLk = LINK(this,SwSortDlg, DelimHdl); - aDelimFreeRB.SetClickHdl(aLk); - aDelimTabRB.SetClickHdl(aLk); - - aDelimPB.SetClickHdl( LINK( this, SwSortDlg, DelimCharHdl )); - - aKeyCB1.Check(bCheck1); - aKeyCB2.Check(bCheck2); - aKeyCB3.Check(bCheck3); - - aColEdt1.SetValue(nCol1); - aColEdt2.SetValue(nCol2); - aColEdt3.SetValue(nCol3); - - // first initialise the language, then select the - if( LANGUAGE_NONE == nLang || LANGUAGE_DONTKNOW == nLang ) - nLang = (sal_uInt16)GetAppLanguage(); - - aLangLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, sal_True, sal_False); - aLangLB.SelectLanguage( nLang ); - - LanguageHdl( 0 ); - aLangLB.SetSelectHdl( LINK( this, SwSortDlg, LanguageHdl )); - - aSortUpRB.Check(bAsc1); - aSortDnRB.Check(!bAsc1); - aSortUp2RB.Check(bAsc2); - aSortDn2RB.Check(!bAsc2); - aSortUp3RB.Check(bAsc3); - aSortDn3RB.Check(!bAsc3); - - aCaseCB.Check( bCsSens ); - - aDelimTabRB.Check(cDeli == '\t'); - if(!aDelimTabRB.IsChecked()) - { - aDelimEdt.SetText(cDeli); - aDelimFreeRB.Check(sal_True); - DelimHdl(&aDelimFreeRB); - } - else - DelimHdl(&aDelimTabRB); - - FreeResource(); - if( ::lcl_GetSelTbl( rSh, nX, nY) ) - { - sal_uInt16 nMax = aRowRB.IsChecked()? nY : nX; - aColEdt1.SetMax(nMax); - aColEdt2.SetMax(nMax); - aColEdt3.SetMax(nMax); - } - - aDelimEdt.SetAccessibleRelationLabeledBy(&aDelimFreeRB); - aDelimPB.SetAccessibleRelationLabeledBy(&aDelimFreeRB); - aDelimPB.SetAccessibleRelationMemberOf(&aDelimFL); - - aColEdt1.SetAccessibleRelationMemberOf(&aKeyCB1); - aColEdt1.SetAccessibleRelationLabeledBy(&aColLbl); - aTypDLB1.SetAccessibleRelationMemberOf(&aKeyCB1); - aTypDLB1.SetAccessibleRelationLabeledBy(&aTypLbl); - - aColEdt2.SetAccessibleRelationMemberOf(&aKeyCB2); - aColEdt2.SetAccessibleRelationLabeledBy(&aColLbl); - aTypDLB2.SetAccessibleRelationMemberOf(&aKeyCB2); - aTypDLB2.SetAccessibleRelationLabeledBy(&aTypLbl); - - aColEdt3.SetAccessibleRelationMemberOf(&aKeyCB3); - aColEdt3.SetAccessibleRelationLabeledBy(&aColLbl); - aTypDLB3.SetAccessibleRelationMemberOf(&aKeyCB3); - aTypDLB3.SetAccessibleRelationLabeledBy(&aTypLbl); -} - -SwSortDlg::~SwSortDlg() -{ - ::lcl_ClearLstBoxAndDelUserData( aTypDLB1 ); - ::lcl_ClearLstBoxAndDelUserData( aTypDLB2 ); - ::lcl_ClearLstBoxAndDelUserData( aTypDLB3 ); - delete pColRes; -} - -sal_Unicode SwSortDlg::GetDelimChar() const -{ - sal_Unicode cRet = '\t'; - if( !aDelimTabRB.IsChecked() ) - { - String aTmp( aDelimEdt.GetText() ); - if( aTmp.Len() ) - cRet = aTmp.GetChar( 0 ); - } - return cRet; -} - -/*-------------------------------------------------------------------- - Description: pass on to the Core - --------------------------------------------------------------------*/ -void SwSortDlg::Apply() -{ - // save all settings - bCheck1 = aKeyCB1.IsChecked(); - bCheck2 = aKeyCB2.IsChecked(); - bCheck3 = aKeyCB3.IsChecked(); - - nCol1 = (sal_uInt16)aColEdt1.GetValue(); - nCol2 = (sal_uInt16)aColEdt2.GetValue(); - nCol3 = (sal_uInt16)aColEdt3.GetValue(); - - nType1 = aTypDLB1.GetSelectEntryPos(); - nType2 = aTypDLB2.GetSelectEntryPos(); - nType3 = aTypDLB3.GetSelectEntryPos(); - - bAsc1 = aSortUpRB.IsChecked(); - bAsc2 = aSortUp2RB.IsChecked(); - bAsc3 = aSortUp3RB.IsChecked(); - bCol = aColumnRB.IsChecked(); - nLang = aLangLB.GetSelectLanguage(); - cDeli = GetDelimChar(); - bCsSens = aCaseCB.IsChecked(); - - void* pUserData; - SwSortOptions aOptions; - if( bCheck1 ) - { - String sEntry( aTypDLB1.GetSelectEntry() ); - if( sEntry == aNumericTxt ) - sEntry.Erase(); - else if( 0 != (pUserData = aTypDLB1.GetEntryData( - aTypDLB1.GetSelectEntryPos())) ) - sEntry = *(String*)pUserData; - - SwSortKey *pKey = new SwSortKey( nCol1, sEntry, - bAsc1 ? SRT_ASCENDING : SRT_DESCENDING ); - aOptions.aKeys.C40_INSERT(SwSortKey, pKey, aOptions.aKeys.Count()); - } - - if( bCheck2 ) - { - String sEntry( aTypDLB2.GetSelectEntry() ); - if( sEntry == aNumericTxt ) - sEntry.Erase(); - else if( 0 != (pUserData = aTypDLB2.GetEntryData( - aTypDLB2.GetSelectEntryPos())) ) - sEntry = *(String*)pUserData; - - SwSortKey *pKey = new SwSortKey( nCol2, sEntry, - bAsc2 ? SRT_ASCENDING : SRT_DESCENDING ); - aOptions.aKeys.C40_INSERT( SwSortKey, pKey, aOptions.aKeys.Count() ); - } - - if( bCheck3 ) - { - String sEntry( aTypDLB3.GetSelectEntry() ); - if( sEntry == aNumericTxt ) - sEntry.Erase(); - else if( 0 != (pUserData = aTypDLB3.GetEntryData( - aTypDLB3.GetSelectEntryPos())) ) - sEntry = *(String*)pUserData; - - SwSortKey *pKey = new SwSortKey( nCol3, sEntry, - bAsc3 ? SRT_ASCENDING : SRT_DESCENDING ); - aOptions.aKeys.C40_INSERT( SwSortKey, pKey, aOptions.aKeys.Count() ); - } - - aOptions.eDirection = bCol ? SRT_COLUMNS : SRT_ROWS; - aOptions.cDeli = cDeli; - aOptions.nLanguage = nLang; - aOptions.bTable = rSh.IsTableMode(); - aOptions.bIgnoreCase = !bCsSens; - - sal_Bool bRet; - { - SwWait aWait( *rSh.GetView().GetDocShell(), sal_True ); - rSh.StartAllAction(); - if( 0 != (bRet = rSh.Sort( aOptions ))) - rSh.SetModified(); - rSh.EndAllAction(); - } - - if( !bRet ) - InfoBox( this->GetParent(), SW_RES(MSG_SRTERR)).Execute(); -} - -IMPL_LINK( SwSortDlg, DelimHdl, RadioButton*, pButton ) -{ - sal_Bool bEnable = pButton == &aDelimFreeRB && aDelimFreeRB.IsEnabled(); - aDelimEdt.Enable( bEnable ); - aDelimPB.Enable( bEnable ); - return 0; -} - -IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG ) -{ - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - SfxAllItemSet aSet( rSh.GetAttrPool() ); - aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); - SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet, - rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); - if( RET_OK == pMap->Execute() ) - { - SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, sal_False ); - if ( pItem ) - aDelimEdt.SetText( sal_Unicode ( pItem->GetValue() ) ); - } - - delete pMap; - } - return 0; -} - -IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck ) -{ - if( pCheck == ( CheckBox* ) &aRowRB) - { - aColLbl.SetText(aColTxt); - aColEdt1.SetMax(nY); - aColEdt2.SetMax(nY); - aColEdt3.SetMax(nY); - - aColEdt1.SetAccessibleName(aColTxt); - aColEdt2.SetAccessibleName(aColTxt); - aColEdt3.SetAccessibleName(aColTxt); - } - else if( pCheck == ( CheckBox* ) &aColumnRB) - { - aColLbl.SetText(aRowTxt); - aColEdt1.SetMax(nX); - aColEdt2.SetMax(nX); - aColEdt3.SetMax(nX); - - aColEdt1.SetAccessibleName(aRowTxt); - aColEdt2.SetAccessibleName(aRowTxt); - aColEdt3.SetAccessibleName(aRowTxt); - } - else if(!aKeyCB1.IsChecked() && - !aKeyCB2.IsChecked() && - !aKeyCB3.IsChecked()) - pCheck->Check(sal_True); - return 0; -} - -IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox ) -{ - Locale aLcl( SvxCreateLocale( aLangLB.GetSelectLanguage() ) ); - Sequence < OUString > aSeq( - GetAppCollator().listCollatorAlgorithms( aLcl )); - - if( !pColRes ) - pColRes = new CollatorRessource(); - - const sal_uInt16 nLstBoxCnt = 3; - ListBox* aLstArr[ nLstBoxCnt ] = { &aTypDLB1, &aTypDLB2, &aTypDLB3 }; - sal_uInt16* aTypeArr[ nLstBoxCnt ] = { &nType1, &nType2, &nType3 }; - String aOldStrArr[ nLstBoxCnt ]; - sal_uInt16 n; - - void* pUserData; - for( n = 0; n < nLstBoxCnt; ++n ) - { - ListBox* pL = aLstArr[ n ]; - if( 0 != (pUserData = pL->GetEntryData( pL->GetSelectEntryPos())) ) - aOldStrArr[ n ] = *(String*)pUserData; - ::lcl_ClearLstBoxAndDelUserData( *pL ); - } - - sal_uInt16 nInsPos; - String sAlg, sUINm; - for( long nCnt = 0, nEnd = aSeq.getLength(); nCnt <= nEnd; ++nCnt ) - { - if( nCnt < nEnd ) - sUINm = pColRes->GetTranslation( sAlg = aSeq[ nCnt ] ); - else - sUINm = sAlg = aNumericTxt; - - for( n = 0; n < nLstBoxCnt; ++n ) - { - ListBox* pL = aLstArr[ n ]; - nInsPos = pL->InsertEntry( sUINm ); - pL->SetEntryData( nInsPos, new String( sAlg )); - if( pLBox && sAlg == aOldStrArr[ n ] ) - pL->SelectEntryPos( nInsPos ); - } - } - - for( n = 0; n < nLstBoxCnt; ++n ) - { - ListBox* pL = aLstArr[ n ]; - if( !pLBox ) - pL->SelectEntryPos( *aTypeArr[n] ); - else if( LISTBOX_ENTRY_NOTFOUND == pL->GetSelectEntryPos() ) - pL->SelectEntryPos( 0 ); - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/srtdlg.hrc b/sw/source/ui/misc/srtdlg.hrc deleted file mode 100644 index 034852718d..0000000000 --- a/sw/source/ui/misc/srtdlg.hrc +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * 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 BT_OK 1 -#define BT_CANCEL 2 -#define FT_COL 3 -#define FT_KEYTYP 4 -#define CB_KEY1 5 -#define ED_KEY1 6 -#define DLB_KEY1 7 -#define CB_KEY2 8 -#define ED_KEY2 9 -#define DLB_KEY2 10 -#define CB_KEY3 11 -#define ED_KEY3 12 -#define DLB_KEY3 13 -#define FL_SORT_2 14 -#define RB_COL 15 -#define RB_ROW 16 -#define FL_DIR 17 -#define RB_UP 18 -#define RB_DN 19 -#define FL_ORDER 20 -#define RB_TAB 21 -#define RB_TABCH 22 -#define ED_TABCH 23 -#define FL_DELIM 24 -#define STR_ROW 25 -#define STR_COL 26 -#define BT_HELP 27 -#define FT_DIR 28 -#define RB_UP2 29 -#define RB_DN2 30 -#define RB_UP3 31 -#define RB_DN3 32 -#define STR_NUMERIC 33 -#define PB_DELIM 34 -#define FL_LANG 35 -#define LB_LANG 36 -#define FL_SORT 37 -#define CB_CASE 38 - diff --git a/sw/source/ui/misc/srtdlg.src b/sw/source/ui/misc/srtdlg.src deleted file mode 100644 index 5ff6c48a8c..0000000000 --- a/sw/source/ui/misc/srtdlg.src +++ /dev/null @@ -1,403 +0,0 @@ -/************************************************************************* - * - * 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 "misc.hrc" -#include "srtdlg.hrc" -#include "cmdid.h" -#include "helpid.h" - -ModalDialog DLG_SORTING -{ - HelpID = CMD_FN_SORTING_DLG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 268 , 193 ) ; - Text [ en-US ] = "Sort" ; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 212 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 212 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 212 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_COL - { - Pos = MAP_APPFONT ( 68 , 12 ) ; - Size = MAP_APPFONT ( 25 , 8 ) ; - Text [ en-US ] = "Column" ; - Left = TRUE ; - }; - FixedText FT_KEYTYP - { - Pos = MAP_APPFONT ( 101, 12 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - Text [ en-US ] = "Key type" ; - Left = TRUE ; - }; - FixedText FT_DIR - { - Pos = MAP_APPFONT ( 155 , 12 ) ; - Size = MAP_APPFONT ( 49 , 10 ) ; - Text [ en-US ] = "Order" ; - }; - CheckBox CB_KEY1 - { - HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY1"; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Key ~1" ; - Check = TRUE ; - }; - NumericField ED_KEY1 - { - HelpID = "sw:NumericField:DLG_SORTING:ED_KEY1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 23 ) ; - Size = MAP_APPFONT ( 25 , 12 ) ; - Text = "10" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Value = 1 ; - First = 1 ; - Last = 99 ; - SpinSize = 1 ; - }; - String STR_NUMERIC - { - Text [ en-US ] = "Numeric"; - }; - ListBox DLB_KEY1 - { - HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY1"; - Pos = MAP_APPFONT ( 96 , 23 ) ; - Size = MAP_APPFONT ( 55 , 45 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - Sort = TRUE; - }; - RadioButton RB_UP - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_UP"; - Pos = MAP_APPFONT ( 155 , 23 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Ascending" ; - TabStop = TRUE ; - Check = TRUE ; - }; - RadioButton RB_DN - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_DN"; - Pos = MAP_APPFONT ( 155 , 35 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Descending" ; - TabStop = TRUE ; - }; - CheckBox CB_KEY2 - { - HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY2"; - Pos = MAP_APPFONT ( 12 , 52 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Key ~2" ; - }; - NumericField ED_KEY2 - { - HelpID = "sw:NumericField:DLG_SORTING:ED_KEY2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 50 ) ; - Size = MAP_APPFONT ( 25 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Value = 1 ; - First = 1 ; - Last = 99 ; - SpinSize = 1 ; - }; - ListBox DLB_KEY2 - { - HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY2"; - Pos = MAP_APPFONT ( 96 , 50 ) ; - Size = MAP_APPFONT ( 55 , 45 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - Sort = TRUE; - }; - RadioButton RB_UP2 - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_UP2"; - Pos = MAP_APPFONT ( 155 , 50 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Ascending" ; - TabStop = TRUE ; - Check = TRUE ; - }; - RadioButton RB_DN2 - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_DN2"; - Pos = MAP_APPFONT ( 155 , 62 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Descending" ; - TabStop = TRUE ; - }; - CheckBox CB_KEY3 - { - HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY3"; - Pos = MAP_APPFONT ( 12 , 81 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Key ~3" ; - }; - NumericField ED_KEY3 - { - HelpID = "sw:NumericField:DLG_SORTING:ED_KEY3"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 79 ) ; - Size = MAP_APPFONT ( 25 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Value = 1 ; - First = 1 ; - Last = 99 ; - SpinSize = 1 ; - }; - ListBox DLB_KEY3 - { - HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY3"; - Pos = MAP_APPFONT ( 96 , 79 ) ; - Size = MAP_APPFONT ( 55 , 45 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - Sort = TRUE; - }; - RadioButton RB_UP3 - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_UP3"; - Pos = MAP_APPFONT ( 155 , 79 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Ascending" ; - TabStop = TRUE ; - Check = TRUE ; - }; - RadioButton RB_DN3 - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_DN3"; - Pos = MAP_APPFONT ( 155 , 91 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Descending" ; - TabStop = TRUE ; - }; - FixedLine FL_SORT_2 - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - Text [ en-US ] = "Sort criteria" ; - }; - RadioButton RB_COL - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_COL"; - Pos = MAP_APPFONT ( 12 , 120 ) ; - Size = MAP_APPFONT ( 38 , 10 ) ; - Text [ en-US ] = "Col~umns" ; - TabStop = TRUE ; - }; - RadioButton RB_ROW - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_ROW"; - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Rows" ; - TabStop = TRUE ; - Check = TRUE ; - }; - FixedLine FL_DIR - { - Pos = MAP_APPFONT ( 6 , 108 ) ; - Size = MAP_APPFONT ( 95 , 8 ) ; - Text [ en-US ] = "Direction" ; - }; - RadioButton RB_TAB - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_TAB"; - Pos = MAP_APPFONT ( 113 , 120 ) ; - Size = MAP_APPFONT ( 44 , 9 ) ; - Text [ en-US ] = "~Tabs" ; - TabStop = TRUE ; - Check = TRUE ; - }; - RadioButton RB_TABCH - { - HelpID = "sw:RadioButton:DLG_SORTING:RB_TABCH"; - Pos = MAP_APPFONT ( 113 , 133 ) ; - Size = MAP_APPFONT ( 38 , 10 ) ; - Text [ en-US ] = "~Character" ; - TabStop = TRUE ; - }; - Edit ED_TABCH - { - HelpID = "sw:Edit:DLG_SORTING:ED_TABCH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 180 , 133 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - }; - FixedLine FL_DELIM - { - Pos = MAP_APPFONT ( 107 , 108 ) ; - Size = MAP_APPFONT ( 99 , 8 ) ; - Text [ en-US ] = "Separator" ; - }; - String STR_ROW - { - Text [ en-US ] = "Rows" ; - }; - String STR_COL - { - Text [ en-US ] = "Column" ; - }; - PushButton PB_DELIM - { - HelpID = "sw:PushButton:DLG_SORTING:PB_DELIM"; - Pos = MAP_APPFONT ( 195 , 133 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - TabStop = TRUE ; - Text = "..."; - }; - FixedLine FL_LANG - { - Pos = MAP_APPFONT ( 6 , 147 ) ; - Size = MAP_APPFONT ( 95 , 8 ) ; - Text [ en-US ] = "Language"; - }; - ListBox LB_LANG - { - HelpID = "sw:ListBox:DLG_SORTING:LB_LANG"; - Pos = MAP_APPFONT ( 12 , 158 ) ; - Size = MAP_APPFONT ( 83 , 61 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedLine FL_SORT - { - Pos = MAP_APPFONT ( 107 , 147 ) ; - Size = MAP_APPFONT ( 99 , 8 ) ; - Text [ en-US ] = "Setting"; - }; - CheckBox CB_CASE - { - HelpID = "sw:CheckBox:DLG_SORTING:CB_CASE"; - Pos = MAP_APPFONT ( 113 , 159 ) ; - Size = MAP_APPFONT ( 147 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Match case"; - }; - -}; -InfoBox MSG_SRTERR -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "Cannot sort selection" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx deleted file mode 100644 index d00a3ae13f..0000000000 --- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - - - -#define _SVSTDARR_STRINGSSORTDTOR -#define _SVSTDARR_USHORTS - - -#include <redline.hxx> -#include <tools/datetime.hxx> -#include <vcl/msgbox.hxx> -#include <svl/svstdarr.hxx> -#include <svl/eitem.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/dispatch.hxx> -#include <svx/ctredlin.hxx> -#include <svx/postattr.hxx> -#include <swtypes.hxx> -#include <wrtsh.hxx> -#include <view.hxx> -#include <swmodule.hxx> -#include <swwait.hxx> -#include <uitool.hxx> - -#include <helpid.h> -#include <cmdid.h> -#include <misc.hrc> -#include <redlndlg.hrc> -#include <shells.hrc> - -#include <vector> -#ifndef _REDLNDLG_HXX -#define _REDLNACCEPTDLG -#include <redlndlg.hxx> -#endif -#include "swmodalredlineacceptdlg.hxx" - -#include <unomid.h> - -SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(Window *pParent) : - SfxModalDialog(pParent, SW_RES(DLG_MOD_REDLINE_ACCEPT)) -{ - pImplDlg = new SwRedlineAcceptDlg(this, sal_True); - - pImplDlg->Initialize(GetExtraData()); - pImplDlg->Activate(); // for data's initialisation - - FreeResource(); -} - -SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg() -{ - AcceptAll(sal_False); // refuse everything remaining - pImplDlg->FillInfo(GetExtraData()); - - delete pImplDlg; -} - -void SwModalRedlineAcceptDlg::Activate() -{ -} - -void SwModalRedlineAcceptDlg::Resize() -{ - pImplDlg->Resize(); - SfxModalDialog::Resize(); -} - -void SwModalRedlineAcceptDlg::AcceptAll( sal_Bool bAccept ) -{ - SvxTPFilter* pFilterTP = pImplDlg->GetChgCtrl()->GetFilterPage(); - - if (pFilterTP->IsDate() || pFilterTP->IsAuthor() || - pFilterTP->IsRange() || pFilterTP->IsAction()) - { - pFilterTP->CheckDate(sal_False); // turn off all filters - pFilterTP->CheckAuthor(sal_False); - pFilterTP->CheckRange(sal_False); - pFilterTP->CheckAction(sal_False); - pImplDlg->FilterChangedHdl(); - } - - pImplDlg->CallAcceptReject( sal_False, bAccept ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx deleted file mode 100644 index 6aac405678..0000000000 --- a/sw/source/ui/misc/titlepage.cxx +++ /dev/null @@ -1,359 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Caolán McNamara <caolanm@redhat.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - -#ifdef SW_DLLIMPLEMENTATION -#undef SW_DLLIMPLEMENTATION -#endif - -#include <sfx2/viewfrm.hxx> -#include <vcl/msgbox.hxx> -#include <view.hxx> -#include <swmodule.hxx> -#include <wrtsh.hxx> -#include <poolfmt.hxx> -#include <docsh.hxx> -#include <charfmt.hxx> -#include <docstyle.hxx> - -#include "fldbas.hxx" -#include "lineinfo.hxx" -#include "globals.hrc" -#include "titlepage.hrc" -#include "titlepage.hxx" -#include "uitool.hxx" -#include "fmtpdsc.hxx" -#include "pagedesc.hxx" - -#include <IDocumentStylePoolAccess.hxx> - -namespace -{ - bool lcl_GetPageDesc(SwWrtShell *pSh, sal_uInt16 &rPageNo, const SwFmtPageDesc **ppPageFmtDesc) - { - bool bRet = false; - SfxItemSet aSet( pSh->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC ); - if (pSh->GetCurAttr( aSet )) - { - const SfxPoolItem* pItem(0); - if (SFX_ITEM_SET == aSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) && pItem) - { - rPageNo = ((const SwFmtPageDesc *)pItem)->GetNumOffset(); - if (ppPageFmtDesc) - (*ppPageFmtDesc) = (const SwFmtPageDesc *)(pItem->Clone()); - bRet = true; - } - } - return bRet; - } - - void lcl_ChangePage(SwWrtShell *pSh, sal_uInt16 nNewNumber, - const SwPageDesc *pNewDesc) - { - const sal_uInt16 nCurIdx = pSh->GetCurPageDesc(); - const SwPageDesc &rCurrentDesc = pSh->GetPageDesc( nCurIdx ); - - const SwFmtPageDesc *pPageFmtDesc(0); - sal_uInt16 nDontCare; - lcl_GetPageDesc(pSh, nDontCare, &pPageFmtDesc); - - //If we want a new number then set it, otherwise reuse the existing one - sal_uInt16 nPgNo = nNewNumber ? - nNewNumber : ( pPageFmtDesc ? pPageFmtDesc->GetNumOffset() : 0 ); - - //If we want a new descriptior then set it, otherwise reuse the existing one - if (!pNewDesc) - { - SwFmtPageDesc aPageFmtDesc(pPageFmtDesc ? *pPageFmtDesc : &rCurrentDesc); - if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo); - pSh->SetAttr(aPageFmtDesc); - } - else - { - SwFmtPageDesc aPageFmtDesc(pNewDesc); - if (nPgNo) aPageFmtDesc.SetNumOffset(nPgNo); - pSh->SetAttr(aPageFmtDesc); - } - - delete pPageFmtDesc; - } - - void lcl_PushCursor(SwWrtShell *pSh) - { - pSh->LockView( sal_True ); - pSh->StartAllAction(); - pSh->SwCrsrShell::Push(); - } - - void lcl_PopCursor(SwWrtShell *pSh) - { - pSh->SwCrsrShell::Pop( sal_False ); - pSh->EndAllAction(); - pSh->LockView( sal_False ); - } - - sal_uInt16 lcl_GetCurrentPage(SwWrtShell *pSh) - { - String sDummy; - sal_uInt16 nPhyNum=1, nVirtNum=1; - pSh->GetPageNumber(0, true, nPhyNum, nVirtNum, sDummy); - return nPhyNum; - } -} - -/* - * Only include the Index page in the list if the page count implies one - * to reduce confusing things - */ -void SwTitlePageDlg::FillList() -{ - sal_uInt16 nTitlePages = aPageCountNF.GetValue(); - aPagePropertiesLB.Clear(); - if (mpTitleDesc) - aPagePropertiesLB.InsertEntry(mpTitleDesc->GetName()); - if (nTitlePages > 1 && mpIndexDesc) - aPagePropertiesLB.InsertEntry(mpIndexDesc->GetName()); - if (mpNormalDesc) - aPagePropertiesLB.InsertEntry(mpNormalDesc->GetName()); - aPagePropertiesLB.SelectEntryPos(0); -} - -sal_uInt16 SwTitlePageDlg::GetInsertPosition() const -{ - sal_uInt16 nPage = 1; - if (aPageStartNF.IsEnabled()) - nPage = aPageStartNF.GetValue(); - return nPage; -} - -SwTitlePageDlg::SwTitlePageDlg( Window *pParent ) : - SfxModalDialog( pParent, SW_RES(DLG_TITLEPAGE) ), -#ifdef MSC -#pragma warning (disable : 4355) -#endif - aMakeInsertFL ( this, SW_RES( FL_MAKEINSERT )), - aUseExistingPagesRB ( this, SW_RES( RB_USE_EXISTING_PAGES )), - aInsertNewPagesRB ( this, SW_RES( RB_INSERT_NEW_PAGES )), - aPageCountFT ( this, SW_RES( FT_PAGE_COUNT )), - aPageCountNF ( this, SW_RES( NF_PAGE_COUNT )), - aPagePagesFT ( this, SW_RES( FT_PAGE_PAGES )), - aPageStartFT ( this, SW_RES( FT_PAGE_START )), - aDocumentStartRB ( this, SW_RES( RB_DOCUMENT_START )), - aPageStartRB ( this, SW_RES( RB_PAGE_START )), - aPageStartNF ( this, SW_RES( NF_PAGE_START )), - aNumberingFL ( this, SW_RES( FL_NUMBERING )), - aRestartNumberingCB ( this, SW_RES( CB_RESTART_NUMBERING )), - aRestartNumberingFT ( this, SW_RES( FT_RESTART_NUMBERING )), - aRestartNumberingNF ( this, SW_RES( NF_RESTART_NUMBERING )), - aSetPageNumberCB ( this, SW_RES( CB_SET_PAGE_NUMBER )), - aSetPageNumberFT ( this, SW_RES( FT_SET_PAGE_NUMBER )), - aSetPageNumberNF ( this, SW_RES( NF_SET_PAGE_NUMBER )), - aPagePropertiesFL ( this, SW_RES( FL_PAGE_PROPERTIES )), - aPagePropertiesLB ( this, SW_RES( LB_PAGE_PROPERTIES )), - aPagePropertiesPB ( this, SW_RES( PB_PAGE_PROPERTIES )), - aBottomFL ( this, SW_RES( FL_BOTTOM )), - aOkPB ( this, SW_RES( PB_OK )), - aCancelPB ( this, SW_RES( PB_CANCEL )), - aHelpPB ( this, SW_RES( PB_HELP )), - mpPageFmtDesc (0) -#ifdef MSC -#pragma warning (default : 4355) -#endif -{ - FreeResource(); - - aOkPB.SetClickHdl(LINK(this, SwTitlePageDlg, OKHdl)); - aRestartNumberingCB.SetClickHdl(LINK(this, SwTitlePageDlg, RestartNumberingHdl)); - aSetPageNumberCB.SetClickHdl(LINK(this, SwTitlePageDlg, SetPageNumberHdl)); - - sal_uInt16 nSetPage = 1; - sal_uInt16 nResetPage = 1; - sal_uInt16 nTitlePages = 1; - mpSh = ::GetActiveView()->GetWrtShellPtr(); - lcl_PushCursor(mpSh); - - SwView& rView = mpSh->GetView(); - rView.InvalidateRulerPos(); - - bool bMaybeResetNumbering = false; - - mpTitleDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_FIRST); - mpIndexDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_REGISTER); - mpNormalDesc = mpSh->GetPageDescFromPool(RES_POOLPAGE_STANDARD); - - mpSh->SttDoc(); - if (lcl_GetPageDesc( mpSh, nSetPage, &mpPageFmtDesc )) - { - if (mpPageFmtDesc->GetPageDesc() == mpTitleDesc) - { - while (mpSh->SttNxtPg()) - { - const sal_uInt16 nCurIdx = mpSh->GetCurPageDesc(); - const SwPageDesc &rPageDesc = mpSh->GetPageDesc( nCurIdx ); - - if (mpIndexDesc != &rPageDesc) - { - mpNormalDesc = &rPageDesc; - bMaybeResetNumbering = lcl_GetPageDesc(mpSh, nResetPage, NULL); - break; - } - ++nTitlePages; - } - } - } - lcl_PopCursor(mpSh); - - aUseExistingPagesRB.Check(); - aPageCountNF.SetValue(nTitlePages); - aPageCountNF.SetUpHdl(LINK(this, SwTitlePageDlg, UpHdl)); - aPageCountNF.SetDownHdl(LINK(this, SwTitlePageDlg, DownHdl)); - - aDocumentStartRB.Check(); - aPageStartNF.Enable(false); - aPageStartNF.SetValue(lcl_GetCurrentPage(mpSh)); - Link aStartPageHdl = LINK(this, SwTitlePageDlg, StartPageHdl); - aDocumentStartRB.SetClickHdl(aStartPageHdl); - aPageStartRB.SetClickHdl(aStartPageHdl); - - if (bMaybeResetNumbering && nResetPage > 0) - { - aRestartNumberingCB.Check(); - aRestartNumberingNF.SetValue(nResetPage); - } - aRestartNumberingNF.Enable(aRestartNumberingCB.IsChecked()); - - aSetPageNumberNF.SetValue(nSetPage); - if (nSetPage > 1) - aSetPageNumberCB.Check(); - aSetPageNumberNF.Enable(aSetPageNumberCB.IsChecked()); - - FillList(); - aPagePropertiesPB.SetClickHdl(LINK(this, SwTitlePageDlg, EditHdl)); -} - -IMPL_LINK(SwTitlePageDlg, UpHdl, NumericField *, EMPTYARG) -{ - if (aPageCountNF.GetValue() == 2) - FillList(); - return 0; -} - -IMPL_LINK(SwTitlePageDlg, DownHdl, NumericField *, EMPTYARG) -{ - if (aPageCountNF.GetValue() == 1) - FillList(); - return 0; -} - -IMPL_LINK(SwTitlePageDlg, RestartNumberingHdl, CheckBox*, EMPTYARG) -{ - aRestartNumberingNF.Enable(aRestartNumberingCB.IsChecked()); - return 0; -} - -IMPL_LINK(SwTitlePageDlg, SetPageNumberHdl, CheckBox*, EMPTYARG) -{ - aSetPageNumberNF.Enable(aSetPageNumberCB.IsChecked()); - return 0; -} - -IMPL_LINK(SwTitlePageDlg, StartPageHdl, RadioButton*, EMPTYARG) -{ - aPageStartNF.Enable(aPageStartRB.IsChecked()); - return 0; -} - -SwTitlePageDlg::~SwTitlePageDlg() -{ - delete mpPageFmtDesc; -} - -IMPL_LINK( SwTitlePageDlg, EditHdl, Button *, /*pBtn*/ ) -{ - SwView& rView = mpSh->GetView(); - rView.GetDocShell()->FormatPage(aPagePropertiesLB.GetSelectEntry(), false, mpSh); - rView.InvalidateRulerPos(); - - return 0; -} - -IMPL_LINK( SwTitlePageDlg, OKHdl, Button *, /*pBtn*/ ) -{ - lcl_PushCursor(mpSh); - - mpSh->StartUndo(); - - SwFmtPageDesc aTitleDesc(mpTitleDesc); - - if (aSetPageNumberCB.IsChecked()) - aTitleDesc.SetNumOffset(aSetPageNumberNF.GetValue()); - else if (mpPageFmtDesc) - aTitleDesc.SetNumOffset(mpPageFmtDesc->GetNumOffset()); - - sal_uInt16 nNoPages = aPageCountNF.GetValue(); - if (!aUseExistingPagesRB.IsChecked()) - { - mpSh->GotoPage(GetInsertPosition(), false); - for (sal_uInt16 nI=0; nI < nNoPages; ++nI) - mpSh->InsertPageBreak(); - } - - mpSh->GotoPage(GetInsertPosition(), false); - for (sal_uInt16 nI=1; nI < nNoPages; ++nI) - { - if (mpSh->SttNxtPg()) - lcl_ChangePage(mpSh, 0, mpIndexDesc); - } - - mpSh->GotoPage(GetInsertPosition(), false); - mpSh->SetAttr(aTitleDesc); - - if (nNoPages > 1 && mpSh->GotoPage(GetInsertPosition() + nNoPages, false)) - { - SwFmtPageDesc aPageFmtDesc(mpNormalDesc); - mpSh->SetAttr(aPageFmtDesc); - } - - if (aRestartNumberingCB.IsChecked() || nNoPages > 1) - { - sal_uInt16 nPgNo = aRestartNumberingCB.IsChecked() ? aRestartNumberingNF.GetValue() : 0; - const SwPageDesc *pNewDesc = nNoPages > 1 ? mpNormalDesc : 0; - mpSh->GotoPage(GetInsertPosition() + nNoPages, false); - lcl_ChangePage(mpSh, nPgNo, pNewDesc); - } - - mpSh->EndUndo(); - lcl_PopCursor(mpSh); - if (!aUseExistingPagesRB.IsChecked()) - mpSh->GotoPage(GetInsertPosition(), false); - EndDialog( RET_OK ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/titlepage.hrc b/sw/source/ui/misc/titlepage.hrc deleted file mode 100644 index 63678427cf..0000000000 --- a/sw/source/ui/misc/titlepage.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Caolán McNamara <caolanm@redhat.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -#define FL_MAKEINSERT 1 -#define RB_USE_EXISTING_PAGES 2 -#define RB_INSERT_NEW_PAGES 3 -#define FT_PAGE_COUNT 4 -#define NF_PAGE_COUNT 5 -#define FT_PAGE_PAGES 6 -#define FT_PAGE_START 7 -#define RB_DOCUMENT_START 8 -#define RB_PAGE_START 9 -#define NF_PAGE_START 10 -#define FL_NUMBERING 11 -#define CB_RESTART_NUMBERING 12 -#define FT_RESTART_NUMBERING 13 -#define NF_RESTART_NUMBERING 14 -#define CB_SET_PAGE_NUMBER 15 -#define FT_SET_PAGE_NUMBER 16 -#define NF_SET_PAGE_NUMBER 17 -#define FL_PAGE_PROPERTIES 18 -#define LB_PAGE_PROPERTIES 19 -#define PB_PAGE_PROPERTIES 20 -#define FL_BOTTOM 21 -#define PB_OK 22 -#define PB_CANCEL 23 -#define PB_HELP 24 diff --git a/sw/source/ui/misc/titlepage.src b/sw/source/ui/misc/titlepage.src deleted file mode 100644 index 1f61be1614..0000000000 --- a/sw/source/ui/misc/titlepage.src +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Caolán McNamara <caolanm@redhat.com> (Red Hat, Inc.) - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Caolán McNamara <caolanm@redhat.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "misc.hrc" -#include "titlepage.hrc" -#include "globals.hrc" -#include "cmdid.h" -#include "helpid.h" - -ModalDialog DLG_TITLEPAGE -{ - HelpID = HID_TITLEPAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 216 , 229 ) ; - Text [ en-US ] = "Title Pages" ; - Moveable = TRUE ; - - FixedLine FL_MAKEINSERT - { - Pos = MAP_APPFONT ( 6 , 5 ) ; - Size = MAP_APPFONT ( 204 , 8 ) ; - Text [ en-US ] = "Make Title Pages" ; - Text [ x-comment ] = " "; - }; - RadioButton RB_USE_EXISTING_PAGES - { - Pos = MAP_APPFONT ( 12 , 18 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - Text [ en-US ] = "Convert existing pages to title pages" ; - TabStop = TRUE ; - Check = TRUE ; - Text [ x-comment ] = " "; - }; - RadioButton RB_INSERT_NEW_PAGES - { - Pos = MAP_APPFONT ( 12 , 34 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - Text [ en-US ] = "Insert new title pages" ; - Text [ x-comment ] = " "; - }; - FixedText FT_PAGE_COUNT - { - Pos = MAP_APPFONT ( 12 , 50 ) ; - Size = MAP_APPFONT ( 82 , 8 ) ; - Text [ en-US ] = "Number of title pages" ; - Text [ x-comment ] = " "; - }; - NumericField NF_PAGE_COUNT - { - Pos = MAP_APPFONT ( 100 , 50 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 65535; - First = 1 ; - Last = 65535; - SpinSize = 1 ; - }; - FixedText FT_PAGE_PAGES - { - Pos = MAP_APPFONT ( 136 , 50 ) ; - Size = MAP_APPFONT ( 80 , 10 ) ; - Text [ en-US ] = "pages" ; - Text [ x-comment ] = " "; - }; - FixedText FT_PAGE_START - { - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 82 , 8 ) ; - Text [ en-US ] = "Place title pages at" ; - Text [ x-comment ] = " "; - }; - RadioButton RB_DOCUMENT_START - { - Pos = MAP_APPFONT ( 100 , 66 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - Text [ en-US ] = "Document Start" ; - TabStop = TRUE ; - Check = TRUE ; - Text [ x-comment ] = " "; - }; - RadioButton RB_PAGE_START - { - Pos = MAP_APPFONT ( 100 , 78 ) ; - Size = MAP_APPFONT ( 30 , 10 ) ; - Text [ en-US ] = "Page" ; - Text [ x-comment ] = " "; - }; - NumericField NF_PAGE_START - { - Pos = MAP_APPFONT ( 131 , 78 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 65535; - First = 1 ; - Last = 65535; - SpinSize = 1 ; - }; - FixedLine FL_NUMBERING - { - Pos = MAP_APPFONT ( 6 , 98 ) ; - Size = MAP_APPFONT ( 204 , 8 ) ; - Text [ en-US ] = "Page Numbering" ; - Text [ x-comment ] = " "; - }; - CheckBox CB_RESTART_NUMBERING - { - Pos = MAP_APPFONT ( 12, 111 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Reset Page Numbering after title pages" ; - Text [ x-comment ] = " "; - }; - FixedText FT_RESTART_NUMBERING - { - Pos = MAP_APPFONT ( 20 , 125 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "Page Number" ; - Text [ x-comment ] = " "; - }; - NumericField NF_RESTART_NUMBERING - { - Pos = MAP_APPFONT ( 100 , 125 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 65535; - First = 1 ; - Last = 65535; - SpinSize = 1 ; - }; - CheckBox CB_SET_PAGE_NUMBER - { - Pos = MAP_APPFONT ( 12 , 139 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Set Page Number for first title page" ; - Text [ x-comment ] = " "; - }; - FixedText FT_SET_PAGE_NUMBER - { - Pos = MAP_APPFONT ( 20 , 153 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "Page Number" ; - Text [ x-comment ] = " "; - }; - NumericField NF_SET_PAGE_NUMBER - { - Pos = MAP_APPFONT ( 100 , 153 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 65535; - First = 1 ; - Last = 65535; - SpinSize = 1 ; - }; - FixedLine FL_PAGE_PROPERTIES - { - Pos = MAP_APPFONT ( 6 , 169 ) ; - Size = MAP_APPFONT ( 204 , 8 ) ; - Text [ en-US ] = "Edit Page Properties" ; - Text [ x-comment ] = " "; - }; - ListBox LB_PAGE_PROPERTIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 182 ) ; - Size = MAP_APPFONT ( 132 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - }; - PushButton PB_PAGE_PROPERTIES - { - Pos = MAP_APPFONT ( 150 , 182 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - Text [ en-US ] = "Edit..." ; - }; - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 6 , 198 ) ; - Size = MAP_APPFONT ( 204 , 8 ) ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 54 , 209 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 107 , 209 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 160 , 209 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; |