Files
libreoffice/sw/source/ui/misc/outline.cxx

1159 lines
38 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 16:15:01 +00:00
#include <hintids.hxx>
#include <tools/shl.hxx>
#include <vcl/menu.hxx>
#include <vcl/msgbox.hxx>
#include <sfx2/tabdlg.hxx>
#include <editeng/brushitem.hxx>
2001-10-08 12:52:46 +00:00
#include <unotools/configmgr.hxx>
#include <SwStyleNameMapper.hxx>
2000-09-18 16:15:01 +00:00
#include <num.hxx>
#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>
2000-09-18 16:15:01 +00:00
#include <charfmt.hxx>
#include <docstyle.hxx>
2002-12-10 08:46:06 +00:00
#include <viewopt.hxx>
#include <svtools/ctrlbox.hxx>
2000-09-18 16:15:01 +00:00
#include <helpid.h>
#include <globals.hrc> // for template name 'none'
2000-09-18 16:15:01 +00:00
#include <misc.hrc>
#include <outline.hrc>
#include <paratr.hxx>
#include <unomid.h>
#include <IDocumentOutlineNodes.hxx>
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
#include <app.hrc>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
using namespace ::com::sun::star;
DBG_NAME(outlinehdl)
2000-09-18 16:15:01 +00:00
class SwNumNamesDlg: public ModalDialog
{
FixedLine aFormFL;
2000-09-18 16:15:01 +00:00
Edit aFormEdit;
ListBox aFormBox;
OKButton aOKBtn;
CancelButton aCancelBtn;
HelpButton aHelpBtn;
DECL_LINK( ModifyHdl, Edit * );
DECL_LINK( SelectHdl, ListBox * );
DECL_LINK(DoubleClickHdl, void *);
2000-09-18 16:15:01 +00:00
public:
SwNumNamesDlg(Window *pParent);
~SwNumNamesDlg();
void SetUserNames(const String *pList[]);
String GetName() const { return aFormEdit.GetText(); }
sal_uInt16 GetCurEntryPos() const { return aFormBox.GetSelectEntryPos(); }
2000-09-18 16:15:01 +00:00
};
/*------------------------------------------------------------------------
Description: remember selected entry
2000-09-18 16:15:01 +00:00
------------------------------------------------------------------------*/
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.
2000-09-18 16:15:01 +00:00
------------------------------------------------------------------------*/
void SwNumNamesDlg::SetUserNames(const String *pList[])
{
sal_uInt16 nSelect = 0;
for(sal_uInt16 i = 0; i < SwBaseNumRules::nMaxRules; ++i)
2000-09-18 16:15:01 +00:00
{
if(pList[i])
{
aFormBox.RemoveEntry(i);
aFormBox.InsertEntry(*pList[i], i);
if(i == nSelect && nSelect < SwBaseNumRules::nMaxRules)
nSelect++;
}
}
aFormBox.SelectEntryPos(nSelect);
SelectHdl(&aFormBox);
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
/*------------------------------------------------------------------------
Description: unlock OK-Button when text is in Edit
2000-09-18 16:15:01 +00:00
------------------------------------------------------------------------*/
IMPL_LINK_INLINE_START( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
{
aOKBtn.Enable(!pBox->GetText().isEmpty());
2000-09-18 16:15:01 +00:00
return 0;
}
IMPL_LINK_INLINE_END( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
/*------------------------------------------------------------------------
Description: DoubleClickHdl
2000-09-18 16:15:01 +00:00
------------------------------------------------------------------------*/
IMPL_LINK_NOARG_INLINE_START(SwNumNamesDlg, DoubleClickHdl)
2000-09-18 16:15:01 +00:00
{
EndDialog(RET_OK);
return 0;
}
IMPL_LINK_NOARG_INLINE_END(SwNumNamesDlg, DoubleClickHdl)
2000-09-18 16:15:01 +00:00
SwNumNamesDlg::SwNumNamesDlg(Window *pParent)
: ModalDialog(pParent, SW_RES(DLG_NUM_NAMES)),
2011-02-21 18:43:22 +01:00
aFormFL(this, SW_RES(FL_FORM)),
2000-09-18 16:15:01 +00:00
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);
}
2010-12-12 00:08:03 +01:00
SwNumNamesDlg::~SwNumNamesDlg() {}
2000-09-18 16:15:01 +00:00
static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel)
2000-09-18 16:15:01 +00:00
{
sal_uInt16 nTmp = nActLevel;
sal_uInt16 nTmpLevel = 0;
2000-09-18 16:15:01 +00:00
while( 0 != (nTmp >>= 1) )
nTmpLevel++;
return nTmpLevel;
}
sal_uInt16 SwOutlineTabDialog::nNumLevel = 1;
SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent, const SfxItemSet* pSwItemSet,
SwWrtShell &rSh)
: SfxTabDialog(pParent, "OutlineNumberingDialog",
"modules/swriter/ui/outlinenumbering.ui", pSwItemSet)
, rWrtSh(rSh)
, pChapterNumRules(SW_MOD()->GetChapterNumRules())
, bModified(rWrtSh.IsModified())
2000-09-18 16:15:01 +00:00
{
PushButton* pUserButton = GetUserButton();
pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl));
pUserButton->SetAccessibleRole( com::sun::star::accessibility::AccessibleRole::BUTTON_MENU );
2000-09-18 16:15:01 +00:00
pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl));
m_nNumPosId = AddTabPage("position", &SwNumPositionTabPage::Create, 0);
m_nOutlineId = AddTabPage("numbering", &SwOutlineSettingsTabPage::Create, 0);
2000-09-18 16:15:01 +00:00
String sHeadline;
sal_uInt16 i;
for( i = 0; i < MAXLEVEL; ++i )
2000-09-18 16:15:01 +00:00
{
// 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 )) )
2000-09-18 16:15:01 +00:00
aCollNames[i] = sHeadline;
}
// query the text templates' outlining levels
const sal_uInt16 nCount = rWrtSh.GetTxtFmtCollCount();
2000-09-18 16:15:01 +00:00
for(i = 0; i < nCount; ++i )
{
SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i);
if(!rTxtColl.IsDefault())
{
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
//->added by zhaojianwei
if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
{
int nOutLevel = rTxtColl.GetAssignedOutlineStyleLevel();
2000-09-18 16:15:01 +00:00
aCollNames[ nOutLevel ] = rTxtColl.GetName();
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
}
//<-end
2000-09-18 16:15:01 +00:00
}
}
}
SwOutlineTabDialog::~SwOutlineTabDialog()
{
delete pNumRule;
}
void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
2000-09-18 16:15:01 +00:00
{
if (nPageId == m_nNumPosId)
{
((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this);
}
else if (nPageId == m_nOutlineId)
2000-09-18 16:15:01 +00:00
{
((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh);
2000-09-18 16:15:01 +00:00
}
}
2010-10-12 17:05:15 +01:00
IMPL_LINK_NOARG(SwOutlineTabDialog, CancelHdl)
2000-09-18 16:15:01 +00:00
{
if (!bModified)
rWrtSh.ResetModified();
EndDialog(RET_CANCEL);
return 0;
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn )
{
PopupMenu *pFormMenu = get_menu("form");
// fill PopupMenu
for( sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i )
2000-09-18 16:15:01 +00:00
{
const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
if( pRules )
pFormMenu->SetItemText(pFormMenu->GetItemId(i), pRules->GetName());
2000-09-18 16:15:01 +00:00
}
OString sHelpId(pFormMenu->GetHelpId(pFormMenu->GetItemId("form1")));
for (sal_Int32 i = 2; i <= 9; ++i)
{
OString sForm("form");
pFormMenu->SetHelpId(pFormMenu->GetItemId(sForm + OString::valueOf(i)), sHelpId);
}
pFormMenu->SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl));
pFormMenu->Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN);
2000-09-18 16:15:01 +00:00
return 0;
}
IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu )
{
sal_uInt8 nLevelNo = 0;
OString sIdent = pMenu->GetCurItemIdent();
if (sIdent == "form1")
nLevelNo = 1;
else if (sIdent == "form2")
nLevelNo = 2;
else if (sIdent == "form3")
nLevelNo = 3;
else if (sIdent == "form4")
nLevelNo = 4;
else if (sIdent == "form5")
nLevelNo = 5;
else if (sIdent == "form6")
nLevelNo = 6;
else if (sIdent == "form7")
nLevelNo = 7;
else if (sIdent == "form8")
nLevelNo = 8;
else if (sIdent == "form9")
nLevelNo = 9;
else if (sIdent == "saveas")
2000-09-18 16:15:01 +00:00
{
SwNumNamesDlg *pDlg = new SwNumNamesDlg(this);
const String *aStrArr[SwChapterNumRules::nMaxRules];
for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i)
2000-09-18 16:15:01 +00:00
{
const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
if(pRules)
aStrArr[i] = &pRules->GetName();
else
aStrArr[i] = 0;
2000-09-18 16:15:01 +00:00
}
pDlg->SetUserNames(aStrArr);
if(RET_OK == pDlg->Execute())
{
const String aName(pDlg->GetName());
pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
*pNumRule, aName ), pDlg->GetCurEntryPos() );
pMenu->SetItemText(pMenu->GetItemId(pDlg->GetCurEntryPos()), aName);
}
delete pDlg;
return 0;
2000-09-18 16:15:01 +00:00
}
2000-09-18 16:15:01 +00:00
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();
2000-09-18 16:15:01 +00:00
SfxTabPage* pPage = GetTabPage( nPageId );
pPage->Reset(*GetOutputItemSet());
return 0;
}
2010-10-12 17:05:15 +01:00
sal_uInt16 SwOutlineTabDialog::GetLevel(const String &rFmtName) const
2000-09-18 16:15:01 +00:00
{
for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
2000-09-18 16:15:01 +00:00
{
if(aCollNames[i] == rFmtName)
return i;
}
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
return MAXLEVEL;//NO_NUMBERING; //#outline level,zhaojianwei
2000-09-18 16:15:01 +00:00
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
short SwOutlineTabDialog::Ok()
{
SfxTabDialog::Ok();
// set levels for all created templates; has to be done in order to
// delete possibly cancelled assignments again.
2011-04-18 12:37:38 -03:00
// #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();
2000-09-18 16:15:01 +00:00
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
{
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
{
rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
}
if (static_cast<const SwNumRuleItem &>(rItem).GetValue() ==
pOutlineRule->GetName())
{
rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE);
}
}
else
{
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
rTxtColl.AssignToListLevelOfOutlineStyle(GetLevel(rTxtColl.GetName()));
if (static_cast<const SwNumRuleItem &>(rItem).GetValue() !=
pOutlineRule->GetName())
{
SwNumRuleItem aItem(pOutlineRule->GetName());
rTxtColl.SetFmtAttr(aItem);
}
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
} //<-end,zhaojianwei
}
2000-09-18 16:15:01 +00:00
}
for(i = 0; i < MAXLEVEL; ++i )
2001-04-05 13:37:02 +00:00
{
String sHeadline;
::SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
sHeadline );
2001-04-05 13:37:02 +00:00
SwTxtFmtColl* pColl = rWrtSh.FindTxtFmtCollByName( sHeadline );
if( !pColl )
2000-09-18 16:15:01 +00:00
{
if(aCollNames[i] != sHeadline)
2001-04-05 13:37:02 +00:00
{
SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool(
static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i) );
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
pTxtColl->DeleteAssignmentToListLevelOfOutlineStyle();
pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE);
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
if( aCollNames[i].Len() )
{
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
pTxtColl = rWrtSh.GetParaStyle(
aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
if(pTxtColl)
{
pTxtColl->AssignToListLevelOfOutlineStyle(i);
SwNumRuleItem aItem(pOutlineRule->GetName());
pTxtColl->SetFmtAttr(aItem);
}
}
}
CWS-TOOLING: integrate CWS outlinelevel 2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
2009-01-07 11:57:24 +00:00
}
}
rWrtSh.SetOutlineNumRule( *pNumRule);
// #i30443#
rWrtSh.EndAction();
2000-09-18 16:15:01 +00:00
return RET_OK;
}
SwOutlineSettingsTabPage::SwOutlineSettingsTabPage(Window* pParent,
const SfxItemSet& rSet)
: SfxTabPage(pParent, "OutlineNumberingPage",
"modules/swriter/ui/outlinenumberingpage.ui", rSet)
, aNoFmtName(SW_RESSTR(SW_STR_NONE))
, pSh(0)
, pCollNames(0)
, nActLevel(1)
{
get(m_pLevelLB, "level");
get(m_pCollBox, "style");
m_pCollBox->SetStyle(m_pCollBox->GetStyle()|WB_SORT);
get(m_pNumberBox, "numbering");
get(m_pCharFmtLB, "charstyle");
get(m_pAllLevelFT, "sublevelsft");
get(m_pAllLevelNF, "sublevelsnf");
get(m_pPrefixED, "prefix");
get(m_pSuffixED, "suffix");
get(m_pStartEdit, "startat");
get(m_pPreviewWIN, "preview");
2000-09-18 16:15:01 +00:00
SetExchangeSupport();
m_pCollBox->InsertEntry(aNoFmtName);
m_pLevelLB->SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, LevelHdl));
m_pAllLevelNF->SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, ToggleComplete));
m_pCollBox->SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CollSelect));
m_pCollBox->SetGetFocusHdl(LINK(this, SwOutlineSettingsTabPage, CollSelectGetFocus));
m_pNumberBox->SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, NumberSelect));
m_pPrefixED->SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
m_pSuffixED->SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
m_pStartEdit->SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, StartModified));
m_pCharFmtLB->SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CharFmtHdl));
2000-09-18 16:15:01 +00:00
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
void SwOutlineSettingsTabPage::Update()
{
// if a template was already selected for this level, select it in the ListBox
m_pCollBox->Enable(USHRT_MAX != nActLevel);
2000-09-18 16:15:01 +00:00
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;
2000-09-18 16:15:01 +00:00
const SwNumFmt* aNumFmtArr[MAXLEVEL];
const SwCharFmt* pFirstFmt = 0;
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
2000-09-18 16:15:01 +00:00
{
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();
2000-09-18 16:15:01 +00:00
bSamePrefix &= aNumFmtArr[i]->GetPrefix() == aNumFmtArr[0]->GetPrefix();
bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix();
bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels();
2000-09-18 16:15:01 +00:00
const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt();
2010-11-06 10:30:17 -05:00
bSameCharFmt &= (!pFirstFmt && !pFmt)
|| (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName());
2000-09-18 16:15:01 +00:00
}
}
CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType());
2000-09-18 16:15:01 +00:00
if(bSameType)
m_pNumberBox->SelectNumberingType( aNumFmtArr[0]->GetNumberingType() );
2000-09-18 16:15:01 +00:00
else
m_pNumberBox->SetNoSelection();
2000-09-18 16:15:01 +00:00
if(bSameStart)
m_pStartEdit->SetValue(aNumFmtArr[0]->GetStart());
2000-09-18 16:15:01 +00:00
else
m_pStartEdit->SetText(aEmptyStr);
2000-09-18 16:15:01 +00:00
if(bSamePrefix)
m_pPrefixED->SetText(aNumFmtArr[0]->GetPrefix());
2000-09-18 16:15:01 +00:00
else
m_pPrefixED->SetText(aEmptyStr);
2000-09-18 16:15:01 +00:00
if(bSameSuffix)
m_pSuffixED->SetText(aNumFmtArr[0]->GetSuffix());
2000-09-18 16:15:01 +00:00
else
m_pSuffixED->SetText(aEmptyStr);
2000-09-18 16:15:01 +00:00
if(bSameCharFmt)
{
if(pFirstFmt)
m_pCharFmtLB->SelectEntry(pFirstFmt->GetName());
2000-09-18 16:15:01 +00:00
else
m_pCharFmtLB->SelectEntry( ViewShell::GetShellRes()->aStrNone );
2000-09-18 16:15:01 +00:00
}
else
m_pCharFmtLB->SetNoSelection();
2000-09-18 16:15:01 +00:00
m_pAllLevelFT->Enable(sal_True);
m_pAllLevelNF->Enable(sal_True);
m_pAllLevelNF->SetMax(MAXLEVEL);
2000-09-18 16:15:01 +00:00
if(bSameComplete)
{
m_pAllLevelNF->SetValue(aNumFmtArr[0]->GetIncludeUpperLevels());
2000-09-18 16:15:01 +00:00
}
else
{
m_pAllLevelNF->SetText(aEmptyStr);
2000-09-18 16:15:01 +00:00
}
}
else
{
sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel);
2000-09-18 16:15:01 +00:00
String aColl(pCollNames[nTmpLevel]);
if(aColl.Len())
m_pCollBox->SelectEntry(aColl);
2000-09-18 16:15:01 +00:00
else
m_pCollBox->SelectEntry(aNoFmtName);
2000-09-18 16:15:01 +00:00
const SwNumFmt &rFmt = pNumRule->Get(nTmpLevel);
m_pNumberBox->SelectNumberingType( rFmt.GetNumberingType() );
m_pPrefixED->SetText(rFmt.GetPrefix());
m_pSuffixED->SetText(rFmt.GetSuffix());
2000-09-18 16:15:01 +00:00
const SwCharFmt* pFmt = rFmt.GetCharFmt();
if(pFmt)
m_pCharFmtLB->SelectEntry(pFmt->GetName());
2000-09-18 16:15:01 +00:00
else
m_pCharFmtLB->SelectEntry( ViewShell::GetShellRes()->aStrNone );
2000-09-18 16:15:01 +00:00
if(nTmpLevel)
{
m_pAllLevelFT->Enable(sal_True);
m_pAllLevelNF->Enable(sal_True);
m_pAllLevelNF->SetMax(nTmpLevel + 1);
m_pAllLevelNF->SetValue(rFmt.GetIncludeUpperLevels());
2000-09-18 16:15:01 +00:00
}
else
{
m_pAllLevelNF->SetText(aEmptyStr);
m_pAllLevelNF->Enable(sal_False);
m_pAllLevelFT->Enable(sal_False);
2000-09-18 16:15:01 +00:00
}
CheckForStartValue_Impl(rFmt.GetNumberingType());
m_pStartEdit->SetValue( rFmt.GetStart() );
2000-09-18 16:15:01 +00:00
}
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++ )
2000-09-18 16:15:01 +00:00
{
if(pBox->IsEntryPosSelected( i ))
nActLevel |= nMask;
nMask <<= 1;
}
}
Update();
return 0;
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
IMPL_LINK( SwOutlineSettingsTabPage, ToggleComplete, NumericField *, pFld )
{
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
2000-09-18 16:15:01 +00:00
{
if(nActLevel & nMask)
{
SwNumFmt aNumFmt(pNumRule->Get(i));
aNumFmt.SetIncludeUpperLevels( Min( (sal_uInt8)pFld->GetValue(),
(sal_uInt8)(i + 1)) );
2000-09-18 16:15:01 +00:00
pNumRule->Set(i, aNumFmt);
}
nMask <<= 1;
}
SetModified();
return 0;
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
IMPL_LINK( SwOutlineSettingsTabPage, CollSelect, ListBox *, pBox )
{
sal_uInt8 i;
2000-09-18 16:15:01 +00:00
const String aCollName(pBox->GetSelectEntry());
//0xFFFF not allowed here (disable)
sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel);
2000-09-18 16:15:01 +00:00
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?
2000-09-18 16:15:01 +00:00
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;
2000-09-18 16:15:01 +00:00
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_NOARG(SwOutlineSettingsTabPage, CollSelectGetFocus)
2000-09-18 16:15:01 +00:00
{
for( sal_uInt8 i = 0; i < MAXLEVEL; ++i)
2000-09-18 16:15:01 +00:00
aSaveCollNames[i] = pCollNames[i];
return 0;
}
2001-03-02 13:10:47 +00:00
IMPL_LINK( SwOutlineSettingsTabPage, NumberSelect, SwNumberingTypeListBox *, pBox )
2000-09-18 16:15:01 +00:00
{
sal_uInt16 nMask = 1;
2010-11-27 09:02:53 +01:00
sal_Int16 nNumberType = pBox->GetSelectedNumberingType();
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
2000-09-18 16:15:01 +00:00
{
if(nActLevel & nMask)
{
SwNumFmt aNumFmt(pNumRule->Get(i));
aNumFmt.SetNumberingType(nNumberType);
2000-09-18 16:15:01 +00:00
pNumRule->Set(i, aNumFmt);
CheckForStartValue_Impl(nNumberType);
2000-09-18 16:15:01 +00:00
}
nMask <<= 1;
}
SetModified();
return 0;
}
2010-10-12 17:05:15 +01:00
IMPL_LINK_NOARG(SwOutlineSettingsTabPage, DelimModify)
2000-09-18 16:15:01 +00:00
{
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
2000-09-18 16:15:01 +00:00
{
if(nActLevel & nMask)
{
SwNumFmt aNumFmt(pNumRule->Get(i));
aNumFmt.SetPrefix( m_pPrefixED->GetText() );
aNumFmt.SetSuffix( m_pSuffixED->GetText() );
2000-09-18 16:15:01 +00:00
pNumRule->Set(i, aNumFmt);
}
nMask <<= 1;
}
SetModified();
return 0;
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
IMPL_LINK( SwOutlineSettingsTabPage, StartModified, NumericField *, pFld )
{
sal_uInt16 nMask = 1;
for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
2000-09-18 16:15:01 +00:00
{
if(nActLevel & nMask)
{
SwNumFmt aNumFmt(pNumRule->Get(i));
aNumFmt.SetStart( (sal_uInt16)pFld->GetValue() );
2000-09-18 16:15:01 +00:00
pNumRule->Set(i, aNumFmt);
}
nMask <<= 1;
}
SetModified();
2000-09-18 16:15:01 +00:00
return 0;
}
2010-10-12 17:05:15 +01:00
IMPL_LINK_NOARG(SwOutlineSettingsTabPage, CharFmtHdl)
2000-09-18 16:15:01 +00:00
{
String sEntry = m_pCharFmtLB->GetSelectEntry();
sal_uInt16 nMask = 1;
bool bFormatNone = sEntry == ViewShell::GetShellRes()->aStrNone;
2000-09-18 16:15:01 +00:00
SwCharFmt* pFmt = 0;
if(!bFormatNone)
{
sal_uInt16 nChCount = pSh->GetCharFmtCount();
for(sal_uInt16 i = 0; i < nChCount; i++)
2000-09-18 16:15:01 +00:00
{
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++)
2000-09-18 16:15:01 +00:00
{
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;
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage()
{
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell)
{
pSh = pShell;
// query this document's NumRules
2000-09-18 16:15:01 +00:00
pNumRule = ((SwOutlineTabDialog*)GetTabDialog())->GetNumRule();
pCollNames = ((SwOutlineTabDialog*)GetTabDialog())->GetCollNames();
m_pPreviewWIN->SetNumRule(pNumRule);
m_pPreviewWIN->SetOutlineNames(pCollNames);
// set start value - nActLevel must be 1 here
sal_uInt16 nTmpLevel = lcl_BitToLevel(nActLevel);
2000-09-18 16:15:01 +00:00
const SwNumFmt& rNumFmt = pNumRule->Get( nTmpLevel );
m_pStartEdit->SetValue( rNumFmt.GetStart() );
2000-09-18 16:15:01 +00:00
// create pool formats for headlines
2000-09-18 16:15:01 +00:00
String sStr;
sal_uInt16 i;
2000-09-18 16:15:01 +00:00
for( i = 0; i < MAXLEVEL; ++i )
{
m_pCollBox->InsertEntry( SwStyleNameMapper::GetUIName(
static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), aEmptyStr ));
m_pLevelLB->InsertEntry( OUString::number(i + 1) );
2000-09-18 16:15:01 +00:00
}
sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ));
sStr += OUString::number(MAXLEVEL);
m_pLevelLB->InsertEntry( sStr );
2000-09-18 16:15:01 +00:00
// query the texttemplates' outlining levels
const sal_uInt16 nCount = pSh->GetTxtFmtCollCount();
2000-09-18 16:15:01 +00:00
for( i = 0; i < nCount; ++i )
{
SwTxtFmtColl &rTxtColl = pSh->GetTxtFmtColl(i);
if(!rTxtColl.IsDefault())
{
sStr = rTxtColl.GetName();
if(LISTBOX_ENTRY_NOTFOUND == m_pCollBox->GetEntryPos( sStr ))
m_pCollBox->InsertEntry( sStr );
2000-09-18 16:15:01 +00:00
}
}
m_pNumberBox->SelectNumberingType(rNumFmt.GetNumberingType());
sal_uInt16 nOutlinePos = pSh->GetOutlinePos(MAXLEVEL);
sal_uInt16 nTmp = 0;
2000-09-18 16:15:01 +00:00
if(nOutlinePos != USHRT_MAX)
{
nTmp = static_cast<sal_uInt16>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos));
2000-09-18 16:15:01 +00:00
}
m_pLevelLB->SelectEntryPos(nTmp-1);//nTmp);//#outline level,zhaojianwei
2000-09-18 16:15:01 +00:00
// collect char styles
m_pCharFmtLB->Clear();
m_pCharFmtLB->InsertEntry( ViewShell::GetShellRes()->aStrNone );
2000-09-18 16:15:01 +00:00
// char styles
::FillCharStyleListBox(*m_pCharFmtLB,
2000-09-18 16:15:01 +00:00
pSh->GetView().GetDocShell());
Update();
}
2010-10-12 17:05:15 +01:00
void SwOutlineSettingsTabPage::ActivatePage(const SfxItemSet& )
2000-09-18 16:15:01 +00:00
{
nActLevel = SwOutlineTabDialog::GetActNumLevel();
2000-09-18 16:15:01 +00:00
if(nActLevel != USHRT_MAX)
m_pLevelLB->SelectEntryPos(lcl_BitToLevel(nActLevel));
2000-09-18 16:15:01 +00:00
else
m_pLevelLB->SelectEntryPos(MAXLEVEL);
LevelHdl(m_pLevelLB);
2000-09-18 16:15:01 +00:00
}
2010-10-12 17:05:15 +01:00
int SwOutlineSettingsTabPage::DeactivatePage(SfxItemSet*)
2000-09-18 16:15:01 +00:00
{
SwOutlineTabDialog::SetActNumLevel(nActLevel);
2000-09-18 16:15:01 +00:00
return LEAVE_PAGE;
}
2010-10-12 17:05:15 +01:00
sal_Bool SwOutlineSettingsTabPage::FillItemSet( SfxItemSet& )
2000-09-18 16:15:01 +00:00
{
return sal_True;
2000-09-18 16:15:01 +00:00
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
void SwOutlineSettingsTabPage::Reset( const SfxItemSet& rSet )
{
ActivatePage(rSet);
}
2010-10-12 17:05:15 +01:00
2000-09-18 16:15:01 +00:00
SfxTabPage* SwOutlineSettingsTabPage::Create( Window* pParent,
const SfxItemSet& rAttrSet)
{
return new SwOutlineSettingsTabPage(pParent, rAttrSet);
}
2010-10-12 17:05:15 +01:00
void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
{
bool bIsNull = m_pStartEdit->GetValue() == 0;
bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
m_pStartEdit->SetMin(bNoZeroAllowed ? 1 : 0);
if(bIsNull && bNoZeroAllowed)
m_pStartEdit->GetModifyHdl().Call(m_pStartEdit);
}
2000-09-18 16:15:01 +00:00
static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
const SwNumFmt& rFmt, sal_uInt16 nXStart,
sal_uInt16 nYStart, const Size& rSize)
2000-09-18 16:15:01 +00:00
{
Font aTmpFont(pVDev->GetFont());
Font aFont(*rFmt.GetBulletFont());
aFont.SetSize(rSize);
aFont.SetTransparent(sal_True);
2000-09-18 16:15:01 +00:00
pVDev->SetFont( aFont );
rtl::OUString aText(rFmt.GetBulletChar());
2000-09-18 16:15:01 +00:00
pVDev->DrawText( Point(nXStart, nYStart), aText );
sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText);
2000-09-18 16:15:01 +00:00
pVDev->SetFont(aTmpFont);
return nRet;
}
static sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, sal_uInt16 nXStart,
sal_uInt16 nYStart, sal_uInt16 nDivision)
2000-09-18 16:15:01 +00:00
{
const SvxBrushItem* pBrushItem = rFmt.GetBrush();
sal_uInt16 nRet = 0;
2000-09-18 16:15:01 +00:00
if(pBrushItem)
{
const Graphic* pGrf = pBrushItem->GetGraphic();
if(pGrf)
{
Size aGSize( rFmt.GetGraphicSize());
2000-09-18 16:15:01 +00:00
aGSize.Width() /= nDivision;
nRet = (sal_uInt16)aGSize.Width();
2000-09-18 16:15:01 +00:00
aGSize.Height() /= nDivision;
pGrf->Draw( pVDev, Point(nXStart,nYStart),
pVDev->PixelToLogic( aGSize ) );
}
}
return nRet;
}
2010-10-12 17:05:15 +01:00
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeNumberingPreview(Window *pParent, VclBuilder::stringmap &)
{
return new NumberingPreview(pParent);
}
/*--------------------------------------------------
paint numbering's preview
2000-09-18 16:15:01 +00:00
--------------------------------------------------*/
void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
2000-09-18 16:15:01 +00:00
{
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() );
2000-09-18 16:15:01 +00:00
pVDev->DrawRect(aRect);
if(pActNum)
{
sal_uInt16 nWidthRelation;
2000-09-18 16:15:01 +00:00
if(nPageWidth)
{
nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width());
2000-09-18 16:15:01 +00:00
if(bPosition)
nWidthRelation = nWidthRelation * 2 / 3;
else
nWidthRelation = nWidthRelation / 4;
}
else
nWidthRelation = 30; // chapter dialog
2000-09-18 16:15:01 +00:00
// height per level
sal_uInt16 nXStep = sal_uInt16(aSize.Width() / (3 * MAXLEVEL));
2000-09-18 16:15:01 +00:00
if(MAXLEVEL < 10)
nXStep /= 2;
sal_uInt16 nYStart = 4;
sal_uInt16 nYStep = sal_uInt16((aSize.Height() - 6)/ MAXLEVEL);
aStdFont = OutputDevice::GetDefaultFont(
DEFAULTFONT_UI_SANS, GetAppLanguage(),
DEFAULTFONT_FLAGS_ONLYONE, this );
// #101524# OJ
2002-12-10 08:46:06 +00:00
aStdFont.SetColor( SwViewOption::GetFontColor() );
2000-09-18 16:15:01 +00:00
sal_uInt16 nFontHeight = nYStep * 6 / 10;
2000-09-18 16:15:01 +00:00
if(bPosition)
nFontHeight = nYStep * 15 / 10;
aStdFont.SetSize(Size( 0, nFontHeight ));
sal_uInt16 nPreNum = pActNum->Get(0).GetStart();
2000-09-18 16:15:01 +00:00
if(bPosition)
{
sal_uInt16 nLineHeight = nFontHeight * 8 / 7;
sal_uInt8 nStart = 0;
2000-09-18 16:15:01 +00:00
while( !(nActLevel & (1<<nStart)) )
{
nStart++;
}
if(nStart) // so that possible predecessors and successors are showed
2000-09-18 16:15:01 +00:00
nStart--;
SwNumberTree::tNumberVector aNumVector;
sal_uInt8 nEnd = Min( (sal_uInt8)(nStart + 3), MAXLEVEL );
for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel )
2000-09-18 16:15:01 +00:00
{
const SwNumFmt &rFmt = pActNum->Get(nLevel);
aNumVector.push_back(rFmt.GetStart());
2000-09-18 16:15:01 +00:00
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);
}
}
2000-09-18 16:15:01 +00:00
sal_uInt16 nBulletWidth = 0;
if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
2000-09-18 16:15:01 +00:00
{
nBulletWidth = lcl_DrawGraphic(pVDev, rFmt,
nNumberXPos,
nYStart, nWidthRelation);
}
else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2000-09-18 16:15:01 +00:00
{
nBulletWidth = lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize());
}
else
{
pVDev->SetFont(aStdFont);
if(pActNum->IsContinusNum())
aNumVector[nLevel] = nPreNum;
2011-04-18 12:37:38 -03:00
// #128041#
String aText(pActNum->MakeNumString( aNumVector ));
2000-09-18 16:15:01 +00:00
pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText);
2000-09-18 16:15:01 +00:00
nPreNum++;
}
if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
{
pVDev->SetFont(aStdFont);
rtl::OUString 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 );
}
2000-09-18 16:15:01 +00:00
Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); // Color( COL_BLACK ) );
2000-09-18 16:15:01 +00:00
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 )
2000-09-18 16:15:01 +00:00
{
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() )
2000-09-18 16:15:01 +00:00
{
lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
nTextOffset = nLineHeight + nXStep;
}
else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2000-09-18 16:15:01 +00:00
{
nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
nTextOffset = nTextOffset + nXStep;
2000-09-18 16:15:01 +00:00
}
else
{
pVDev->SetFont(aStdFont);
if(pActNum->IsContinusNum())
aNumVector[nLevel] = nPreNum;
2011-04-18 12:37:38 -03:00
// #128041#
String aText(pActNum->MakeNumString( aNumVector ));
2000-09-18 16:15:01 +00:00
pVDev->DrawText( Point(nXStart, nYStart), aText );
nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText);
nTextOffset = nTextOffset + nXStep;
2000-09-18 16:15:01 +00:00
nPreNum++;
}
pVDev->SetFont(aStdFont);
2011-11-11 22:48:37 +01:00
pVDev->DrawText(
Point(nXStart + nTextOffset, nYStart),
(pOutlineNames == 0
? utl::ConfigManager::getProductName()
: rtl::OUString(pOutlineNames[nLevel])));
2000-09-18 16:15:01 +00:00
}
}
}
DrawOutDev( Point(0,0), aSize,
Point(0,0), aSize,
*pVDev );
delete pVDev;
}
NumberingPreview::~NumberingPreview()
{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */