summaryrefslogtreecommitdiff
path: root/sw/source/ui/app
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/app')
-rw-r--r--sw/source/ui/app/app.src665
-rw-r--r--sw/source/ui/app/appenv.cxx545
-rw-r--r--sw/source/ui/app/apphdl.cxx967
-rw-r--r--sw/source/ui/app/applab.cxx457
-rw-r--r--sw/source/ui/app/appopt.cxx657
-rw-r--r--sw/source/ui/app/docsh.cxx1370
-rw-r--r--sw/source/ui/app/docsh2.cxx1894
-rw-r--r--sw/source/ui/app/docshdrw.cxx84
-rw-r--r--sw/source/ui/app/docshini.cxx826
-rw-r--r--sw/source/ui/app/docst.cxx1305
-rw-r--r--sw/source/ui/app/docstyle.cxx2908
-rw-r--r--sw/source/ui/app/error.src214
-rw-r--r--sw/source/ui/app/mainwn.cxx165
-rw-r--r--sw/source/ui/app/makefile.mk101
-rw-r--r--sw/source/ui/app/mn.src1108
-rw-r--r--sw/source/ui/app/swdll.cxx156
-rw-r--r--sw/source/ui/app/swmodul1.cxx675
-rw-r--r--sw/source/ui/app/swmodule.cxx512
-rw-r--r--sw/source/ui/app/swwait.cxx75
19 files changed, 14684 insertions, 0 deletions
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
new file mode 100644
index 000000000000..e1a3d314d572
--- /dev/null
+++ b/sw/source/ui/app/app.src
@@ -0,0 +1,665 @@
+/*************************************************************************
+ *
+ * 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 <svl/style.hrc>
+#include <sfx2/sfx.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/globlmn.hrc>
+#include "cmdid.h"
+#include "globals.hrc"
+#include "app.hrc"
+#include "statstr.hrc"
+#include "swstyle.h"
+#include "comcore.hrc"
+#include "shells.hrc"
+#include "helpid.h"
+
+String RID_SW_NAME
+{
+ Text = "StarWriter" ;
+};
+
+String STR_PRINT_MERGE_MACRO
+{
+ Text [ en-US ] = "Print form letters" ;
+};
+
+String STR_PAGE_COUNT_MACRO
+{
+ Text [ en-US ] = "Changing the page count" ;
+};
+
+ // Image-Liste ----------------------------------------------------------------
+ // Don't use this image list for normal toolbar images. We have now our commandimagelist
+ // folder in default_images. This list is now only used for special toolboxes that are
+ // used in floating windows.
+
+#define IMAGELIST_AND_COUNT \
+ IdList = { \
+ FN_FORMULA_CALC ;\
+ FN_FORMULA_CANCEL ;\
+ FN_FORMULA_APPLY ;\
+ }; \
+ IdCount = { \
+ 3; \
+ };
+
+ImageList RID_DEFAULTIMAGELIST_SC
+{
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+ImageList RID_DEFAULTIMAGELIST_LC
+{
+ Prefix = "lc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+
+ImageList RID_DEFAULTIMAGELIST_SCH
+{
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+ImageList RID_DEFAULTIMAGELIST_LCH
+{
+ Prefix = "lch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+
+// Vorlagen
+#define STYLE_IMAGE_LISTEF \
+ MaskColor = IMAGE_MASK_COLOR ; \
+ IdList = \
+ { \
+ 1; 2; 3; 4; 5; \
+ }; \
+ IdCount = 5;
+
+SfxStyleFamilies DLG_STYLE_DESIGNER
+{
+ StyleFamilyList =
+ {
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Paragraph Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_PARA ;
+ FilterList [ en-US ] =
+ {
+ < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ < "Automatic" ; SFXSTYLEBIT_AUTO ; > ;
+ < "Text Styles" ; SWSTYLEBIT_TEXT ; > ;
+ < "Chapter Styles" ; SWSTYLEBIT_CHAPTER ; > ;
+ < "List Styles" ; SWSTYLEBIT_LIST ; > ;
+ < "Index Styles" ; SWSTYLEBIT_IDX ; > ;
+ < "Special Styles" ; SWSTYLEBIT_EXTRA ; > ;
+ < "HTML Styles" ; SWSTYLEBIT_HTML ; > ;
+ < "Conditional Styles" ; SWSTYLEBIT_CONDCOLL ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Character Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_CHAR ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Frame Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_FRAME ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Page Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_PAGE ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ Text [ en-US ] = "List Styles" ;
+ };
+ };
+
+ ImageList 1 // == BMP_COLOR_NORMAL + 1
+ {
+ Prefix = "sf";
+ STYLE_IMAGE_LISTEF
+ };
+ ImageList 2 // == BMP_COLOR_HIGHCONTRAST + 1
+ {
+ Prefix = "sfh";
+ STYLE_IMAGE_LISTEF
+ };
+};
+
+
+
+ // Default Bitmap fuer Toolbox
+BITMAP BMP_FEHLT { FILE = "x.bmp" ; };
+ // Bitmap fuer die NumerierungsVorlagen im Organizer
+Bitmap BMP_STYLES_FAMILY_NUM { File = "styfamnu.bmp" ; };
+Bitmap BMP_STYLES_FAMILY_NUM_HC { File = "styfamnu_h.bmp" ; };
+
+String STR_ENV_TITLE
+{
+ Text [ en-US ] = "Envelope" ;
+};
+
+String STR_LAB_TITLE
+{
+ Text [ en-US ] = "Labels" ;
+};
+
+ // ShortName!!!
+String STR_HUMAN_SWDOC_NAME
+{
+ Text [ en-US ] = "Text" ;
+};
+
+String STR_WRITER_DOCUMENT_FULLTYPE
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Text Document";
+};
+
+
+String STR_CANTOPEN
+{
+ Text [ en-US ] = "Cannot open document." ;
+};
+
+String STR_CANTCREATE
+{
+ Text [ en-US ] = "Can't create document.";
+};
+String STR_DLLNOTFOUND
+{
+ Text [ en-US ] = "Filter not found." ;
+};
+
+
+String STR_UNBENANNT
+{
+ Text [ en-US ] = "Untitled" ;
+};
+
+
+String STR_LOAD_GLOBAL_DOC
+{
+ Text [ en-US ] = "Name and Path of Master Document" ;
+};
+
+String STR_LOAD_HTML_DOC
+{
+ Text [ en-US ] = "Name and Path of the HTML Document" ;
+};
+
+InfoBox MSG_ERROR_SEND_MAIL
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "Error sending mail." ;
+};
+InfoBox MSG_ERROR_PASSWD
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "Invalid password" ;
+};
+
+/*
+ * auskommentiert, da die Toolbox z. Zt. nicht aus der Resource
+ * geladen werden kann
+Window WIN_TOOLBOX {
+ "Bearbeitung von Text, Rahmen, Grafik, Tabellen oder "
+ "Numerierungen.";
+HelpText [ en-US ] = "The objectbar contains, depending on your current "
+ "working context, buttons for the editing of text, "
+ "frames, graphics, tables or numberings.";
+ OUTPUTSIZE = TRUE;
+ BORDER = TRUE;
+ Size = (28,27);
+};
+ */
+
+String STR_FMT_STD
+{
+ Text [ en-US ] = "(none)" ;
+};
+
+String STR_DOC_STAT
+{
+ Text [ en-US ] = "Statistics" ;
+};
+
+ // ----------------------------
+ // Statusleisten-Ueberschriften
+ // ----------------------------
+
+String STR_STATSTR_W4WREAD
+{
+ Text [ en-US ] = "Importing document..." ;
+};
+
+String STR_STATSTR_W4WWRITE
+{
+ Text [ en-US ] = "Exporting document..." ;
+};
+
+String STR_STATSTR_SWGREAD
+{
+ Text [ en-US ] = "Loading document..." ;
+};
+
+String STR_STATSTR_SWGWRITE
+{
+ Text [ en-US ] = "Saving document..." ;
+};
+
+String STR_STATSTR_REFORMAT
+{
+ Text [ en-US ] = "Repagination..." ;
+};
+
+String STR_STATSTR_AUTOFORMAT
+{
+ Text [ en-US ] = "Formatting document automatically..." ;
+};
+
+String STR_STATSTR_IMPGRF
+{
+ Text [ en-US ] = "Importing graphics..." ;
+};
+
+String STR_STATSTR_SEARCH
+{
+ Text [ en-US ] = "Search..." ;
+};
+
+String STR_STATSTR_FORMAT
+{
+ Text [ en-US ] = "Formatting..." ;
+};
+
+String STR_STATSTR_PRINT
+{
+ Text [ en-US ] = "Printing..." ;
+};
+
+String STR_STATSTR_LAYOUTINIT
+{
+ Text [ en-US ] = "Converting..." ;
+};
+
+String STR_STATSTR_LETTER
+{
+ Text [ en-US ] = "Letter" ;
+};
+
+String STR_STATSTR_SPELL
+{
+ Text [ en-US ] = "Spellcheck..." ;
+};
+
+String STR_STATSTR_HYPHEN
+{
+ Text [ en-US ] = "Hyphenation..." ;
+};
+
+String STR_STATSTR_TOX_INSERT
+{
+ Text [ en-US ] = "Inserting Index..." ;
+};
+
+String STR_STATSTR_TOX_UPDATE
+{
+ Text [ en-US ] = "Updating Index..." ;
+};
+
+String STR_STATSTR_SUMMARY
+{
+ Text [ en-US ] = "Creating abstract..." ;
+};
+
+String STR_STATSTR_SWGPRTOLENOTIFY
+{
+ Text [ en-US ] = "Adapt Objects...";
+};
+
+
+QueryBox MSG_COMCORE_ASKSEARCH
+{
+ Buttons = WB_YES_NO_CANCEL ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "To proceed with this action, you must first turn off the \"undo\" function. Do you want to turn off the \"undo\" function?" ;
+};
+
+Bitmap RID_GRAPHIC_REPLACEBMP
+{
+ File = "grafikei.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_ERRORBMP
+{
+ File = "grafikde.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_REPLACEBMP_HC
+{
+ File = "grafikei_h.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_ERRORBMP_HC
+{
+ File = "grafikde_h.bmp" ;
+};
+
+String STR_TABLE_DEFNAME
+{
+ Text [ en-US ] = "Table" ;
+};
+
+String STR_GRAPHIC_DEFNAME
+{
+ Text[ en-US ] = "graphics" ;
+};
+
+String STR_OBJECT_DEFNAME
+{
+ Text [ en-US ] = "Object" ;
+};
+
+String STR_FRAME_DEFNAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+String STR_REGION_DEFNAME
+{
+ Text [ en-US ] = "Section" ;
+};
+String STR_NUMRULE_DEFNAME
+{
+ Text [ en-US ] = "Numbering" ;
+};
+String STR_EMPTYPAGE
+{
+ Text [ en-US ] = "blank page" ;
+};
+
+QueryBox MSG_CLPBRD_CLEAR
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "You have a large amount of data saved in the clipboard.\nShould the clipboard contents remain available for other applications?" ;
+};
+
+QueryBox MSG_SAVE_HTML_QUERY
+{
+ BUTTONS = WB_YES_NO_CANCEL ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "Conversion into HTML format \nmay cause information loss. \nDo you want to save the document?" ;
+};
+QueryBox MSG_SAVEAS_HTML_QUERY
+{
+ BUTTONS = WB_YES_NO;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "The source code can only be displayed if the document is saved in HTML format.\nWould you like to save the document as HTML?";
+};
+String STR_ABSTRACT_TITLE
+{
+ Text [ en-US ] = "Abstract: " ;
+};
+
+String STR_FDLG_TEMPLATE_BUTTON
+{
+ Text [ en-US ] = "Style" ;
+};
+
+String STR_FDLG_TEMPLATE_NAME
+{
+ //Text [ en-US ] = "Styles: " ; //#outline level,removed by zhaojianwei
+ Text [ en-US ] = "separated by: " ; //<-end,add by zhaojianwei
+};
+//#outline level,add by zhaojianwei
+String STR_FDLG_OUTLINE_LEVEL
+{
+ Text [ en-US ] = "Outline: Level ";
+};
+
+String STR_FDLG_STYLE
+{
+ Text [ en-US ] = "Style: ";
+};
+//<-end
+
+
+String STR_PAGEOFFSET
+{
+ Text [ en-US ] = "Page number: " ;
+};
+String STR_PAGEBREAK
+{
+ Text [ en-US ] = "Break before new page" ;
+};
+String STR_WESTERN_FONT
+{
+ Text [ en-US ] = "Western text: ";
+};
+String STR_CJK_FONT
+{
+ Text [ en-US ] = "Asian text: ";
+};
+String STR_REDLINE_UNKNOWN_AUTHOR
+{
+ Text [ en-US ] = "Unknown Author";
+};
+
+WarningBox MSG_DISABLE_UNDO_QUESTION
+{
+ BUTTONS = WB_YES_NO_CANCEL;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "This action deletes the list of actions that can be undone. Previous changes made to the document are still valid, but cannot be undone. Do you want to continue formatting?";
+};
+/*QueryBox MSG_INS_MERGE_FIELDS
+{
+ HelpId = HID_MAIL_MERGE_INSERT_FIELDS;
+ Buttons = WB_OK_CANCEL ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "Do you want to use names and addresses from a database?";
+};
+*/
+QueryBox MSG_PRINT_AS_MERGE
+{
+ HelpId = HID_PRINT_AS_MERGE;
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "Your document contains address database fields. Do you want to print a form letter?";
+};
+ModalDialog DLG_MERGE_SOURCE_UNAVAILABLE
+{
+ HelpId = HID_MERGE_SOURCE_UNAVAILABLE;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 202 , 72 ) ;
+ Moveable = TRUE ;
+
+ FixedImage IMG_MERGE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 103 , 32 ) ;
+ };
+ FixedText ST_MERGE_SOURCE_UNAVAILABLE
+ {
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 178 , 40 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The data source \'%1\' was not found. Thus the connection to the data source could not be established.\n\nPlease check the connections settings.";
+ };
+ OKButton PB_MERGE_OK
+ {
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 125 , 14 ) ;
+ Text [ en-US ] = "Check Connection Settings...";
+ };
+ CancelButton PB_MERGE_CANCEL
+ {
+ Pos = MAP_APPFONT ( 140 , 52 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+WarningBox MSG_DATA_SOURCES_UNAVAILABLE
+{
+ HelpId = HID_DATA_SOURCES_UNAVAILABLE;
+ Buttons = WB_OK_CANCEL;
+ Message [ en-US ] = "No data source has been set up yet. You need a data source, such as a database, to supply data (for example, names and addresses) for the fields.";
+};
+
+String RID_MODULE_TOOLBOX
+{
+ Text [ en-US ] = "Function Bar (viewing mode)" ;
+};
+String STR_DONT_ASK_AGAIN
+{
+ Text [ en-US ] = "~Do not show warning again" ;
+};
+// --> OD 2008-04-14 #outlinelevel#
+String STR_OUTLINE_NUMBERING
+{
+ Text [ en-US ] = "Outline Numbering";
+};
+ToolBox RID_MODULE_TOOLBOX
+{
+ HelpID = HID_MODULE_TOOLBOX ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ LineSpacing = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Hide = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = SID_SAVEASDOC ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_EDITDOC ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_MAIL_SENDDOC ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_DIRECTEXPORTDOCASPDF ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PRINTDOCDIRECT ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_COPY ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_SEARCH_DLG ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_NAVIGATOR ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_ZOOM ;
+ };
+ };
+ Scroll = TRUE ;
+};
+
+WarningBox MSG_DISABLE_READLINE_QUESTION
+{
+ BUTTONS = WB_YES_NO;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "In the current document, changes are being recorded but not shown as such. In large documents, delays can occur when the document is edited. Do you want to show the changes to avoid delays?";
+};
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
new file mode 100644
index 000000000000..ce06c22cfc88
--- /dev/null
+++ b/sw/source/ui/app/appenv.cxx
@@ -0,0 +1,545 @@
+/*************************************************************************
+ *
+ * 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"
+
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+
+#include <hintids.hxx>
+
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+
+#include <svtools/svmedit.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/printer.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/brkitem.hxx>
+#include <fmthdft.hxx>
+#include <swwait.hxx>
+#include <paratr.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <frmatr.hxx>
+#include <fldbas.hxx>
+#include <swundo.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <dbmgr.hxx>
+#include <fmtcol.hxx>
+#include <frmmgr.hxx>
+#include <fldmgr.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <expfld.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <crsskip.hxx>
+
+#include <cmdid.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "envelp.hrc"
+#include "envimg.hxx"
+
+#define ENV_NEWDOC RET_OK
+#define ENV_INSERT RET_USER
+#define ENV_CANCEL SHRT_MAX
+
+
+// --------------------------------------------------------------------------
+
+
+// Funktion wird fuer Etiketten und Briefumschlaege benutzt!
+// im applab.cxx und appenv.cxx
+String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText )
+{
+ String sRet;
+ String aText(rText);
+ aText.EraseAllChars( '\r' );
+
+
+ USHORT nTokenPos = 0;
+ while( STRING_NOTFOUND != nTokenPos )
+ {
+ String aLine = aText.GetToken( 0, '\n', nTokenPos );
+ while ( aLine.Len() )
+ {
+ String sTmpText;
+ BOOL bField = FALSE;
+
+ USHORT nPos = aLine.Search( '<' );
+ if ( nPos )
+ {
+ sTmpText = aLine.Copy( 0, nPos );
+ aLine.Erase( 0, nPos );
+// sTmpText = aLine.Cut( 0, nPos );
+ }
+ else
+ {
+ nPos = aLine.Search( '>' );
+ if ( nPos == STRING_NOTFOUND )
+ {
+ sTmpText = aLine;
+ aLine.Erase();
+// sTmpText = aLine.Cut();
+ }
+ else
+ {
+ sTmpText = aLine.Copy( 0, nPos + 1);
+ aLine.Erase( 0, nPos + 1);
+// sTmpText = aLine.Cut( 0, nPos + 1 );
+
+ // Datenbankfelder muesen mind. 3 Punkte beinhalten!
+ String sDBName( sTmpText.Copy( 1, sTmpText.Len() - 2));
+ USHORT nCnt = sDBName.GetTokenCount('.');
+ if (nCnt >= 3)
+ {
+ ::ReplacePoint(sDBName, TRUE);
+ SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0, &rSh );
+ rFldMgr.InsertFld( aData );
+ sRet = sDBName;
+ bField = TRUE;
+ }
+ }
+ }
+ if ( !bField )
+ rSh.Insert( sTmpText );
+ }
+ rSh.InsertLineBreak();
+ }
+ rSh.DelLeft(); // Letzten Linebreak wieder l???schen
+
+ return sRet;
+}
+
+// ----------------------------------------------------------------------------
+
+
+void lcl_CopyCollAttr(SwWrtShell* pOldSh, SwWrtShell* pNewSh, USHORT nCollId)
+{
+ USHORT nCollCnt = pOldSh->GetTxtFmtCollCount();
+ SwTxtFmtColl* pColl;
+ for( USHORT nCnt = 0; nCnt < nCollCnt; ++nCnt )
+ if(nCollId == (pColl = &pOldSh->GetTxtFmtColl(nCnt))->GetPoolFmtId())
+ pNewSh->GetTxtCollFromPool(nCollId)->SetFmtAttr(pColl->GetAttrSet());
+}
+
+// ----------------------------------------------------------------------------
+
+
+void SwModule::InsertEnv( SfxRequest& rReq )
+{
+static USHORT nTitleNo = 0;
+
+ SwDocShell *pMyDocSh;
+ SfxViewFrame *pFrame;
+ SwView *pNewView;
+ SwWrtShell *pOldSh,
+ *pSh;
+
+ //aktuelle Shell besorgen
+ pMyDocSh = (SwDocShell*) SfxObjectShell::Current();
+ pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : 0;
+
+ // Neues Dokument erzeugen (kein Show!)
+ SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
+ xDocSh->DoInitNew( 0 );
+ pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ pNewView = (SwView*) pFrame->GetViewShell();
+ pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
+ pSh = pNewView->GetWrtShellPtr();
+
+ String aTmp( SW_RES(STR_ENV_TITLE) );
+ aTmp += String::CreateFromInt32( ++nTitleNo );
+ xDocSh->SetTitle( aTmp );
+
+ // Ggf. alte Collections "Absender" und "Empfaenger" in neues
+ // Dokument kopieren
+ if ( pOldSh )
+ {
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_JAKETADRESS);
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SENDADRESS);
+ }
+
+ // SwEnvItem aus Config lesen
+ SwEnvCfgItem aEnvCfg;
+
+ //Haben wir schon einen Briefumschlag.
+ BOOL bEnvChange = FALSE;
+
+ SfxItemSet aSet(GetPool(), FN_ENVELOP, FN_ENVELOP, 0);
+ aSet.Put(aEnvCfg.GetItem());
+
+ SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+ if(pOldSh )
+ {
+ const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc());
+ String sJacket;
+ SwStyleNameMapper::FillUIName( RES_POOLPAGE_JAKET, sJacket );
+ bEnvChange = rCurPageDesc.GetName() == sJacket;
+
+ IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess();
+ if( pIDDA_old->getPrinter( false ) )
+ {
+ IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
+ pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
+ //#69563# if it isn't the same printer then the pointer has been invalidated!
+ pTempPrinter = pIDDA->getPrinter( true );
+ }
+ pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+
+ }
+
+ Window *pParent = pOldSh ? pOldSh->GetWin() : 0;
+ SfxAbstractTabDialog * pDlg=NULL;
+ short nMode = ENV_INSERT;
+
+ SFX_REQUEST_ARG( rReq, pItem, SwEnvItem, FN_ENVELOP, sal_False );
+ if ( !pItem )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwEnvDlg( pParent, aSet, pOldSh, pTempPrinter, !bEnvChange, DLG_ENV );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ nMode = pDlg->Execute();
+ }
+ else
+ {
+ SFX_REQUEST_ARG( rReq, pBoolItem, SfxBoolItem, FN_PARAM_1, sal_False );
+ if ( pBoolItem && pBoolItem->GetValue() )
+ nMode = ENV_NEWDOC;
+ }
+
+ if (nMode == ENV_NEWDOC || nMode == ENV_INSERT)
+ {
+ SwWait aWait( (SwDocShell&)*xDocSh, TRUE );
+
+ // Dialog auslesen, Item in Config speichern
+ const SwEnvItem& rItem = pItem ? *pItem : (const SwEnvItem&) pDlg->GetOutputItemSet()->Get(FN_ENVELOP);
+ aEnvCfg.GetItem() = rItem;
+ aEnvCfg.Commit();
+
+ //Wenn wir Drucken uebernehmen wir den eingestellten Jobsetup aus
+ //dem Dialog. Die Informationen muessen hier vor dem evtl. zerstoeren
+ //der neuen Shell gesetzt werden, weil deren Drucker an den Dialog
+ //gereicht wurde.
+ if ( nMode != ENV_NEWDOC )
+ {
+ ASSERT(pOldSh, "Kein Dokument - war 'Einfuegen' nicht disabled???");
+ SvxPaperBinItem aItem( RES_PAPER_BIN );
+ aItem.SetValue((BYTE)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin());
+ pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFmtAttr(aItem);
+ }
+
+ SwWrtShell *pTmp = nMode == ENV_INSERT ? pOldSh : pSh;
+ const SwPageDesc* pFollow = 0;
+ SwTxtFmtColl *pSend = pTmp->GetTxtCollFromPool( RES_POOLCOLL_SENDADRESS ),
+ *pAddr = pTmp->GetTxtCollFromPool( RES_POOLCOLL_JAKETADRESS);
+ const String &rSendMark = pSend->GetName();
+ const String &rAddrMark = pAddr->GetName();
+
+ if (nMode == ENV_INSERT)
+ {
+
+ SetView(&pOldSh->GetView()); // Pointer auf oberste View restaurieren
+
+ //Neues Dok wieder loeschen
+ xDocSh->DoClose();
+ pSh = pOldSh;
+ //#i4251# selected text or objects in the document should
+ //not be deleted on inserting envelopes
+ pSh->EnterStdMode();
+ // Los geht's (Einfuegen)
+ pSh->StartUndo(UNDO_UI_INSERT_ENVELOPE, NULL);
+ pSh->StartAllAction();
+ pSh->SttEndDoc(TRUE);
+
+ if (bEnvChange)
+ {
+ // Folgevorlage: Seite 2
+ pFollow = pSh->GetPageDesc(pSh->GetCurPageDesc()).GetFollow();
+
+ // Text der ersten Seite loeschen
+ if ( !pSh->SttNxtPg(TRUE) )
+ pSh->EndPg(TRUE);
+ pSh->DelRight();
+ // Rahmen der ersten Seite loeschen
+ if( pSh->GotoFly( rSendMark ) )
+ {
+ pSh->EnterSelFrmMode();
+ pSh->DelRight();
+ }
+ if ( pSh->GotoFly( rAddrMark ) )
+ {
+ pSh->EnterSelFrmMode();
+ pSh->DelRight();
+ }
+ pSh->SttEndDoc(TRUE);
+ }
+ else
+ // Folgevorlage: Seite 1
+ pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
+
+ // Seitenumbruch einfuegen
+ if ( pSh->IsCrsrInTbl() )
+ {
+ pSh->SplitNode();
+ pSh->Right( CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ SfxItemSet aBreakSet( pSh->GetAttrPool(), RES_BREAK, RES_BREAK, 0 );
+ aBreakSet.Put( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
+ pSh->SetTblAttr( aBreakSet );
+ }
+ else
+ pSh->InsertPageBreak(0, FALSE);
+ pSh->SttEndDoc(TRUE);
+ }
+ else
+ {
+ pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
+ // Los geht's (Drucken)
+ pSh->StartAllAction();
+ pSh->DoUndo(FALSE);
+
+ // Neue Collections "Absender" und "Empfaenger" wieder in neues
+ // Dokument kopieren
+ if ( pOldSh )
+ {
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_JAKETADRESS);
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SENDADRESS);
+ }
+ }
+
+ SET_CURR_SHELL(pSh);
+ pSh->SetNewDoc(); // Performanceprobleme vermeiden
+
+ // Flys dieser Seite merken
+ SvPtrarr aFlyArr(0, 5);
+ if( ENV_NEWDOC != nMode && !bEnvChange )
+ pSh->GetPageObjs( aFlyArr );
+
+ // Page-Desc ermitteln
+ SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_JAKET);
+ SwFrmFmt& rFmt = pDesc->GetMaster();
+
+ Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+
+ // Raender (setzen sich zusammen aus Shift-Offset und
+ // Ausrichtung)
+ Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(),
+ MAP_TWIP);
+ if ( !aPaperSize.Width() && !aPaperSize.Height() )
+ aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
+ if ( aPaperSize.Width() > aPaperSize.Height() )
+ Swap( aPaperSize );
+
+ long lLeft = rItem.lShiftRight,
+ lUpper = rItem.lShiftDown;
+
+ USHORT nPageW = (USHORT) Max(rItem.lWidth, rItem.lHeight),
+ nPageH = (USHORT) Min(rItem.lWidth, rItem.lHeight);
+
+ switch (rItem.eAlign)
+ {
+ case ENV_HOR_LEFT: break;
+ case ENV_HOR_CNTR: lLeft += Max(0L, long(aPaperSize.Width() - nPageW)) / 2;
+ break;
+ case ENV_HOR_RGHT: lLeft += Max(0L, long(aPaperSize.Width() - nPageW));
+ break;
+ case ENV_VER_LEFT: lUpper += Max(0L, long(aPaperSize.Width() - nPageH));
+ break;
+ case ENV_VER_CNTR: lUpper += Max(0L, long(aPaperSize.Width() - nPageH)) / 2;
+ break;
+ case ENV_VER_RGHT: break;
+ }
+ SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
+ SvxULSpaceItem aULMargin( RES_UL_SPACE );
+ aLRMargin.SetLeft ((USHORT) lLeft );
+ aULMargin.SetUpper((USHORT) lUpper);
+ aLRMargin.SetRight(0);
+ aULMargin.SetLower(0);
+ rFmt.SetFmtAttr(aLRMargin);
+ rFmt.SetFmtAttr(aULMargin);
+
+ // Kopf-, Fusszeilen
+ rFmt.SetFmtAttr(SwFmtHeader(BOOL(FALSE)));
+ pDesc->ChgHeaderShare(FALSE);
+ rFmt.SetFmtAttr(SwFmtFooter(BOOL(FALSE)));
+ pDesc->ChgFooterShare(FALSE);
+
+ // Seitennumerierung
+ pDesc->SetUseOn(nsUseOnPage::PD_ALL);
+
+ // Einstellen der Seitengroesse
+ rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE,
+ nPageW + lLeft, nPageH + lUpper));
+
+ // Einstellen der Numerierungsart der Seite
+ SvxNumberType aType;
+ aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ pDesc->SetNumType(aType);
+
+ // Folgevorlage
+ if (pFollow)
+ pDesc->SetFollow(pFollow);
+
+ // Landscape
+ pDesc->SetLandscape( rItem.eAlign >= ENV_VER_LEFT &&
+ rItem.eAlign <= ENV_VER_RGHT);
+
+ // Page-Desc anwenden
+
+ USHORT nPos;
+ pSh->FindPageDescByName( pDesc->GetName(),
+ FALSE,
+ &nPos );
+
+
+ pSh->ChgPageDesc( nPos, *pDesc);
+ pSh->ChgCurPageDesc(*pDesc);
+
+ // Rahmen einfuegen
+ SwFlyFrmAttrMgr aMgr(FALSE, pSh, FRMMGR_TYPE_ENVELP);
+ SwFldMgr aFldMgr;
+ aMgr.SetHeightSizeType(ATT_VAR_SIZE);
+
+ //Defaults ueberschreiben!
+ aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) );
+ aMgr.SetULSpace( 0L, 0L );
+ aMgr.SetLRSpace( 0L, 0L );
+
+ // Absender
+ if (rItem.bSend)
+ {
+ pSh->SttEndDoc(TRUE);
+ aMgr.InsertFlyFrm(FLY_AT_PAGE,
+ Point(rItem.lSendFromLeft + lLeft, rItem.lSendFromTop + lUpper),
+ Size (rItem.lAddrFromLeft - rItem.lSendFromLeft, 0));
+
+ pSh->EnterSelFrmMode();
+ pSh->SetFlyName( rSendMark );
+ pSh->UnSelectFrm();
+ pSh->LeaveSelFrmMode();
+ pSh->SetTxtFmtColl( pSend );
+ InsertLabEnvText( *pSh, aFldMgr, rItem.aSendText );
+ aMgr.UpdateAttrMgr();
+ }
+
+ // Empfaenger
+ pSh->SttEndDoc(TRUE);
+
+ aMgr.InsertFlyFrm(FLY_AT_PAGE,
+ Point(rItem.lAddrFromLeft + lLeft, rItem.lAddrFromTop + lUpper),
+ Size (nPageW - rItem.lAddrFromLeft - 566, 0));
+ pSh->EnterSelFrmMode();
+ pSh->SetFlyName( rAddrMark );
+ pSh->UnSelectFrm();
+ pSh->LeaveSelFrmMode();
+ pSh->SetTxtFmtColl( pAddr );
+ InsertLabEnvText(*pSh, aFldMgr, rItem.aAddrText);
+
+ // Flys auf die "alten" Seiten verschieben
+ if (aFlyArr.Count())
+ pSh->SetPageObjsNewPage(aFlyArr, 1);
+
+ // Fertig
+ pSh->SttEndDoc(TRUE);
+
+ pSh->EndAllAction();
+
+ if (nMode == ENV_NEWDOC)
+ pSh->DoUndo(TRUE);
+ else
+ pSh->EndUndo(UNDO_UI_INSERT_ENVELOPE);
+
+ if (nMode == ENV_NEWDOC)
+ {
+ pFrame->GetFrame().Appear();
+
+ if ( rItem.aAddrText.indexOf('<') >= 0 )
+ {
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_SBA_BRW_UPDATE,
+ SID_SBA_BRW_INSERT,
+ SID_SBA_BRW_MERGE,
+ 0
+ };
+ pFrame->GetBindings().Invalidate( aInva );
+
+ // Datenbankbeamer oeffnen
+ ShowDBObj(*pNewView, pSh->GetDBData());
+ }
+ }
+
+ if ( !pItem )
+ {
+ rReq.AppendItem( rItem );
+ if ( nMode == ENV_NEWDOC )
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, TRUE ) );
+ }
+
+ rReq.Done();
+ }
+ else //Abbruch
+ {
+ rReq.Ignore();
+
+ xDocSh->DoClose();
+ --nTitleNo;
+
+ // Pointer auf oberste View restaurieren
+ if (pOldSh)
+ SetView(&pOldSh->GetView());
+ }
+ delete pDlg;
+}
+
+
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
new file mode 100644
index 000000000000..8d8fc095b5be
--- /dev/null
+++ b/sw/source/ui/app/apphdl.cxx
@@ -0,0 +1,967 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+#include <tools/urlobj.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/link.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/undoopt.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/objitem.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <svl/srchitem.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/isethint.hxx>
+#include <svx/hyprlink.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svl/stritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svx/insctrl.hxx>
+#include <svx/selctrl.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <sfx2/docfile.hxx>
+#include <svx/xmlsecctrl.hxx>
+#include <navicfg.hxx>
+
+#include <sfx2/objface.hxx>
+#include <sfx2/app.hxx>
+
+#include <view.hxx>
+#include <pview.hxx>
+#include <srcview.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h> // Funktion-Ids
+#endif
+#include <initui.hxx>
+#include <uitool.hxx>
+#include <swmodule.hxx>
+#include <wdocsh.hxx>
+#include <wview.hxx>
+#include <usrpref.hxx>
+#include <gloslst.hxx> // SwGlossaryList
+#include <glosdoc.hxx> // SwGlossaryList
+#include <doc.hxx>
+#include <cfgitems.hxx>
+#include <prtopt.hxx>
+#include <modcfg.hxx>
+#include <globals.h> // globale Konstanten z.B.
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#include <fontcfg.hxx>
+#include <barcfg.hxx>
+#include <uinums.hxx>
+#include <dbconfig.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergechildwindow.hxx>
+#include <linguistic/lngprops.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <swabstdlg.hxx>
+
+
+#include <vcl/status.hxx>
+
+#include "salhelper/simplereferenceobject.hxx"
+#include "rtl/ref.hxx"
+
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slotmaps fuer Methoden der Applikation
+ --------------------------------------------------------------------*/
+
+
+// hier werden die SlotID's included
+// siehe Idl-File
+//
+#define SwModule
+#define ViewSettings
+#define WebViewSettings
+#define PrintSettings
+#define _ExecAddress ExecOther
+#define _StateAddress StateOther
+#include <sfx2/msg.hxx>
+#include <svx/svxslots.hxx>
+#include "swslots.hxx"
+#include <cfgid.h>
+
+#include <shells.hrc>
+
+SFX_IMPL_INTERFACE( SwModule, SfxModule, SW_RES(RID_SW_NAME) )
+{
+ SFX_CHILDWINDOW_REGISTRATION(SvxHyperlinkDlgWrapper::GetChildWindowId());
+ SFX_STATUSBAR_REGISTRATION(SW_RES(CFG_STATUSBAR));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION |
+ SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER,
+ SW_RES(RID_MODULE_TOOLBOX) );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Andere States
+ --------------------------------------------------------------------*/
+
+
+void SwModule::StateOther(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ SwView* pActView = ::GetActiveView();
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pActView);
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case FN_BUSINESS_CARD:
+ case FN_LABEL:
+ case FN_ENVELOP:
+ {
+ sal_Bool bDisable = sal_False;
+ SfxViewShell* pCurrView = SfxViewShell::Current();
+ if( !pCurrView || (pCurrView && !pCurrView->ISA(SwView)) )
+ bDisable = sal_True;
+ SwDocShell *pDocSh = (SwDocShell*) SfxObjectShell::Current();
+ if ( bDisable ||
+ (pDocSh && (pDocSh->IsReadOnly() ||
+ pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)) )
+ rSet.DisableItem( nWhich );
+
+ }
+ break;
+ case FN_XFORMS_INIT:
+ // slot is always active!
+ break;
+ case FN_EDIT_FORMULA:
+ {
+ SwWrtShell* pSh = 0;
+ int nSelection = 0;
+ if( pActView )
+ pSh = &pActView->GetWrtShell();
+ if( pSh )
+ nSelection = pSh->GetSelectionType();
+
+ if( (pSh && pSh->HasSelection()) ||
+ !(nSelection & (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL)))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ATTR_METRIC:
+ rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(::GetDfltMetric(bWebView))));
+ break;
+ case FN_SET_MODOPT_TBLNUMFMT:
+ rSet.Put( SfxBoolItem( nWhich, pModuleConfig->
+ IsInsTblFormatNum( bWebView )));
+ break;
+ default:
+ DBG_ERROR("::StateOther: default");
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*-- 06.04.2004 15:21:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwView* lcl_LoadDoc(SwView* pView, const String& rURL)
+{
+ SwView* pNewView = 0;
+ if(rURL.Len())
+ {
+ SfxStringItem aURL(SID_FILE_NAME, rURL);
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, String::CreateFromAscii("_blank") );
+ SfxBoolItem aHidden( SID_HIDDEN, TRUE );
+ SfxStringItem aReferer(SID_REFERER, pView->GetDocShell()->GetTitle());
+ SfxObjectItem* pItem = (SfxObjectItem*)pView->GetViewFrame()->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_SYNCHRON,
+ &aURL, &aHidden, &aReferer, &aTargetFrameName, 0L);
+ SfxShell* pShell = pItem ? pItem->GetShell() : 0;
+
+ if(pShell)
+ {
+ SfxViewShell* pViewShell = pShell->GetViewShell();
+ if(pViewShell)
+ {
+ if( pViewShell->ISA(SwView) )
+ {
+ pNewView = PTR_CAST(SwView,pViewShell);
+ pNewView->GetViewFrame()->GetFrame().Appear();
+ }
+ else
+ {
+ pViewShell->GetViewFrame()->DoClose();
+ }
+ }
+ }
+ }
+ else
+ {
+ SfxStringItem aFactory(SID_NEWDOCDIRECT, SwDocShell::Factory().GetFilterContainer()->GetName());
+ const SfxFrameItem* pItem = (SfxFrameItem*)
+ pView->GetViewFrame()->GetDispatcher()->Execute(SID_NEWDOCDIRECT,
+ SFX_CALLMODE_SYNCHRON, &aFactory, 0L);
+ SfxFrame* pFrm = pItem ? pItem->GetFrame() : 0;
+ SfxViewFrame* pFrame = pFrm ? pFrm->GetCurrentViewFrame() : 0;
+ pNewView = pFrame ? PTR_CAST(SwView, pFrame->GetViewShell()) : 0;
+ }
+
+ return pNewView;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Felddialog starten
+ --------------------------------------------------------------------*/
+
+void NewXForms( SfxRequest& rReq ); // implementation: below
+
+namespace
+{
+
+class SwMailMergeWizardExecutor : public salhelper::SimpleReferenceObject
+{
+ SwView* m_pView; // never owner
+ SwView* m_pView2Close; // never owner
+ SwMailMergeConfigItem* m_pMMConfig; // sometimes owner
+ AbstractMailMergeWizard* m_pWizard; // always owner
+
+ DECL_LINK( EndDialogHdl, AbstractMailMergeWizard* );
+ DECL_LINK( DestroyDialogHdl, AbstractMailMergeWizard* );
+ DECL_LINK( DestroyWizardHdl, AbstractMailMergeWizard* );
+ DECL_LINK( CancelHdl, AbstractMailMergeWizard* );
+ DECL_LINK( CloseFrameHdl, AbstractMailMergeWizard* );
+
+ void ExecutionFinished( bool bDeleteConfigItem );
+ void ExecuteWizard();
+
+public:
+ SwMailMergeWizardExecutor();
+ ~SwMailMergeWizardExecutor();
+
+ void ExecuteMailMergeWizard( const SfxItemSet * pArgs );
+};
+
+SwMailMergeWizardExecutor::SwMailMergeWizardExecutor()
+ : m_pView( 0 ),
+ m_pView2Close( NULL ),
+ m_pMMConfig( 0 ),
+ m_pWizard( 0 )
+{
+}
+
+SwMailMergeWizardExecutor::~SwMailMergeWizardExecutor()
+{
+ DBG_ASSERT( m_pWizard == 0, "SwMailMergeWizardExecutor: m_pWizard must be Null!" );
+ DBG_ASSERT( m_pMMConfig == 0, "SwMailMergeWizardExecutor: m_pMMConfig must be Null!" );
+}
+
+void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs )
+{
+ if ( m_pView )
+ {
+ DBG_ERROR( "SwMailMergeWizardExecutor::ExecuteMailMergeWizard: Already executing the wizard!" );
+ return;
+ }
+
+ m_pView = ::GetActiveView(); // not owner!
+ DBG_ASSERT(m_pView, "no current view?");
+ if(m_pView)
+ {
+ // keep self alive until done.
+ acquire();
+
+ // if called from the child window - get the config item and close the ChildWindow, then restore
+ // the wizard
+ SwMailMergeChildWindow* pChildWin =
+ static_cast<SwMailMergeChildWindow*>(m_pView->GetViewFrame()->GetChildWindow(FN_MAILMERGE_CHILDWINDOW));
+ bool bRestoreWizard = false;
+ sal_uInt16 nRestartPage = 0;
+ if(pChildWin && pChildWin->IsVisible())
+ {
+ m_pMMConfig = m_pView->GetMailMergeConfigItem();
+ nRestartPage = m_pView->GetMailMergeRestartPage();
+ if(m_pView->IsMailMergeSourceView())
+ m_pMMConfig->SetSourceView( m_pView );
+ m_pView->SetMailMergeConfigItem(0, 0, sal_True);
+ SfxViewFrame* pViewFrame = m_pView->GetViewFrame();
+ pViewFrame->ShowChildWindow(FN_MAILMERGE_CHILDWINDOW, FALSE);
+ DBG_ASSERT(m_pMMConfig, "no MailMergeConfigItem available");
+ bRestoreWizard = true;
+ }
+ // to make it bullet proof ;-)
+ if(!m_pMMConfig)
+ {
+ m_pMMConfig = new SwMailMergeConfigItem;
+ m_pMMConfig->SetSourceView(m_pView);
+
+ //set the first used database as default source on the config item
+ const SfxPoolItem* pItem = 0;
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_DATABASE_PROPERTIES, sal_False, &pItem))
+ {
+ //mailmerge has been called from the database beamer
+ uno::Sequence< beans::PropertyValue> aDBValues;
+ if(static_cast<const SfxUsrAnyItem*>(pItem)->GetValue() >>= aDBValues)
+ {
+ SwDBData aDBData;
+ svx::ODataAccessDescriptor aDescriptor(aDBValues);
+ aDescriptor[svx::daDataSource] >>= aDBData.sDataSource;
+ aDescriptor[svx::daCommand] >>= aDBData.sCommand;
+ aDescriptor[svx::daCommandType] >>= aDBData.nCommandType;
+
+ uno::Sequence< uno::Any > aSelection;
+ uno::Reference< sdbc::XConnection> xConnection;
+ uno::Reference< sdbc::XDataSource> xSource;
+ uno::Reference< sdbcx::XColumnsSupplier> xColumnsSupplier;
+ if ( aDescriptor.has(svx::daSelection) )
+ aDescriptor[svx::daSelection] >>= aSelection;
+ if ( aDescriptor.has(svx::daConnection) )
+ aDescriptor[svx::daConnection] >>= xConnection;
+ uno::Reference<container::XChild> xChild(xConnection, uno::UNO_QUERY);
+ if(xChild.is())
+ xSource = uno::Reference<sdbc::XDataSource>(
+ xChild->getParent(), uno::UNO_QUERY);
+ m_pMMConfig->SetCurrentConnection(
+ xSource, SharedConnection( xConnection, SharedConnection::NoTakeOwnership ),
+ xColumnsSupplier, aDBData);
+ }
+ }
+ else
+ {
+ SvStringsDtor aDBNameList(5, 1);
+ SvStringsDtor aAllDBNames(5, 5);
+ m_pView->GetWrtShell().GetAllUsedDB( aDBNameList, &aAllDBNames );
+ if(aDBNameList.Count())
+ {
+ String sDBName = *aDBNameList[0];
+ SwDBData aDBData;
+ aDBData.sDataSource = sDBName.GetToken(0, DB_DELIM);
+ aDBData.sCommand = sDBName.GetToken(1, DB_DELIM);
+ aDBData.nCommandType = sDBName.GetToken(2, DB_DELIM ).ToInt32();
+ //set the currently used database for the wizard
+ m_pMMConfig->SetCurrentDBData( aDBData );
+ }
+ }
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+
+ if(bRestoreWizard)
+ {
+ m_pWizard->ShowPage( nRestartPage );
+ }
+
+ ExecuteWizard();
+ }
+}
+
+void SwMailMergeWizardExecutor::ExecutionFinished( bool bDeleteConfigItem )
+{
+ m_pMMConfig->Commit();
+ if ( bDeleteConfigItem ) // owner?
+ delete m_pMMConfig;
+
+ m_pMMConfig = 0;
+
+ // release/destroy asynchronously
+ Application::PostUserEvent( LINK( this, SwMailMergeWizardExecutor, DestroyDialogHdl ) );
+}
+
+void SwMailMergeWizardExecutor::ExecuteWizard()
+{
+ m_pWizard->StartExecuteModal(
+ LINK( this, SwMailMergeWizardExecutor, EndDialogHdl ) );
+}
+
+#if OSL_DEBUG_LEVEL > 1
+IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, pDialog )
+#else
+IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EMPTYARG )
+#endif
+{
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( pDialog == m_pWizard, "wrong dialog passed to EndDialogHdl!" );
+ (void) pDialog;
+#endif
+
+ long nRet = m_pWizard->GetResult();
+ sal_uInt16 nRestartPage = m_pWizard->GetRestartPage();
+
+ switch ( nRet )
+ {
+ case RET_LOAD_DOC:
+ {
+ SwView* pNewView = lcl_LoadDoc(m_pView, m_pWizard->GetReloadDocument());
+
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if(pNewView)
+ {
+ m_pView = pNewView;
+ m_pMMConfig->DocumentReloaded();
+ //new source view!
+ m_pMMConfig->SetSourceView( m_pView );
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+ }
+ else
+ {
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+ }
+
+ // execute the wizard again
+ ExecuteWizard();
+ break;
+ }
+ case RET_TARGET_CREATED:
+ {
+ SwView* pTargetView = m_pMMConfig->GetTargetView();
+ uno::Reference< frame::XFrame > xFrame =
+ m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
+ xFrame->getContainerWindow()->setVisible(sal_False);
+ DBG_ASSERT(pTargetView, "No target view has been created");
+ if(pTargetView)
+ {
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*pTargetView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+
+ // execute the wizard again
+ ExecuteWizard();
+ }
+ else
+ {
+ //should not happen - just in case no target view has been created
+ ExecutionFinished( true );
+ }
+ break;
+ }
+ case RET_EDIT_DOC:
+ case RET_EDIT_RESULT_DOC:
+ {
+ //create a non-modal dialog that allows to return to the wizard
+ //the ConfigItem ownership moves to this dialog
+ bool bResult = nRet == RET_EDIT_RESULT_DOC && m_pMMConfig->GetTargetView();
+ SwView* pTempView = bResult ? m_pMMConfig->GetTargetView() : m_pMMConfig->GetSourceView();
+ pTempView->SetMailMergeConfigItem(m_pMMConfig, m_pWizard->GetRestartPage(), !bResult);
+ SfxViewFrame* pViewFrame = pTempView->GetViewFrame();
+ pViewFrame->GetDispatcher()->Execute(
+ FN_MAILMERGE_CHILDWINDOW, SFX_CALLMODE_SYNCHRON);
+ ExecutionFinished( false );
+ break;
+ }
+ case RET_REMOVE_TARGET:
+ {
+ SwView* pTargetView = m_pMMConfig->GetTargetView();
+ SwView* pSourceView = m_pMMConfig->GetSourceView();
+ DBG_ASSERT(pTargetView && pSourceView, "source or target view not available" );
+ if(pTargetView && pSourceView)
+ {
+ m_pView2Close = pTargetView;
+ pTargetView->GetViewFrame()->GetTopViewFrame()->GetWindow().Hide();
+ pSourceView->GetViewFrame()->GetFrame().AppearWithUpdate();
+ // the current view has be be set when the target is destroyed
+ m_pView = pSourceView;
+ m_pMMConfig->SetTargetView(0);
+
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, CloseFrameHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*pSourceView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+
+ // execute the wizard again
+ ExecuteWizard();
+ }
+ else
+ {
+ //should not happen - just in case no target view has been created
+ ExecutionFinished( true );
+ }
+ break;
+ }
+ case RET_CANCEL:
+ {
+ // close frame and destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, CancelHdl ), m_pWizard );
+ break;
+ }
+ default: //finish
+ {
+ SwView* pSourceView = m_pMMConfig->GetSourceView();
+ if(pSourceView)
+ {
+ SwDocShell* pDocShell = pSourceView->GetDocShell();
+ if(pDocShell->HasName() && !pDocShell->IsModified())
+ m_pMMConfig->GetSourceView()->GetViewFrame()->DoClose();
+ else
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear();
+ }
+ ExecutionFinished( true );
+ break;
+ }
+
+ } // switch
+
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, DestroyDialogHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ delete m_pWizard;
+ m_pWizard = 0;
+
+ release();
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, DestroyWizardHdl, AbstractMailMergeWizard*, pDialog )
+{
+ delete pDialog;
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, CancelHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ if(m_pMMConfig->GetTargetView())
+ {
+ m_pMMConfig->GetTargetView()->GetViewFrame()->DoClose();
+ m_pMMConfig->SetTargetView(0);
+ }
+ if(m_pMMConfig->GetSourceView())
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().AppearWithUpdate();
+
+ m_pMMConfig->Commit();
+ delete m_pMMConfig;
+ m_pMMConfig = 0;
+ // m_pWizard already deleted by closing the target view
+ m_pWizard = 0;
+ release();
+
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, CloseFrameHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ if ( m_pView2Close )
+ {
+ m_pView2Close->GetViewFrame()->DoClose();
+ m_pView2Close = NULL;
+ }
+
+ return 0L;
+}
+
+} // namespace
+
+void SwModule::ExecOther(SfxRequest& rReq)
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+
+ sal_uInt16 nWhich = rReq.GetSlot();
+ switch (nWhich)
+ {
+ case FN_ENVELOP:
+ InsertEnv( rReq );
+ break;
+
+ case FN_BUSINESS_CARD:
+ case FN_LABEL:
+ InsertLab(rReq, nWhich == FN_LABEL);
+ break;
+
+ case FN_XFORMS_INIT:
+ NewXForms( rReq );
+ break;
+
+ case SID_ATTR_METRIC:
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(nWhich, sal_False, &pItem))
+ {
+ FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
+ switch( eUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_INCH:
+ case FUNIT_PICA:
+ case FUNIT_POINT:
+ {
+ SwView* pActView = ::GetActiveView();
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pActView);
+ ::SetDfltMetric(eUnit, bWebView);
+ }
+ break;
+ default:;//prevent warning
+ }
+ }
+ break;
+
+ case FN_SET_MODOPT_TBLNUMFMT:
+ {
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, ::GetActiveView() ),
+ bSet;
+
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(
+ nWhich, sal_False, &pItem ))
+ bSet = ((SfxBoolItem*)pItem)->GetValue();
+ else
+ bSet = !pModuleConfig->IsInsTblFormatNum( bWebView );
+
+ pModuleConfig->SetInsTblFormatNum( bWebView, bSet );
+ }
+ break;
+ case FN_MAILMERGE_WIZARD:
+ {
+ rtl::Reference< SwMailMergeWizardExecutor > xEx( new SwMailMergeWizardExecutor );
+ xEx->ExecuteMailMergeWizard( pArgs );
+ }
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Notifies abfangen
+ --------------------------------------------------------------------*/
+
+
+ // Hint abfangen fuer DocInfo
+void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if( rHint.ISA( SfxEventHint ) )
+ {
+ SfxEventHint& rEvHint = (SfxEventHint&) rHint;
+ SwDocShell* pDocSh = PTR_CAST( SwDocShell, rEvHint.GetObjShell() );
+ if( pDocSh )
+ {
+ SwWrtShell* pWrtSh = pDocSh ? pDocSh->GetWrtShell() : 0;
+ switch( rEvHint.GetEventId() )
+ {
+/* MA 07. Mar. 96: UpdateInputFlds() nur noch bei Dokument neu.
+ (Und bei Einfuegen Textbaust.)
+ case SFX_EVENT_OPENDOC:
+ // dann am aktuellen Dokument die Input-Fedler updaten
+ if( pWrtSh )
+ pWrtSh->UpdateInputFlds();
+ break;
+*/
+ case SFX_EVENT_CREATEDOC:
+ // alle FIX-Date/Time Felder auf akt. setzen
+ if( pWrtSh )
+ {
+ SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ sal_Bool bUpdateFields = sal_True;
+ if( pUpdateDocItem && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE)
+ bUpdateFields = sal_False;
+ pWrtSh->SetFixFields();
+ if(bUpdateFields)
+ {
+ pWrtSh->UpdateInputFlds();
+
+ // Sind Datenbankfelder enthalten?
+ // Erstmal alle verwendeten Datenbanken holen
+ SwDoc *pDoc = pDocSh->GetDoc();
+ SvStringsDtor aDBNameList;
+ pDoc->GetAllUsedDB( aDBNameList );
+ sal_uInt16 nCount = aDBNameList.Count();
+ if (nCount)
+ { // Datenbankbeamer oeffnen
+ ShowDBObj(pWrtSh->GetView(), pDoc->GetDBData());
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ else if(rHint.ISA(SfxItemSetHint))
+ {
+ if( SFX_ITEM_SET == ((SfxItemSetHint&)rHint).GetItemSet().GetItemState(SID_ATTR_PATHNAME))
+ {
+ ::GetGlossaries()->UpdateGlosPath( sal_False );
+ SwGlossaryList* pList = ::GetGlossaryList();
+ if(pList->IsActive())
+ pList->Update();
+ }
+ }
+ else if(rHint.ISA(SfxSimpleHint))
+ {
+ USHORT nHintId = ((SfxSimpleHint&)rHint).GetId();
+ if(SFX_HINT_DEINITIALIZING == nHintId)
+ {
+ DELETEZ(pWebUsrPref);
+ DELETEZ(pUsrPref) ;
+ DELETEZ(pModuleConfig);
+ DELETEZ(pPrtOpt) ;
+ DELETEZ(pWebPrtOpt) ;
+ DELETEZ(pChapterNumRules);
+ DELETEZ(pStdFontConfig) ;
+ DELETEZ(pNavigationConfig) ;
+ DELETEZ(pToolbarConfig) ;
+ DELETEZ(pWebToolbarConfig) ;
+ DELETEZ(pAuthorNames) ;
+ DELETEZ(pDBConfig);
+ pColorConfig->RemoveListener(this);
+ DELETEZ(pColorConfig);
+ pAccessibilityOptions->RemoveListener(this);
+ DELETEZ(pAccessibilityOptions);
+ pCTLOptions->RemoveListener(this);
+ DELETEZ(pCTLOptions);
+ pUserOptions->RemoveListener(this);
+ DELETEZ(pUserOptions);
+ pUndoOptions->RemoveListener(this);
+ DELETEZ(pUndoOptions);
+ }
+ }
+}
+
+void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal_uInt32 )
+{
+ if( pBrdCst == pUserOptions )
+ {
+ bAuthorInitialised = FALSE;
+ }
+ else if( pBrdCst == pUndoOptions )
+ {
+ const int nNew = GetUndoOptions().GetUndoCount();
+ const int nOld = SwEditShell::GetUndoActionCount();
+ if(!nNew || !nOld)
+ {
+ sal_Bool bUndo = nNew != 0;
+ //ueber DocShells iterieren und Undo umschalten
+
+ TypeId aType(TYPE(SwDocShell));
+ SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+ while( pDocShell )
+ {
+ pDocShell->GetDoc()->DoUndo( bUndo );
+ pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType);
+ }
+ }
+ SwEditShell::SetUndoActionCount( static_cast< USHORT >(nNew));
+ }
+ else if ( pBrdCst == pColorConfig || pBrdCst == pAccessibilityOptions )
+ {
+ sal_Bool bAccessibility = sal_False;
+ if( pBrdCst == pColorConfig )
+ SwViewOption::ApplyColorConfigValues(*pColorConfig);
+ else
+ bAccessibility = sal_True;
+
+ //invalidate all edit windows
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ const TypeId aSwPreViewTypeId = TYPE(SwPagePreView);
+ const TypeId aSwSrcViewTypeId = TYPE(SwSrcView);
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while(pViewShell)
+ {
+ if(pViewShell->GetWindow())
+ {
+ if((pViewShell->IsA(aSwViewTypeId) ||
+ pViewShell->IsA(aSwPreViewTypeId) ||
+ pViewShell->IsA(aSwSrcViewTypeId)))
+ {
+ if(bAccessibility)
+ {
+ if(pViewShell->IsA(aSwViewTypeId))
+ ((SwView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions);
+ else if(pViewShell->IsA(aSwPreViewTypeId))
+ ((SwPagePreView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions);
+ }
+ pViewShell->GetWindow()->Invalidate();
+ }
+ }
+ pViewShell = SfxViewShell::GetNext( *pViewShell );
+ }
+ }
+ else if( pBrdCst == pCTLOptions )
+ {
+ const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
+ while( pObjSh )
+ {
+ if( pObjSh->IsA(TYPE(SwDocShell)) )
+ {
+ const SwDoc* pDoc = ((SwDocShell*)pObjSh)->GetDoc();
+ ViewShell* pVSh = 0;
+ pDoc->GetEditShell( &pVSh );
+ if ( pVSh )
+ pVSh->ChgNumberDigits();
+ }
+ pObjSh = SfxObjectShell::GetNext(*pObjSh);
+ }
+ }
+
+}
+
+/* -----------------------------20.02.01 12:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig* SwModule::GetDBConfig()
+{
+ if(!pDBConfig)
+ pDBConfig = new SwDBConfig;
+ return pDBConfig;
+}
+/* -----------------------------11.04.2002 15:27------------------------------
+
+ ---------------------------------------------------------------------------*/
+svtools::ColorConfig& SwModule::GetColorConfig()
+{
+ if(!pColorConfig)
+ {
+ pColorConfig = new svtools::ColorConfig;
+ SwViewOption::ApplyColorConfigValues(*pColorConfig);
+ pColorConfig->AddListener(this);
+ }
+ return *pColorConfig;
+}
+/* -----------------------------06.05.2002 09:42------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvtAccessibilityOptions& SwModule::GetAccessibilityOptions()
+{
+ if(!pAccessibilityOptions)
+ {
+ pAccessibilityOptions = new SvtAccessibilityOptions;
+ pAccessibilityOptions->AddListener(this);
+ }
+ return *pAccessibilityOptions;
+}
+/* -----------------06.05.2003 14:52-----------------
+
+ --------------------------------------------------*/
+SvtCTLOptions& SwModule::GetCTLOptions()
+{
+ if(!pCTLOptions)
+ {
+ pCTLOptions = new SvtCTLOptions;
+ pCTLOptions->AddListener(this);
+ }
+ return *pCTLOptions;
+}
+/* -----------------07.07.2003 09:31-----------------
+
+ --------------------------------------------------*/
+SvtUserOptions& SwModule::GetUserOptions()
+{
+ if(!pUserOptions)
+ {
+ pUserOptions = new SvtUserOptions;
+ pUserOptions->AddListener(this);
+ }
+ return *pUserOptions;
+}
+/* -----------------18.07.2003 13:31-----------------
+
+ --------------------------------------------------*/
+SvtUndoOptions& SwModule::GetUndoOptions()
+{
+ if(!pUndoOptions)
+ {
+ pUndoOptions = new SvtUndoOptions;
+ pUndoOptions->AddListener(this);
+ }
+ return *pUndoOptions;
+}
+/*-----------------30.01.97 08.30-------------------
+
+--------------------------------------------------*/
+const SwMasterUsrPref *SwModule::GetUsrPref(sal_Bool bWeb) const
+{
+ SwModule* pNonConstModule = (SwModule*)this;
+ if(bWeb && !pWebUsrPref)
+ {
+ // im Load der SwMasterUsrPref wird der SpellChecker gebraucht, dort darf
+ // er aber nicht angelegt werden #58256#
+ pNonConstModule->pWebUsrPref = new SwMasterUsrPref(TRUE);
+ }
+ else if(!bWeb && !pUsrPref)
+ {
+ pNonConstModule->pUsrPref = new SwMasterUsrPref(FALSE);
+ }
+ return bWeb ? pWebUsrPref : pUsrPref;
+}
+
+
+
+void NewXForms( SfxRequest& rReq )
+{
+ // copied & excerpted from SwModule::InsertLab(..)
+
+ // create new document
+ SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD) );
+ xDocSh->DoInitNew( 0 );
+
+ // initialize XForms
+ static_cast<SwDocShell*>( &xDocSh )->GetDoc()->initXForms( true );
+
+ // load document into frame
+ SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+
+ // set return value
+ rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) );
+}
diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx
new file mode 100644
index 000000000000..41f055f86050
--- /dev/null
+++ b/sw/source/ui/app/applab.cxx
@@ -0,0 +1,457 @@
+/*************************************************************************
+ *
+ * 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"
+
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+
+#include <hintids.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/protitem.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <fmthdft.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <swwait.hxx>
+#include <gloshdl.hxx>
+#include <mdiexp.hxx>
+#include <frmatr.hxx>
+#include <paratr.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <fldbas.hxx>
+#include <swundo.hxx>
+#include <wrtsh.hxx>
+#include <cmdid.h>
+#include <dbmgr.hxx>
+#include <fmtcol.hxx>
+#include <expfld.hxx>
+#include <fldmgr.hxx>
+#include <label.hxx>
+#include <labimg.hxx>
+#include <section.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "envelp.hrc"
+#include <misc.hrc>
+
+#include <IDocumentDeviceAccess.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+// steht im appenv.cxx
+extern String InsertLabEnvText( SwWrtShell& , SwFldMgr& , const String& );
+
+const char __FAR_DATA MASTER_LABEL[] = "MasterLabel";
+
+// --------------------------------------------------------------------------
+
+const SwFrmFmt *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem,
+ SwFrmFmt &rFmt,
+ sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bPage)
+{
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
+ sal_uInt16 nPhyPageNum, nVirtPageNum;
+ rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
+
+ aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
+ if (!bPage)
+ {
+ aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
+ text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
+ text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ }
+ const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen
+ ASSERT( pFmt, "Fly not inserted" );
+
+ rSh.UnSelectFrm(); //Rahmen wurde automatisch selektiert
+
+ rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+
+ //
+ if(!rItem.bSynchron || !(nCol|nRow))
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( rItem.sGlossaryGroup );
+ SwGlossaryHdl* pGlosHdl = rSh.GetView().GetGlosHdl();
+ pGlosHdl->SetCurGroup(rItem.sGlossaryGroup, sal_True);
+ pGlosHdl->InsertGlossary( rItem.sGlossaryBlockName );
+ }
+
+ return pFmt;
+}
+
+const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem,
+ SwFrmFmt &rFmt, SwFldMgr& rFldMgr,
+ sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bLast, sal_Bool bPage)
+{
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
+ sal_uInt16 nPhyPageNum, nVirtPageNum;
+ rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
+
+ aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
+ if (!bPage)
+ {
+ aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
+ text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
+ text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ }
+ const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen
+ ASSERT( pFmt, "Fly not inserted" );
+
+ rSh.UnSelectFrm(); //Rahmen wurde automatisch selektiert
+
+ rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+
+ // Ggf. "Naechster Datensatz"
+ String sDBName;
+ if( (!rItem.bSynchron || !(nCol|nRow)) && (sDBName = InsertLabEnvText( rSh, rFldMgr, rItem.aWriting )).Len() && !bLast )
+ {
+ sDBName.SetToken( 3, DB_DELIM, String::CreateFromAscii("True"));
+ SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh );
+ rFldMgr.InsertFld( aData );
+ }
+
+ return pFmt;
+}
+
+// ----------------------------------------------------------------------------
+
+
+void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
+{
+static sal_uInt16 nLabelTitleNo = 0;
+static sal_uInt16 nBCTitleNo = 0;
+
+ // DB-Manager anlegen
+ SwNewDBMgr* pNewDBMgr = new SwNewDBMgr;
+
+ // SwLabItem aus Config lesen
+ SwLabCfgItem aLabCfg(bLabel);
+
+ // Dialog hochfahren
+ SfxItemSet aSet( GetPool(), FN_LABEL, FN_LABEL, 0 );
+ aSet.Put( aLabCfg.GetItem() );
+
+ SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!");
+
+ AbstarctSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if ( RET_OK == pDlg->Execute() )
+ {
+ // Dialog auslesen, Item in Config speichern
+ const SwLabItem& rItem = (const SwLabItem&) pDlg->
+ GetOutputItemSet()->Get(FN_LABEL);
+ aLabCfg.GetItem() = rItem;
+ aLabCfg.Commit();
+
+ // Neues Dokument erzeugen.
+ SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD));
+ xDocSh->DoInitNew( 0 );
+
+ // Drucker
+ Printer *pPrt = pDlg->GetPrt();
+ if (pPrt)
+ {
+ SwDocShell *pDocSh = (SwDocShell*)(&*xDocSh);
+ pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup());
+ }
+
+ SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+
+ SwView *pNewView = (SwView*) pViewFrame->GetViewShell();
+ pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
+
+ // Dokumenttitel setzen
+ String aTmp;
+ if(bLabel)
+ {
+ aTmp = String(SW_RES( STR_LAB_TITLE));
+ aTmp += String::CreateFromInt32(++nLabelTitleNo );
+ }
+ else
+ {
+ aTmp = pDlg->GetBusinessCardStr();
+ aTmp += String::CreateFromInt32( ++nBCTitleNo );
+ }
+ xDocSh->SetTitle( aTmp );
+
+ pViewFrame->GetFrame().Appear();
+
+ // Shell ermitteln
+ SwWrtShell *pSh = pNewView->GetWrtShellPtr();
+ ASSERT( pSh, "missing WrtShell" );
+
+ { // block for locks the dispatcher!!
+
+ SwWait aWait( (SwDocShell&)*xDocSh, sal_True );
+
+ SET_CURR_SHELL(pSh);
+ pSh->SetLabelDoc(rItem.bSynchron);
+ pSh->DoUndo( sal_False );
+ pSh->StartAllAction();
+
+ pSh->SetNewDoc(); // Performanceprobleme vermeiden
+
+ SwPageDesc aDesc = pSh->GetPageDesc( 0 );
+ SwFrmFmt& rFmt = aDesc.GetMaster();
+
+ // Raender
+ SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
+ SvxULSpaceItem aULMargin( RES_UL_SPACE );
+ aLRMargin.SetLeft ((sal_uInt16) rItem.lLeft );
+ aULMargin.SetUpper((sal_uInt16) rItem.lUpper);
+ aLRMargin.SetRight(MINLAY/2);
+ aULMargin.SetLower(MINLAY/2);
+ rFmt.SetFmtAttr(aLRMargin);
+ rFmt.SetFmtAttr(aULMargin);
+
+ // Kopf- und Fusszeilen
+ rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False)));
+ aDesc.ChgHeaderShare(sal_False);
+ rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False)));
+ aDesc.ChgFooterShare(sal_False);
+
+
+ aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Seitennumerierung
+
+ // Einstellen der Seitengroesse
+ rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE,
+ rItem.lLeft + rItem.nCols * rItem.lHDist + MINLAY,
+ rItem.lUpper + rItem.nRows * rItem.lVDist + MINLAY));
+
+ // Numerierungsart
+ SvxNumberType aType;
+ aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aDesc.SetNumType( aType );
+
+ // Folgevorlage
+ const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() );
+ aDesc.SetFollow( &rFollow );
+
+ pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+ SvxPaperBinItem aItem( RES_PAPER_BIN );
+ aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
+ rFmt.SetFmtAttr(aItem);
+
+ //determine orientation by calculating the width and height of the resulting page
+ const int nResultWidth = rItem.lHDist * (rItem.nCols - 1) + rItem.lWidth + rItem.lLeft;
+ const int nResultHeight = rItem.lVDist * (rItem.nRows - 1) + rItem.lHeight + rItem.lUpper;
+ aDesc.SetLandscape(nResultWidth > nResultHeight);
+
+ pSh->ChgPageDesc( 0, aDesc );
+
+ // Rahmen einfuegen
+ SwFldMgr* pFldMgr = new SwFldMgr;
+ pFldMgr->SetEvalExpFlds(sal_False);
+
+ //fix(24446): Damit der Text der Ettiketten nicht im unbedruckbaren
+ //Bereich landet stellen wir entsprechende Raender ein. Um das Handling
+ //so Optimal wie moeglich zu halten stellen wir zunaechst an der
+ //aktuellen Absatzvorlage keinen Rand als hartes Attribut ein (Damit die
+ //Formatierung wg. der Zeichengeb. Rahmen passt. Dann stellen wir die
+ //Standarabsatzvorlage anhand des unbedruckbaren Bereiches ein.
+ const long nMin = pPrt->GetPageOffset().X() - rItem.lLeft;
+ if ( nMin > 0 )
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ pSh->SetAttr( aLR );
+ SwFmt *pStandard = pSh->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+ aLR.SetLeft ( sal_uInt16(nMin) );
+ aLR.SetRight( sal_uInt16(nMin) );
+ pStandard->SetFmtAttr( aLR );
+ }
+
+ // Rahmenvorlage vorbereiten
+ SwFrmFmt* pFmt = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL );
+ SwFmtFrmSize aFrmSize( ATT_FIX_SIZE,
+ rItem.lHDist - (rItem.lHDist-rItem.lWidth),
+ rItem.lVDist - (rItem.lVDist-rItem.lHeight));
+ pFmt->SetFmtAttr(aFrmSize);
+
+ SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth),
+ 0, 0,
+ RES_LR_SPACE);
+ pFmt->SetFmtAttr(aFrmLRSpace);
+
+ SvxULSpaceItem aFrmULSpace( 0, (sal_uInt16)(rItem.lVDist - rItem.lHeight),
+ RES_UL_SPACE);
+ pFmt->SetFmtAttr(aFrmULSpace);
+
+ const SwFrmFmt *pFirstFlyFmt = 0;
+ if ( rItem.bPage )
+ {
+ SwFmtVertOrient aFrmVertOrient( pFmt->GetVertOrient() );
+ aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP );
+ pFmt->SetFmtAttr(aFrmVertOrient);
+
+ for ( sal_uInt16 i = 0; i < rItem.nRows; ++i )
+ {
+ for ( sal_uInt16 j = 0; j < rItem.nCols; ++j )
+ {
+ pSh->Push();
+ const SwFrmFmt *pTmp =
+ bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr, j, i,
+ i == rItem.nRows - 1 && j == rItem.nCols - 1,
+ sal_True ) :
+ lcl_InsertBCText(*pSh, rItem, *pFmt, j, i, sal_True);
+ if (!(i|j))
+ {
+ pFirstFlyFmt = pTmp;
+
+ if (rItem.bSynchron)
+ {
+ // if there is no content in the fly then
+ // dont leave the fly!!!
+ pSh->Push();
+ pSh->SttDoc();
+ sal_Bool bInFly = 0 != pSh->WizzardGetFly();
+ pSh->Pop( bInFly );
+
+ if( bInFly )
+ pSh->EndDoc(sal_True); // select all content
+ // in the fly
+ else
+ pSh->SetMark(); // set only the mark
+
+ SwSectionData aSect(CONTENT_SECTION,
+ String::CreateFromAscii(MASTER_LABEL));
+ pSh->InsertSection(aSect);
+ }
+ }
+ else if (rItem.bSynchron)
+ {
+ SwSectionData aSect(FILE_LINK_SECTION,
+ pSh->GetUniqueSectionName());
+ String sLinkName(sfx2::cTokenSeperator);
+ sLinkName += sfx2::cTokenSeperator;
+ sLinkName += String::CreateFromAscii(MASTER_LABEL);
+ aSect.SetLinkFileName(sLinkName);
+ aSect.SetProtectFlag(true);
+ pSh->Insert(aDotStr); // Dummytext zum Zuweisen der Section
+ pSh->SttDoc();
+ pSh->EndDoc(sal_True); // Alles im Rahmen selektieren
+ pSh->InsertSection(aSect);
+ }
+ pSh->Pop( sal_False );
+ }
+ if ( i + 1 != rItem.nRows )
+ pSh->SplitNode(); // Kleine Optimierung
+ }
+ }
+ else
+ {
+ pFirstFlyFmt = bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr,
+ static_cast< sal_uInt16 >(rItem.nCol - 1),
+ static_cast< sal_uInt16 >(rItem.nRow - 1), sal_True, sal_False ) :
+ lcl_InsertBCText(*pSh, rItem, *pFmt,
+ static_cast< sal_uInt16 >(rItem.nCol - 1),
+ static_cast< sal_uInt16 >(rItem.nRow - 1), sal_False);
+ }
+
+ //fill the user fields
+ if(!bLabel)
+ {
+ uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel();
+ DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!");
+ SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod ();
+ SwLabDlgUpdateFieldInformation(xModel, rItem);
+ }
+
+ pFldMgr->SetEvalExpFlds(sal_True);
+ pFldMgr->EvalExpFlds(pSh);
+
+ delete pFldMgr;
+
+ pSh->GotoFly(pFirstFlyFmt->GetName(), FLYCNTTYPE_ALL, sal_False);
+
+ pSh->EndAllAction();
+ pSh->DoUndo( sal_True );
+ }
+
+ if( rItem.aWriting.indexOf( '<' ) >= 0 )
+ {
+ // Datenbankbrowser mit zuletzt verwendeter Datenbank oeffnen
+ ShowDBObj( *pNewView, pSh->GetDBData() );
+ }
+
+ if( rItem.bSynchron )
+ {
+ SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
+ ASSERT(pDisp, "Heute kein Dispatcher am Frame?");
+ pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON);
+ }
+ rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
+ }
+ delete pDlg;
+
+ if( pNewDBMgr )
+ delete pNewDBMgr;
+}
+
+
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
new file mode 100644
index 000000000000..c6e2527ba0c8
--- /dev/null
+++ b/sw/source/ui/app/appopt.cxx
@@ -0,0 +1,657 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h> // Funktion-Ids
+#endif
+
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/htmlmode.hxx>
+#include <sfx2/bindings.hxx>
+#include <editeng/brshitem.hxx>
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include <editeng/tstpitem.hxx>
+#endif
+#include <svx/optgrid.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <i18npool/mslangid.hxx>
+#include <fontcfg.hxx>
+#include <optload.hxx>
+#include <optcomp.hxx>
+#include <edtwin.hxx>
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
+#include <IDocumentDeviceAccess.hxx>
+#endif
+#include <uitool.hxx>
+#include <initui.hxx> // fuer ::GetGlossaries()
+#include <fldbas.hxx> //fuer UpdateFields
+#ifndef _WVIEW_HXX
+#include <wview.hxx>
+#endif
+#include <cfgitems.hxx>
+#include <prtopt.hxx>
+#ifndef _PVIEW_HXX
+#include <pview.hxx>
+#endif
+#include <usrpref.hxx>
+#ifndef _MODCFG_HXX
+#include <modcfg.hxx>
+#endif
+#include <glosdoc.hxx>
+#include <uiitems.hxx>
+#include <editeng/langitem.hxx>
+#include <unotools/lingucfg.hxx>
+#include <editeng/unolingu.hxx>
+
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <globals.h> // globale Konstanten z.B.
+#include <svl/slstitm.hxx>
+#include "swabstdlg.hxx"
+#include <swwrtshitem.hxx>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+
+SfxItemSet* SwModule::CreateItemSet( USHORT nId )
+{
+ BOOL bTextDialog = (nId == SID_SW_EDITOPTIONS) ? TRUE : FALSE;
+
+ // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
+ SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
+ SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
+ //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
+ SwView* pAppView = GetView();
+ if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
+ pAppView = 0;
+ if(pAppView)
+ {
+ // wenn Text dann nicht WebView und umgekehrt
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
+ if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
+ {
+ aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
+ }
+ else
+ pAppView = 0; // mit View kann hier nichts gewonnen werden
+ }
+
+ /********************************************************************/
+ /* */
+ /* Optionen/Bearbeiten */
+ /* */
+ /********************************************************************/
+ SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
+ SID_PRINTPREVIEW, SID_PRINTPREVIEW,
+ SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
+ FN_PARAM_PRINTER, FN_PARAM_STDFONTS,
+ FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_ATTR_METRIC, SID_ATTR_METRIC,
+ SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
+ RES_BACKGROUND, RES_BACKGROUND,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
+ FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
+ FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
+ SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
+ SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
+ SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
+#ifdef DBG_UTIL
+ FN_PARAM_SWTEST, FN_PARAM_SWTEST,
+#endif
+ 0);
+
+ pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
+ pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
+ if( bTextDialog )
+ {
+ pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
+ pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
+ }
+
+ if( pAppView )
+ {
+ SwWrtShell& rWrtShell = pAppView->GetWrtShell();
+
+ SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
+ if( pPrt )
+ pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
+ pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
+ }
+ else
+ {
+/* Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
+ * SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+
+ pPrt = new SfxPrinter(pSet);
+ pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
+
+ SvtLinguConfig aLinguCfg;
+ Locale aLocale;
+ LanguageType nLang;
+
+ using namespace ::com::sun::star::i18n::ScriptType;
+
+ Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
+
+ aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
+
+ aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
+ }
+ if(bTextDialog)
+ pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
+ if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
+ {
+ SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, TRUE));
+ pRet->Put(aBool);
+ }
+
+ FieldUnit eUnit = pPref->GetHScrollMetric();
+ if(pAppView)
+ pAppView->GetHLinealMetric(eUnit);
+ pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< UINT16 >(eUnit)));
+
+ eUnit = pPref->GetVScrollMetric();
+ if(pAppView)
+ pAppView->GetVLinealMetric(eUnit);
+ pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< UINT16 >(eUnit) ));
+ pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(pPref->GetMetric()) ));
+ if(bTextDialog)
+ {
+ if(pAppView)
+ {
+ const SvxTabStopItem& rDefTabs =
+ (const SvxTabStopItem&)pAppView->GetWrtShell().
+ GetDefault(RES_PARATR_TABSTOP);
+ pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (USHORT)::GetTabDist(rDefTabs)));
+ }
+ else
+ pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (UINT16)pPref->GetDefTab()));
+ }
+
+ /*-----------------01.02.97 11.13-------------------
+ Optionen fuer GridTabPage
+ --------------------------------------------------*/
+
+ SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
+
+ aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
+ aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
+ aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
+
+ const Size& rSnapSize = aViewOpt.GetSnapSize();
+ aGridItem.SetFldDrawX( (USHORT) (rSnapSize.Width() ));
+ aGridItem.SetFldDrawY( (USHORT) (rSnapSize.Height()));
+
+ aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
+ aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
+
+ pRet->Put(aGridItem);
+
+ /*-----------------01.02.97 13.02-------------------
+ Optionen fuer PrintTabPage
+ --------------------------------------------------*/
+ SwPrintData* pOpt = pAppView ?
+ pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
+ 0;
+
+ if(!pOpt)
+ pOpt = GetPrtOptions(!bTextDialog);
+
+ SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
+ pRet->Put(aAddPrinterItem);
+
+ /*-----------------01.02.97 13.12-------------------
+ Optionen fuer Web-Hintergrund
+ --------------------------------------------------*/
+ if(!bTextDialog)
+ {
+ pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
+ }
+
+#ifdef DBG_UTIL
+ /*-----------------01.02.97 13.02-------------------
+ Test-Optionen
+ --------------------------------------------------*/
+ SwTestItem aTestItem(FN_PARAM_SWTEST);
+ aTestItem.bTest1 = aViewOpt.IsTest1();
+ aTestItem.bTest2 = aViewOpt.IsTest2();
+ aTestItem.bTest3 = aViewOpt.IsTest3();
+ aTestItem.bTest4 = aViewOpt.IsTest4();
+ aTestItem.bTest5 = aViewOpt.IsTest5();
+ aTestItem.bTest6 = aViewOpt.IsTest6();
+ aTestItem.bTest7 = aViewOpt.IsTest7();
+ aTestItem.bTest8 = aViewOpt.IsTest8();
+ aTestItem.bTest9 = SwViewOption::IsTest9();
+ aTestItem.bTest10 = aViewOpt.IsTest10();
+ pRet->Put(aTestItem);
+#endif
+ /*-----------------01.02.97 13.04-------------------
+
+ --------------------------------------------------*/
+ if(!bTextDialog)
+ pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
+// delete pPrt;
+ return pRet;
+}
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet )
+{
+ BOOL bTextDialog = nId == SID_SW_EDITOPTIONS;
+ SwView* pAppView = GetView();
+ if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
+ pAppView = 0;
+ if(pAppView)
+ {
+ // the text dialog mustn't apply data to the web view and vice versa
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
+ if( (bWebView == bTextDialog))
+ pAppView = 0; //
+ }
+
+ SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
+ SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
+
+ const SfxPoolItem* pItem;
+ SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
+ : NULL;
+
+ /*---------------------------------------------------------------------
+ Seite Dokumentansicht auswerten
+ -----------------------------------------------------------------------*/
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_DOCDISP, FALSE, &pItem ))
+ {
+ const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
+
+ if(!aViewOpt.IsViewMetaChars())
+ {
+ if( (!aViewOpt.IsTab( TRUE ) && pDocDispItem->bTab) ||
+ (!aViewOpt.IsBlank( TRUE ) && pDocDispItem->bSpace) ||
+ (!aViewOpt.IsParagraph( TRUE ) && pDocDispItem->bParagraphEnd) ||
+ (!aViewOpt.IsLineBreak( TRUE ) && pDocDispItem->bManualBreak) )
+ {
+ aViewOpt.SetViewMetaChars(TRUE);
+ if(pBindings)
+ pBindings->Invalidate(FN_VIEW_META_CHARS);
+ }
+
+ }
+ pDocDispItem->FillViewOptions( aViewOpt );
+ if(pBindings)
+ {
+ pBindings->Invalidate(FN_VIEW_GRAPHIC);
+ pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
+ }
+ }
+
+ /*---------------------------------------------------------------------
+ Elemente - Item auswerten
+ -----------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_ELEM, FALSE, &pItem ) )
+ {
+ const SwElemItem* pElemItem = (const SwElemItem*)pItem;
+ pElemItem->FillViewOptions( aViewOpt );
+
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC,
+ FALSE, &pItem ) )
+ {
+ SFX_APP()->SetOptions(rSet);
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
+ }
+ if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC,
+ FALSE, &pItem ) )
+ {
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
+ pPref->SetHScrollMetric(eUnit);
+ if(pAppView)
+ pAppView->ChangeTabMetric(eUnit);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC,
+ FALSE, &pItem ) )
+ {
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
+ pPref->SetVScrollMetric(eUnit);
+ if(pAppView)
+ pAppView->ChangeVLinealMetric(eUnit);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP,
+ FALSE, &pItem ) )
+ {
+ USHORT nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
+ pPref->SetDefTab(nTabDist);
+ if(pAppView)
+ {
+ SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ MakeDefTabs( nTabDist, aDefTabs );
+ pAppView->GetWrtShell().SetDefault( aDefTabs );
+ }
+ }
+
+
+ /*-----------------01.02.97 11.36-------------------
+ Hintergrund nur im WebDialog
+ --------------------------------------------------*/
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
+ {
+ const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
+ RES_BACKGROUND);
+ aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
+ }
+
+ /*--------------------------------------------------------------------
+ Seite Rastereinstellungen auswerten
+ ----------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ SID_ATTR_GRID_OPTIONS, FALSE, &pItem ))
+ {
+ const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
+
+ aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
+ aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
+ if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
+ aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
+ Size aSize = Size( pGridItem->GetFldDrawX() ,
+ pGridItem->GetFldDrawY() );
+ if( aViewOpt.GetSnapSize() != aSize )
+ aViewOpt.SetSnapSize( aSize );
+ short nDiv = (short)pGridItem->GetFldDivisionX() ;
+ if( aViewOpt.GetDivisionX() != nDiv )
+ aViewOpt.SetDivisionX( nDiv );
+ nDiv = (short)pGridItem->GetFldDivisionY();
+ if( aViewOpt.GetDivisionY() != nDiv )
+ aViewOpt.SetDivisionY( nDiv );
+
+ if(pBindings)
+ {
+ pBindings->Invalidate(SID_GRID_VISIBLE);
+ pBindings->Invalidate(SID_GRID_USE);
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ // Writer Drucker Zusatzeinstellungen auswerten
+ //----------------------------------------------------------------------------
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_ADDPRINTER, FALSE, &pItem ))
+ {
+ SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
+ if (pOpt)
+ {
+ const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
+ *pOpt = *pAddPrinterAttr;
+
+ if(pAppView)
+ pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
+ }
+
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_SHADOWCURSOR, FALSE, &pItem ))
+ {
+ ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
+ if(pBindings)
+ pBindings->Invalidate(FN_SHADOWCURSOR);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem ))
+ {
+ aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
+ }
+
+
+#ifdef DBG_UTIL
+ /*--------------------------------------------------------------------------
+ Writer Testseite auswerten
+ ----------------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_SWTEST, FALSE, &pItem ))
+ {
+ const SwTestItem* pTestItem = (const SwTestItem*)pItem;
+ aViewOpt.SetTest1((BOOL)pTestItem->bTest1);
+ aViewOpt.SetTest2((BOOL)pTestItem->bTest2);
+ aViewOpt.SetTest3((BOOL)pTestItem->bTest3);
+ aViewOpt.SetTest4((BOOL)pTestItem->bTest4);
+ aViewOpt.SetTest5((BOOL)pTestItem->bTest5);
+ aViewOpt.SetTest6((BOOL)pTestItem->bTest6);
+ aViewOpt.SetTest7((BOOL)pTestItem->bTest7);
+ aViewOpt.SetTest8((BOOL)pTestItem->bTest8);
+ SwViewOption::SetTest9((BOOL)pTestItem->bTest9);
+ aViewOpt.SetTest10((BOOL)pTestItem->bTest10);
+ }
+#endif
+ // dann an der akt. View und Shell die entsp. Elemente setzen
+ ApplyUsrPref( aViewOpt, pAppView,
+ bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
+}
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemSet& rSet )
+{
+ SfxTabPage* pRet = NULL;
+ SfxAllItemSet aSet(*(rSet.GetPool()));
+ switch( nId )
+ {
+ case RID_SW_TP_CONTENT_OPT:
+ case RID_SW_TP_HTML_CONTENT_OPT:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+ case RID_SW_TP_HTML_OPTGRID_PAGE:
+ case RID_SVXPAGE_GRID:
+ pRet = SvxGridTabPage::Create(pParent, rSet);
+ break;
+
+ case RID_SW_TP_STD_FONT:
+ case RID_SW_TP_STD_FONT_CJK:
+ case RID_SW_TP_STD_FONT_CTL:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ if(RID_SW_TP_STD_FONT != nId)
+ {
+ aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
+ pRet->PageCreated(aSet);
+ }
+ }
+ break;
+ case RID_SW_TP_HTML_OPTPRINT_PAGE:
+ case RID_SW_TP_OPTPRINT_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
+ pRet->PageCreated(aSet);
+ }
+ break;
+ case RID_SW_TP_HTML_OPTTABLE_PAGE:
+ case RID_SW_TP_OPTTABLE_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ SwView* pCurrView = GetView();
+ if(pCurrView)
+ {
+ // wenn Text dann nicht WebView und umgekehrt
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
+ if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
+ (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
+ {
+ aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
+ pRet->PageCreated(aSet);
+ }
+ }
+ }
+ break;
+ case RID_SW_TP_OPTSHDWCRSR:
+ case RID_SW_TP_HTML_OPTSHDWCRSR:
+ case RID_SW_TP_REDLINE_OPT:
+ case RID_SW_TP_OPTLOAD_PAGE:
+ case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
+ case RID_SW_TP_MAILCONFIG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ }
+ break;
+#ifdef DBG_UTIL
+ case RID_SW_TP_OPTTEST_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+#endif
+ case RID_SW_TP_BACKGROUND:
+ {
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+ case TP_OPTCAPTION_PAGE:
+ case RID_SW_TP_OPTCAPTION_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ }
+ break;
+ }
+
+ DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
+ return pRet;
+}
+
+
+
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
new file mode 100644
index 000000000000..34ccac06a256
--- /dev/null
+++ b/sw/source/ui/app/docsh.cxx
@@ -0,0 +1,1370 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+#include <rtl/logfile.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/jobset.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/whiter.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/adjitem.hxx>
+#include <basic/sbx.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/misccfg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/passwd.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svtools/soerr.hxx>
+#include <sot/clsids.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <swevent.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfld.hxx>
+#include <node.hxx>
+#include <swwait.hxx>
+#include <swprtopt.hxx>
+#include <frmatr.hxx>
+#include <view.hxx> // fuer die aktuelle Sicht
+#include <edtwin.hxx>
+#include <PostItMgr.hxx>
+#include <wrtsh.hxx> // Verbindung zur Core
+#include <docsh.hxx> // Dokumenterzeugung
+#include <basesh.hxx>
+#include <viewopt.hxx>
+#include <wdocsh.hxx>
+#include <swmodule.hxx>
+#include <globdoc.hxx>
+#include <usrpref.hxx>
+#include <shellio.hxx> // I/O
+#include <docstyle.hxx>
+#include <doc.hxx>
+#include <docstat.hxx>
+#include <pagedesc.hxx>
+#include <pview.hxx>
+#include <mdiexp.hxx>
+#include <swbaslnk.hxx>
+#include <srcview.hxx>
+#include <ndindex.hxx>
+#include <ndole.hxx>
+#include <swcli.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+
+// --> FME 2004-08-05 #i20883# Digital Signatures and Encryption
+#include <fldbas.hxx>
+#include <docary.hxx>
+// <--
+#include <swerror.h> // Fehlermeldungen
+#include <helpid.h>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <app.hrc>
+#include "warnpassword.hxx"
+
+#include <cfgid.h>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/fltrcfg.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/objface.hxx>
+#include <comphelper/storagehelper.hxx>
+
+#define SwDocShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <unomid.h>
+
+#include <sfx2/Metadatable.hxx>
+
+
+using rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::container;
+
+
+SFX_IMPL_INTERFACE( SwDocShell, SfxObjectShell, SW_RES(0) )
+{
+ SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT );
+}
+
+TYPEINIT2(SwDocShell, SfxObjectShell, SfxListener);
+
+//-------------------------------------------------------------------------
+SFX_IMPL_OBJECTFACTORY(SwDocShell, SvGlobalName(SO3_SW_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter" )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden vorbereiten
+ --------------------------------------------------------------------*/
+
+
+Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
+ SwCrsrShell *pCrsrShell,
+ SwPaM* pPaM )
+{
+ BOOL bAPICall = FALSE;
+ const SfxPoolItem* pApiItem;
+ const SfxItemSet* pMedSet;
+ if( 0 != ( pMedSet = rMedium.GetItemSet() ) && SFX_ITEM_SET ==
+ pMedSet->GetItemState( FN_API_CALL, TRUE, &pApiItem ) )
+ bAPICall = ((const SfxBoolItem*)pApiItem)->GetValue();
+
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ if( !pFlt )
+ {
+ if(!bAPICall)
+ {
+ InfoBox( 0, SW_RESSTR(STR_CANTOPEN)).Execute();
+ }
+ return 0;
+ }
+ String aFileName( rMedium.GetName() );
+ SwRead pRead = SwReaderWriter::GetReader( pFlt->GetUserData() );
+ if( !pRead )
+ return 0;
+
+ if( rMedium.IsStorage()
+ ? SW_STORAGE_READER & pRead->GetReaderType()
+ : SW_STREAM_READER & pRead->GetReaderType() )
+ {
+ *ppRdr = pPaM ? new SwReader( rMedium, aFileName, *pPaM ) :
+ pCrsrShell ?
+ new SwReader( rMedium, aFileName, *pCrsrShell->GetCrsr() )
+ : new SwReader( rMedium, aFileName, pDoc );
+ }
+ else
+ return 0;
+
+ // PassWord Checken
+ String aPasswd;
+ if ((*ppRdr)->NeedsPasswd( *pRead ))
+ {
+ if(!bAPICall)
+ {
+ SfxPasswordDialog* pPasswdDlg =
+ new SfxPasswordDialog( 0 );
+ if(RET_OK == pPasswdDlg->Execute())
+ aPasswd = pPasswdDlg->GetPassword();
+ }
+ else
+ {
+ const SfxItemSet* pSet = rMedium.GetItemSet();
+ const SfxPoolItem *pPassItem;
+ if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pPassItem))
+ aPasswd = ((const SfxStringItem *)pPassItem)->GetValue();
+ }
+
+ if (!(*ppRdr)->CheckPasswd( aPasswd, *pRead ))
+ {
+ InfoBox( 0, SW_RES(MSG_ERROR_PASSWD)).Execute();
+ delete *ppRdr;
+ return 0;
+ }
+ }
+ if(rMedium.IsStorage())
+ {
+ //SvStorageRef aStor( rMedium.GetStorage() );
+ const SfxItemSet* pSet = rMedium.GetItemSet();
+ const SfxPoolItem *pItem;
+ if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pItem))
+ {
+ DBG_ASSERT(pItem->IsA( TYPE(SfxStringItem) ), "Fehler Parametertype");
+ comphelper::OStorageHelper::SetCommonStoragePassword( rMedium.GetStorage(), ((const SfxStringItem *)pItem)->GetValue() );
+ }
+ // Fuer's Dokument-Einfuegen noch die FF-Version, wenn's der
+ // eigene Filter ist.
+ ASSERT( /*pRead != ReadSw3 || */pRead != ReadXML || pFlt->GetVersion(),
+ "Am Filter ist keine FF-Version gesetzt" );
+ //if( (pRead == ReadSw3 || pRead == ReadXML) && pFlt->GetVersion() )
+ // aStor->SetVersion( (long)pFlt->GetVersion() );
+ }
+ // #i30171# set the UpdateDocMode at the SwDocShell
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE;
+
+ if( pFlt->GetDefaultTemplate().Len() )
+ pRead->SetTemplateName( pFlt->GetDefaultTemplate() );
+
+ if( pRead == ReadAscii && 0 != rMedium.GetInStream() &&
+ pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) )
+ {
+ SwAsciiOptions aOpt;
+ const SfxItemSet* pSet;
+ const SfxPoolItem* pItem;
+ if( 0 != ( pSet = rMedium.GetItemSet() ) && SFX_ITEM_SET ==
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ aOpt.ReadUserData( ((const SfxStringItem*)pItem)->GetValue() );
+
+ if( pRead )
+ pRead->GetReaderOpt().SetASCIIOpts( aOpt );
+ }
+
+ return pRead;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertFrom" );
+
+ SwReader* pRdr;
+ SwRead pRead = StartConvertFrom(rMedium, &pRdr);
+ if (!pRead)
+ return FALSE; // #129881# return if no reader is found
+ SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls
+
+ SwWait aWait( *this, TRUE );
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() );
+
+ pRdr->GetDoc()->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell));
+
+ /* #106748# Restore the pool default if reading a saved document. */
+ pDoc->RemoveAllFmtLanguageDependencies();
+
+ ULONG nErr = pRdr->Read( *pRead );
+
+ // Evtl. ein altes Doc weg
+ if ( pDoc != pRdr->GetDoc() )
+ {
+ if( pDoc )
+ RemoveLink();
+ pDoc = pRdr->GetDoc();
+
+ AddLink();
+
+ if ( !mxBasePool.is() )
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ }
+
+ UpdateFontList();
+ InitDraw();
+
+ delete pRdr;
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ BOOL bOk = !IsError( nErr );
+
+ // --> OD 2006-11-07 #i59688#
+// // StartFinishedLoading rufen. Nicht bei asynchronen Filtern!
+// // Diese muessen das selbst rufen!
+// if( bOk && !pDoc->IsInLoadAsynchron() )
+// StartLoadFinishedTimer();
+ if ( bOk && !pDoc->IsInLoadAsynchron() )
+ {
+ LoadingFinished();
+ }
+ // <--
+
+ pRead->setSotStorageRef(pStg); // #i45333# save sot storage ref in case of recursive calls
+
+ return bOk;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern des Default-Formats, Stg vorhanden
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocShell::Save()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Save" );
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+ SwWait aWait( *this, TRUE );
+
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
+ if( SfxObjectShell::Save() )
+ {
+ switch( GetCreateMode() )
+ {
+ case SFX_CREATE_MODE_INTERNAL:
+ nErr = 0;
+ break;
+
+ case SFX_CREATE_MODE_ORGANIZER:
+ {
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt );
+ xWrt->SetOrganizerMode( TRUE );
+ SwWriter aWrt( *GetMedium(), *pDoc );
+ nErr = aWrt.Write( xWrt );
+ xWrt->SetOrganizerMode( FALSE );
+ }
+ break;
+
+ case SFX_CREATE_MODE_EMBEDDED:
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( TRUE );
+ // kein break;
+
+ case SFX_CREATE_MODE_STANDARD:
+ case SFX_CREATE_MODE_PREVIEW:
+ default:
+ {
+ if( pDoc->ContainsMSVBasic() )
+ {
+ //TODO/MBA: it looks as that this code can be removed!
+ //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() );
+ //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr );
+ if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
+ nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) );
+ pDoc->SetContainsMSVBasic( FALSE );
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt );
+
+ BOOL bLockedView(FALSE);
+ if ( pWrtShell )
+ {
+ bLockedView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ }
+
+ SwWriter aWrt( *GetMedium(), *pDoc );
+ nErr = aWrt.Write( xWrt );
+
+ if ( pWrtShell )
+ pWrtShell->LockView( bLockedView );
+ }
+ break;
+ }
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ }
+ SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ SfxViewFrame* pFrm = pWrtShell ? pWrtShell->GetView().GetViewFrame() : 0;
+ if( pFrm )
+ {
+ pFrm->GetBindings().SetState( SfxStringItem( SID_DOC_MODIFIED, ' ' ));
+ }
+ return !IsError( nErr );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern im Defaultformat
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveAs" );
+
+ SwWait aWait( *this, TRUE );
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+
+ //#i91811# mod if we have an active margin window, write back the text
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
+
+ if( pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) &&
+ !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS) )
+ RemoveOLEObjects();
+
+ {
+ // Task 75666 - is the Document imported by our Microsoft-Filters?
+ const SfxFilter* pOldFilter = GetMedium()->GetFilter();
+ if( pOldFilter &&
+ ( pOldFilter->GetUserData().EqualsAscii( FILTER_WW8 ) ||
+ pOldFilter->GetUserData().EqualsAscii( "CWW6" ) ||
+ pOldFilter->GetUserData().EqualsAscii( "WW6" ) ||
+ pOldFilter->GetUserData().EqualsAscii( "WW1" ) ))
+ {
+ // when saving it in our own fileformat, then remove the template
+ // name from the docinfo.
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ xDocProps->setTemplateName(::rtl::OUString::createFromAscii(""));
+ xDocProps->setTemplateURL(::rtl::OUString::createFromAscii(""));
+ xDocProps->setTemplateDate(::util::DateTime());
+ }
+ }
+
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
+ uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage();
+ if( SfxObjectShell::SaveAs( rMedium ) )
+ {
+ if( GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) && !ISA( SwGlobalDocShell ) )
+ {
+ // This is to set the correct class id if SaveAs is
+ // called from SwDoc::SplitDoc to save a normal doc as
+ // global doc. In this case, SaveAs is called at a
+ // normal doc shell, therefore, SfxInplaceObject::SaveAs
+ // will set the wrong class id.
+ SvGlobalName aClassName;
+ String aAppName, aLongUserName, aUserName;
+ SfxObjectShellRef xDocSh =
+ new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL );
+ // the global document can not be a template
+ xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), sal_False );
+ xDocSh->DoClose();
+ }
+
+ if( pDoc->ContainsMSVBasic() )
+ {
+ //TODO/MBA: it looks as that this code can be removed!
+ //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() );
+ //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr );
+ if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
+ nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this );
+ pDoc->SetContainsMSVBasic( FALSE );
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ // Modified-Flag merken und erhalten ohne den Link zu Callen
+ // (fuer OLE; nach Anweisung von MM)
+ BOOL bIsModified = pDoc->IsModified();
+ SwUndoNoModifiedPosition aOldPos = pDoc->getUndoNoModifiedPosition();
+ Link aOldOLELnk( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() );
+
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, rMedium.GetBaseURL( true ), xWrt );
+
+ BOOL bLockedView(FALSE);
+ if ( pWrtShell )
+ {
+ bLockedView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ }
+
+ SwWriter aWrt( rMedium, *pDoc );
+ nErr = aWrt.Write( xWrt );
+
+ if ( pWrtShell )
+ pWrtShell->LockView( bLockedView );
+
+ if( bIsModified )
+ {
+ pDoc->SetModified();
+ pDoc->setUndoNoModifiedPosition( aOldPos );
+ }
+ pDoc->SetOle2Link( aOldOLELnk );
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ }
+ SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ return !IsError( nErr );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern aller Formate
+ --------------------------------------------------------------------*/
+SwSrcView* lcl_GetSourceView( SwDocShell* pSh )
+{
+ // sind wir in der SourceView?
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( pSh );
+ SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ return PTR_CAST( SwSrcView, pViewShell);
+}
+
+BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertTo" );
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ if( !pFlt )
+ return FALSE;
+
+ WriterRef xWriter;
+ SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter );
+ if( !xWriter.Is() )
+ { // Der Filter ist nicht vorhanden
+ InfoBox( 0,
+ SW_RESSTR(STR_DLLNOTFOUND) ).Execute();
+ return FALSE;
+ }
+
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+
+ //#i91811# mod if we have an active margin window, write back the text
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
+
+ ULONG nVBWarning = 0;
+
+ if( pDoc->ContainsMSVBasic() )
+ {
+ BOOL bSave = pFlt->GetUserData().EqualsAscii( "CWW8" )
+ && SvtFilterOptions::Get()->IsLoadWordBasicStorage();
+
+ if ( bSave )
+ {
+ SvStorageRef xStg = new SotStorage( rMedium.GetOutStream(), FALSE );
+ DBG_ASSERT( !xStg->GetError(), "No storage available for storing VBA macros!" );
+ if ( !xStg->GetError() )
+ {
+ nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, String::CreateFromAscii("Macros") );
+ xStg->Commit();
+ pDoc->SetContainsMSVBasic( TRUE );
+ }
+ }
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ if( pFlt->GetUserData().EqualsAscii( "HTML") )
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if( !pHtmlOpt->IsStarBasic() && pHtmlOpt->IsStarBasicWarning() && HasBasic() )
+ {
+ uno::Reference< XLibraryContainer > xLibCont(GetBasicContainer(), UNO_QUERY);
+ uno::Reference< XNameAccess > xLib;
+ Sequence<rtl::OUString> aNames = xLibCont->getElementNames();
+ const rtl::OUString* pNames = aNames.getConstArray();
+ for(sal_Int32 nLib = 0; nLib < aNames.getLength(); nLib++)
+ {
+ Any aLib = xLibCont->getByName(pNames[nLib]);
+ aLib >>= xLib;
+ if(xLib.is())
+ {
+ Sequence<rtl::OUString> aModNames = xLib->getElementNames();
+ if(aModNames.getLength())
+ {
+ SetError(WARN_SWG_HTML_NO_MACROS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ break;
+ }
+ }
+ }
+ }
+ UpdateDocInfoForSave();
+ }
+
+ // --> FME 2007-5-7 #i76360# Update document statistics
+ SwDocStat aDocStat( pDoc->GetDocStat() );;
+ pDoc->UpdateDocStat( aDocStat );
+ // <--
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ if( xWriter->IsStgWriter() &&
+ ( /*xWriter->IsSw3Writer() ||*/
+ pFlt->GetUserData().EqualsAscii( FILTER_XML ) ||
+ pFlt->GetUserData().EqualsAscii( FILTER_XMLV ) ||
+ pFlt->GetUserData().EqualsAscii( FILTER_XMLVW ) ) )
+ {
+ // eigenen Typ ermitteln
+ BYTE nMyType = 0;
+ if( ISA( SwWebDocShell) )
+ nMyType = 1;
+ else if( ISA( SwGlobalDocShell) )
+ nMyType = 2;
+
+ // gewuenschten Typ ermitteln
+ BYTE nSaveType = 0;
+ ULONG nSaveClipId = pFlt->GetFormat();
+ if( SOT_FORMATSTR_ID_STARWRITERWEB_8 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_60 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_50 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_40 == nSaveClipId )
+ nSaveType = 1;
+ else if( SOT_FORMATSTR_ID_STARWRITERGLOB_8 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_60 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_50 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_40 == nSaveClipId )
+ nSaveType = 2;
+
+ // Flags am Dokument entsprechend umsetzen
+ BOOL bIsHTMLModeSave = GetDoc()->get(IDocumentSettingAccess::HTML_MODE);
+ BOOL bIsGlobalDocSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT);
+ BOOL bIsGlblDocSaveLinksSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
+ if( nMyType != nSaveType )
+ {
+ GetDoc()->set(IDocumentSettingAccess::HTML_MODE, 1 == nSaveType);
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, 2 == nSaveType);
+ if( 2 != nSaveType )
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false);
+ }
+
+ // if the target format is storage based, then the output storage must be already created
+ if ( rMedium.IsStorage() )
+ {
+ // set MediaType on target storage
+ // (MediaType will be queried during SaveAs)
+ try
+ {
+ // TODO/MBA: testing
+ uno::Reference < beans::XPropertySet > xSet( rMedium.GetStorage(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("MediaType"), uno::makeAny( ::rtl::OUString( SotExchange::GetFormatMimeType( nSaveClipId ) ) ) );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ // Jetzt das Dokument normal speichern
+ BOOL bRet = SaveAs( rMedium );
+
+ if( nMyType != nSaveType )
+ {
+ GetDoc()->set(IDocumentSettingAccess::HTML_MODE, bIsHTMLModeSave );
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, bIsGlobalDocSave);
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bIsGlblDocSaveLinksSave);
+ }
+
+ if( bRet && nMyType != nSaveType )
+ {
+ SvGlobalName aClassName;
+ String aAppName, aLongUserName, aUserName;
+ SfxObjectShellRef xDocSh;
+ switch( nSaveType )
+ {
+ case 0:
+ xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL );
+ break;
+ case 1:
+ xDocSh = new SwWebDocShell( SFX_CREATE_MODE_INTERNAL );
+ break;
+ case 2:
+ xDocSh = new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL );
+ break;
+ }
+ }
+
+ return bRet;
+ }
+
+ if( pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) &&
+ ( pWrtShell || !::lcl_GetSourceView( this ) ))
+ {
+ SwAsciiOptions aOpt;
+ String sItemOpt;
+ const SfxItemSet* pSet;
+ const SfxPoolItem* pItem;
+ if( 0 != ( pSet = rMedium.GetItemSet() ) )
+ {
+ if( SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS,
+ TRUE, &pItem ) )
+ sItemOpt = ((const SfxStringItem*)pItem)->GetValue();
+ }
+ if(sItemOpt.Len())
+ aOpt.ReadUserData( sItemOpt );
+
+ xWriter->SetAsciiOptions( aOpt );
+ }
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode());
+
+ // Kontext aufspannen, um die Anzeige der Selektion zu unterbinden
+ ULONG nErrno;
+ String aFileName( rMedium.GetName() );
+
+ //Keine View also das ganze Dokument!
+ if ( pWrtShell )
+ {
+ SwWait aWait( *this, TRUE );
+ // --> OD 2009-12-31 #i106906#
+ const sal_Bool bFormerLockView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ // <--
+ pWrtShell->StartAllAction();
+ pWrtShell->Push();
+ SwWriter aWrt( rMedium, *pWrtShell, TRUE );
+ nErrno = aWrt.Write( xWriter, &aFileName );
+ //JP 16.05.97: falls der SFX uns die View waehrend des speicherns
+ // entzieht
+ if( pWrtShell )
+ {
+ pWrtShell->Pop(FALSE);
+ pWrtShell->EndAllAction();
+ // --> OD 2009-12-31 #i106906#
+ pWrtShell->LockView( bFormerLockView );
+ // <--
+ }
+ }
+ else
+ {
+ // sind wir in der SourceView?
+ SwSrcView* pSrcView = ::lcl_GetSourceView( this );
+ if( pSrcView )
+ {
+ pSrcView->SaveContentTo(rMedium);
+ nErrno = 0;
+ }
+ else
+ {
+ SwWriter aWrt( rMedium, *pDoc );
+ nErrno = aWrt.Write( xWriter, &aFileName );
+ }
+ }
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ SetError( nErrno ? nErrno : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ if( !rMedium.IsStorage() )
+ rMedium.CloseOutStream();
+
+ return !IsError( nErrno );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Haende weg
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: ??? noch nicht zu aktivieren, muss TRUE liefern
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" );
+ BOOL bRet = SfxObjectShell::SaveCompleted( xStor );
+ if( bRet )
+ {
+ // erst hier entscheiden, ob das Speichern geklappt hat oder nicht
+ if( IsModified() )
+ pDoc->SetModified();
+ else
+ pDoc->ResetModified();
+ }
+
+ if( pOLEChildList )
+ {
+ BOOL bResetModified = IsEnableSetModified();
+ if( bResetModified )
+ EnableSetModified( FALSE );
+
+ uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames();
+ for( sal_Int32 n = aNames.getLength(); n; n-- )
+ {
+ if ( !pOLEChildList->MoveEmbeddedObject( aNames[n-1], GetEmbeddedObjectContainer() ) )
+ {
+ DBG_ERROR( "Copying of objects didn't work!" );
+ }
+
+ //SvPersist* pPersist = this;
+ //SvInfoObjectRef aRef( pInfList->GetObject( --n ));
+ //pPersist->Move( &aRef, aRef->GetStorageName() );
+ }
+
+ DELETEZ( pOLEChildList );
+ if( bResetModified )
+ EnableSetModified( TRUE );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Draw()-Overload fuer OLE2 (Sfx)
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
+ USHORT nAspect )
+{
+ //fix #25341# Draw sollte das Modified nicht beeinflussen
+ BOOL bResetModified;
+ if ( TRUE == (bResetModified = IsEnableSetModified()) )
+ EnableSetModified( FALSE );
+
+ //sollte am Document ein JobSetup haengen, dann kopieren wir uns diesen,
+ //um nach dem PrtOle2 diesen wieder am Doc zu verankern.
+ //Einen leeren JobSetup setzen wir nicht ein, denn der wuerde nur zu
+ //fragwuerdigem Ergebnis nach teurer Neuformatierung fuehren (Preview!)
+ JobSetup *pOrig = 0;
+ if ( rSetup.GetPrinterName().Len() && ASPECT_THUMBNAIL != nAspect )
+ {
+ pOrig = const_cast<JobSetup*>(pDoc->getJobsetup());
+ if( pOrig ) // dann kopieren wir uns den
+ pOrig = new JobSetup( *pOrig );
+ pDoc->setJobsetup( rSetup );
+ }
+
+ Rectangle aRect( nAspect == ASPECT_THUMBNAIL ?
+ GetVisArea( nAspect ) : GetVisArea( ASPECT_CONTENT ) );
+
+ pDev->Push();
+ pDev->SetFillColor();
+ pDev->SetLineColor();
+ pDev->SetBackground();
+ BOOL bWeb = 0 != PTR_CAST(SwWebDocShell, this);
+ SwPrtOptions aOpts( aEmptyStr );
+ ViewShell::PrtOle2( pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, pDev, aRect );
+ pDev->Pop();
+
+ if( pOrig )
+ {
+ pDoc->setJobsetup( *pOrig );
+ delete pOrig;
+ }
+ if ( bResetModified )
+ EnableSetModified( TRUE );
+}
+
+
+void SwDocShell::SetVisArea( const Rectangle &rRect )
+{
+ Rectangle aRect( rRect );
+ if ( pView )
+ {
+ Size aSz( pView->GetDocSz() );
+ aSz.Width() += DOCUMENTBORDER; aSz.Height() += DOCUMENTBORDER;
+ long nMoveX = 0, nMoveY = 0;
+ if ( aRect.Right() > aSz.Width() )
+ nMoveX = aSz.Width() - aRect.Right();
+ if ( aRect.Bottom() > aSz.Height() )
+ nMoveY = aSz.Height() - aRect.Bottom();
+ aRect.Move( nMoveX, nMoveY );
+ nMoveX = aRect.Left() < 0 ? -aRect.Left() : 0;
+ nMoveY = aRect.Top() < 0 ? -aRect.Top() : 0;
+ aRect.Move( nMoveX, nMoveY );
+
+ //Ruft das SfxInPlaceObject::SetVisArea()!
+ pView->SetVisArea( aRect, TRUE );
+ }
+ else
+ SfxObjectShell::SetVisArea( aRect );
+}
+
+
+Rectangle SwDocShell::GetVisArea( USHORT nAspect ) const
+{
+ if ( nAspect == ASPECT_THUMBNAIL )
+ {
+ //PreView: VisArea auf die erste Seite einstellen.
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pNd = pDoc->GetNodes().GoNext( &aIdx );
+
+ const SwRect aPageRect = pNd->FindPageFrmRect( FALSE, 0, FALSE );
+ return aPageRect.SVRect();
+
+ // Why does this have to be that complicated? I replaced this by the
+ // call of FindPageFrmRect():
+ /*
+ //PageDesc besorgen, vom ersten Absatz oder den default.
+ const SwFmtPageDesc &rDesc = pNd->GetSwAttrSet().GetPageDesc();
+ const SwPageDesc* pDesc = rDesc.GetPageDesc();
+ if( !pDesc )
+ pDesc = &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 );
+
+ //Das Format wird evtl. von der virtuellen Seitennummer bestimmt.
+ const USHORT nPgNum = rDesc.GetNumOffset();
+ const BOOL bOdd = nPgNum % 2 ? TRUE : FALSE;
+ const SwFrmFmt *pFmt = bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt();
+ if ( !pFmt ) //#40568#
+ pFmt = bOdd ? pDesc->GetLeftFmt() : pDesc->GetRightFmt();
+
+ if ( pFmt->GetFrmSize().GetWidth() == LONG_MAX )
+ //Jetzt wird es aber Zeit fuer die Initialisierung
+ pDoc->getPrinter( true );
+
+ const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
+ const Size aSz( rFrmSz.GetWidth(), rFrmSz.GetHeight() );
+ const Point aPt( DOCUMENTBORDER, DOCUMENTBORDER );
+ const Rectangle aRect( aPt, aSz );
+ return aRect;*/
+ }
+ return SfxObjectShell::GetVisArea( nAspect );
+}
+
+Printer *SwDocShell::GetDocumentPrinter()
+{
+ return pDoc->getPrinter( false );
+}
+
+OutputDevice* SwDocShell::GetDocumentRefDev()
+{
+ return pDoc->getReferenceDevice( false );
+}
+
+void SwDocShell::OnDocumentPrinterChanged( Printer * pNewPrinter )
+{
+ if ( pNewPrinter )
+ GetDoc()->setJobsetup( pNewPrinter->GetJobSetup() );
+ else
+ GetDoc()->setPrinter( 0, true, true );
+}
+
+ULONG SwDocShell::GetMiscStatus() const
+{
+ return SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE;
+}
+
+// --> FME 2004-08-05 #i20883# Digital Signatures and Encryption
+sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates )
+{
+ // get global state like HIDDENINFORMATION_DOCUMENTVERSIONS
+ sal_uInt16 nState = SfxObjectShell::GetHiddenInformationState( nStates );
+
+ if ( nStates & HIDDENINFORMATION_RECORDEDCHANGES )
+ {
+ if ( GetDoc()->GetRedlineTbl().Count() )
+ nState |= HIDDENINFORMATION_RECORDEDCHANGES;
+ }
+ if ( nStates & HIDDENINFORMATION_NOTES )
+ {
+ ASSERT( GetWrtShell(), "No SwWrtShell, no information" )
+ if ( GetWrtShell() )
+ {
+ SwFieldType* pType = GetWrtShell()->GetFldType( RES_POSTITFLD, aEmptyStr );
+ SwClientIter aIter( *pType );
+ SwClient* pFirst = aIter.GoStart();
+ while( pFirst )
+ {
+ if( static_cast<SwFmtFld*>(pFirst)->GetTxtFld() &&
+ static_cast<SwFmtFld*>(pFirst)->IsFldInDoc() )
+ {
+ nState |= HIDDENINFORMATION_NOTES;
+ break;
+ }
+ pFirst = ++aIter;
+ }
+ }
+ }
+
+ return nState;
+}
+// <--
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::GetState(SfxItemSet& rSet)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ // MT: MakroChosser immer enablen, weil Neu moeglich
+ // case SID_BASICCHOOSER:
+ // {
+ // StarBASIC* pBasic = GetBasic();
+ // StarBASIC* pAppBasic = SFX_APP()->GetBasic();
+ // if ( !(pBasic->GetModules()->Count() ||
+ // pAppBasic->GetModules()->Count()) )
+ // rSet.DisableItem(nWhich);
+ // }
+ // break;
+ case SID_PRINTPREVIEW:
+ {
+ BOOL bDisable = IsInPlaceActive();
+ if ( !bDisable )
+ {
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this);
+ while (pTmpFrm) // Preview suchen
+ {
+ if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) &&
+ ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ bDisable = TRUE;
+ break;
+ }
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this);
+ }
+ }
+ if ( bDisable )
+ rSet.DisableItem( SID_PRINTPREVIEW );
+ else
+ {
+ SfxBoolItem aBool( SID_PRINTPREVIEW, FALSE );
+ if( PTR_CAST( SwPagePreView, SfxViewShell::Current()) )
+ aBool.SetValue( TRUE );
+ rSet.Put( aBool );
+ }
+ }
+ break;
+ case SID_SOURCEVIEW:
+ {
+ SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
+ rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
+ }
+ break;
+ case SID_HTML_MODE:
+ rSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
+ break;
+
+ case FN_ABSTRACT_STARIMPRESS:
+ case FN_OUTLINE_TO_IMPRESS:
+ {
+ SvtModuleOptions aMOpt;
+ if ( !aMOpt.IsImpress() )
+ rSet.DisableItem( nWhich );
+ }
+ /* no break here */
+ case FN_ABSTRACT_NEWDOC:
+ case FN_OUTLINE_TO_CLIPBOARD:
+ {
+ if ( !GetDoc()->GetNodes().GetOutLineNds().Count() )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ {
+ sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+ if(FN_PRINT_LAYOUT == nWhich)
+ bState = !bState;
+ rSet.Put( SfxBoolItem( nWhich, bState));
+ }
+ break;
+
+ case FN_NEW_GLOBAL_DOC:
+ if ( ISA(SwGlobalDocShell) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_NEW_HTML_DOC:
+ if( ISA( SwWebDocShell ) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_ATTR_YEAR2000:
+ {
+ const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(FALSE);
+ rSet.Put( SfxUInt16Item( nWhich,
+ static_cast< sal_uInt16 >(
+ pFmtr ? pFmtr->GetYear2000()
+ : ::utl::MiscCfg().GetYear2000() )));
+ }
+ break;
+ case SID_ATTR_CHAR_FONTLIST:
+ {
+ rSet.Put( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) );
+ }
+ break;
+
+ default: DBG_ASSERT(!this,"Hier darfst Du nicht hinein!");
+
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: OLE-Hdls
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwDocShell, Ole2ModifiedHdl, void *, p )
+{
+ // vom Doc wird der Status mitgegeben (siehe doc.cxx)
+ // Bit 0: -> alter Zustand
+ // Bit 1: -> neuer Zustand
+ long nStatus = (long)p;
+ if( IsEnableSetModified() )
+ SetModified( (nStatus & 2) ? TRUE : FALSE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pool returnen Hier weil virtuelll
+ --------------------------------------------------------------------*/
+
+
+SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool()
+{
+ return mxBasePool.get();
+}
+
+
+void SwDocShell::SetView(SwView* pVw)
+{
+ if ( 0 != (pView = pVw) )
+ pWrtShell = &pView->GetWrtShell();
+ else
+ pWrtShell = 0;
+}
+
+
+void SwDocShell::PrepareReload()
+{
+ ::DelAllGrfCacheEntries( pDoc );
+}
+
+// --> OD 2006-11-07 #i59688#
+// linked graphics are now loaded on demand.
+// Thus, loading of linked graphics no longer needed and necessary for
+// the load of document being finished.
+void SwDocShell::LoadingFinished()
+{
+ // --> OD 2007-10-08 #i38810#
+ // Original fix fails after integration of cws xmlsec11:
+ // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
+ // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
+ // enables the document modification again.
+ // Thus, manuell modify the document, if its modified and its links are updated
+ // before <FinishedLoading(..)> is called.
+ const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() );
+// // --> OD 2005-02-11 #i38810# - disable method <SetModified(..)>, if document
+// // has stay in modified state, due to the update of its links during load.
+// bool bResetEnableSetModified(false);
+// if ( IsEnableSetModified() &&
+// pDoc->IsModified() && pDoc->LinksUpdated() )
+// {
+// EnableSetModified( FALSE );
+// bResetEnableSetModified = true;
+// }
+ // <--
+ FinishedLoading( SFX_LOADED_ALL );
+// // --> OD 2005-02-11 #i38810#
+// if ( bResetEnableSetModified )
+// {
+// EnableSetModified( TRUE );
+// }
+// // <--
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
+ if(pVFrame)
+ {
+ SfxViewShell* pShell = pVFrame->GetViewShell();
+ if(PTR_CAST(SwSrcView, pShell))
+ ((SwSrcView*)pShell)->Load(this);
+ }
+
+ // --> OD 2007-10-08 #i38810#
+ if ( bHasDocToStayModified && !pDoc->IsModified() )
+ {
+ pDoc->SetModified();
+ }
+ // <--
+}
+
+// eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
+void SwDocShell::CancelTransfers()
+{
+ // alle Links vom LinkManager Canceln
+ aFinishedTimer.Stop();
+ pDoc->GetLinkManager().CancelTransfers();
+ SfxObjectShell::CancelTransfers();
+}
+
+SwFEShell* SwDocShell::GetFEShell()
+{
+ return pWrtShell;
+}
+
+void SwDocShell::RemoveOLEObjects()
+{
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ {
+ SwOLENode* pOLENd = pNd->GetOLENode();
+ if( pOLENd && ( pOLENd->IsOLEObjectDeleted() ||
+ pOLENd->IsInGlobalDocSection() ) )
+ {
+ if( !pOLEChildList )
+ pOLEChildList = new comphelper::EmbeddedObjectContainer;
+
+ ::rtl::OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
+ GetEmbeddedObjectContainer().MoveEmbeddedObject( aObjName, *pOLEChildList );
+ }
+ }
+}
+
+// When a document is loaded, SwDoc::PrtOLENotify is called to update
+// the sizes of math objects. However, for objects that do not have a
+// SwFrm at this time, only a flag is set (bIsOLESizeInvalid) and the
+// size change takes place later, while calculating the layout in the
+// idle handler. If this document is saved now, it is saved with invalid
+// sizes. For this reason, the layout has to be calculated before a document is
+// saved, but of course only id there are OLE objects with bOLESizeInvalid set.
+void SwDocShell::CalcLayoutForOLEObjects()
+{
+ if( !pWrtShell )
+ return;
+
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ {
+ SwOLENode* pOLENd = pNd->GetOLENode();
+ if( pOLENd && pOLENd->IsOLESizeInvalid() )
+ {
+ pWrtShell->CalcLayout();
+ break;
+ }
+ }
+}
+
+
+// --> FME 2005-02-25 #i42634# Overwrites SfxObjectShell::UpdateLinks
+// This new function is necessary to trigger update of links in docs
+// read by the binary filter:
+void SwDocShell::UpdateLinks()
+{
+ GetDoc()->UpdateLinks(TRUE);
+ // --> FME 2005-07-27 #i50703# Update footnote numbers
+ SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() );
+ SwNodeIndex aTmp( GetDoc()->GetNodes() );
+ GetDoc()->GetFtnIdxs().UpdateFtn( aTmp );
+ // <--
+}
+
+uno::Reference< frame::XController >
+ SwDocShell::GetController()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > aRet;
+ // --> FME 2007-10-15 #i82346# No view in page preview
+ if ( GetView() )
+ // <--
+ aRet = GetView()->GetController();
+ return aRet;
+}
+
+/* -----------------------------12.02.01 12:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static const char* pEventNames[] =
+{
+ "OnPageCountChange",
+ "OnMailMerge",
+ "OnMailMergeFinished",
+ "OnFieldMerge",
+ "OnFieldMergeFinished",
+ "OnLayoutFinished"
+};
+
+Sequence< OUString > SwDocShell::GetEventNames()
+{
+ Sequence< OUString > aRet = SfxObjectShell::GetEventNames();
+ sal_Int32 nLen = aRet.getLength();
+ aRet.realloc(nLen + 6);
+ OUString* pNames = aRet.getArray();
+ pNames[nLen++] = GetEventName(0);
+ pNames[nLen++] = GetEventName(1);
+ pNames[nLen++] = GetEventName(2);
+ pNames[nLen++] = GetEventName(3);
+ pNames[nLen++] = GetEventName(4);
+ pNames[nLen] = GetEventName(5);
+
+ return aRet;
+}
+
+static sal_Int32 nEvents=13;
+
+rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex )
+{
+ if ( nIndex<nEvents )
+ return ::rtl::OUString::createFromAscii(pEventNames[nIndex]);
+ return rtl::OUString();
+}
+
+const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
+{
+ return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
+}
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
new file mode 100644
index 000000000000..9cb3caffa7cc
--- /dev/null
+++ b/sw/source/ui/app/docsh2.cxx
@@ -0,0 +1,1894 @@
+/*************************************************************************
+ *
+ * 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/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/tempfile.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/lckbitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/transfer.hxx>
+#ifndef _SFXSIDS_HRC //autogen
+#include <sfx2/dialogs.hrc>
+#endif
+#include <sfx2/dinfdlg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/new.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/evntconf.hxx>
+#include <svtools/sfxecode.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <svx/drawitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/fmshell.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <svx/ofaitem.hxx>
+#include <SwSmartTagMgr.hxx>
+#include <sfx2/app.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/basmgr.hxx>
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+#include <swunodef.hxx>
+#include <fmtcol.hxx>
+#include <swevent.hxx>
+#include <view.hxx> // fuer die aktuelle Sicht
+#include <docsh.hxx> // Dokumenterzeugung
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <viewopt.hxx>
+#include <globdoc.hxx>
+#include <fldwrap.hxx>
+#include <redlndlg.hxx>
+#include <docstyle.hxx>
+#include <doc.hxx>
+#include <pagedesc.hxx>
+#include <shellio.hxx>
+#include <pview.hxx>
+#include <srcview.hxx>
+#include <poolfmt.hxx>
+#include <usrpref.hxx>
+#include <wdocsh.hxx>
+#include <unotxdoc.hxx>
+#include <acmplwrd.hxx>
+#include <swmodule.hxx>
+#include <unobaseclass.hxx>
+#include <swwait.hxx>
+#include <swcli.hxx>
+
+#include <cmdid.h>
+#include <globals.h>
+#include <helpid.h>
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+
+#include <editeng/acorrcfg.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#include <sfx2/fcontnr.hxx>
+
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include "swabstdlg.hxx"
+
+#include <ndtxt.hxx> //#outline level,add by zhaojianwei
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using namespace ::sfx2;
+
+extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
+
+/*--------------------------------------------------------------------
+ Beschreibung: DocInfo kreieren (virtuell)
+ --------------------------------------------------------------------*/
+
+SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
+ Window *pParent, const SfxItemSet &rSet)
+{
+ SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet);
+ //nur mit Statistik, wenn dieses Doc auch angezeigt wird, nicht
+ //aus dem Doc-Manager
+ SwDocShell* pDocSh = (SwDocShell*) SfxObjectShell::Current();
+ if( pDocSh == this )
+ {
+ //Nicht fuer SourceView.
+ SfxViewShell *pVSh = SfxViewShell::Current();
+ if ( pVSh && !pVSh->ISA(SwSrcView) )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ pDlg->AddTabPage(TP_DOC_STAT, SW_RESSTR(STR_DOC_STAT),pFact->GetTabPageCreatorFunc( TP_DOC_STAT ),0);
+ }
+ }
+ return pDlg;
+}
+
+
+/// update text fields on document properties changes
+void SwDocShell::DoFlushDocInfo()
+{
+ if ( !pDoc ) return;
+
+ bool bUnlockView(true);
+ if ( pWrtShell ) {
+ bUnlockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); // lock visible section
+ pWrtShell->StartAllAction();
+ }
+
+ pDoc->DocInfoChgd();
+
+ if ( pWrtShell ) {
+ pWrtShell->EndAllAction();
+ if ( bUnlockView ) {
+ pWrtShell->LockView( FALSE );
+ }
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benachrichtigung bei geaenderter DocInfo
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if( !pDoc )
+ {
+//MA: Kommt bei der OLE-Registration vor!
+// ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
+ return ;
+ }
+
+ USHORT nAction = 0;
+ if( rHint.ISA(SfxSimpleHint) )
+ {
+ // swithc for more actions
+ switch( ((SfxSimpleHint&) rHint).GetId() )
+ {
+ case SFX_HINT_TITLECHANGED:
+ if( GetMedium() )
+ nAction = 2;
+ break;
+ }
+ }
+ else if( rHint.ISA(SfxEventHint) &&
+ ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
+ {
+ // --> OD 2004-12-03 #i38126# - own action id
+ nAction = 3;
+ // <--
+ }
+
+ if( nAction )
+ {
+ BOOL bUnlockView = sal_True; //initializing prevents warning
+ if( pWrtShell )
+ {
+ bUnlockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ pWrtShell->StartAllAction();
+ }
+ switch( nAction )
+ {
+ case 2:
+ pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds();
+ break;
+ // --> OD 2004-12-03 #i38126# - own action for event LOADFINISHED
+ // in order to avoid a modified document.
+ // --> OD 2005-02-01 #i41679# - Also for the instance of <SwDoc>
+ // it has to be assured, that it's not modified.
+ // Perform the same as for action id 1, but disable <SetModified>.
+ case 3:
+ {
+ const bool bResetModified = IsEnableSetModified();
+ if ( bResetModified )
+ EnableSetModified( FALSE );
+ // --> OD 2005-02-01 #i41679#
+ const bool bIsDocModified = pDoc->IsModified();
+ // <--
+
+ pDoc->DocInfoChgd( );
+
+ // --> OD 2005-02-01 #i41679#
+ if ( !bIsDocModified )
+ pDoc->ResetModified();
+ // <--
+ if ( bResetModified )
+ EnableSetModified( TRUE );
+ }
+ break;
+ // <--
+ }
+
+ if( pWrtShell )
+ {
+ pWrtShell->EndAllAction();
+ if( bUnlockView )
+ pWrtShell->LockView( FALSE );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benachrichtigung Doc schliessen
+ --------------------------------------------------------------------*/
+
+USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
+{
+ USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
+
+ if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
+ EndListening( *this );
+
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Organizer
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::Insert( SfxObjectShell &rSource,
+ USHORT nSourceIdx1, // SourcePool: oberste Inhaltsebene (Vorlagen/Makros)
+ USHORT nSourceIdx2, // Index in den Inhalt
+ USHORT nSourceIdx3, // Index in die Inhaltsebene
+ USHORT &rIdx1, // und das gleiche fuer den DestinationPool
+ USHORT &rIdx2, // ""
+ USHORT &rIdx3, // ""
+ USHORT &rRemovedIdx ) // falls doppelte geloescht werden, Pos zurueck
+{
+ // --> OD 2005-05-10 #i48949# - actions aren't undoable. Thus, allow no undo
+ // actions
+ // Note: The undo action stack is cleared at the end of this method.
+ bool bDoesUndo( GetDoc()->DoesUndo() );
+ GetDoc()->DoUndo( sal_False );
+ // <--
+
+ BOOL bRet = FALSE;
+
+ if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
+ rIdx1 = CONTENT_STYLE;
+
+ if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
+ {
+ SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
+ SwDocStyleSheetPool* pMyPool =
+ (SwDocStyleSheetPool*)GetStyleSheetPool();
+
+ // wir koennen nicht in uns selbst hin und her moven
+ if( pHisPool == pMyPool )
+ return FALSE;
+
+ if( INDEX_IGNORE == rIdx2 )
+ rIdx2 = pMyPool->Count();
+
+ // erstmal auf die Such-Maske "positionieren"
+ pHisPool->First();
+ SfxStyleSheetBase* pHisSheet = (*pHisPool)[nSourceIdx2];
+
+ // wenn so eine Vorlage schon existiert: loeschen!
+ const String& rOldName = pHisSheet->GetName();
+ SfxStyleFamily eOldFamily( pHisSheet->GetFamily() );
+
+ // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!!
+ if( ( SFX_STYLE_FAMILY_PAGE == eOldFamily &&
+ const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName() ==
+ rOldName ) ||
+ ( SFX_STYLE_FAMILY_CHAR == eOldFamily &&
+ rOldName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] ))
+ return FALSE;
+
+ SfxStyleFamily eMyOldFamily( pMyPool->GetSearchFamily() );
+ USHORT nMySrchMask = pMyPool->GetSearchMask();
+
+ SfxStyleSheetBase* pExist;
+ if( ::FindPhyStyle( *pDoc, rOldName, eOldFamily ) )
+ {
+ // Bug 20365: nur uebernehmen, wenn das gewuenscht ist!
+ if( ERRCODE_BUTTON_OK != ErrorHandler::HandleError(
+ *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, rOldName )) )
+ {
+ return FALSE;
+ }
+
+ // Da Replace den aStyleSheet-Member selbst benoetigt, muss
+ // das Ergebnis vom Find kopiert werden (s.u.))
+ rtl::Reference< SwDocStyleSheet > xExist( new SwDocStyleSheet(
+ *(SwDocStyleSheet*)pMyPool->Find( rOldName, eOldFamily ) ) );
+ pMyPool->Replace( *pHisSheet, *xExist.get() );
+
+ // An der Reihenfolge der Vorlagen im Pool aendert sich nichts.
+ rIdx2 = rIdx1 = INDEX_IGNORE;
+
+ GetDoc()->SetModified();
+
+ return TRUE;
+ }
+
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+
+ // MIB 18.12.98: SwDocStyleSheetPool::Make liefert einen
+ // Pointer auf SwDocStyleSheetPool::aStyleSheet zurueck.
+ // Der gleiche Member von SwDocStyleSheetPool::Find benutzt.
+ // Deshalb muss hier mit einer Kopie gearbeitet werden.
+ // Vorsicht: SfxStyleSheetBase::SetFollow ruft seinerseits
+ // ein SwDocStyleSheetPool::Find auf, do dass es nicht genuegt
+ // die Find-Aufrufe in dieser Methode zu eleminieren.
+
+ rtl::Reference< SwDocStyleSheet > xNewSheet( new SwDocStyleSheet( (SwDocStyleSheet&)pMyPool
+ ->Make(rOldName, eOldFamily, pHisSheet->GetMask() ) ) );
+ if( SFX_STYLE_FAMILY_PAGE == eOldFamily && rSource.ISA(SwDocShell) )
+ {
+ // gesondert behandeln!!
+ SwPageDesc* pDestDsc = (SwPageDesc*)xNewSheet->GetPageDesc();
+ SwPageDesc* pCpyDsc = (SwPageDesc*)((SwDocStyleSheet*)pHisSheet)->GetPageDesc();
+ pDoc->CopyPageDesc( *pCpyDsc, *pDestDsc );
+ }
+ else
+ // die neue Vorlage mit den Attributen fuellen
+ xNewSheet->SetItemSet( pHisSheet->GetItemSet() );
+
+ pMyPool->SetSearchMask( SFX_STYLE_FAMILY_ALL, nMySrchMask );
+
+ if( xNewSheet->IsUserDefined() || xNewSheet->IsUsed() )
+ {
+ // Benutzte und Benutzer-definierte Vorlagen werden angezeigt.
+ // Dshalb muss hier der Index der neuen Vorlage im Pool
+ // ermittelt werden.
+ pExist = pMyPool->First();
+ USHORT nIdx = 0;
+ while( pExist )
+ {
+ if( pExist->GetName() == rOldName &&
+ eOldFamily == pExist->GetFamily() )
+ {
+ rIdx2 = nIdx;
+ break;
+ }
+ pExist = pMyPool->Next();
+ nIdx++;
+ }
+ }
+ else
+ {
+ // Andere Vorlagen werden nicht angezeigt.
+ rIdx1 = rIdx2 = INDEX_IGNORE;
+ }
+
+/* pMyPool->Count(); //interne Liste neu fuellen lassen!!!!!
+
+ // suchen, um die richige Insert-Position returnen zu koennen
+ pMyPool->Find( rOldName, SFX_STYLE_FAMILY_ALL, nMySrchMask );
+ rIdx2 = pMyPool->GetFindPos();*/
+
+ // wer bekommt den Neuen als Parent? wer benutzt den Neuen als Follow?
+ // (immer nur ueber die Instanziierten!!!)
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ pMyPool->SetOrganizerMode( TRUE );
+ SfxStyleSheetBase* pTestSheet = pMyPool->First();
+ while (pTestSheet)
+ {
+ if (pTestSheet->GetFamily() == eOldFamily &&
+ pTestSheet->HasParentSupport() &&
+ pTestSheet->GetParent() == rOldName)
+ {
+ pTestSheet->SetParent(rOldName); // Verknuepfung neu aufbauen
+ }
+
+ if (pTestSheet->GetFamily() == eOldFamily &&
+ pTestSheet->HasFollowSupport() &&
+ pTestSheet->GetFollow() == rOldName)
+ {
+ pTestSheet->SetFollow(rOldName); // Verknuepfung neu aufbauen
+ }
+
+ pTestSheet = pMyPool->Next();
+ }
+ pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+
+ // hat der Neue einen Parent? wenn ja, mit gleichem Namen bei uns suchen
+ if (pHisSheet->HasParentSupport())
+ {
+ const String& rParentName = pHisSheet->GetParent();
+ if (0 != rParentName.Len())
+ {
+ SfxStyleSheetBase* pParentOfNew = pMyPool->Find(rParentName,
+ eOldFamily);
+ if (pParentOfNew)
+ {
+ xNewSheet->SetParent(rParentName);
+ }
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ }
+ }
+
+ // hat der Neue einen Follow? wenn ja, mit gleichem Namen bei uns suchen
+ if (pHisSheet->HasFollowSupport())
+ {
+ const String& rFollowName = pHisSheet->GetFollow();
+ if (0 != rFollowName.Len())
+ {
+ SfxStyleSheetBase* pFollowOfNew = pMyPool->Find(rFollowName,
+ eOldFamily);
+ if (pFollowOfNew)
+ {
+ xNewSheet->SetFollow(rFollowName);
+ }
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ }
+ }
+
+ // Bug 27347: alte Einstellung wieder setzen
+ pMyPool->SetSearchMask( eMyOldFamily, nMySrchMask );
+
+ // Model geaendert
+ ASSERT(pDoc, "Doc fehlt");
+ GetDoc()->SetModified();
+
+ bRet = TRUE;
+ }
+ else
+ bRet = SfxObjectShell::Insert( rSource,
+ nSourceIdx1,
+ nSourceIdx2,
+ nSourceIdx3,
+ rIdx1,
+ rIdx2,
+ rIdx3,
+ rRemovedIdx);
+
+ // --> OD 2005-05-10 #i48949# - actions aren't undoable and could have change
+ // the document node array. Thus, clear the undo action stack.
+ if ( bDoesUndo )
+ {
+ GetDoc()->DelAllUndoObj();
+ }
+ GetDoc()->DoUndo( bDoesUndo );
+ // <--
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlagen Remove
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::Remove(USHORT nIdx1, // siehe Insert
+ USHORT nIdx2,
+ USHORT nIdx3)
+{
+ BOOL bRet = FALSE;
+
+ if (CONTENT_STYLE == nIdx1)
+ {
+ SwDocStyleSheetPool* pMyPool = (SwDocStyleSheetPool*)GetStyleSheetPool();
+
+ pMyPool->First(); // vorm Zugriff Pool aktualisieren!!
+ SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2];
+
+ String aName( pMySheet->GetName() );
+ SfxStyleFamily eFamily( pMySheet->GetFamily() );
+
+ // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!!
+ if( ( SFX_STYLE_FAMILY_PAGE == eFamily &&
+ const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName()
+ == aName ) ||
+ ( SFX_STYLE_FAMILY_CHAR == eFamily &&
+ aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] ))
+ return FALSE;
+
+ // also loeschen
+ pMyPool->Remove( pMySheet );
+
+ // jetzt noch die Parents/Follows aller Instanziierten korrigieren
+ pMyPool->SetOrganizerMode( TRUE );
+ SfxStyleSheetBase* pTestSheet = pMyPool->First();
+ while (pTestSheet)
+ {
+ if (pTestSheet->GetFamily() == eFamily &&
+ pTestSheet->HasParentSupport() &&
+ pTestSheet->GetParent() == aName)
+ {
+ pTestSheet->SetParent( aEmptyStr ); // Verknuepfung aufloesen
+ }
+
+ if (pTestSheet->GetFamily() == eFamily &&
+ pTestSheet->HasFollowSupport() &&
+ pTestSheet->GetFollow() == aName)
+ {
+ pTestSheet->SetFollow( aEmptyStr ); // Verknuepfung aufloesen
+ }
+
+ pTestSheet = pMyPool->Next();
+ }
+ pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+
+ bRet = TRUE;
+ }
+ else
+ bRet = SfxObjectShell::Remove( nIdx1,
+ nIdx2,
+ nIdx3 );
+
+
+ // Model geaendert
+ ASSERT(pDoc, "Doc fehlt");
+ GetDoc()->SetModified();
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Execute(SfxRequest& rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ USHORT nWhich = rReq.GetSlot();
+ BOOL bDone = FALSE;
+ switch ( nWhich )
+ {
+ case SID_AUTO_CORRECT_DLG:
+ {
+ SvxSwAutoFmtFlags* pAFlags = &SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
+ SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
+
+ BOOL bOldLocked = rACW.IsLockWordLstLocked(),
+ bOldAutoCmpltCollectWords = pAFlags->bAutoCmpltCollectWords;
+
+ rACW.SetLockWordLstLocked( TRUE );
+
+ SvStringsISortDtor aTmpLst;
+ aTmpLst.Insert( &rACW.GetWordList() );
+ pAFlags->pAutoCmpltList = &aTmpLst;
+
+ SfxApplication* pApp = SFX_APP();
+ SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SFX_CALLMODE_SYNCHRON, pApp->GetPool());
+ SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG, TRUE );
+ aAppReq.AppendItem(aSwOptions);
+
+ // SMARTTAGS
+ pAFlags->pSmartTagMgr = &SwSmartTagMgr::Get();
+
+ //pApp->ExecuteSlot(aAppReq);
+
+ SfxItemSet aSet( pApp->GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG, SID_OPEN_SMARTTAGOPTIONS, SID_OPEN_SMARTTAGOPTIONS, 0 );
+ aSet.Put( aSwOptions );
+
+ const SfxPoolItem* pOpenSmartTagOptionsItem = 0;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_OPEN_SMARTTAGOPTIONS, FALSE, &pOpenSmartTagOptionsItem ) )
+ aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) );
+
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL );
+ pDlg->Execute();
+ delete pDlg;
+
+ rACW.SetLockWordLstLocked( bOldLocked );
+
+ SwEditShell::SetAutoFmtFlags( pAFlags );
+ rACW.SetMinWordLen( pAFlags->nAutoCmpltWordLen );
+ rACW.SetMaxCount( pAFlags->nAutoCmpltListLen );
+ if( pAFlags->pAutoCmpltList ) // any changes?
+ {
+ rACW.CheckChangedList( aTmpLst );
+ // clear the temp WordList pointer
+ pAFlags->pAutoCmpltList = 0;
+ }
+ // remove all pointer we never delete the strings
+ aTmpLst.Remove( (USHORT)0, aTmpLst.Count() );
+
+ if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords !=
+ pAFlags->bAutoCmpltCollectWords )
+ {
+ // call on all Docs the idle formatter to start
+ // the collection of Words
+ TypeId aType = TYPE(SwDocShell);
+ for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+ pDocSh;
+ pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
+ {
+ SwDoc* pTmp = pDocSh->GetDoc();
+ if ( pTmp->GetRootFrm() )
+ pTmp->InvalidateAutoCompleteFlag();
+ }
+ }
+ }
+ break;
+
+ case SID_PRINTPREVIEW:
+ {
+ BOOL bSet = FALSE, bFound = FALSE, bOnly = TRUE;
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this);
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ SwView* pCurrView = dynamic_cast< SwView *> ( pViewShell );
+ BOOL bCurrent = IS_TYPE( SwPagePreView, pViewShell );
+
+ while( pTmpFrm ) // search PreView
+ {
+ if( IS_TYPE( SwView, pTmpFrm->GetViewShell()) )
+ bOnly = FALSE;
+ else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell()))
+ {
+ pTmpFrm->GetFrame().Appear();
+ bFound = TRUE;
+ }
+ if( bFound && !bOnly )
+ break;
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this);
+ }
+
+ if( pArgs && SFX_ITEM_SET ==
+ pArgs->GetItemState( SID_PRINTPREVIEW, FALSE, &pItem ))
+ bSet = ((SfxBoolItem*)pItem)->GetValue();
+ else
+ bSet = !bCurrent;
+
+ USHORT nSlotId = 0;
+ if( bSet && !bFound ) // Keine gefunden, daher neue Preview anlegen
+ {
+ //Keine neue anlegen fuer BrowseView!
+ if( !GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ nSlotId = SID_VIEWSHELL1;
+ }
+ else if( bFound && !bSet )
+ nSlotId = bOnly ? SID_VIEWSHELL0 : SID_VIEWSHELL1;
+
+ if( nSlotId )
+ {
+ //JP 23.8.2001: Bug 91360 - PagePreView in the WebDocShell
+ // is found under Id ViewShell2.
+ if( ISA(SwWebDocShell) && SID_VIEWSHELL1 == nSlotId )
+ nSlotId = SID_VIEWSHELL2;
+
+ if( pCurrView && pCurrView->GetDocShell() == this )
+ pTmpFrm = pCurrView->GetViewFrame();
+ else
+ pTmpFrm = SfxViewFrame::GetFirst( this );
+
+ pTmpFrm->GetDispatcher()->Execute( nSlotId, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ }
+
+ rReq.SetReturnValue(SfxBoolItem(SID_PRINTPREVIEW, bSet ));
+ }
+ break;
+ case SID_TEMPLATE_LOAD:
+ {
+ String aFileName;
+ static BOOL bText = TRUE;
+ static BOOL bFrame = FALSE;
+ static BOOL bPage = FALSE;
+ static BOOL bNum = FALSE;
+ static BOOL bMerge = FALSE;
+ USHORT nRet = USHRT_MAX;
+
+ USHORT nFlags = bFrame ? SFX_LOAD_FRAME_STYLES : 0;
+ if(bPage)
+ nFlags|= SFX_LOAD_PAGE_STYLES;
+ if(bNum)
+ nFlags|= SFX_LOAD_NUM_STYLES;
+ if(!nFlags || bText)
+ nFlags|= SFX_LOAD_TEXT_STYLES;
+ if(bMerge)
+ nFlags|= SFX_MERGE_STYLES;
+
+ if ( pArgs )
+ {
+ SFX_REQUEST_ARG( rReq, pTemplateItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE );
+ if ( pTemplateItem )
+ {
+ aFileName = pTemplateItem->GetValue();
+ SFX_REQUEST_ARG( rReq, pFlagsItem, SfxInt32Item, SID_TEMPLATE_LOAD, FALSE );
+ if ( pFlagsItem )
+ nFlags = (USHORT) pFlagsItem->GetValue();
+ }
+ }
+
+ if ( !aFileName.Len() )
+ {
+ SvtPathOptions aPathOpt;
+ SfxNewFileDialog* pNewFileDlg =
+ new SfxNewFileDialog(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE);
+ pNewFileDlg->SetTemplateFlags(nFlags);
+
+ nRet = pNewFileDlg->Execute();
+ if(RET_TEMPLATE_LOAD == nRet)
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
+
+ SfxObjectFactory &rFact = GetFactory();
+ SfxFilterMatcher aMatcher( String::CreateFromAscii(rFact.GetShortName()) );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ const SfxFilter* pFlt = aIter.First();
+ while( pFlt )
+ {
+ if( pFlt && pFlt->IsAllowedAsTemplate() )
+ {
+ const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pFlt->GetUIName(), sWild );
+ }
+ pFlt = aIter.Next();
+ }
+ BOOL bWeb = 0 != dynamic_cast< SwWebDocShell *>( this );
+ const SfxFilter *pOwnFlt =
+ SwDocShell::Factory().GetFilterContainer()->
+ GetFilter4FilterName(String::CreateFromAscii("writer8"));
+
+ //#b6439685# make sure the default file format is also available
+ if(bWeb)
+ {
+ const String sWild = ((WildCard&)pOwnFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pOwnFlt->GetUIName(), sWild );
+ }
+
+ bool bError = false;
+ //#b6439685# catch expception if wrong filter is selected - should not happen anymore
+ try
+ {
+ xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() );
+ }
+ catch( const uno::Exception& )
+ {
+ bError = true;
+ }
+
+ if( !bError && ERRCODE_NONE == aDlgHelper.Execute() )
+ {
+ aFileName = xFP->getFiles().getConstArray()[0];
+ }
+ }
+ else if( RET_OK == nRet)
+ {
+ aFileName = pNewFileDlg->GetTemplateFileName();
+ }
+
+ nFlags = pNewFileDlg->GetTemplateFlags();
+ rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aFileName ) );
+ rReq.AppendItem( SfxInt32Item( SID_TEMPLATE_LOAD, (long) nFlags ) );
+ delete pNewFileDlg;
+ }
+
+ if( aFileName.Len() )
+ {
+ SwgReaderOption aOpt;
+ aOpt.SetTxtFmts( bText = (0 != (nFlags&SFX_LOAD_TEXT_STYLES) ));
+ aOpt.SetFrmFmts( bFrame = (0 != (nFlags&SFX_LOAD_FRAME_STYLES)));
+ aOpt.SetPageDescs( bPage = (0 != (nFlags&SFX_LOAD_PAGE_STYLES )));
+ aOpt.SetNumRules( bNum = (0 != (nFlags&SFX_LOAD_NUM_STYLES )));
+ //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge!
+ bMerge = 0 != (nFlags&SFX_MERGE_STYLES);
+ aOpt.SetMerge( !bMerge );
+
+ SetError( LoadStylesFromFile( aFileName, aOpt, FALSE ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
+ if ( !GetError() )
+ rReq.Done();
+ }
+ }
+ break;
+ case SID_SOURCEVIEW:
+ {
+ SfxViewShell* pViewShell = GetView()
+ ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
+ SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell );
+ if(!pSrcView)
+ {
+ // 3 possible state:
+ // 1 - file unsaved -> save as HTML
+ // 2 - file modified and HTML filter active -> save
+ // 3 - file saved in non-HTML -> QueryBox to save as HTML
+ const SfxFilter* pHtmlFlt =
+ SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii("HTML"),
+ SwWebDocShell::Factory().GetFilterContainer() );
+ BOOL bLocalHasName = HasName();
+ if(bLocalHasName)
+ {
+ //check for filter type
+ const SfxFilter* pFlt = GetMedium()->GetFilter();
+ if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
+ {
+ QueryBox aQuery(&pViewFrm->GetWindow(), SW_RES(MSG_SAVEAS_HTML_QUERY));
+ if(RET_YES == aQuery.Execute())
+ bLocalHasName = FALSE;
+ else
+ break;
+ }
+ }
+ if(!bLocalHasName)
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() );
+ aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() );
+ if( ERRCODE_NONE != aDlgHelper.Execute())
+ {
+ break;
+ }
+ String sPath = aDlgHelper.GetPath();
+ SfxStringItem aName(SID_FILE_NAME, sPath);
+ SfxStringItem aFilter(SID_FILTER_NAME, pHtmlFlt->GetName());
+ const SfxBoolItem* pBool = (const SfxBoolItem*)
+ pViewFrm->GetDispatcher()->Execute(
+ SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, &aName, &aFilter, 0L );
+ if(!pBool || !pBool->GetValue())
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ {
+ BOOL bWeb = 0 != dynamic_cast<SwWebDocShell*>(this);
+ DBG_ASSERT(bWeb == TRUE, "SourceView nur in der WebDocShell");
+ }
+#endif
+ // die SourceView ist fuer die SwWebDocShell die 1
+ USHORT nSlot = SID_VIEWSHELL1;
+ BOOL bSetModified = FALSE;
+ SfxPrinter* pSavePrinter = 0;
+ if( 0 != pSrcView)
+ {
+ SfxPrinter* pTemp = GetDoc()->getPrinter( false );
+ if(pTemp)
+ pSavePrinter = new SfxPrinter(*pTemp);
+ bSetModified = IsModified() || pSrcView->IsModified();
+ if(pSrcView->IsModified()||pSrcView->HasSourceSaved())
+ {
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ pSrcView->SaveContent(aTempFile.GetURL());
+ bDone = TRUE;
+ SfxEventConfiguration* pEvent = SFX_APP()->GetEventConfig();
+ SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this);
+ ReloadFromHtml(aTempFile.GetURL(), pSrcView);
+ nSlot = 0;
+ }
+ else
+ {
+ nSlot = SID_VIEWSHELL0;
+ }
+ }
+/* OS 10.04.97 14.20: Im Web-Writer gibt es keinen Unterschied zwischen
+ Export in den SourceMode und dem Speichern des Docs
+ else if(IsModified())
+ {
+ USHORT nRet = QueryBox( SFX_APPWINDOW ,SW_RES(MSG_SAVE_HTML_QUERY)).Execute();
+ if(RET_YES == nRet)
+ {
+ S F X _DISPATCHER().Execute(SID_SAVEDOC,
+ SFX_CALLMODE_SYNCHRON);
+ // der ReturnValue von SID_SAVEDOC ist etwas schwer verstaendlich
+ if(IsModified())
+ nSlot = 0;
+ }
+ else if( RET_CANCEL == nRet )
+ {
+ nSlot = 0;
+ }
+ }*/
+ if(nSlot)
+ pViewFrm->GetDispatcher()->Execute(nSlot, SFX_CALLMODE_SYNCHRON);
+ if(bSetModified)
+ GetDoc()->SetModified();
+ if(pSavePrinter)
+ {
+ GetDoc()->setPrinter( pSavePrinter, true, true);
+ //pSavePrinter darf nicht wieder geloescht werden
+ }
+ pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2));
+ pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE );
+ pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT );
+ }
+ break;
+ case SID_GET_COLORTABLE:
+ {
+ SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
+ XColorTable* pTable = pColItem->GetColorTable();
+ rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable));
+ }
+ break;
+ case FN_ABSTRACT_STARIMPRESS:
+ case FN_ABSTRACT_NEWDOC:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwInsertAbstractDlg* pDlg = pFact->CreateSwInsertAbstractDlg(0, DLG_INSERT_ABSTRACT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ BYTE nLevel = pDlg->GetLevel();
+ BYTE nPara = pDlg->GetPara();
+ SwDoc* pSmryDoc = new SwDoc();
+ SfxObjectShellRef xDocSh( new SwDocShell( pSmryDoc, SFX_CREATE_MODE_STANDARD));
+ xDocSh->DoInitNew( 0 );
+
+ BOOL bImpress = FN_ABSTRACT_STARIMPRESS == nWhich;
+ pDoc->Summary( pSmryDoc, nLevel, nPara, bImpress );
+ if( bImpress )
+ {
+ WriterRef xWrt;
+ // mba: looks as if relative URLs don't make sense here
+ ::GetRTFWriter( aEmptyStr, String(), xWrt );
+ SvMemoryStream *pStrm = new SvMemoryStream();
+ pStrm->SetBufferSize( 16348 );
+ SwWriter aWrt( *pStrm, *pSmryDoc );
+ ErrCode eErr = aWrt.Write( xWrt );
+ if( !ERRCODE_TOERROR( eErr ) )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ uno::Reference< frame::XDispatchProvider > xProv(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
+ if ( xProv.is() )
+ {
+ ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" );
+ uno::Reference< frame::XDispatchHelper > xHelper(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
+ if ( xHelper.is() )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ // Transfer ownership of stream to a lockbytes object
+ SvLockBytes aLockBytes( pStrm, TRUE );
+ SvLockBytesStat aStat;
+ if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
+ {
+ sal_uInt32 nLen = aStat.nSize;
+ ULONG nRead = 0;
+ uno::Sequence< sal_Int8 > aSeq( nLen );
+ aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline");
+ aArgs[0].Value <<= aSeq;
+ xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
+ }
+ }
+ }
+ }
+ else
+ ErrorHandler::HandleError(ErrCode( eErr ));
+ }
+ else
+ {
+ // Neues Dokument erzeugen.
+ SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 );
+ SwView *pCurrView = (SwView*) pFrame->GetViewShell();
+
+ // Dokumenttitel setzen
+ String aTmp( SW_RES(STR_ABSTRACT_TITLE) );
+ aTmp += GetTitle();
+ xDocSh->SetTitle( aTmp );
+ pCurrView->GetWrtShell().SetNewDoc();
+ pFrame->Show();
+ pSmryDoc->SetModified();
+ }
+
+ }
+ delete pDlg;
+ }
+ break;
+ case FN_OUTLINE_TO_CLIPBOARD:
+ case FN_OUTLINE_TO_IMPRESS:
+ {
+ WriterRef xWrt;
+ // mba: looks as if relative URLs don't make sense here
+ ::GetRTFWriter( 'O', String(), xWrt );
+ SvMemoryStream *pStrm = new SvMemoryStream();
+ pStrm->SetBufferSize( 16348 );
+ SwWriter aWrt( *pStrm, *GetDoc() );
+ ErrCode eErr = aWrt.Write( xWrt );
+ if( !ERRCODE_TOERROR( eErr ) )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ if ( nWhich == FN_OUTLINE_TO_IMPRESS )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ uno::Reference< frame::XDispatchProvider > xProv(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
+ if ( xProv.is() )
+ {
+ ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" );
+ uno::Reference< frame::XDispatchHelper > xHelper(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
+ if ( xHelper.is() )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ // Transfer ownership of stream to a lockbytes object
+ SvLockBytes aLockBytes( pStrm, TRUE );
+ SvLockBytesStat aStat;
+ if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
+ {
+ sal_uInt32 nLen = aStat.nSize;
+ ULONG nRead = 0;
+ uno::Sequence< sal_Int8 > aSeq( nLen );
+ aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline");
+ aArgs[0].Value <<= aSeq;
+ xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
+ }
+ }
+ }
+ }
+ else
+ {
+ TransferDataContainer* pClipCntnr =
+ new TransferDataContainer;
+ STAR_REFERENCE( datatransfer::XTransferable )
+ xRef( pClipCntnr );
+
+ pClipCntnr->CopyAnyData( FORMAT_RTF, (sal_Char*)
+ pStrm->GetData(), pStrm->GetEndOfData() );
+ pClipCntnr->CopyToClipboard(
+ GetView()? (Window*)&GetView()->GetEditWin() : 0 );
+ delete pStrm;
+ }
+ }
+ else
+ ErrorHandler::HandleError(ErrCode( eErr ));
+ }
+ break;
+ case SID_SPELLCHECKER_CHANGED:
+ //! FALSE, TRUE, TRUE is on the save side but a probably overdone
+ SW_MOD()->CheckSpellChanges(FALSE, TRUE, TRUE, FALSE );
+ break;
+
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT: //Fuer Web, genau umgekehrt zum BrowserMode
+ {
+ int eState = STATE_TOGGLE;
+ BOOL bSet = sal_True;
+ const SfxPoolItem* pAttr=NULL;
+ if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich , FALSE, &pAttr ))
+ {
+ bSet = ((SfxBoolItem*)pAttr)->GetValue();
+ if ( nWhich == FN_PRINT_LAYOUT )
+ bSet = !bSet;
+ eState = bSet ? STATE_ON : STATE_OFF;
+ }
+
+ if ( STATE_TOGGLE == eState )
+ bSet = !GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+
+ ToggleBrowserMode(bSet, 0);
+
+ // OS: numerische Reihenfolge beachten!
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_NEWWINDOW,/*5620*/
+ SID_BROWSER_MODE, /*6313*/
+ SID_RULER_BORDERS, SID_RULER_PAGE_POS,
+ SID_ATTR_LONG_LRSPACE,
+ SID_HTML_MODE,
+ SID_RULER_PROTECT,
+ SID_AUTOSPELL_CHECK,
+ FN_RULER, /*20211*/
+ FN_VIEW_GRAPHIC, /*20213*/
+ FN_VIEW_BOUNDS, /**/
+ FN_VIEW_FIELDS, /*20215*/
+ FN_VLINEAL, /*20216*/
+ FN_VSCROLLBAR, /*20217*/
+ FN_HSCROLLBAR, /*20218*/
+ FN_VIEW_META_CHARS, /**/
+ FN_VIEW_MARKS, /**/
+ FN_VIEW_FIELDNAME, /**/
+ FN_VIEW_TABLEGRID, /*20227*/
+ FN_PRINT_LAYOUT, /*20237*/
+ FN_QRY_MERGE, /*20364*/
+ 0
+ };
+ // the view must not exist!
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst( this );
+ if( pTmpFrm )
+ pTmpFrm->GetBindings().Invalidate( aInva );
+ if ( !pAttr )
+ rReq.AppendItem( SfxBoolItem( nWhich, bSet ) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_MAIL_EXPORT_FINISHED:
+ {
+ if(pWrtShell)
+ pWrtShell->StartAllAction();
+ //try to undo the removal of invisible content
+ pDoc->RestoreInvisibleContent();
+ if(pWrtShell)
+ pWrtShell->EndAllAction();
+ }
+ break;
+ case FN_NEW_HTML_DOC:
+ case FN_NEW_GLOBAL_DOC:
+ {
+ bDone = FALSE;
+ BOOL bCreateHtml = FN_NEW_HTML_DOC == nWhich;
+
+ BOOL bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei
+ sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei
+
+ String aFileName, aTemplateName;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich, FALSE, &pItem ) )
+ {
+ aFileName = ((const SfxStringItem*)pItem)->GetValue();
+ SFX_ITEMSET_ARG( pArgs, pTemplItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False );
+ if ( pTemplItem )
+ aTemplateName = pTemplItem->GetValue();
+ }
+ bool bError = false;
+ if ( !aFileName.Len() )
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, 0 );
+ //set HelpIds
+ const sal_Int16 nControlIds[] = {
+ CommonFilePickerElementIds::PUSHBUTTON_OK,
+ CommonFilePickerElementIds::PUSHBUTTON_CANCEL,
+ CommonFilePickerElementIds::LISTBOX_FILTER,
+ CommonFilePickerElementIds::CONTROL_FILEVIEW,
+ CommonFilePickerElementIds::EDIT_FILEURL,
+ ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
+ ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ 0
+ };
+ sal_Int32 nHelpIds[8];
+ sal_Int32 nStartHelpId =
+ bCreateHtml ?
+ HID_SEND_HTML_CTRL_PUSHBUTTON_OK : HID_SEND_MASTER_CTRL_PUSHBUTTON_OK ;
+ for(int nHelp = 0; nHelp < 7; nHelp++)
+ nHelpIds[nHelp] = nStartHelpId++;
+ nHelpIds[7] = 0;
+
+ aDlgHelper.SetControlHelpIds( nControlIds, nHelpIds );
+// aDlgHelper.SetDialogHelpId( bCreateHtml ? HID_SEND_HTML_DIALOG : HID_SEND_MASTER_DIALOG );
+
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ const SfxFilter* pFlt;
+ USHORT nStrId;
+
+ if( bCreateHtml )
+ {
+ // fuer HTML gibts es nur einen Filter!!
+ pFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii("HTML"),
+ SwWebDocShell::Factory().GetFilterContainer() );
+ nStrId = STR_LOAD_HTML_DOC;
+ }
+ else
+ {
+ // Fuer Global-Dokumente bieten wir jetzt auch nur
+ // noch den aktuellen an.
+ pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
+ GetFilter4Extension( String::CreateFromAscii("odm") );
+ nStrId = STR_LOAD_GLOBAL_DOC;
+ }
+
+ if( pFlt )
+ {
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pFlt->GetUIName(), sWild );
+ try
+ {
+ xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ;
+ }
+ catch( const uno::Exception& )
+ {
+ bError = true;
+ }
+ }
+ if(!bError)
+ {
+ uno::Reference<XFilePickerControlAccess> xCtrlAcc(xFP, UNO_QUERY);
+
+ //#removed by zhaojianwei
+
+ // const USHORT nCount = pDoc->GetTxtFmtColls()->Count();
+ // Sequence<OUString> aListBoxEntries(nCount);
+ // OUString* pEntries = aListBoxEntries.getArray();
+ // sal_Int32 nIdx = 0;
+ // sal_Int16 nSelect = 0;
+ // OUString sStartTemplate;
+ // SwTxtFmtColl *pFnd = 0, *pAny = 0;
+ // for(USHORT i = 0; i < nCount; ++i)
+ // {
+ // SwTxtFmtColl &rTxtColl =
+ // *pDoc->GetTxtFmtColls()->GetObject( i );
+ // if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
+ // {
+ // //if( MAXLEVEL >= rTxtColl.GetOutlineLevel() && ( !pFnd || //#outline level,zhaojianwei
+ //if( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && ( !pFnd || //<-end,zhaojianwei
+ // pFnd->GetAssignedOutlineStyleLevel() > rTxtColl.GetAssignedOutlineStyleLevel() ))
+ // {
+ // nSelect = (sal_Int16)nIdx;
+ // pFnd = &rTxtColl;
+ // sStartTemplate = rTxtColl.GetName();
+ // }
+ // else if( !pAny )
+ // pAny = &rTxtColl;
+ // //pEntries[nIdx++] = rTxtColl.GetName(); //#outline level,remove by zhaojianwei
+ // pEntries[nIdx++] = sStyles + rTxtColl.GetName(); //#outline level,add by zhaojianwei
+ // }
+ // }
+ // if(!sStartTemplate.getLength() && pAny)
+ // sStartTemplate = pAny->GetName();
+ // aListBoxEntries.realloc(nIdx);
+ //<-end,zhaojianwei
+
+
+ //#outline level,add by zhaojianwei
+ /////////////////////////////////////////////////////////////////////
+
+ bool bOutline[MAXLEVEL] = {false};
+ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ if( rOutlNds.Count() )
+ {
+ int nLevel;
+ for(USHORT n = 0; n < rOutlNds.Count(); ++n )
+ if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 &&
+ ! bOutline[nLevel-1] )
+ {
+ bOutline[nLevel-1] = true;
+ }
+ }
+
+ const USHORT nStyleCount = pDoc->GetTxtFmtColls()->Count();
+ Sequence<OUString> aListBoxEntries( MAXLEVEL + nStyleCount);
+ OUString* pEntries = aListBoxEntries.getArray();
+ sal_Int32 nIdx = 0 ;
+
+ OUString sOutline( SW_RESSTR(STR_FDLG_OUTLINE_LEVEL) );
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if( bOutline[i] )
+ pEntries[nIdx++] = sOutline + String::CreateFromInt32( i+1 );
+ }
+
+ OUString sStyle( SW_RESSTR(STR_FDLG_STYLE) );
+ for(USHORT i = 0; i < nStyleCount; ++i)
+ {
+ SwTxtFmtColl &rTxtColl =
+ *pDoc->GetTxtFmtColls()->GetObject( i );
+ if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
+ {
+ pEntries[nIdx++] = sStyle + rTxtColl.GetName();
+ }
+ }
+
+ aListBoxEntries.realloc(nIdx);
+ sal_Int16 nSelect = 0;
+ /////////////////////////////////////////////////////////////////////
+ //<-end,zhaojianwei
+
+ try
+ {
+ Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries));
+
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::ADD_ITEMS , aTemplates );
+ Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
+ xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ String(SW_RES( STR_FDLG_TEMPLATE_NAME )));
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("control acces failed");
+ }
+
+ xFP->setTitle( SW_RESSTR( nStrId ));
+ SvtPathOptions aPathOpt;
+ xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
+ if( ERRCODE_NONE == aDlgHelper.Execute())
+ {
+ aFileName = xFP->getFiles().getConstArray()[0];
+ Any aTemplateValue = xCtrlAcc->getValue(
+ ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::GET_SELECTED_ITEM );
+ OUString sTmpl;
+ aTemplateValue >>= sTmpl;
+ //aTemplateName = sTmpl; //#outline level,removed by zhaojianwei
+ //#outline level,add by zhaojianwei
+
+ sal_Int32 nColonPos = sTmpl.indexOf( sal_Unicode(':') );
+ OUString sPrefix = sTmpl.copy( 0L, nColonPos );
+ if( sPrefix.equalsAscii("Style"))
+ {
+ aTemplateName = sTmpl.copy( 7L ); //get string behind "Style: "
+ }
+ else if( sPrefix.equalsAscii("Outline"))
+ {
+ nTemplateOutlineLevel = ( sTmpl.copy( 15L )).toInt32(); //get string behind "Outline: Leve ";
+ bCreateByOutlineLevel = true;
+ }
+ //<-end,zhaojianwei
+
+ if ( aFileName.Len() )
+ {
+ rReq.AppendItem( SfxStringItem( nWhich, aFileName ) );
+ if( aTemplateName.Len() )
+ rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aTemplateName ) );
+ }
+ }
+ }
+ }
+
+ //const SwTxtFmtColl* pSplitColl = 0; //#outline level,removed by zhaojianwei
+ // if ( aTemplateName.Len() )
+ // pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
+ //<-end,zhaojianwei
+ if( aFileName.Len() )
+ {
+ if( PrepareClose( FALSE ) )
+ {
+ SwWait aWait( *this, TRUE );
+
+ //bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
+ // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
+ if ( bCreateByOutlineLevel ) //add by zhaojianwei
+ {
+ bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ ? pDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )
+ : pDoc->GenerateGlobalDoc( aFileName, nTemplateOutlineLevel );
+ }
+ else
+ {
+ const SwTxtFmtColl* pSplitColl = 0;
+ if ( aTemplateName.Len() )
+ pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
+ bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
+ : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
+ }
+ //<-end,zhaojianwei
+ if( bDone )
+ {
+ SfxStringItem aName( SID_FILE_NAME, aFileName );
+ SfxStringItem aReferer( SID_REFERER, aEmptyStr );
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while(pViewShell)
+ {
+ //search for the view that created the call
+ if(pViewShell->GetObjectShell() == this && pViewShell->GetDispatcher())
+ {
+ SfxFrameItem* pFrameItem = new SfxFrameItem( SID_DOCFRAME,
+ pViewShell->GetViewFrame() );
+ SfxDispatcher* pDispatch = pViewShell->GetDispatcher();
+ pDispatch->Execute(
+ SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON,
+ &aName,
+ &aReferer,
+ pFrameItem, 0L );
+
+ delete pFrameItem;
+ break;
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+ }
+ if( !bDone && !rReq.IsAPI() )
+ {
+ InfoBox( 0, SW_RESSTR( STR_CANTCREATE )).Execute();
+ }
+ }
+ }
+ rReq.SetReturnValue(SfxBoolItem( nWhich, bDone ));
+ if (bDone)
+ rReq.Done();
+ else
+ rReq.Ignore();
+ break;
+
+ case SID_ATTR_YEAR2000:
+ if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich , FALSE, &pItem ))
+ {
+ DBG_ASSERT(pItem->ISA(SfxUInt16Item), "falsches Item");
+ USHORT nYear2K = ((SfxUInt16Item*)pItem)->GetValue();
+ //ueber Views iterieren und den State an den FormShells setzen
+
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( this );
+ SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ SwView* pCurrView = dynamic_cast< SwView* >( pViewShell );
+ while(pCurrView)
+ {
+ FmFormShell* pFormShell = pCurrView->GetFormShell();
+ if(pFormShell)
+ pFormShell->SetY2KState(nYear2K);
+ pVFrame = SfxViewFrame::GetNext( *pVFrame, this );
+ pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ pCurrView = dynamic_cast<SwView*>( pViewShell );
+ }
+ pDoc->GetNumberFormatter(TRUE)->SetYear2000(nYear2K);
+ }
+ break;
+
+ default: DBG_ERROR("falscher Dispatcher");
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SwDocShell::DdeGetData( const String& rItem, const String& rMimeType,
+ uno::Any & rValue )
+{
+ return pDoc->GetData( rItem, rMimeType, rValue );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SwDocShell::DdeSetData( const String& rItem, const String& rMimeType,
+ const uno::Any & rValue )
+{
+ return pDoc->SetData( rItem, rMimeType, rValue );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+::sfx2::SvLinkSource* SwDocShell::DdeCreateLinkSource( const String& rItem )
+{
+ return pDoc->CreateLinkSource( rItem );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * /*pAppName*/,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nVersion,
+ sal_Bool bTemplate /* = sal_False */) const
+{
+ if (nVersion == SOFFICE_FILEFORMAT_60)
+ {
+ *pClassName = SvGlobalName( SO3_SW_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITER_60;
+ *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
+ }
+ else if (nVersion == SOFFICE_FILEFORMAT_8)
+ {
+ *pClassName = SvGlobalName( SO3_SW_CLASSID_60 );
+ *pClipFormat = bTemplate ? SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : SOT_FORMATSTR_ID_STARWRITER_8;
+ *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
+ }
+
+ *pUserName = SW_RESSTR(STR_HUMAN_SWDOC_NAME);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::SetModified( BOOL bSet )
+{
+ SfxObjectShell::SetModified( bSet );
+ if( IsEnableSetModified())
+ {
+ if (!pDoc->IsInCallModified() )
+ {
+ EnableSetModified( FALSE );
+ if( bSet )
+ {
+ BOOL bOld = pDoc->IsModified();
+ pDoc->SetModified();
+ if( !bOld )
+ pDoc->SetUndoNoResetModified();
+ }
+ else
+ pDoc->ResetModified();
+
+ EnableSetModified( TRUE );
+ }
+
+ UpdateChildWindows();
+ Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED));
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::UpdateChildWindows()
+{
+ // Flddlg ggf neu initialisieren (z.B. fuer TYP_SETVAR)
+ if(!GetView())
+ return;
+ SfxViewFrame* pVFrame = GetView()->GetViewFrame();
+ SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->
+ GetChildWindow( SwFldDlgWrapper::GetChildWindowId() );
+ if( pWrp )
+ pWrp->ReInitDlg( this );
+
+ // RedlineDlg ggf neu initialisieren
+ SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame->
+ GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() );
+ if( pRed )
+ pRed->ReInitDlg( this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+// --> OD 2005-08-02 #i48748#
+class SwReloadFromHtmlReader : public SwReader
+{
+ public:
+ SwReloadFromHtmlReader( SfxMedium& _rTmpMedium,
+ const String& _rFilename,
+ SwDoc* _pDoc )
+ : SwReader( _rTmpMedium, _rFilename, _pDoc )
+ {
+ SetBaseURL( _rFilename );
+ }
+};
+// <--
+void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView )
+{
+ BOOL bModified = IsModified();
+
+ // MIB 23.6.97: Die HTTP-Header-Felder muessen geloescht werden,
+ // sonst gibt es welche aus Meta-Tags hinter doppelt und dreifach.
+ ClearHeaderAttributesForSourceViewHack();
+
+ // MIB 24.07.97: Das Dokument-Basic muss auch noch d'ran glauben ...
+ // Ein EnterBasicCall braucht man hier nicht, weil man nichts ruft und
+ // in HTML-Dokument kein Dok-Basic vorhanden sein kann, das noch nicht
+ // geladen wurde.
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell
+ // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext
+ // vorhanden sind.
+ if( pHtmlOptions && pHtmlOptions->IsStarBasic() && HasBasic())
+ {
+ BasicManager *pBasicMan = GetBasicManager();
+ if( pBasicMan && (pBasicMan != SFX_APP()->GetBasicManager()) )
+ {
+ USHORT nLibCount = pBasicMan->GetLibCount();
+ while( nLibCount )
+ {
+ StarBASIC *pBasic = pBasicMan->GetLib( --nLibCount );
+ if( pBasic )
+ {
+ // Die IDE benachrichtigen
+ SfxUsrAnyItem aShellItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( GetModel() ) );
+ String aLibName( pBasic->GetName() );
+ SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
+ pSrcView->GetViewFrame()->GetDispatcher()->Execute(
+ SID_BASICIDE_LIBREMOVED,
+ SFX_CALLMODE_SYNCHRON,
+ &aShellItem, &aLibNameItem, 0L );
+
+ // Aus der Standard-Lib werden nur die Module geloescht
+ if( nLibCount )
+ pBasicMan->RemoveLib( nLibCount, TRUE );
+ else
+ pBasic->Clear();
+ }
+ }
+
+ ASSERT( pBasicMan->GetLibCount() <= 1,
+ "Loschen des Basics hat nicht geklappt" );
+ }
+ }
+ sal_Bool bWasBrowseMode = pDoc->get(IDocumentSettingAccess::BROWSE_MODE);
+ RemoveLink();
+
+ //jetzt muss auch das UNO-Model ueber das neue Doc informiert werden #51535#
+ uno::Reference<text::XTextDocument> xDoc(GetBaseModel(), uno::UNO_QUERY);
+ text::XTextDocument* pxDoc = xDoc.get();
+ ((SwXTextDocument*)pxDoc)->InitNewDoc();
+
+ AddLink();
+ //#116402# update font list when new document is created
+ UpdateFontList();
+ pDoc->set(IDocumentSettingAccess::BROWSE_MODE, bWasBrowseMode);
+ pSrcView->SetPool(&GetPool());
+
+
+ const String& rMedname = GetMedium()->GetName();
+
+ // fix #51032#: Die HTML-Vorlage muss noch gesetzt werden
+ SetHTMLTemplate( *GetDoc() ); //Styles aus HTML.vor
+
+ SfxViewShell* pViewShell = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
+ pViewFrm->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON );
+
+ SubInitNew();
+
+ SfxMedium aMed( rStreamName, STREAM_READ, FALSE );
+ // --> OD 2005-08-01 #i48748# - use class <SwReloadFromHtmlReader>, because
+ // the base URL has to be set to the filename of the document <rMedname>
+ // and not to the base URL of the temporary file <aMed> in order to get
+ // the URLs of the linked graphics correctly resolved.
+ SwReloadFromHtmlReader aReader( aMed, rMedname, pDoc );
+ // <--
+ aReader.Read( *ReadHTML );
+
+ const SwView* pCurrView = GetView();
+ //in print layout the first page(s) may have been formatted as a mix of browse
+ //and print layout
+ if(!bWasBrowseMode && pCurrView)
+ {
+ SwWrtShell& rWrtSh = pCurrView->GetWrtShell();
+ if( rWrtSh.GetLayout())
+ rWrtSh.CheckBrowseView( TRUE );
+ }
+
+
+ // MIB 23.6.97: Die HTTP-Header-Attribute wieder in die DokInfo
+ // uebernehmen. Die Base-URL ist hier egal, da TLX zum absolutieren die
+ // vom Dokument nimmt.
+ SetHeaderAttributesForSourceViewHack();
+
+ if(bModified && !IsReadOnly())
+ SetModified();
+ else
+ pDoc->ResetModified();
+}
+
+/* -----------------------------14.12.99 16:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
+{
+ GetDoc()->set(IDocumentSettingAccess::BROWSE_MODE, bSet );
+ UpdateFontList();
+ SwView* pTempView = _pView ? _pView : (SwView*)GetView();
+ if( pTempView )
+ {
+ SfxBindings& rBind = pTempView->GetViewFrame()->GetBindings();
+ rBind.Invalidate(FN_SHADOWCURSOR);
+ rBind.Invalidate(SID_BROWSER_MODE);
+ rBind.Invalidate(FN_PRINT_LAYOUT);
+
+ if( !GetDoc()->getPrinter( false ) )
+ {
+ pTempView->SetPrinter( GetDoc()->getPrinter( false ),
+ SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP );
+ }
+
+ // --> FME 2005-03-16 #i44963# Good occasion to check if page sizes in
+ // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
+ GetDoc()->CheckDefaultPageFmt();
+ // <--
+
+ // Currently there can be only one view (layout) if the document is viewed in Web layout
+ // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
+ do {
+ if( pTmpFrm != pTempView->GetViewFrame() )
+ {
+ pTmpFrm->DoClose();
+ pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
+ }
+ else
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, FALSE);
+
+ } while ( pTmpFrm );
+
+ const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions();
+
+ // set view columns before toggling:
+ if ( bSet )
+ {
+ const USHORT nColumns = rViewOptions.GetViewLayoutColumns();
+ const bool bBookMode = rViewOptions.IsViewLayoutBookMode();
+ if ( 1 != nColumns || bBookMode )
+ {
+ ((SwView*)GetView())->SetViewLayout( 1, false );
+ }
+ }
+
+ // Triggeres a formatting:
+ pTempView->GetWrtShell().CheckBrowseView( TRUE );
+ pTempView->CheckVisArea();
+
+ if( GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ {
+ const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
+
+ if ( SVX_ZOOM_PERCENT != eType)
+ {
+ ((SwView*)GetView())->SetZoom( eType );
+ }
+ }
+ pTempView->InvalidateBorder();
+ pTempView->SetNewWindowAllowed(!bSet);
+ }
+}
+
+ULONG SwDocShell::LoadStylesFromFile( const String& rURL,
+ SwgReaderOption& rOpt, BOOL bUnoCall )
+{
+ ULONG nErr = 0;
+
+ // Create a URL from filename
+ INetURLObject aURLObj( rURL );
+ String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ SwRead pRead = 0;
+ SwReader* pReader = 0;
+ SwPaM* pPam = 0;
+
+ // Filter bestimmen:
+// const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr );
+ String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
+ SfxFilterMatcher aMatcher( sFactory );
+
+ //#b6445961# search for filter in WebDocShell, too
+ SfxMedium aMed( rURL, STREAM_STD_READ, FALSE );
+ const SfxFilter* pFlt = 0;
+ aMatcher.DetectFilter( aMed, &pFlt, FALSE, FALSE );
+ if(!pFlt)
+ {
+ String sWebFactory(String::CreateFromAscii(SwWebDocShell::Factory().GetShortName()));
+ SfxFilterMatcher aWebMatcher( sWebFactory );
+ aWebMatcher.DetectFilter( aMed, &pFlt, FALSE, FALSE );
+ }
+ if( aMed.IsStorage() )
+ {
+ DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?");
+ pRead = ReadXML;
+ // the SW3IO - Reader need the pam/wrtshell, because only then he
+ // insert the styles!
+ if( bUnoCall )
+ {
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfContent(), -1 );
+ pPam = new SwPaM( aIdx );
+ pReader = new SwReader( aMed, rURL, *pPam );
+ }
+ else
+ pReader = new SwReader( aMed, rURL, *pWrtShell->GetCrsr() );
+ }
+ else if( pFlt )
+ {
+// if( pFlt->GetUserData().EqualsAscii( FILTER_SWG ) ||
+// pFlt->GetUserData().EqualsAscii( FILTER_SWGV ))
+// pRead = ReadSwg;
+ pReader = new SwReader( aMed, rURL, pDoc );
+ }
+
+ ASSERT( pRead, "no reader found" );
+ if( pRead )
+ {
+ pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() );
+ pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() );
+ pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() );
+ pRead->GetReaderOpt().SetNumRules( rOpt.IsNumRules() );
+ pRead->GetReaderOpt().SetMerge( rOpt.IsMerge() );
+
+ if( bUnoCall )
+ {
+ UnoActionContext aAction( pDoc );
+ nErr = pReader->Read( *pRead );
+ }
+ else
+ {
+ pWrtShell->StartAllAction();
+ nErr = pReader->Read( *pRead );
+ pWrtShell->EndAllAction();
+ }
+ }
+ delete pPam;
+ delete pReader;
+ return nErr;
+}
+
+/*--------------------------------------------------------------------
+ Get a client for an embedded object if possible.
+ --------------------------------------------------------------------*/
+SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef )
+{
+ SfxInPlaceClient* pResult = NULL;
+
+ SwWrtShell* pShell = GetWrtShell();
+ if ( pShell )
+ {
+ pResult = pShell->GetView().FindIPClient( xObjRef.GetObject(), (Window*)&pShell->GetView().GetEditWin() );
+ if ( !pResult )
+ pResult = new SwOleClient( &pShell->GetView(), &pShell->GetView().GetEditWin(), xObjRef );
+ }
+
+ return pResult;
+}
+
diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx
new file mode 100644
index 000000000000..cd6d2aee296d
--- /dev/null
+++ b/sw/source/ui/app/docshdrw.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+
+
+
+
+
+
+
+
+#include <svl/stritem.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/xtable.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <doc.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Document laden
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::InitDraw()
+{
+ SdrModel *pDrDoc = pDoc->GetDrawModel();
+ if( pDrDoc )
+ {
+ // Listen, bzw. Tables im ItemSet der DocShell anlegen
+ PutItem( SvxGradientListItem( pDrDoc->GetGradientList(), SID_GRADIENT_LIST ) );
+ PutItem( SvxHatchListItem( pDrDoc->GetHatchList(), SID_HATCH_LIST ) );
+ PutItem( SvxBitmapListItem( pDrDoc->GetBitmapList(), SID_BITMAP_LIST ) );
+ PutItem( SvxDashListItem( pDrDoc->GetDashList(), SID_DASH_LIST ) );
+ PutItem( SvxLineEndListItem( pDrDoc->GetLineEndList(), SID_LINEEND_LIST ) );
+
+ Outliner& rOutliner = pDrDoc->GetDrawOutliner();
+ uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() );
+ rOutliner.SetHyphenator( xHyphenator );
+ }
+ else
+ PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE ));
+}
+
+
+
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
new file mode 100644
index 000000000000..c201109ca1cb
--- /dev/null
+++ b/sw/source/ui/app/docshini.cxx
@@ -0,0 +1,826 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+
+#include <svx/dialogs.hrc>
+#include <i18npool/mslangid.hxx>
+#include <sot/storinfo.hxx>
+#include <sot/storage.hxx>
+#include <svl/zforlist.hxx>
+#include <svtools/ctrltool.hxx>
+#include <unotools/lingucfg.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/asiancfg.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <linguistic/lngprops.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <rtl/logfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svx/xtable.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <vcl/svapp.hxx>
+#include <view.hxx>
+#include <prtopt.hxx>
+#include <fmtcol.hxx>
+#include <docsh.hxx>
+#include <wdocsh.hxx>
+#include <swmodule.hxx>
+#include <doc.hxx>
+#include <docfac.hxx>
+#include <docstyle.hxx>
+#include <shellio.hxx>
+#include <tox.hxx>
+#include <swdtflvr.hxx>
+#include <dbmgr.hxx>
+#include <usrpref.hxx>
+#include <fontcfg.hxx>
+#include <poolfmt.hxx>
+#include <modcfg.hxx>
+#include <globdoc.hxx>
+#include <ndole.hxx>
+#include <mdiexp.hxx>
+#include <unotxdoc.hxx>
+#include <linkenum.hxx>
+#include <swwait.hxx>
+#include <wrtsh.hxx>
+#include <swerror.h>
+#include <globals.hrc>
+
+// #i18732#
+#include <fmtfollowtextflow.hxx>
+
+#include <unochart.hxx>
+
+// text grid
+#include <tgrditem.hxx>
+
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/*-----------------21.09.96 15.29-------------------
+
+--------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Document laden
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::InitNew" );
+
+ sal_Bool bRet = SfxObjectShell::InitNew( xStor );
+ ASSERT( GetMapUnit() == MAP_TWIP, "map unit is not twip!" );
+ sal_Bool bHTMLTemplSet = sal_False;
+ if( bRet )
+ {
+ AddLink(); // pDoc / pIo ggf. anlegen
+
+ sal_Bool bWeb = ISA( SwWebDocShell );
+ if ( bWeb )
+ bHTMLTemplSet = SetHTMLTemplate( *GetDoc() );//Styles aus HTML.vor
+ else if( ISA( SwGlobalDocShell ) )
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); // Globaldokument
+
+
+/*
+ //JP 12.07.95: so einfach waere es fuer die neu Mimik
+ pDoc->SetDefault( SvxTabStopItem( 1,
+ GetStar Writer App()->GetUsrPref()->GetDefTabDist(),
+ SVX_TAB_ADJUST_DEFAULT,
+ RES_PARATR_TABSTOP));
+*/
+ if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ SwTransferable::InitOle( this, *pDoc );
+
+ // set forbidden characters if necessary
+ SvxAsianConfig aAsian;
+ Sequence<Locale> aLocales = aAsian.GetStartEndCharLocales();
+ if(aLocales.getLength())
+ {
+ const Locale* pLocales = aLocales.getConstArray();
+ for(sal_Int32 i = 0; i < aLocales.getLength(); i++)
+ {
+ ForbiddenCharacters aForbidden;
+ aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine);
+ LanguageType eLang = SvxLocaleToLanguage(pLocales[i]);
+ pDoc->setForbiddenCharacters( eLang, aForbidden);
+ }
+ }
+ pDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION,
+ !aAsian.IsKerningWesternTextOnly());
+ pDoc->setCharacterCompressionType(static_cast<SwCharCompressType>(aAsian.GetCharDistanceCompression()));
+ pDoc->setPrintData(*SW_MOD()->GetPrtOptions(bWeb));
+
+ SubInitNew();
+
+ // fuer alle
+
+ SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
+ SfxPrinter* pPrt = pDoc->getPrinter( false );
+
+ String sEntry;
+ USHORT aFontWhich[] =
+ { RES_CHRATR_FONT,
+ RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT
+ };
+ USHORT aFontHeightWhich[] =
+ {
+ RES_CHRATR_FONTSIZE,
+ RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CTL_FONTSIZE
+ };
+ USHORT aFontIds[] =
+ {
+ FONT_STANDARD,
+ FONT_STANDARD_CJK,
+ FONT_STANDARD_CTL
+ };
+ USHORT nFontTypes[] =
+ {
+ DEFAULTFONT_LATIN_TEXT,
+ DEFAULTFONT_CJK_TEXT,
+ DEFAULTFONT_CTL_TEXT
+ };
+ USHORT aLangTypes[] =
+ {
+ RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE
+ };
+
+ for(sal_uInt8 i = 0; i < 3; i++)
+ {
+ USHORT nFontWhich = aFontWhich[i];
+ USHORT nFontId = aFontIds[i];
+ SvxFontItem* pFontItem = 0;
+ const SvxLanguageItem& rLang = (const SvxLanguageItem&)pDoc->GetDefault( aLangTypes[i] );
+ LanguageType eLanguage = rLang.GetLanguage();
+ if(!pStdFont->IsFontDefault(nFontId))
+ {
+ sEntry = pStdFont->GetFontFor(nFontId);
+ sal_Bool bDelete = sal_False;
+ const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(sEntry): 0;
+ if(!pFnt)
+ {
+ pFnt = new SfxFont( FAMILY_DONTKNOW, sEntry, PITCH_DONTKNOW,
+ ::gsl_getSystemTextEncoding() );
+ bDelete = sal_True;
+ }
+ pFontItem = new SvxFontItem(pFnt->GetFamily(), pFnt->GetName(),
+ aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich);
+ if(bDelete)
+ {
+ delete (SfxFont*) pFnt;
+ bDelete = sal_False;
+ }
+ }
+ else
+ {
+ // #107782# OJ use korean language if latin was used
+ if ( i == 0 )
+ {
+ LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
+ switch( eUiLanguage )
+ {
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ eLanguage = eUiLanguage;
+ break;
+ }
+ }
+
+ Font aLangDefFont = OutputDevice::GetDefaultFont(
+ nFontTypes[i],
+ eLanguage,
+ DEFAULTFONT_FLAGS_ONLYONE );
+ pFontItem = new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetName(),
+ aEmptyStr, aLangDefFont.GetPitch(), aLangDefFont.GetCharSet(), nFontWhich);
+ }
+ pDoc->SetDefault(*pFontItem);
+ if( !bHTMLTemplSet )
+ {
+ SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(nFontWhich);
+ }
+ delete pFontItem;
+ sal_Int32 nFontHeight = pStdFont->GetFontHeight( FONT_STANDARD, i, eLanguage );
+ if(nFontHeight <= 0)
+ nFontHeight = pStdFont->GetDefaultHeightFor( nFontId, eLanguage );
+ pDoc->SetDefault(SvxFontHeightItem( nFontHeight, 100, aFontHeightWhich[i] ));
+ if( !bHTMLTemplSet )
+ {
+ SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(aFontHeightWhich[i]);
+ }
+
+ }
+ USHORT aFontIdPoolId[] =
+ {
+ FONT_OUTLINE, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION, RES_POOLCOLL_LABEL,
+ FONT_INDEX, RES_POOLCOLL_REGISTER_BASE,
+ FONT_OUTLINE_CJK, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST_CJK, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION_CJK, RES_POOLCOLL_LABEL,
+ FONT_INDEX_CJK, RES_POOLCOLL_REGISTER_BASE,
+ FONT_OUTLINE_CTL, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST_CTL, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION_CTL, RES_POOLCOLL_LABEL,
+ FONT_INDEX_CTL, RES_POOLCOLL_REGISTER_BASE
+ };
+
+ USHORT nFontWhich = RES_CHRATR_FONT;
+ USHORT nFontHeightWhich = RES_CHRATR_FONTSIZE;
+ LanguageType eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_LANGUAGE )).GetLanguage();
+ for(sal_uInt8 nIdx = 0; nIdx < 24; nIdx += 2)
+ {
+ if(nIdx == 8)
+ {
+ nFontWhich = RES_CHRATR_CJK_FONT;
+ nFontHeightWhich = RES_CHRATR_CJK_FONTSIZE;
+ eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CJK_LANGUAGE )).GetLanguage();
+ }
+ else if(nIdx == 16)
+ {
+ nFontWhich = RES_CHRATR_CTL_FONT;
+ nFontHeightWhich = RES_CHRATR_CTL_FONTSIZE;
+ eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CTL_LANGUAGE )).GetLanguage();
+ }
+ SwTxtFmtColl *pColl = 0;
+ if(!pStdFont->IsFontDefault(aFontIdPoolId[nIdx]))
+ {
+ sEntry = pStdFont->GetFontFor(aFontIdPoolId[nIdx]);
+ sal_Bool bDelete = sal_False;
+ const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(sEntry): 0;
+ if(!pFnt)
+ {
+ pFnt = new SfxFont( FAMILY_DONTKNOW, sEntry, PITCH_DONTKNOW,
+ ::gsl_getSystemTextEncoding() );
+ bDelete = sal_True;
+ }
+ pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]);
+ if( !bHTMLTemplSet ||
+ SFX_ITEM_SET != pColl->GetAttrSet().GetItemState(
+ nFontWhich, sal_False ) )
+ {
+ pColl->SetFmtAttr(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(),
+ aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich));
+ }
+ if(bDelete)
+ {
+ delete (SfxFont*) pFnt;
+ }
+ }
+ sal_Int32 nFontHeight = pStdFont->GetFontHeight( static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage );
+ if(nFontHeight <= 0)
+ nFontHeight = pStdFont->GetDefaultHeightFor( aFontIdPoolId[nIdx], eLanguage );
+ if(!pColl)
+ pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]);
+ SvxFontHeightItem aFontHeight( (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True ));
+ if(aFontHeight.GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight))
+ {
+ aFontHeight.SetHeight(nFontHeight);
+ pColl->SetFmtAttr( aFontHeight );
+ }
+ }
+ }
+
+ /* #106748# If the default frame direction of a document is RTL
+ the default adjusment is to the right. */
+ if( !bHTMLTemplSet &&
+ FRMDIR_HORI_RIGHT_TOP == GetDefaultFrameDirection(GetAppLanguage()) )
+ pDoc->SetDefault( SvxAdjustItem(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST ) );
+
+ // OD 09.10.2003 #i18732# - set dynamic pool default for
+ // item RES_FOLLOW_TEXT_FLOW to FALSE for *new document*.
+ // Thus, redo this change in method <SwDoc::RemoveAllFmtLanguageDependencies()>,
+ // which is called from <SwDocShell::ConvertFrom(..)> in order to restore
+ // the static pool default.
+ pDoc->SetDefault( SwFmtFollowTextFlow( FALSE ) );
+
+// --> collapsing borders FME 2005-05-27 #i29550#
+ pDoc->SetDefault( SfxBoolItem( RES_COLLAPSING_BORDERS, TRUE ) );
+// <-- collapsing
+
+ //#i16874# AutoKerning as default for new documents
+ pDoc->SetDefault( SvxAutoKernItem( sal_True, RES_CHRATR_AUTOKERN ) );
+
+ // --> OD 2005-02-10 #i42080# - Due to the several calls of method <SetDefault(..)>
+ // at the document instance, the document is modified. Thus, reset this
+ // status here. Note: In method <SubInitNew()> this is also done.
+ pDoc->ResetModified();
+ // <--
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor mit SfxCreateMode ?????
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) :
+ SfxObjectShell ( eMode ),
+ pDoc(0),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor / Dtor
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
+ SfxObjectShell ( i_nSfxCreationFlags ),
+ pDoc(0),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor / Dtor
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ):
+ SfxObjectShell ( eMode ),
+ pDoc(pD),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dtor
+ --------------------------------------------------------------------*/
+
+
+ SwDocShell::~SwDocShell()
+{
+ // disable chart related objects now because in ~SwDoc it may be to late for this
+ if( pDoc )
+ {
+ pDoc->GetChartControllerHelper().Disconnect();
+ SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
+ if (pPCD)
+ pPCD->dispose();
+ }
+
+ RemoveLink();
+ delete pFontList;
+
+ // wir als BroadCaster werden auch unser eigener Listener
+ // (fuer DocInfo/FileNamen/....)
+ EndListening( *this );
+ SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
+ // wird nur die DocInfo fuer den Explorer gelesen, ist das Item nicht da
+ if(pColItem)
+ {
+ XColorTable* pTable = pColItem->GetColorTable();
+ // wurde eine neue Table angelegt, muss sie auch geloescht werden.
+ if((void*)pTable != (void*)(XColorTable::GetStdColorTable()) )
+ delete pTable;
+ }
+
+ delete pOLEChildList;
+}
+/* -----------------------------10.09.2001 15:59------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDocShell::Init_Impl()
+{
+ SetPool(&SW_MOD()->GetPool());
+ SetBaseModel(new SwXTextDocument(this));
+ // wir als BroadCaster werden auch unser eigener Listener
+ // (fuer DocInfo/FileNamen/....)
+ StartListening( *this );
+ //position of the "Automatic" style filter for the stylist (app.src)
+ SetAutoStyleFilterIndex(3);
+
+ // set map unit to twip
+ SetMapUnit( MAP_TWIP );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: AddLink
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::AddLink()
+{
+ if( !pDoc )
+ {
+ SwDocFac aFactory;
+ pDoc = aFactory.GetDoc();
+ pDoc->acquire();
+ pDoc->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell) );
+ }
+ else
+ pDoc->acquire();
+ pDoc->SetDocShell( this ); // am Doc den DocShell-Pointer setzen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+
+ SetPool(&pDoc->GetAttrPool());
+
+ // am besten erst wenn eine sdbcx::View erzeugt wird !!!
+ pDoc->SetOle2Link(LINK(this, SwDocShell, Ole2ModifiedHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: neue FontList erzeugen Aenderung Drucker
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::UpdateFontList()
+{
+ if(!bInUpdateFontList)
+ {
+ bInUpdateFontList = true;
+ ASSERT(pDoc, "Kein Doc keine FontList");
+ if( pDoc )
+ {
+ delete pFontList;
+ pFontList = new FontList( pDoc->getReferenceDevice( true ) );
+ PutItem( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) );
+ }
+ bInUpdateFontList = false;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: RemoveLink
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::RemoveLink()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Invalidate();
+ aFinishedTimer.Stop();
+ if(pDoc)
+ {
+ if( mxBasePool.is() )
+ {
+ static_cast<SwDocStyleSheetPool*>(mxBasePool.get())->dispose();
+ mxBasePool.clear();
+ }
+ sal_Int8 nRefCt = static_cast< sal_Int8 >(pDoc->release());
+ pDoc->SetOle2Link(Link());
+ pDoc->SetDocShell( 0 );
+ if( !nRefCt )
+ delete pDoc;
+ pDoc = 0; // wir haben das Doc nicht mehr !!
+ }
+}
+void SwDocShell::InvalidateModel()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Invalidate();
+}
+void SwDocShell::ReactivateModel()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden, Default-Format
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::Load( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Load" );
+ sal_Bool bRet = sal_False;
+ if( SfxObjectShell::Load( rMedium ))
+ {
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after SfxInPlaceObject::Load" );
+ if( pDoc ) // fuer Letzte Version !!
+ RemoveLink(); // das existierende Loslassen
+
+ AddLink(); // Link setzen und Daten updaten !!
+
+ // Das Laden
+ // fuer MD
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ if(GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
+ {
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE;
+ }
+
+ SwWait aWait( *this, sal_True );
+ sal_uInt32 nErr = ERR_SWG_READ_ERROR;
+ switch( GetCreateMode() )
+ {
+// case SFX_CREATE_MODE_INTERNAL:
+// nErr = 0;
+// break;
+
+ case SFX_CREATE_MODE_ORGANIZER:
+ {
+ if( ReadXML )
+ {
+ ReadXML->SetOrganizerMode( TRUE );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ nErr = aRdr.Read( *ReadXML );
+ ReadXML->SetOrganizerMode( FALSE );
+ }
+ }
+ break;
+
+ case SFX_CREATE_MODE_INTERNAL:
+ case SFX_CREATE_MODE_EMBEDDED:
+ {
+ // fuer MWERKS (Mac-Compiler): kann nicht selbststaendig casten
+ SwTransferable::InitOle( this, *pDoc );
+ }
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( sal_True );
+ // kein break;
+
+ case SFX_CREATE_MODE_STANDARD:
+ case SFX_CREATE_MODE_PREVIEW:
+ {
+ Reader *pReader = ReadXML;
+ if( pReader )
+ {
+ // die DocInfo vom Doc am DocShell-Medium setzen
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before ReadDocInfo" );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before Read" );
+ nErr = aRdr.Read( *pReader );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after Read" );
+
+ // If a XML document is loaded, the global doc/web doc
+ // flags have to be set, because they aren't loaded
+ // by this formats.
+ if( ISA( SwWebDocShell ) )
+ {
+ if( !pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ pDoc->set(IDocumentSettingAccess::HTML_MODE, true);
+ }
+ if( ISA( SwGlobalDocShell ) )
+ {
+ if( !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ ASSERT( !this, "ohne Sw3Reader geht nichts" );
+#endif
+ }
+ break;
+
+ default:
+ ASSERT( !this, "Load: new CreateMode?" );
+
+ }
+
+ UpdateFontList();
+ InitDraw();
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ bRet = !IsError( nErr );
+
+ // --> OD 2006-11-07 #i59688#
+// // StartFinishedLoading rufen.
+// if( bRet && !pDoc->IsInLoadAsynchron() &&
+// GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+// StartLoadFinishedTimer();
+ if ( bRet && !pDoc->IsInLoadAsynchron() &&
+ GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+ {
+ LoadingFinished();
+ }
+ // <--
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( sal_False );
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::LoadFrom" );
+ sal_Bool bRet = sal_False;
+ if( pDoc )
+ RemoveLink();
+
+ AddLink(); // Link setzen und Daten updaten !!
+
+ do { // middle check loop
+ sal_uInt32 nErr = ERR_SWG_READ_ERROR;
+ //const String& rNm = pStor->GetName();
+ String aStreamName;
+ aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("styles.xml"));
+ uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY );
+ if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) )
+ {
+ // Das Laden
+ SwWait aWait( *this, sal_True );
+ {
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ if( ReadXML )
+ {
+ ReadXML->SetOrganizerMode( TRUE );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ nErr = aRdr.Read( *ReadXML );
+ ReadXML->SetOrganizerMode( FALSE );
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR("Code removed!");
+ /*
+ //TODO/LATER: looks like some binary stuff?!
+ // sollte es sich um eine 2. Vrolage handeln ??
+ if( SvStorage::IsStorageFile( rNm ) )
+ break;
+
+ const SfxFilter* pFltr = SwIoSystem::GetFileFilter( rNm, aEmptyStr );
+ if( !pFltr || !pFltr->GetUserData().EqualsAscii( FILTER_SWG ))
+ break;
+
+ SfxMedium aMed( rNm, STREAM_STD_READ, FALSE );
+ if( 0 == ( nErr = aMed.GetInStream()->GetError() ) )
+ {
+ SwWait aWait( *this, sal_True );
+ SwReader aRead( aMed, rNm, pDoc );
+ nErr = aRead.Read( *ReadSwg );
+ }
+ */
+ }
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ bRet = !IsError( nErr );
+
+ } while( sal_False );
+
+ SfxObjectShell::LoadFrom( rMedium );
+ pDoc->ResetModified();
+ return bRet;
+}
+
+
+void SwDocShell::SubInitNew()
+{
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ UpdateFontList();
+ InitDraw();
+
+ pDoc->setLinkUpdateMode( GLOBALSETTING );
+ pDoc->setFieldUpdateFlags( AUTOUPD_GLOBALSETTING );
+
+ sal_Bool bWeb = ISA(SwWebDocShell);
+
+ sal_uInt16 nRange[] = {
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ RES_CHRATR_COLOR, RES_CHRATR_COLOR,
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0, 0, 0 };
+ if(!bWeb)
+ {
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP;
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE;
+ }
+ SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange );
+
+ //! get lingu options without loading lingu DLL
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+ aDfltSet.Put( SvxLanguageItem( nVal, RES_CHRATR_LANGUAGE ) );
+ aDfltSet.Put( SvxLanguageItem( eCJK, RES_CHRATR_CJK_LANGUAGE ) );
+ aDfltSet.Put( SvxLanguageItem( eCTL, RES_CHRATR_CTL_LANGUAGE ) );
+
+ if(!bWeb)
+ {
+ SvxHyphenZoneItem aHyp( (SvxHyphenZoneItem&) pDoc->GetDefault(
+ RES_PARATR_HYPHENZONE) );
+ aHyp.GetMinLead() = static_cast< BYTE >(aLinguOpt.nHyphMinLeading);
+ aHyp.GetMinTrail() = static_cast< BYTE >(aLinguOpt.nHyphMinTrailing);
+
+ aDfltSet.Put( aHyp );
+
+ sal_uInt16 nNewPos = static_cast< sal_uInt16 >(SW_MOD()->GetUsrPref(FALSE)->GetDefTab());
+ if( nNewPos )
+ aDfltSet.Put( SvxTabStopItem( 1, nNewPos,
+ SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ) );
+ }
+ aDfltSet.Put( SvxColorItem( Color( COL_AUTO ), RES_CHRATR_COLOR ) );
+
+ pDoc->SetDefault( aDfltSet );
+
+ //default page mode for text grid
+ if(!bWeb)
+ {
+ sal_Bool bSquaredPageMode = SW_MOD()->GetUsrPref(FALSE)->IsSquaredPageMode();
+ pDoc->SetDefaultPageMode( bSquaredPageMode );
+ }
+
+ pDoc->ResetModified();
+}
+
+/*
+ * Document Interface Access
+ */
+IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; }
+const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; }
+IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; }
+
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
new file mode 100644
index 000000000000..d06ab31b7478
--- /dev/null
+++ b/sw/source/ui/app/docst.cxx
@@ -0,0 +1,1305 @@
+/*************************************************************************
+ *
+ * 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/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <hintids.hxx>
+#include <sfx2/app.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/templdlg.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/newstyle.hxx>
+#include <sfx2/printer.hxx>
+#include <svl/macitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <swmodule.hxx>
+#include <wdocsh.hxx>
+#include <fmtfsize.hxx>
+#include <fchrfmt.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <undobj.hxx>
+#include <swundo.hxx>
+
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "docsh.hxx"
+#include "uitool.hxx"
+#include "cmdid.h"
+#include "globals.hrc"
+#include "viewopt.hxx"
+#include "doc.hxx"
+#include "swstyle.h"
+#include "frmfmt.hxx"
+#include "charfmt.hxx"
+#include "poolfmt.hxx"
+#include "pagedesc.hxx"
+#include "docstyle.hxx"
+#include "uiitems.hxx"
+#include "fmtcol.hxx"
+#include "frmmgr.hxx" //SwFrmValid
+#include "swevent.hxx"
+#include "edtwin.hxx"
+#include "unochart.hxx"
+
+#include "app.hrc"
+#include <fmtui.hrc>
+#include "swabstdlg.hxx"
+// --> OD 2008-03-27 #refactorlists#
+#include <list.hxx>
+// <--
+
+#include <paratr.hxx> //#outline level,add by zhaojianwei
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ USHORT nActualFamily = USHRT_MAX;
+
+ SwWrtShell* pShell = pSh ? pSh : GetWrtShell();
+ if(!pShell)
+ {
+ while (nWhich)
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = aIter.NextWhich();
+ }
+ return;
+ }
+ else
+ {
+ SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
+ const ISfxTemplateCommon* pCommon = SFX_APP()->GetCurrentTemplateCommon(pFrame->GetBindings());
+ if( pCommon )
+ nActualFamily = static_cast< USHORT >(pCommon->GetActualFamily());
+ }
+
+ while (nWhich)
+ {
+ // aktuelle Vorlage zu jeder Familie ermitteln
+ //
+ String aName;
+ switch (nWhich)
+ {
+ case SID_STYLE_APPLY:
+ {//hier wird die Vorlage und ihre Familie an die StyleBox
+ //uebergeben, damit diese Familie angezeigt wird
+ if(pShell->IsFrmSelected())
+ {
+ SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
+ if( pFmt )
+ aName = pFmt->GetName();
+ }
+ else
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aName = pColl->GetName();
+ }
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+ case SID_STYLE_FAMILY1:
+ if( !pShell->IsFrmSelected() )
+ {
+ SwCharFmt* pFmt = pShell->GetCurCharFmt();
+ if(pFmt)
+ aName = pFmt->GetName();
+ else
+ aName = *SwStyleNameMapper::GetTextUINameArray()[
+ RES_POOLCOLL_STANDARD - RES_POOLCOLL_TEXT_BEGIN ];
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+
+ case SID_STYLE_FAMILY2:
+ if(!pShell->IsFrmSelected())
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aName = pColl->GetName();
+
+ SfxTemplateItem aItem(nWhich, aName);
+
+ USHORT nMask = 0;
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ nMask = SWSTYLEBIT_HTML;
+ else
+ {
+ const int nSelection = pShell->GetFrmType(0,TRUE);
+ if(pShell->GetCurTOX())
+ nMask = SWSTYLEBIT_IDX ;
+ else if(nSelection & FRMTYPE_HEADER ||
+ nSelection & FRMTYPE_FOOTER ||
+ nSelection & FRMTYPE_TABLE ||
+ nSelection & FRMTYPE_FLY_ANY ||
+ nSelection & FRMTYPE_FOOTNOTE ||
+ nSelection & FRMTYPE_FTNPAGE)
+ nMask = SWSTYLEBIT_EXTRA;
+ else
+ nMask = SWSTYLEBIT_TEXT;
+ }
+
+ aItem.SetValue(nMask);
+ rSet.Put(aItem);
+ }
+
+ break;
+
+ case SID_STYLE_FAMILY3:
+
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
+ if(pFmt && pShell->IsFrmSelected())
+ {
+ aName = pFmt->GetName();
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ }
+ break;
+
+ case SID_STYLE_FAMILY4:
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) && !pHtmlOpt->IsPrintLayoutExtension())
+ rSet.DisableItem( nWhich );
+ else
+ {
+ USHORT n = pShell->GetCurPageDesc( FALSE );
+ if( n < pShell->GetPageDescCnt() )
+ aName = pShell->GetPageDesc( n ).GetName();
+
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ }
+ break;
+ case SID_STYLE_FAMILY5:
+ {
+ const SwNumRule* pRule = pShell->GetCurNumRule();
+ if( pRule )
+ aName = pRule->GetName();
+
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+
+ case SID_STYLE_WATERCAN:
+ {
+ SwEditWin& rEdtWin = pShell->GetView().GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != 0));
+ }
+ break;
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ if( pShell->IsFrmSelected()
+ ? SFX_STYLE_FAMILY_FRAME != nActualFamily
+ : ( SFX_STYLE_FAMILY_FRAME == nActualFamily ||
+ SFX_STYLE_FAMILY_PAGE == nActualFamily ||
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule())) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ if( (pShell->IsFrmSelected()
+ ? SFX_STYLE_FAMILY_FRAME != nActualFamily
+ : SFX_STYLE_FAMILY_FRAME == nActualFamily) ||
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule()) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Invalid SlotId");
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: StyleSheet-Requeste auswerten
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
+{
+ USHORT nSlot = rReq.GetSlot();
+ USHORT nRet = 0xffff;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ SwWrtShell* pActShell = 0;
+ BOOL bSetReturn = TRUE;
+ switch (nSlot)
+ {
+ case SID_STYLE_NEW:
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
+ FALSE, &pItem ))
+ {
+ USHORT nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
+
+ String sName;
+ USHORT nMask = 0;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_NEW,
+ FALSE, &pItem ))
+ sName = ((const SfxStringItem*)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_MASK,
+ FALSE, &pItem ))
+ nMask = ((const SfxUInt16Item*)pItem)->GetValue();
+ String sParent;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
+ FALSE, &pItem ))
+ sParent = ((const SfxStringItem*)pItem)->GetValue();
+
+ nRet = Edit( sName, sParent, nFamily, nMask, TRUE, FALSE, 0, rReq.IsAPI() );
+ }
+ break;
+
+ case SID_STYLE_APPLY:
+ if( !pArgs )
+ {
+ GetView()->GetViewFrame()->GetDispatcher()->Execute(SID_STYLE_DESIGNER, FALSE);
+ break;
+ }
+ else
+ {
+ // convert internal StyleName to DisplayName (slot implementation uses the latter)
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
+ SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
+ if ( pFamilyItem && pNameItem )
+ {
+ uno::Reference< style::XStyleFamiliesSupplier > xModel(GetModel(), uno::UNO_QUERY);
+ try
+ {
+ uno::Reference< container::XNameAccess > xStyles;
+ uno::Reference< container::XNameAccess > xCont = xModel->getStyleFamilies();
+ xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
+ uno::Reference< beans::XPropertySet > xInfo;
+ xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
+ ::rtl::OUString aUIName;
+ xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName;
+ if ( aUIName.getLength() )
+ rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ // intentionally no break
+
+ case SID_STYLE_EDIT:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_WATERCAN:
+ case SID_STYLE_FAMILY:
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ String aParam;
+ USHORT nFamily = SFX_STYLE_FAMILY_PARA;
+ USHORT nMask = 0;
+
+ if( !pArgs )
+ {
+ nFamily = SFX_STYLE_FAMILY_PARA;
+
+ switch (nSlot)
+ {
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ SfxNewStyleDlg *pDlg = new SfxNewStyleDlg( 0,
+ *GetStyleSheetPool());
+ if(RET_OK == pDlg->Execute())
+ {
+ aParam = pDlg->GetName();
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+
+ delete pDlg;
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_EDIT:
+ {
+ SwTxtFmtColl* pColl = GetWrtShell()->GetCurTxtFmtColl();
+ if(pColl)
+ {
+ aParam = pColl->GetName();
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ ASSERT( pArgs->Count(), "SfxBug ItemSet ist leer");
+
+ SwWrtShell* pShell = GetWrtShell();
+ if( SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem ))
+ aParam = ((const SfxStringItem*)pItem)->GetValue();
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILY,
+ FALSE, &pItem ))
+ nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, FALSE, &pItem ))
+ {
+ String aFamily = ((const SfxStringItem*)pItem)->GetValue();
+ if(aFamily.CompareToAscii("CharacterStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_CHAR;
+ else
+ if(aFamily.CompareToAscii("ParagraphStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PARA;
+ else
+ if(aFamily.CompareToAscii("PageStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PAGE;
+ else
+ if(aFamily.CompareToAscii("FrameStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_FRAME;
+ else
+ if(aFamily.CompareToAscii("NumberingStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PSEUDO;
+ }
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_MASK,
+ FALSE, &pItem ))
+ nMask = ((const SfxUInt16Item*)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
+ FALSE, &pItem ))
+ pActShell = pShell = (SwWrtShell*)((SwPtrItem*)pItem)->GetValue();
+
+ if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE )
+ {
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aParam = pColl->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pWrtShell->GetCurFrmFmt();
+ if( pFrm )
+ aParam = pFrm->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pWrtShell->GetCurCharFmt();
+ if( pChar )
+ aParam = pChar->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ if(SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_UPD_BY_EX_NAME, FALSE, &pItem))
+ {
+ aParam = ((const SfxStringItem*)pItem)->GetValue();
+ }
+ break;
+ }
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+ }
+ if (aParam.Len() || nSlot == SID_STYLE_WATERCAN )
+ {
+ switch(nSlot)
+ {
+ case SID_STYLE_EDIT:
+ nRet = Edit(aParam, aEmptyStr, nFamily, nMask, FALSE, FALSE, pActShell );
+ break;
+ case SID_STYLE_DELETE:
+ nRet = Delete(aParam, nFamily);
+ break;
+ case SID_STYLE_APPLY:
+ // Shellwechsel in ApplyStyles
+ nRet = ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
+ break;
+ case SID_STYLE_WATERCAN:
+ nRet = DoWaterCan(aParam, nFamily);
+ break;
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ nRet = UpdateStyle(aParam, nFamily, pActShell);
+ break;
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ nRet = MakeByExample(aParam, nFamily, nMask, pActShell );
+ SfxTemplateDialog* pDlg = SFX_APP()->GetTemplateDialog();
+
+ if(pDlg && pDlg->IsVisible())
+ pDlg->Update();
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Slot-Id");
+ }
+
+ rReq.Done();
+ }
+
+ break;
+ }
+ }
+
+ if(bSetReturn)
+ {
+ if(rReq.IsAPI()) // Basic bekommt nur TRUE oder FALSE
+ rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet !=0));
+ else
+ rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Edit
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFamily, USHORT nMask,
+ BOOL bNew, BOOL bColumn, SwWrtShell* pActShell,
+ BOOL bBasic )
+{
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+ SfxStyleSheetBase *pStyle = 0;
+
+ USHORT nRet = nMask;
+ BOOL bModified = pDoc->IsModified();
+
+ if( bNew )
+ {
+ if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_USED != nMask )
+ nMask |= SFXSTYLEBIT_USERDEF;
+ else
+ nMask = SFXSTYLEBIT_USERDEF;
+
+ pStyle = &mxBasePool->Make( rName, (SfxStyleFamily)nFamily, nMask );
+
+ // die aktuellen als Parent setzen
+ SwDocStyleSheet* pDStyle = (SwDocStyleSheet*)pStyle;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if(rParent.Len())
+ {
+ SwTxtFmtColl* pColl = pWrtShell->FindTxtFmtCollByName( rParent );
+ if(!pColl)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(USHRT_MAX != nId)
+ pColl = pWrtShell->GetTxtCollFromPool( nId );
+ }
+ pDStyle->GetCollection()->SetDerivedFrom( pColl );
+ pDStyle->PresetParent( rParent );
+
+ //#outline level,add by zhaojianwei
+ /*When a new paragraph style is created based on a "to outline style
+ assigned" paragraph style, the outline level attribute and the list
+ style attribute of the new paragraph style have to be set to 0
+ respectively "".*/
+ if( pColl->IsAssignedToListLevelOfOutlineStyle())
+ {
+ SwNumRuleItem aItem(aEmptyStr);
+ pDStyle->GetCollection()->SetFmtAttr( aItem );
+ pDStyle->GetCollection()->SetAttrOutlineLevel( 0 );
+ }
+ //<-end,zhaojianwei
+
+ }
+ else
+ {
+ SwTxtFmtColl* pColl = pWrtShell->GetCurTxtFmtColl();
+ pDStyle->GetCollection()->SetDerivedFrom( pColl );
+ if( pColl )
+ pDStyle->PresetParent( pColl->GetName() );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if(rParent.Len())
+ {
+ SwCharFmt* pCFmt = pWrtShell->FindCharFmtByName( rParent );
+ if(!pCFmt)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ if(USHRT_MAX != nId)
+ pCFmt = pWrtShell->GetCharFmtFromPool( nId );
+ }
+
+ pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
+ pDStyle->PresetParent( rParent );
+ }
+ else
+ {
+ SwCharFmt* pCFmt = pWrtShell->GetCurCharFmt();
+ pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
+ if( pCFmt )
+ pDStyle->PresetParent( pCFmt->GetName() );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if(rParent.Len())
+ {
+ SwFrmFmt* pFFmt = pWrtShell->GetDoc()->FindFrmFmtByName( rParent );
+ if(!pFFmt)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
+ if(USHRT_MAX != nId)
+ pFFmt = pWrtShell->GetFrmFmtFromPool( nId );
+ }
+ pDStyle->GetFrmFmt()->SetDerivedFrom( pFFmt );
+ pDStyle->PresetParent( rParent );
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ pStyle = mxBasePool->Find( rName, (SfxStyleFamily)nFamily );
+ ASSERT(pStyle, "Vorlage nicht gefunden");
+ }
+
+ if(!pStyle)
+ return FALSE;
+
+ // Dialoge zusammenstoepseln
+ //
+ rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ {
+ SfxItemSet& rSet = xTmp->GetItemSet();
+ ::SwToSfxPageDescAttr( rSet );
+ // erstmal nur eine Null
+ rSet.Put(SwBackgroundDestinationItem(SID_PARA_BACKGRND_DESTINATION, 0));
+ // --> OD 2008-02-13 #newlistlevelattrs#
+ // merge list level indent attributes into the item set if needed
+ xTmp->MergeIndentAttrsOfListStyle( rSet );
+ // <--
+ }
+/* else if( SFX_STYLE_FAMILY_FRAME == nFamily )
+ {
+ // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
+ SfxItemSet& rSet = aTmp.GetItemSet();
+ if( SFX_ITEM_SET != rSet.GetItemState( RES_FRM_SIZE ))
+ {
+ // dann sollten wir spaetesten hier eines anlegen
+ SwFrmValid aFrmDefValues;
+ rSet.Put( SwFmtFrmSize( ATT_VAR_SIZE, aFrmDefValues.nWidth,
+ aFrmDefValues.nHeight ));
+ }
+ }*/
+ else if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ SfxItemSet& rSet = xTmp->GetItemSet();
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
+ TRUE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_BACKGROUND );
+ rSet.Put( aTmpBrush );
+ }
+ }
+ if (!bBasic)
+ {
+ // vor dem Dialog wird der HtmlMode an der DocShell versenkt
+ USHORT nHtmlMode = ::GetHtmlMode(this);
+
+ // In HTML mode, we do not always have a printer. In order to show
+ // the correct page size in the Format - Page dialog, we have to
+ // get one here.
+ SwWrtShell* pCurrShell = ( pActShell ? pActShell : pWrtShell );
+ if( ( HTMLMODE_ON & nHtmlMode ) &&
+ !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) )
+ pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) );
+
+ PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
+ FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE,
+ 0, *(xTmp.get()), nFamily, bColumn,
+ pActShell ? pActShell : pWrtShell, bNew);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ GetWrtShell()->StartAllAction();
+
+ // nur bei Absatz-Vorlagen die Maske neu setzen
+ if( bNew )
+ {
+ nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
+ ? xTmp->GetMask()
+ : SFXSTYLEBIT_USERDEF;
+ }
+ else if( pStyle->GetMask() != xTmp->GetMask() )
+ nRet = xTmp->GetMask();
+
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ {
+ SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+ ::SfxToSwPageDescAttr( *GetWrtShell(), aSet );
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // reset indent attributes at paragraph style, if a list style
+ // will be applied and no indent attributes will be applied.
+ xTmp->SetItemSet( aSet, true );
+ // <--
+ }
+ else
+ {
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ {
+ static const USHORT aInval[] = {
+ SID_IMAGE_ORIENTATION,
+ SID_ATTR_CHAR_FONT,
+ FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0};
+ pView->GetViewFrame()->GetBindings().Invalidate(aInval);
+ }
+ SfxItemSet aTmpSet( *pDlg->GetOutputItemSet() );
+ if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+ aTmpSet.ClearItem( RES_BACKGROUND );
+ }
+ xTmp->SetItemSet( aTmpSet );
+
+ if( SFX_STYLE_FAMILY_PAGE == nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ const SfxPoolItem *pItem = NULL;
+ if( aTmpSet.GetItemState( GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, FALSE ) , TRUE, &pItem ) == SFX_ITEM_SET )
+ SwChartHelper::DoUpdateAllCharts( pDoc );
+ }
+ }
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ pView->InvalidateRulerPos();
+
+ if( bNew )
+ mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
+
+ // JP 19.09.97:
+ // Dialog vorm EndAction zerstoeren - bei Seitenvorlagen kann
+ // muss der ItemSet zerstoert werden, damit die Cursor aus den
+ // Kopf-/Fusszeilen entfernt werden. Sonst kommts zu GPFs!!!
+ delete pDlg;
+
+ pDoc->SetModified();
+ if( !bModified ) // Bug 57028
+ pDoc->SetUndoNoResetModified();
+
+ GetWrtShell()->EndAllAction();
+ }
+ else
+ {
+ if( bNew )
+ {
+ // #116530#
+ //pBasePool->Erase( &aTmp );
+ GetWrtShell()->Undo(UNDO_EMPTY, 1);
+ pDoc->ClearRedo();
+ }
+
+ if( !bModified )
+ pDoc->ResetModified();
+ delete pDlg;
+ }
+ }
+ else
+ {
+ // vor dem Dialog wird der HtmlMode an der DocShell versenkt
+ PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
+
+ GetWrtShell()->StartAllAction();
+
+ // nur bei Absatz-Vorlagen die Maske neu setzen
+ if( bNew )
+ {
+ nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
+ ? xTmp->GetMask()
+ : SFXSTYLEBIT_USERDEF;
+ }
+ else if( pStyle->GetMask() != xTmp->GetMask() )
+ nRet = xTmp->GetMask();
+
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
+ else
+ {
+ SfxItemSet aTmpSet( xTmp->GetItemSet() );
+ if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+ aTmpSet.ClearItem( RES_BACKGROUND );
+ }
+ xTmp->SetItemSet( aTmpSet );
+ }
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ pView->InvalidateRulerPos();
+
+ if( bNew )
+ mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
+
+ pDoc->SetModified();
+ if( !bModified ) // Bug 57028
+ pDoc->SetUndoNoResetModified();
+ GetWrtShell()->EndAllAction();
+ }
+
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Delete
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::Delete(const String &rName, USHORT nFamily)
+{
+ SfxStyleSheetBase *pStyle = mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ if(pStyle)
+ {
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ GetWrtShell()->StartAllAction();
+ mxBasePool->Remove(pStyle);
+ GetWrtShell()->EndAllAction();
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlage anwenden
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::ApplyStyles(const String &rName, USHORT nFamily,
+ SwWrtShell* pShell, USHORT nMode )
+{
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ ASSERT(pStyle, "Wo ist der StyleSheet");
+ if(!pStyle)
+ return FALSE;
+
+ SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
+
+ ASSERT( pSh, "Keine Shell, keine Styles");
+
+ pSh->StartAllAction();
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ pSh->SetAttr( aFmt, (nMode & KEY_SHIFT) ?
+ nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ // --> OD 2007-11-06 #i62675#
+ // clear also list attributes at affected text nodes, if paragraph
+ // style has the list style attribute set.
+ pSh->SetTxtFmtColl( pStyle->GetCollection(), true );
+ // <--
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ if ( pSh->IsFrmSelected() )
+ pSh->SetFrmFmt( pStyle->GetFrmFmt() );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
+ break;
+ }
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-17 #refactorlists#
+ // continue list of list style
+ const SwNumRule* pNumRule = pStyle->GetNumRule();
+ const String sListIdForStyle =pNumRule->GetDefaultListId();
+ pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
+ // <--
+ break;
+ }
+ default:
+ DBG_ERROR("Unbekannte Familie");
+ }
+ pSh->EndAllAction();
+
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Giesskanne starten
+ --------------------------------------------------------------------*/
+
+
+
+USHORT SwDocShell::DoWaterCan(const String &rName, USHORT nFamily)
+{
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ SwEditWin& rEdtWin = pView->GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ BOOL bWaterCan = !(pApply && pApply->eType != 0);
+ if( !rName.Len() )
+ bWaterCan = FALSE;
+ SwApplyTemplate aTemplate;
+ aTemplate.eType = nFamily;
+
+ if(bWaterCan)
+ {
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ ASSERT(pStyle, "Wo ist der StyleSheet");
+ if(!pStyle) return nFamily;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ aTemplate.aColl.pCharFmt = pStyle->GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ aTemplate.aColl.pTxtColl = pStyle->GetCollection();
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ aTemplate.aColl.pFrmFmt = pStyle->GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ aTemplate.aColl.pPageDesc = (SwPageDesc*)pStyle->GetPageDesc();
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ aTemplate.aColl.pNumRule = (SwNumRule*)pStyle->GetNumRule();
+ break;
+
+ default:
+ DBG_ERROR( "Unbekannte Familie");
+ }
+ }
+ else
+ aTemplate.eType = 0;
+
+ // Template anwenden
+ pView->GetEditWin().SetApplyTemplate(aTemplate);
+
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlage Updaten
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* pShell)
+{
+ SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ if(!pStyle)
+ return nFamily;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pStyle->GetCollection();
+ if(pColl && !pColl->IsDefault())
+ {
+ GetWrtShell()->StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pColl->GetName());
+
+ GetWrtShell()->StartUndo(UNDO_INSFMTATTR, &aRewriter);
+ GetWrtShell()->FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ GetWrtShell()->SetTxtFmtColl( pColl );
+ GetWrtShell()->EndUndo(UNDO_INSFMTATTR, NULL);
+ GetWrtShell()->EndAllAction();
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pStyle->GetFrmFmt();
+ if( pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault() )
+ {
+ SfxItemSet aSet( GetPool(), aFrmFmtSetRange );
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->GetFlyFrmAttr( aSet );
+
+ // --> OD 2009-12-28 #i105535#
+ // no update of anchor attribute
+ aSet.ClearItem( RES_ANCHOR );
+ // <--
+
+ pFrm->SetFmtAttr( aSet );
+
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->SetFrmFmt( pFrm, TRUE );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pStyle->GetCharFmt();
+ if( pChar && !pChar->IsDefault() )
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx(pChar);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->EndAllAction();
+ }
+
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRule* pCurRule;
+ if( pStyle->GetNumRule() &&
+ 0 != ( pCurRule = pCurrWrtShell->GetCurNumRule() ))
+ {
+ SwNumRule aRule( *pCurRule );
+ // --> OD 2008-07-08 #i91400#
+ aRule.SetName( pStyle->GetNumRule()->GetName(),
+ *(pCurrWrtShell->GetDoc()) );
+ // <--
+ pCurrWrtShell->ChgNumRuleFmts( aRule );
+ }
+ }
+ break;
+ }
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: NewByExample
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::MakeByExample( const String &rName, USHORT nFamily,
+ USHORT nMask, SwWrtShell* pShell )
+{
+ SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
+ SwDocStyleSheet* pStyle = (SwDocStyleSheet*)mxBasePool->Find(
+ rName, (SfxStyleFamily)nFamily );
+ if(!pStyle)
+ {
+ // JP 07.07.95: behalte die akt. Maske vom PI bei, dadurch werden
+ // neue sofort in den sichtbaren Bereich einsortiert
+ if( SFXSTYLEBIT_ALL == nMask || SFXSTYLEBIT_USED == nMask )
+ nMask = SFXSTYLEBIT_USERDEF;
+ else
+ nMask |= SFXSTYLEBIT_USERDEF;
+
+ pStyle = (SwDocStyleSheet*)&mxBasePool->Make(rName,
+ (SfxStyleFamily)nFamily, nMask );
+ }
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pStyle->GetCollection();
+ if(pColl && !pColl->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pColl->SetDerivedFrom(pCurrWrtShell->GetCurTxtFmtColl());
+
+ // setze die Maske noch an der Collection:
+ USHORT nId = pColl->GetPoolFmtId() & 0x87ff;
+ switch( nMask & 0x0fff )
+ {
+ case SWSTYLEBIT_TEXT:
+ nId |= COLL_TEXT_BITS;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ nId |= COLL_DOC_BITS;
+ break;
+ case SWSTYLEBIT_LIST:
+ nId |= COLL_LISTS_BITS;
+ break;
+ case SWSTYLEBIT_IDX:
+ nId |= COLL_REGISTER_BITS;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ nId |= COLL_EXTRA_BITS;
+ break;
+ case SWSTYLEBIT_HTML:
+ nId |= COLL_HTML_BITS;
+ break;
+ }
+ pColl->SetPoolFmtId(nId);
+
+ pCurrWrtShell->SetTxtFmtColl(pColl);
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pStyle->GetFrmFmt();
+ if(pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+
+ SfxItemSet aSet(GetPool(), aFrmFmtSetRange );
+ pCurrWrtShell->GetFlyFrmAttr( aSet );
+
+ SwFrmFmt* pFFmt = pCurrWrtShell->GetCurFrmFmt();
+ pFrm->SetDerivedFrom( pFFmt );
+
+ // JP 10.06.98: nur automatische Orientierungen uebernehmen
+/* #61359# jetzt auch wieder alle Orientierungen
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT,
+ FALSE, &pItem ) &&
+ text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient())
+ aSet.ClearItem( RES_VERT_ORIENT );
+
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT,
+ FALSE, &pItem ) &&
+ text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient())
+ aSet.ClearItem( RES_HORI_ORIENT );
+ */
+
+ pFrm->SetFmtAttr( aSet );
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->SetFrmFmt( pFrm );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pStyle->GetCharFmt();
+ if(pChar && !pChar->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx( pChar );
+ pChar->SetDerivedFrom( pCurrWrtShell->GetCurCharFmt() );
+ SwFmtCharFmt aFmt( pChar );
+ pCurrWrtShell->SetAttr( aFmt );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ pCurrWrtShell->StartAllAction();
+ USHORT nPgDsc = pCurrWrtShell->GetCurPageDesc();
+ SwPageDesc& rSrc = (SwPageDesc&)pCurrWrtShell->GetPageDesc( nPgDsc );
+ SwPageDesc& rDest = *(SwPageDesc*)pStyle->GetPageDesc();
+
+ USHORT nPoolId = rDest.GetPoolFmtId();
+ USHORT nHId = rDest.GetPoolHelpId();
+ BYTE nHFId = rDest.GetPoolHlpFileId();
+
+ pCurrWrtShell->GetDoc()->CopyPageDesc( rSrc, rDest );
+
+ // PoolId darf NIE kopiert werden!
+ rDest.SetPoolFmtId( nPoolId );
+ rDest.SetPoolHelpId( nHId );
+ rDest.SetPoolHlpFileId( nHFId );
+
+ // werden Kopf-/Fusszeilen angelegt, so gibt es kein Undo mehr!
+ pCurrWrtShell->GetDoc()->DelAllUndoObj();
+
+ pCurrWrtShell->EndAllAction();
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ pCurrWrtShell->StartAllAction();
+
+ SwNumRule aRule( *pCurrWrtShell->GetCurNumRule() );
+ String sOrigRule( aRule.GetName() );
+ // --> OD 2008-07-08 #i91400#
+ aRule.SetName( pStyle->GetNumRule()->GetName(),
+ *(pCurrWrtShell->GetDoc()) );
+ // <--
+ pCurrWrtShell->ChgNumRuleFmts( aRule );
+
+ pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
+
+
+ pCurrWrtShell->EndAllAction();
+ }
+ break;
+ }
+ return nFamily;
+}
+
+void SwDocShell::LoadStyles( SfxObjectShell& rSource )
+{
+ _LoadStyles(rSource, FALSE);
+}
+/* -----------------16.05.2003 15:45-----------------
+ bPreserveCurrentDocument determines whether SetFixFields() is called
+ This call modifies the source document. This mustn't happen when the source
+ is a document the user is working on.
+ Calls of ::LoadStyles() normally use files especially loaded for the purpose
+ of importing styles.
+ --------------------------------------------------*/
+void SwDocShell::_LoadStyles( SfxObjectShell& rSource, BOOL bPreserveCurrentDocument )
+{
+/* [Beschreibung]
+
+ Diese Methode wird vom SFx gerufen, wenn aus einer Dokument-Vorlage
+ Styles nachgeladen werden sollen. Bestehende Styles soll dabei
+ "uberschrieben werden. Das Dokument mu"s daher neu formatiert werden.
+ Daher werden die Applikationen in der Regel diese Methode "uberladen
+ und in ihrer Implementierung die Implementierung der Basisklasse
+ rufen.
+*/
+ // ist die Source unser Document, dann uebernehmen wir das
+ // abpruefen selbst (wesentlich schneller und laeuft nicht ueber
+ // die Kruecke SfxStylePool
+ if( rSource.ISA( SwDocShell ))
+ {
+ //JP 28.05.99: damit die Kopf-/Fusszeilen nicht den fixen Inhalt
+ // der Vorlage erhalten, einmal alle FixFelder der
+ // Source aktualisieren
+ if(!bPreserveCurrentDocument)
+ ((SwDocShell&)rSource).pDoc->SetFixFields(false, NULL);
+ if( pWrtShell )
+ {
+ pWrtShell->StartAllAction();
+ pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
+ pWrtShell->EndAllAction();
+ }
+ else
+ {
+ BOOL bModified = pDoc->IsModified();
+ pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
+ if( !bModified && pDoc->IsModified() && !pView )
+ {
+ // die View wird spaeter angelegt, ueberschreibt aber das
+ // Modify-Flag. Per Undo ist sowieso nichts mehr zu machen
+ pDoc->SetUndoNoResetModified();
+ }
+ }
+ }
+ else
+ SfxObjectShell::LoadStyles( rSource );
+}
+
+
+void SwDocShell::FormatPage( const String& rPage, BOOL bColumn, SwWrtShell* pActShell )
+{
+ Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, FALSE, bColumn, pActShell);
+}
+
+Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode )
+{
+ if( SFX_STYLE_FAMILY_PSEUDO == eFamily )
+ {
+ if ( eColorMode == BMP_COLOR_NORMAL )
+ return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM ));
+ else
+ return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM_HC ));
+ }
+
+ return SfxObjectShell::GetStyleFamilyBitmap( eFamily, eColorMode );
+}
+
+
+
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
new file mode 100644
index 000000000000..b0b81c5df6e4
--- /dev/null
+++ b/sw/source/ui/app/docstyle.cxx
@@ -0,0 +1,2908 @@
+/*************************************************************************
+ *
+ * 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_USHORTS
+
+#include <svl/smplhint.hxx>
+#include <hintids.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/syslocale.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/numitem.hxx>
+// --> OD 2008-02-13 #newlistlevelattrs#
+#include <editeng/lrspitem.hxx>
+// <--
+#include <fmtcol.hxx>
+#include <uitool.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <errhdl.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <poolfmt.hxx>
+#include <pagedesc.hxx>
+#include <docstyle.hxx>
+#include <docary.hxx>
+#include <ccoll.hxx>
+#include <doc.hxx>
+#include <cmdid.h>
+#include <swstyle.h>
+#include <app.hrc>
+#include <paratr.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <svl/cjkoptions.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <numrule.hxx>
+#include <fmthdft.hxx>
+#include <svx/svxids.hrc>
+// --> OD 2008-02-12 #newlistlevelattrs#
+#include <SwRewriter.hxx>
+#include <undobj.hxx>
+// <--
+
+// MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als
+// erstes Zeichen die Familie:
+
+#define cCHAR (sal_Unicode)'c'
+#define cPARA (sal_Unicode)'p'
+#define cFRAME (sal_Unicode)'f'
+#define cPAGE (sal_Unicode)'g'
+#define cNUMRULE (sal_Unicode)'n'
+
+// Dieses Zeichen wird bei der Herausgabe der Namen wieder entfernt und
+// die Familie wird neu generiert.
+
+// Ausserdem gibt es jetzt zusaetzlich das Bit bPhysical. Ist dieses Bit
+// TRUE, werden die Pool-Formatnamen NICHT mit eingetragen.
+
+class SwImplShellAction
+{
+ SwWrtShell* pSh;
+ CurrShell* pCurrSh;
+public:
+ SwImplShellAction( SwDoc& rDoc );
+ ~SwImplShellAction();
+
+ SwWrtShell* GetSh() { return pSh; }
+};
+
+SwImplShellAction::SwImplShellAction( SwDoc& rDoc )
+ : pCurrSh( 0 )
+{
+ if( rDoc.GetDocShell() )
+ pSh = rDoc.GetDocShell()->GetWrtShell();
+ else
+ pSh = 0;
+
+ if( pSh )
+ {
+ pCurrSh = new CurrShell( pSh );
+ pSh->StartAllAction();
+ }
+}
+
+SwImplShellAction::~SwImplShellAction()
+{
+ if( pCurrSh )
+ {
+ pSh->EndAllAction();
+ delete pCurrSh;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwCharFormate finden/anlegen
+ evtl. Style fuellen
+ --------------------------------------------------------------------*/
+
+SwCharFmt* lcl_FindCharFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwCharFmt* pFmt = 0;
+ if( rName.Len() )
+ {
+ pFmt = rDoc.FindCharFmtByName( rName );
+ if( !pFmt && rName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] )
+ {
+ // Standard-Zeichenvorlage
+ pFmt = (SwCharFmt*)rDoc.GetDfltCharFmt();
+ }
+
+ if( !pFmt && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ if(nId != USHRT_MAX)
+ pFmt = rDoc.GetCharFmtFromPool(nId);
+ }
+ }
+ if(pStyle)
+ {
+ if(pFmt)
+ {
+ pStyle->SetPhysical(TRUE);
+ SwFmt* p = pFmt->DerivedFrom();
+ if( p && !p->IsDefault() )
+ pStyle->PresetParent( p->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pFmt;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: ParaFormate finden/erzeugen
+ Style fuellen
+ --------------------------------------------------------------------*/
+
+SwTxtFmtColl* lcl_FindParaFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwTxtFmtColl* pColl = 0;
+
+ if( rName.Len() )
+ {
+ pColl = rDoc.FindTxtFmtCollByName( rName );
+ if( !pColl && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(nId != USHRT_MAX)
+ pColl = rDoc.GetTxtCollFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pColl)
+ {
+ pStyle->SetPhysical(TRUE);
+ if( pColl->DerivedFrom() && !pColl->DerivedFrom()->IsDefault() )
+ pStyle->PresetParent( pColl->DerivedFrom()->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+
+ SwTxtFmtColl& rNext = pColl->GetNextTxtFmtColl();
+ pStyle->PresetFollow(rNext.GetName());
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pColl;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmenformate
+ --------------------------------------------------------------------*/
+
+
+SwFrmFmt* lcl_FindFrmFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwFrmFmt* pFmt = 0;
+ if( rName.Len() )
+ {
+ pFmt = rDoc.FindFrmFmtByName( rName );
+ if( !pFmt && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
+ if(nId != USHRT_MAX)
+ pFmt = rDoc.GetFrmFmtFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pFmt)
+ {
+ pStyle->SetPhysical(TRUE);
+ if( pFmt->DerivedFrom() && !pFmt->DerivedFrom()->IsDefault() )
+ pStyle->PresetParent( pFmt->DerivedFrom()->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pFmt;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitendescriptoren
+ --------------------------------------------------------------------*/
+
+
+const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ const SwPageDesc* pDesc = 0;
+
+ if( rName.Len() )
+ {
+ pDesc = rDoc.FindPageDescByName( rName );
+ if( !pDesc && bCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
+ if(nId != USHRT_MAX)
+ pDesc = rDoc.GetPageDescFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pDesc)
+ {
+ pStyle->SetPhysical(TRUE);
+ if(pDesc->GetFollow())
+ pStyle->PresetFollow(pDesc->GetFollow()->GetName());
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pDesc;
+}
+
+const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ const SwNumRule* pRule = 0;
+
+ if( rName.Len() )
+ {
+ pRule = rDoc.FindNumRulePtr( rName );
+ if( !pRule && bCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE);
+ if(nId != USHRT_MAX)
+ pRule = rDoc.GetNumRuleFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pRule)
+ {
+ pStyle->SetPhysical(TRUE);
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pRule;
+}
+
+
+USHORT lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
+ const String& rName )
+{
+ if( rLst.Count() )
+ {
+ // suchen
+ String sSrch( ' ' );
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR: sSrch = cCHAR; break;
+ case SFX_STYLE_FAMILY_PARA: sSrch = cPARA; break;
+ case SFX_STYLE_FAMILY_FRAME: sSrch = cFRAME; break;
+ case SFX_STYLE_FAMILY_PAGE: sSrch = cPAGE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: sSrch = cNUMRULE; break;
+ default:; //prevent warning
+ }
+ sSrch += rName;
+ for( USHORT i=0; i < rLst.Count(); ++i )
+ if( *rLst[i] == sSrch )
+ return i;
+ }
+ return USHRT_MAX;
+}
+
+BOOL FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam )
+{
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ return 0 != lcl_FindCharFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PARA :
+ return 0 != lcl_FindParaFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_FRAME:
+ return 0 != lcl_FindFrmFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PAGE :
+ return 0 != lcl_FindPageDesc( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return 0 != lcl_FindNumRule( rDoc, rName, 0, FALSE );
+ default:; //prevent warning
+ }
+ return FALSE;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von Strings in die Liste der Vorlagen
+ --------------------------------------------------------------------*/
+
+
+void SwPoolFmtList::Append( char cChar, const String& rStr )
+{
+ String* pStr = new String( cChar );
+ *pStr += rStr;
+ for ( USHORT i=0; i < Count(); ++i )
+ {
+ if( *operator[](i) == *pStr )
+ {
+ delete pStr;
+ return;
+ }
+ }
+ Insert( pStr, Count() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Liste kompletti loeschen
+ --------------------------------------------------------------------*/
+
+
+void SwPoolFmtList::Erase()
+{
+ DeleteAndDestroy( 0, Count() );
+}
+
+/* */
+
+/*--------------------------------------------------------------------
+ Beschreibung: UI-seitige implementierung von StyleSheets
+ greift auf die Core-Engine zu
+ --------------------------------------------------------------------*/
+
+SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument,
+ const String& rName,
+ SwDocStyleSheetPool& _rPool,
+ SfxStyleFamily eFam,
+ USHORT _nMask) :
+
+ SfxStyleSheetBase( rName, _rPool, eFam, _nMask ),
+ pCharFmt(0),
+ pColl(0),
+ pFrmFmt(0),
+ pDesc(0),
+ pNumRule(0),
+
+ rDoc(rDocument),
+ aCoreSet(GetPool().GetPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ // --> OD 2008-02-25 #refactorlists#
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ // <--
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ SID_ATTR_PAGE, SID_ATTR_PAGE_EXT1,
+ SID_ATTR_PAGE_HEADERSET,SID_ATTR_PAGE_FOOTERSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL,
+ SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
+ SID_SWREGISTER_MODE, SID_SWREGISTER_MODE,
+ SID_SWREGISTER_COLLECTION, SID_SWREGISTER_COLLECTION,
+ FN_COND_COLL, FN_COND_COLL,
+ SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE,
+ SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
+ SID_PARA_BACKGRND_DESTINATION, SID_ATTR_BRUSH_CHAR,
+ SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
+ 0),
+ bPhysical(FALSE)
+{
+ nHelpId = UCHAR_MAX;
+}
+
+
+SwDocStyleSheet::SwDocStyleSheet( const SwDocStyleSheet& rOrg) :
+ SfxStyleSheetBase(rOrg),
+ pCharFmt(rOrg.pCharFmt),
+ pColl(rOrg.pColl),
+ pFrmFmt(rOrg.pFrmFmt),
+ pDesc(rOrg.pDesc),
+ pNumRule(rOrg.pNumRule),
+ rDoc(rOrg.rDoc),
+ aCoreSet(rOrg.aCoreSet),
+ bPhysical(rOrg.bPhysical)
+{
+}
+
+
+ SwDocStyleSheet::~SwDocStyleSheet()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zuruecksetzen
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::Reset()
+{
+ aName.Erase();
+ aFollow.Erase();
+ aParent.Erase();
+ SetPhysical(FALSE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: virtuelle Methoden
+ --------------------------------------------------------------------*/
+
+
+const String& SwDocStyleSheet::GetParent() const
+{
+ if( !bPhysical )
+ {
+ // dann pruefe, ob schon im Doc vorhanden
+ SwFmt* pFmt = 0;
+ SwGetPoolIdFromName eGetType;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pFmt = rDoc.FindCharFmtByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pFmt = rDoc.FindTxtFmtCollByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL;
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFmt = rDoc.FindFrmFmtByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_FRMFMT;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ default:
+ return aEmptyStr; // es gibt keinen Parent
+ }
+
+ String sTmp;
+ if( !pFmt ) // noch nicht vorhanden, also dflt. Parent
+ {
+ USHORT i = SwStyleNameMapper::GetPoolIdFromUIName( aName, eGetType );
+ i = ::GetPoolParent( i );
+ if( i && USHRT_MAX != i )
+ SwStyleNameMapper::FillUIName( i, sTmp );
+ }
+ else
+ {
+ SwFmt* p = pFmt->DerivedFrom();
+ if( p && !p->IsDefault() )
+ sTmp = p->GetName();
+ }
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->aParent = sTmp;
+ }
+ return aParent;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nachfolger
+ --------------------------------------------------------------------*/
+
+
+const String& SwDocStyleSheet::GetFollow() const
+{
+ if( !bPhysical )
+ {
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->FillStyleSheet( FillAllInfo );
+ }
+ return aFollow;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Welche Verkettung ist moeglich
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::HasFollowSupport() const
+{
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_PAGE : return TRUE;
+ case SFX_STYLE_FAMILY_FRAME:
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_PSEUDO: return FALSE;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parent ?
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::HasParentSupport() const
+{
+ BOOL bRet = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_FRAME: bRet = TRUE;
+ default:; //prevent warning
+ }
+ return bRet;
+}
+
+
+BOOL SwDocStyleSheet::HasClearParentSupport() const
+{
+ BOOL bRet = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_FRAME: bRet = TRUE;
+ default:; //prevent warning
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: textuelle Beschreibung ermitteln
+ --------------------------------------------------------------------*/
+String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
+{
+ IntlWrapper aIntlWrapper(
+ ::comphelper::getProcessServiceFactory(),
+ SvtSysLocale().GetLocaleData().getLocale());
+
+ String sPlus(String::CreateFromAscii(" + "));
+ if ( SFX_STYLE_FAMILY_PAGE == nFamily )
+ {
+ if( !pSet )
+ GetItemSet();
+
+ SfxItemIter aIter( *pSet );
+ String aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ if(!IsInvalidItem(pItem))
+ switch ( pItem->Which() )
+ {
+ case RES_LR_SPACE:
+ case SID_ATTR_PAGE_SIZE:
+ case SID_ATTR_PAGE_MAXSIZE:
+ case SID_ATTR_PAGE_PAPERBIN:
+ case SID_ATTR_PAGE_APP:
+ case SID_ATTR_BORDER_INNER:
+ break;
+ default:
+ {
+ String aItemPresentation;
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eUnit, aItemPresentation, &aIntlWrapper ) )
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+ aDesc += sPlus;
+ aDesc += aItemPresentation;
+ }
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ return aDesc;
+ }
+ else if ( SFX_STYLE_FAMILY_FRAME == nFamily ||
+ SFX_STYLE_FAMILY_PARA == nFamily)
+ {
+ if( !pSet )
+ GetItemSet();
+
+ SfxItemIter aIter( *pSet );
+ String aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ String sPageNum, sModel, sBreak;
+ BOOL bHasWesternFontPrefix = FALSE;
+ BOOL bHasCJKFontPrefix = FALSE;
+ SvtCJKOptions aCJKOptions;
+
+ while ( pItem )
+ {
+ if(!IsInvalidItem(pItem))
+ switch ( pItem->Which() )
+ {
+ case SID_ATTR_AUTO_STYLE_UPDATE:
+ case SID_PARA_BACKGRND_DESTINATION:
+ case RES_PAGEDESC:
+ //CTL no yet supported
+ case RES_CHRATR_CTL_FONT:
+ case RES_CHRATR_CTL_FONTSIZE:
+ case RES_CHRATR_CTL_LANGUAGE:
+ case RES_CHRATR_CTL_POSTURE:
+ case RES_CHRATR_CTL_WEIGHT:
+ break;
+ default:
+ {
+ String aItemPresentation;
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eUnit, aItemPresentation, &aIntlWrapper ) )
+ {
+ BOOL bIsDefault = FALSE;
+ switch ( pItem->Which() )
+ {
+ case SID_ATTR_PARA_PAGENUM:
+ sPageNum = aItemPresentation;
+ break;
+ case SID_ATTR_PARA_MODEL:
+ sModel = aItemPresentation;
+ break;
+ case RES_BREAK:
+ sBreak = aItemPresentation;
+ break;
+ case RES_CHRATR_CJK_FONT:
+ case RES_CHRATR_CJK_FONTSIZE:
+ case RES_CHRATR_CJK_LANGUAGE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CJK_WEIGHT:
+ if(aCJKOptions.IsCJKFontEnabled())
+ bIsDefault = TRUE;
+ if(!bHasCJKFontPrefix)
+ {
+ aItemPresentation.Insert(SW_RESSTR(STR_CJK_FONT), 0);
+ bHasCJKFontPrefix = TRUE;
+ }
+ break;
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_LANGUAGE:
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_WEIGHT:
+ if(!bHasWesternFontPrefix)
+ {
+ aItemPresentation.Insert(SW_RESSTR(STR_WESTERN_FONT), 0);
+ bHasWesternFontPrefix = TRUE;
+ bIsDefault = TRUE;
+ }
+ // no break;
+ default:
+ bIsDefault = TRUE;
+ }
+ if(bIsDefault)
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+ aDesc += sPlus;
+ aDesc += aItemPresentation;
+ }
+ }
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ //Sonderbehandlung fuer Umburch, Seitenvorlage und Seitenoffset
+ if(sBreak.Len() && !sModel.Len()) // wemm Model. dann ist Break ungueltig
+ {
+ if(aDesc.Len())
+ aDesc += sPlus;
+ aDesc += sBreak;
+ }
+ if(sModel.Len())
+ {
+ if(aDesc.Len())
+ aDesc += sPlus;
+ aDesc += SW_RESSTR(STR_PAGEBREAK);
+ aDesc += sPlus;
+ aDesc += sModel;
+ if(sPageNum != String(UniString::CreateFromInt32(0)))
+ {
+ aDesc += sPlus;
+ aDesc += SW_RESSTR(STR_PAGEOFFSET);
+ aDesc += sPageNum;
+ }
+ }
+ return aDesc;
+ }
+ else if( SFX_STYLE_FAMILY_PSEUDO == nFamily )
+ {
+// if( pNumRule )
+// return pNumRule->GetName();
+ //os: was sollte man bei Numerierungen schon anzeigen?
+ return aEmptyStr;
+ }
+
+ return SfxStyleSheetBase::GetDescription(eUnit);
+}
+
+
+String SwDocStyleSheet::GetDescription()
+{
+ return GetDescription(SFX_MAPUNIT_CM);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Namen setzen
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetName( const String& rStr)
+{
+ if( !rStr.Len() )
+ return FALSE;
+
+ if( aName != rStr )
+ {
+ if( !SfxStyleSheetBase::SetName( rStr ))
+ return FALSE;
+ }
+ else if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ int bChg = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ {
+ ASSERT(pCharFmt, "SwCharFormat fehlt!");
+ if( pCharFmt && pCharFmt->GetName() != rStr )
+ {
+ pCharFmt->SetName( rStr );
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Collektion fehlt!");
+ if( pColl && pColl->GetName() != rStr )
+ {
+ if (pColl->GetName().Len() > 0)
+ rDoc.RenameFmt(*pColl, rStr);
+ else
+ pColl->SetName(rStr);
+
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ ASSERT(pFrmFmt, "FrmFmt fehlt!");
+ if( pFrmFmt && pFrmFmt->GetName() != rStr )
+ {
+ if (pFrmFmt->GetName().Len() > 0)
+ rDoc.RenameFmt(*pFrmFmt, rStr);
+ else
+ pFrmFmt->SetName( rStr );
+
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE :
+ ASSERT(pDesc, "PageDesc fehlt!");
+ if( pDesc && pDesc->GetName() != rStr )
+ {
+ //PageDesc setzen - mit vorherigem kopieren - ist fuer das
+ //setzen des Namens wohl nicht notwendig. Deshalb erlauben
+ //wir hier mal einen cast.
+ // -> #116530#
+ SwPageDesc aPageDesc(*((SwPageDesc*)pDesc));
+ String aOldName(aPageDesc.GetName());
+
+ aPageDesc.SetName( rStr );
+ BOOL bDoesUndo = rDoc.DoesUndo();
+
+ rDoc.DoUndo(aOldName.Len() > 0);
+ rDoc.ChgPageDesc(aOldName, aPageDesc);
+ rDoc.DoUndo(bDoesUndo);
+ // <- #116530#
+
+ rDoc.SetModified();
+ bChg = TRUE;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ ASSERT(pNumRule, "NumRule fehlt!");
+
+ // -> #106897#
+ if (pNumRule)
+ {
+ String aOldName = pNumRule->GetName();
+
+ if (aOldName.Len() > 0)
+ {
+ if ( aOldName != rStr &&
+ rDoc.RenameNumRule(aOldName, rStr))
+ {
+ pNumRule = rDoc.FindNumRulePtr(rStr);
+ rDoc.SetModified();
+
+ bChg = TRUE;
+ }
+ }
+ else
+ {
+ // --> OD 2008-07-08 #i91400#
+ ((SwNumRule*)pNumRule)->SetName( rStr, rDoc );
+ // <--
+ rDoc.SetModified();
+
+ bChg = TRUE;
+ }
+ }
+ // <- #106897#
+
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ if( bChg )
+ {
+ rPool.First(); // interne Liste muss geupdatet werden
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ SwEditShell* pSh = rDoc.GetEditShell();
+ if( pSh )
+ pSh->CallChgLnk();
+ }
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ableitungshirachie
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetParent( const String& rStr)
+{
+ SwFmt* pFmt = 0, *pParent = 0;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ ASSERT( pCharFmt, "SwCharFormat fehlt!" )
+ if( 0 != ( pFmt = pCharFmt ) && rStr.Len() )
+ pParent = lcl_FindCharFmt(rDoc, rStr);
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ ASSERT( pColl, "Collektion fehlt!")
+ if( 0 != ( pFmt = pColl ) && rStr.Len() )
+ pParent = lcl_FindParaFmt( rDoc, rStr );
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ ASSERT(pFrmFmt, "FrameFormat fehlt!");
+ if( 0 != ( pFmt = pFrmFmt ) && rStr.Len() )
+ pParent = lcl_FindFrmFmt( rDoc, rStr );
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ BOOL bRet = FALSE;
+ if( pFmt && pFmt->DerivedFrom() &&
+ pFmt->DerivedFrom()->GetName() != rStr )
+ {
+ {
+ SwImplShellAction aTmp( rDoc );
+ bRet = pFmt->SetDerivedFrom( pParent );
+ }
+
+ if( bRet )
+ {
+ aParent = rStr;
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
+ *this ) );
+ }
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nachfolger detzen
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetFollow( const String& rStr)
+{
+ if( rStr.Len() && !SfxStyleSheetBase::SetFollow( rStr ))
+ return FALSE;
+
+ SwImplShellAction aTmpSh( rDoc );
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Collection fehlt!");
+ if( pColl )
+ {
+ SwTxtFmtColl* pFollow = pColl;
+ if( rStr.Len() && 0 == (pFollow = lcl_FindParaFmt(rDoc, rStr) ))
+ pFollow = pColl;
+
+ pColl->SetNextTxtFmtColl(*pFollow);
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "PageDesc fehlt!");
+ if( pDesc )
+ {
+ const SwPageDesc* pFollowDesc = rStr.Len()
+ ? lcl_FindPageDesc(rDoc, rStr)
+ : 0;
+ USHORT nId;
+ if( pFollowDesc != pDesc->GetFollow() &&
+ rDoc.FindPageDescByName( pDesc->GetName(), &nId ) )
+ {
+ SwPageDesc aDesc( *pDesc );
+ aDesc.SetFollow( pFollowDesc );
+ rDoc.ChgPageDesc( nId, aDesc );
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nId );
+ }
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_CHAR:
+ case SFX_STYLE_FAMILY_FRAME:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ueber Name und Family, Mask den ItemSet rausholen
+ --------------------------------------------------------------------*/
+
+SfxItemSet& SwDocStyleSheet::GetItemSet()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ ASSERT(pCharFmt, "Wo ist das SwCharFmt");
+ aCoreSet.Put(pCharFmt->GetAttrSet());
+ if(pCharFmt->DerivedFrom())
+ aCoreSet.SetParent(&pCharFmt->DerivedFrom()->GetAttrSet());
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aBoxInfo.SetTable( FALSE );
+ aBoxInfo.SetDist( TRUE); // Abstandsfeld immer anzeigen
+ aBoxInfo.SetMinDist( TRUE );// Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetDefDist( MIN_BORDER_DIST );// Default-Abstand immer setzen
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid( VALID_DISABLE, TRUE );
+ if ( nFamily == SFX_STYLE_FAMILY_PARA )
+ {
+ ASSERT(pColl, "Wo ist die Collektion");
+ aCoreSet.Put(pColl->GetAttrSet());
+ aCoreSet.Put( aBoxInfo );
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFmt()));
+ if(pColl->DerivedFrom())
+ aCoreSet.SetParent(&pColl->DerivedFrom()->GetAttrSet());
+ }
+ else
+ {
+ ASSERT(pFrmFmt, "Wo ist das FrmFmt");
+ aCoreSet.Put(pFrmFmt->GetAttrSet());
+ aCoreSet.Put( aBoxInfo );
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrmFmt->IsAutoUpdateFmt()));
+ if(pFrmFmt->DerivedFrom())
+ aCoreSet.SetParent(&pFrmFmt->DerivedFrom()->GetAttrSet());
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "Kein PageDescriptor");
+ ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet);
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ ASSERT(pNumRule, "Keine NumRule");
+ SvxNumRule aRule = pNumRule->MakeSvxNumRule();
+ aCoreSet.Put(SvxNumBulletItem(aRule));
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ // Member der Basisklasse
+ pSet = &aCoreSet;
+
+ return aCoreSet;
+}
+
+// --> OD 2008-02-13 #newlistlevelattrs#
+void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
+{
+ if ( nFamily != SFX_STYLE_FAMILY_PARA )
+ {
+ return;
+ }
+
+ ASSERT( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
+ if ( pColl->AreListLevelIndentsApplicable() )
+ {
+ ASSERT( pColl->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET,
+ "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect -> please inform OD." );
+ const String sNumRule = pColl->GetNumRule().GetValue();
+ if( sNumRule.Len() )
+ {
+ const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
+ if( pRule )
+ {
+ const SwNumFmt& rFmt = pRule->Get( 0 );
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtLeft( rFmt.GetIndentAt() );
+ aLR.SetTxtFirstLineOfst( static_cast<short>(rFmt.GetFirstLineIndent()) );
+ rSet.Put( aLR );
+ }
+ }
+ }
+ }
+}
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung: ItemSet setzen
+ --------------------------------------------------------------------*/
+
+// --> OD 2008-02-12 #newlistlevelattrs#
+// handling of parameter <bResetIndentAttrsAtParagraphStyle>
+void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
+ const bool bResetIndentAttrsAtParagraphStyle )
+{
+ // gegebenenfalls Format erst ermitteln
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ SwImplShellAction aTmpSh( rDoc );
+
+ ASSERT( &rSet != &aCoreSet, "SetItemSet mit eigenem Set ist nicht erlaubt" );
+
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if ( rDoc.DoesUndo() )
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule( UNDO_ARG1, GetName() );
+ rDoc.StartUndo( UNDO_INSFMTATTR, &aRewriter );
+ }
+ // <--
+
+ SwFmt* pFmt = 0;
+ SwPageDesc* pNewDsc = 0;
+ USHORT nPgDscPos = 0;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ {
+ ASSERT(pCharFmt, "Wo ist das CharFormat");
+ pFmt = pCharFmt;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Wo ist die Collection");
+ const SfxPoolItem* pAutoUpdate;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,FALSE, &pAutoUpdate ))
+ {
+ pColl->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
+ }
+
+ const SwCondCollItem* pCondItem;
+ if( SFX_ITEM_SET != rSet.GetItemState( FN_COND_COLL, FALSE,
+ (const SfxPoolItem**)&pCondItem ))
+ pCondItem = 0;
+
+ if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
+ {
+ SwFmt* pFindFmt;
+ const CommandStruct* pCmds = SwCondCollItem::GetCmds();
+ for(USHORT i = 0; i < COND_COMMAND_COUNT; i++)
+ {
+ SwCollCondition aCond( 0, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
+ ((SwConditionTxtFmtColl*)pColl)->RemoveCondition( aCond );
+ const String& rStyle = pCondItem->GetStyle( i );
+ if( rStyle.Len() &&
+ 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, TRUE )))
+ {
+ pFindFmt->Add( &aCond );
+ ((SwConditionTxtFmtColl*)pColl)->InsertCondition( aCond );
+ }
+ }
+
+ // Document auf die neue Bedingungen updaten
+ SwCondCollCondChg aMsg( pColl );
+ pColl->Modify( &aMsg, &aMsg );
+ }
+ else if( pCondItem && !pColl->GetDepends() )
+ {
+ // keine bedingte Vorlage, dann erstmal erzeugen und
+ // alle wichtigen Werte uebernehmen
+ SwConditionTxtFmtColl* pCColl = rDoc.MakeCondTxtFmtColl(
+ pColl->GetName(), (SwTxtFmtColl*)pColl->DerivedFrom() );
+ if( pColl != &pColl->GetNextTxtFmtColl() )
+ pCColl->SetNextTxtFmtColl( pColl->GetNextTxtFmtColl() );
+
+ //pCColl->SetOutlineLevel( pColl->GetOutlineLevel() );//#outline level,zhaojianwei
+ if( pColl->IsAssignedToListLevelOfOutlineStyle())
+ pCColl->AssignToListLevelOfOutlineStyle(pColl->GetAssignedOutlineStyleLevel());
+ else
+ pCColl->DeleteAssignmentToListLevelOfOutlineStyle();//<--end,zhaojianwei
+
+
+
+ SwTxtFmtColl* pFindFmt;
+ const CommandStruct* pCmds = SwCondCollItem::GetCmds();
+ for( USHORT i = 0; i < COND_COMMAND_COUNT; ++i )
+ {
+ const String& rStyle = pCondItem->GetStyle( i );
+ if( rStyle.Len() &&
+ 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, TRUE )))
+ {
+ pCColl->InsertCondition( SwCollCondition( pFindFmt,
+ pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
+ }
+ }
+
+ rDoc.DelTxtFmtColl( pColl );
+ pColl = pCColl;
+ }
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if ( bResetIndentAttrsAtParagraphStyle &&
+ rSet.GetItemState( RES_PARATR_NUMRULE, FALSE, 0 ) == SFX_ITEM_SET &&
+ rSet.GetItemState( RES_LR_SPACE, FALSE, 0 ) != SFX_ITEM_SET &&
+ pColl->GetItemState( RES_LR_SPACE, FALSE, 0 ) == SFX_ITEM_SET )
+ {
+ rDoc.ResetAttrAtFormat( RES_LR_SPACE, *pColl );
+ }
+ // <--
+
+ // #i56252: If a standard numbering style is assigned to a standard paragraph style
+ // we have to create a physical instance of the numbering style. If we do not and
+ // neither the paragraph style nor the numbering style is used in the document
+ // the numbering style will not be saved with the document and the assignment got lost.
+ const SfxPoolItem* pNumRuleItem = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, FALSE, &pNumRuleItem ) )
+ { // Setting a numbering rule?
+ String sNumRule = ((SwNumRuleItem*)pNumRuleItem)->GetValue();
+ if( sNumRule.Len() )
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
+ if( !pRule )
+ { // Numbering rule not in use yet.
+ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
+ {
+ pRule = rDoc.GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
+ }
+ }
+ }
+ }
+
+ pFmt = pColl;
+
+ USHORT nId = pColl->GetPoolFmtId() &
+ ~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID );
+ switch( GetMask() & ( 0x0fff & ~SWSTYLEBIT_CONDCOLL ) )
+ {
+ case SWSTYLEBIT_TEXT:
+ nId |= COLL_TEXT_BITS;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ nId |= COLL_DOC_BITS;
+ break;
+ case SWSTYLEBIT_LIST:
+ nId |= COLL_LISTS_BITS;
+ break;
+ case SWSTYLEBIT_IDX:
+ nId |= COLL_REGISTER_BITS;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ nId |= COLL_EXTRA_BITS;
+ break;
+ case SWSTYLEBIT_HTML:
+ nId |= COLL_HTML_BITS;
+ break;
+ }
+ pColl->SetPoolFmtId( nId );
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ ASSERT(pFrmFmt, "Wo ist das FrmFmt");
+ const SfxPoolItem* pAutoUpdate;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,FALSE, &pAutoUpdate ))
+ {
+ pFrmFmt->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
+ }
+ pFmt = pFrmFmt;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "Wo ist der PageDescriptor");
+
+ if( rDoc.FindPageDescByName( pDesc->GetName(), &nPgDscPos ))
+ {
+ pNewDsc = new SwPageDesc( *pDesc );
+ // --> OD 2005-05-09 #i48949# - no undo actions for the
+ // copy of the page style
+ const sal_Bool bDoesUndo( rDoc.DoesUndo() );
+ rDoc.DoUndo( sal_False );
+ rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
+ rDoc.DoUndo( bDoesUndo );
+ // <--
+
+ pFmt = &pNewDsc->GetMaster();
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ ASSERT(pNumRule, "Wo ist die NumRule");
+
+ if (!pNumRule)
+ break;
+
+ const SfxPoolItem* pItem;
+ switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, FALSE, &pItem ))
+ {
+ case SFX_ITEM_SET:
+ {
+ SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ pSetRule->UnLinkGraphics();
+ //SwNumRule aSetRule(rDoc.GetUniqueNumRuleName());
+ SwNumRule aSetRule(*pNumRule);
+ aSetRule.SetSvxRule(*pSetRule, &rDoc);
+ rDoc.ChgNumRuleFmts( aSetRule );
+ }
+ break;
+ case SFX_ITEM_DONTCARE:
+ // NumRule auf default Werte
+ // was sind die default Werte?
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aRule( pNumRule->GetName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ rDoc.ChgNumRuleFmts( aRule );
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ if( pFmt && rSet.Count())
+ {
+ SfxItemIter aIter( rSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ while( TRUE )
+ {
+ if( IsInvalidItem( pItem ) ) // Clearen
+ {
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // use method <SwDoc::ResetAttrAtFormat(..)> in order to
+ // create an Undo object for the attribute reset.
+// pFmt->ResetAttr( rSet.GetWhichByPos(aIter.GetCurPos()));
+ rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
+ *pFmt );
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ SfxItemSet aSet(rSet);
+ aSet.ClearInvalidItems();
+
+ aCoreSet.ClearItem();
+
+ if( pNewDsc )
+ {
+ ::ItemSetToPageDesc( aSet, *pNewDsc );
+ rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nPgDscPos );
+ rDoc.PreDelPageDesc(pNewDsc); // #i7983#
+ delete pNewDsc;
+ }
+ else
+ rDoc.ChgFmt(*pFmt, aSet); // alles gesetzten Putten
+ }
+ else
+ {
+ aCoreSet.ClearItem();
+ if( pNewDsc ) // den muessen wir noch vernichten!!
+ {
+ rDoc.PreDelPageDesc(pNewDsc); // #i7983#
+ delete pNewDsc;
+ }
+ }
+
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if ( rDoc.DoesUndo() )
+ {
+ rDoc.EndUndo( UNDO_INSFMTATTR, NULL );
+ }
+ // <--
+}
+
+void lcl_SaveStyles( USHORT nFamily, SvPtrarr& rArr, SwDoc& rDoc )
+{
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ const SwCharFmts& rTbl = *rDoc.GetCharFmts();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ for( sal_uInt16 n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
+ {
+ void* p =
+ (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ }
+}
+
+void lcl_DeleteInfoStyles( USHORT nFamily, SvPtrarr& rArr, SwDoc& rDoc )
+{
+ sal_uInt16 n, nCnt;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SvUShorts aDelArr;
+ const SwCharFmts& rTbl = *rDoc.GetCharFmts();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelCharFmt( aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ SvUShorts aDelArr;
+ const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelTxtFmtColl( aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SvPtrarr aDelArr;
+ const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( p, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelFrmFmt( (SwFrmFmt*)aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SvUShorts aDelArr;
+ for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
+ {
+ void* p =
+ (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelPageDesc( aDelArr[ n ] );
+ }
+ break;
+
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SvPtrarr aDelArr;
+ const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( p, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelNumRule( ((SwNumRule*)aDelArr[ n ])->GetName() );
+ }
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Das Format ermitteln
+ --------------------------------------------------------------------*/
+
+BOOL SwDocStyleSheet::FillStyleSheet( FillStyleType eFType )
+{
+ BOOL bRet = FALSE;
+ USHORT nPoolId = USHRT_MAX;
+ SwFmt* pFmt = 0;
+
+ BOOL bCreate = FillPhysical == eFType;
+ BOOL bDeleteInfo = FALSE;
+ BOOL bFillOnlyInfo = FillAllInfo == eFType;
+ SvPtrarr aDelArr;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pCharFmt = lcl_FindCharFmt(rDoc, aName, this, bCreate );
+ bPhysical = 0 != pCharFmt;
+ if( bFillOnlyInfo && !bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pCharFmt = lcl_FindCharFmt(rDoc, aName, this, TRUE );
+ }
+
+ pFmt = pCharFmt;
+ if( !bCreate && !pFmt )
+ {
+ if( aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] )
+ nPoolId = 0;
+ else
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ }
+
+ bRet = 0 != pCharFmt || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pCharFmt = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ pColl = lcl_FindParaFmt(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pColl;
+ if( bFillOnlyInfo && !bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pColl = lcl_FindParaFmt(rDoc, aName, this, TRUE );
+ }
+
+ pFmt = pColl;
+ if( pColl )
+ PresetFollow( pColl->GetNextTxtFmtColl().GetName() );
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+
+ bRet = 0 != pColl || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pColl = 0;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pFrmFmt;
+ if( bFillOnlyInfo && bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, TRUE );
+ }
+ pFmt = pFrmFmt;
+ if( !bCreate && !pFmt )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
+
+ bRet = 0 != pFrmFmt || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pFrmFmt = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pDesc;
+ if( bFillOnlyInfo && !pDesc )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pDesc = lcl_FindPageDesc( rDoc, aName, this, TRUE );
+ }
+
+ if( pDesc )
+ {
+ nPoolId = pDesc->GetPoolFmtId();
+ nHelpId = pDesc->GetPoolHelpId();
+ if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+ }
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
+ SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
+
+ bRet = 0 != pDesc || USHRT_MAX != nPoolId;
+ if( bDeleteInfo )
+ pDesc = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pNumRule;
+ if( bFillOnlyInfo && !pNumRule )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pNumRule = lcl_FindNumRule( rDoc, aName, this, TRUE );
+ }
+
+ if( pNumRule )
+ {
+ nPoolId = pNumRule->GetPoolFmtId();
+ nHelpId = pNumRule->GetPoolHelpId();
+ if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pNumRule->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+ }
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
+
+ bRet = 0 != pNumRule || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pNumRule = 0;
+ break;
+ default:; //prevent warning
+ }
+
+ if( SFX_STYLE_FAMILY_CHAR == nFamily ||
+ SFX_STYLE_FAMILY_PARA == nFamily ||
+ SFX_STYLE_FAMILY_FRAME == nFamily )
+ {
+ if( pFmt )
+ nPoolId = pFmt->GetPoolFmtId();
+
+ USHORT _nMask = 0;
+ if( pFmt == rDoc.GetDfltCharFmt() )
+ _nMask |= SFXSTYLEBIT_READONLY;
+ else if( USER_FMT & nPoolId )
+ _nMask |= SFXSTYLEBIT_USERDEF;
+
+ switch ( COLL_GET_RANGE_BITS & nPoolId )
+ {
+ case COLL_TEXT_BITS: _nMask |= SWSTYLEBIT_TEXT; break;
+ case COLL_DOC_BITS : _nMask |= SWSTYLEBIT_CHAPTER; break;
+ case COLL_LISTS_BITS: _nMask |= SWSTYLEBIT_LIST; break;
+ case COLL_REGISTER_BITS: _nMask |= SWSTYLEBIT_IDX; break;
+ case COLL_EXTRA_BITS: _nMask |= SWSTYLEBIT_EXTRA; break;
+ case COLL_HTML_BITS: _nMask |= SWSTYLEBIT_HTML; break;
+ }
+
+ if( pFmt )
+ {
+ ASSERT( bPhysical, "Format nicht gefunden" );
+
+ nHelpId = pFmt->GetPoolHelpId();
+ if( pFmt->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pFmt->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+
+ if( RES_CONDTXTFMTCOLL == pFmt->Which() )
+ _nMask |= SWSTYLEBIT_CONDCOLL;
+ }
+
+ SetMask( _nMask );
+ }
+ if( bDeleteInfo && bFillOnlyInfo )
+ ::lcl_DeleteInfoStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Neues Format in der Core anlegen
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::Create()
+{
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ pCharFmt = lcl_FindCharFmt( rDoc, aName );
+ if( !pCharFmt )
+ pCharFmt = rDoc.MakeCharFmt(aName,
+ rDoc.GetDfltCharFmt());
+ pCharFmt->SetAuto( FALSE );
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ pColl = lcl_FindParaFmt( rDoc, aName );
+ if( !pColl )
+ {
+ SwTxtFmtColl *pPar = (*rDoc.GetTxtFmtColls())[0];
+ if( nMask & SWSTYLEBIT_CONDCOLL )
+ pColl = rDoc.MakeCondTxtFmtColl( aName, pPar );
+ else
+ pColl = rDoc.MakeTxtFmtColl( aName, pPar );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFrmFmt = lcl_FindFrmFmt( rDoc, aName );
+ if( !pFrmFmt )
+ pFrmFmt = rDoc.MakeFrmFmt(aName, rDoc.GetDfltFrmFmt(), FALSE, FALSE);
+
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ pDesc = lcl_FindPageDesc( rDoc, aName );
+ if( !pDesc )
+ {
+ USHORT nId = rDoc.MakePageDesc(aName);
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc(nId);
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ pNumRule = lcl_FindNumRule( rDoc, aName );
+ if( !pNumRule )
+ {
+ //JP 05.02.99: temp Namen erzeugen, damit kein ASSERT kommt
+ String sTmpNm( aName );
+ if( !aName.Len() )
+ sTmpNm = rDoc.GetUniqueNumRuleName();
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule* pRule = rDoc.GetNumRuleTbl()[
+ rDoc.MakeNumRule( sTmpNm, 0, FALSE,
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() ) ];
+ // <--
+ // <--
+ pRule->SetAutoRule( FALSE );
+ if( !aName.Len() )
+ {
+ // --> OD 2008-07-08 #i91400#
+ pRule->SetName( aName, rDoc );
+ // <--
+ }
+ pNumRule = pRule;
+ }
+ break;
+ default:; //prevent warning
+ }
+ bPhysical = TRUE;
+ aCoreSet.ClearItem();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Konkrete Formate rausholen
+ --------------------------------------------------------------------*/
+
+
+
+SwCharFmt* SwDocStyleSheet::GetCharFmt()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pCharFmt;
+}
+
+
+SwTxtFmtColl* SwDocStyleSheet::GetCollection()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pColl;
+}
+
+
+const SwPageDesc* SwDocStyleSheet::GetPageDesc()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pDesc;
+}
+
+const SwNumRule * SwDocStyleSheet::GetNumRule()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pNumRule;
+}
+
+void SwDocStyleSheet::SetNumRule(const SwNumRule& rRule)
+{
+ DBG_ASSERT(pNumRule, "Wo ist die NumRule");
+ rDoc.ChgNumRuleFmts( rRule );
+}
+
+// Namen UND Familie aus String re-generieren
+// First() und Next() (s.u.) fuegen einen Kennbuchstaben an Pos.1 ein
+
+void SwDocStyleSheet::PresetNameAndFamily(const String& rName)
+{
+ switch( rName.GetChar(0) )
+ {
+ case cPARA: nFamily = SFX_STYLE_FAMILY_PARA; break;
+ case cFRAME: nFamily = SFX_STYLE_FAMILY_FRAME; break;
+ case cPAGE: nFamily = SFX_STYLE_FAMILY_PAGE; break;
+ case cNUMRULE: nFamily = SFX_STYLE_FAMILY_PSEUDO; break;
+ default: nFamily = SFX_STYLE_FAMILY_CHAR; break;
+ }
+ aName = rName;
+ aName.Erase( 0, 1 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ist das Format physikalisch schon vorhanden
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::SetPhysical(BOOL bPhys)
+{
+ bPhysical = bPhys;
+
+ if(!bPhys)
+ {
+ pCharFmt = 0;
+ pColl = 0;
+ pFrmFmt = 0;
+ pDesc = 0;
+ }
+}
+
+SwFrmFmt* SwDocStyleSheet::GetFrmFmt()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pFrmFmt;
+}
+
+
+BOOL SwDocStyleSheet::IsUsed() const
+{
+ if( !bPhysical )
+ {
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->FillStyleSheet( FillOnlyName );
+ }
+
+ // immer noch nicht ?
+ if( !bPhysical )
+ return FALSE;
+
+ const SwModify* pMod;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR : pMod = pCharFmt; break;
+ case SFX_STYLE_FAMILY_PARA : pMod = pColl; break;
+ case SFX_STYLE_FAMILY_FRAME: pMod = pFrmFmt; break;
+ case SFX_STYLE_FAMILY_PAGE : pMod = pDesc; break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return pNumRule ? rDoc.IsUsed( *pNumRule ) : FALSE;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return FALSE;
+ }
+ return rDoc.IsUsed( *pMod );
+}
+
+
+ULONG SwDocStyleSheet::GetHelpId( String& rFile )
+{
+static String sTemplateHelpFile = String::CreateFromAscii("swrhlppi.hlp");
+
+ USHORT nId = 0;
+ USHORT nPoolId = 0;
+ unsigned char nFileId = UCHAR_MAX;
+
+ rFile = sTemplateHelpFile;
+
+ const SwFmt* pTmpFmt = 0;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( !pCharFmt &&
+ 0 == (pCharFmt = lcl_FindCharFmt( rDoc, aName, 0, FALSE )) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pCharFmt;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ if( !pColl &&
+ 0 == ( pColl = lcl_FindParaFmt( rDoc, aName, 0, FALSE )) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pColl;
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ if( !pFrmFmt &&
+ 0 == ( pFrmFmt = lcl_FindFrmFmt( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pFrmFmt;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ if( !pDesc &&
+ 0 == ( pDesc = lcl_FindPageDesc( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+
+ nId = pDesc->GetPoolHelpId();
+ nFileId = pDesc->GetPoolHlpFileId();
+ nPoolId = pDesc->GetPoolFmtId();
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ if( !pNumRule &&
+ 0 == ( pNumRule = lcl_FindNumRule( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+
+ nId = pNumRule->GetPoolHelpId();
+ nFileId = pNumRule->GetPoolHlpFileId();
+ nPoolId = pNumRule->GetPoolFmtId();
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return 0;
+ }
+
+ if( pTmpFmt )
+ {
+ nId = pTmpFmt->GetPoolHelpId();
+ nFileId = pTmpFmt->GetPoolHlpFileId();
+ nPoolId = pTmpFmt->GetPoolFmtId();
+ }
+
+ if( UCHAR_MAX != nFileId )
+ {
+ const String *pTemplate = rDoc.GetDocPattern( nFileId );
+ if( pTemplate )
+ {
+// const String aHelpPath(MakeHelpPath(*pTemplate));
+ rFile = *pTemplate;
+ }
+ }
+ else if( !IsPoolUserFmt( nPoolId ) )
+ {
+ nId = nPoolId;
+ }
+
+ // weil sich der SFX so anstellt mit der HilfeId:
+ if( USHRT_MAX == nId )
+ nId = 0; // entsp. keine Hilfe anzeigen
+
+ return nId;
+}
+
+
+void SwDocStyleSheet::SetHelpId( const String& r, ULONG nId )
+{
+ BYTE nFileId = static_cast< BYTE >(rDoc.SetDocPattern( r ));
+ USHORT nHId = static_cast< USHORT >(nId); //!! SFX hat eigenmaechtig auf ULONG umgestellt!
+
+ SwFmt* pTmpFmt = 0;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR : pTmpFmt = pCharFmt; break;
+ case SFX_STYLE_FAMILY_PARA : pTmpFmt = pColl; break;
+ case SFX_STYLE_FAMILY_FRAME: pTmpFmt = pFrmFmt; break;
+ case SFX_STYLE_FAMILY_PAGE :
+ ((SwPageDesc*)pDesc)->SetPoolHelpId( nHId );
+ ((SwPageDesc*)pDesc)->SetPoolHlpFileId( nFileId );
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ ((SwNumRule*)pNumRule)->SetPoolHelpId( nHId );
+ ((SwNumRule*)pNumRule)->SetPoolHlpFileId( nFileId );
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return ;
+ }
+ if( pTmpFmt )
+ {
+ pTmpFmt->SetPoolHelpId( nHId );
+ pTmpFmt->SetPoolHlpFileId( nFileId );
+ }
+}
+
+
+/* */
+
+/*--------------------------------------------------------------------
+ Beschreibung: Methoden fuer den DocStyleSheetPool
+ --------------------------------------------------------------------*/
+
+SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, BOOL bOrg )
+: SfxStyleSheetBasePool( rDocument.GetAttrPool() )
+, mxStyleSheet( new SwDocStyleSheet( rDocument, aEmptyStr, *this, SFX_STYLE_FAMILY_CHAR, 0 ) )
+, rDoc( rDocument )
+{
+ bOrganizer = bOrg;
+}
+
+ SwDocStyleSheetPool::~SwDocStyleSheetPool()
+{
+}
+
+void SAL_CALL SwDocStyleSheetPool::acquire( ) throw ()
+{
+ comphelper::OWeakTypeObject::acquire();
+}
+
+void SAL_CALL SwDocStyleSheetPool::release( ) throw ()
+{
+ comphelper::OWeakTypeObject::release();
+}
+
+SfxStyleSheetBase& SwDocStyleSheetPool::Make(
+ const String& rName,
+ SfxStyleFamily eFam,
+ USHORT _nMask,
+ USHORT /*nPos*/ )
+{
+ mxStyleSheet->PresetName(rName);
+ mxStyleSheet->PresetParent(aEmptyStr);
+ mxStyleSheet->PresetFollow(aEmptyStr);
+ mxStyleSheet->SetMask(_nMask) ;
+ mxStyleSheet->SetFamily(eFam);
+ mxStyleSheet->SetPhysical(TRUE);
+ mxStyleSheet->Create();
+
+ return *mxStyleSheet.get();
+}
+
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Create( const SfxStyleSheetBase& /*rOrg*/)
+{
+ ASSERT(!this , "Create im SW-Stylesheet-Pool geht nicht" );
+ return NULL;
+}
+
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Create( const String &,
+ SfxStyleFamily, USHORT )
+{
+ ASSERT( !this, "Create im SW-Stylesheet-Pool geht nicht" );
+ return NULL;
+}
+
+void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
+ SfxStyleSheetBase& rTarget )
+{
+ SfxStyleFamily eFamily( rSource.GetFamily() );
+ if( rSource.HasParentSupport())
+ {
+ const String& rParentName = rSource.GetParent();
+ if( 0 != rParentName.Len() )
+ {
+ SfxStyleSheetBase* pParentOfNew = Find( rParentName, eFamily );
+ if( pParentOfNew )
+ rTarget.SetParent( rParentName );
+ }
+ }
+ if( rSource.HasFollowSupport())
+ {
+ const String& rFollowName = rSource.GetFollow();
+ if( 0 != rFollowName.Len() )
+ {
+ SfxStyleSheetBase* pFollowOfNew = Find( rFollowName, eFamily );
+ if( pFollowOfNew )
+ rTarget.SetFollow( rFollowName );
+ }
+ }
+
+ SwImplShellAction aTmpSh( rDoc );
+
+ BOOL bSwSrcPool = GetAppName() == rSource.GetPool().GetAppName();
+ if( SFX_STYLE_FAMILY_PAGE == eFamily && bSwSrcPool )
+ {
+ // gesondert behandeln!!
+ SwPageDesc* pDestDsc =
+ (SwPageDesc*)((SwDocStyleSheet&)rTarget).GetPageDesc();
+ SwPageDesc* pCpyDsc =
+ (SwPageDesc*)((SwDocStyleSheet&)rSource).GetPageDesc();
+ rDoc.CopyPageDesc( *pCpyDsc, *pDestDsc );
+ }
+ else
+ {
+ const SwFmt *pSourceFmt = 0;
+ SwFmt *pTargetFmt = 0;
+ USHORT nPgDscPos = USHRT_MAX;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetCharFmt();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetCollection();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCollection();
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetFrmFmt();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ if( bSwSrcPool )
+ pSourceFmt = &((SwDocStyleSheet&)rSource).GetPageDesc()
+ ->GetMaster();
+ {
+ SwPageDesc *pDesc = rDoc.FindPageDescByName(
+ ((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
+ &nPgDscPos );
+
+ if( pDesc )
+ pTargetFmt = &pDesc->GetMaster();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ // Eine NumRule besteht nur aus einem Item, also muss man
+ // hier nichts loeschen.
+ break;
+ default:; //prevent warning
+ }
+ if( pTargetFmt )
+ {
+ if( pSourceFmt )
+ pTargetFmt->DelDiffs( *pSourceFmt );
+ else if( USHRT_MAX != nPgDscPos )
+ pTargetFmt->ResetFmtAttr( RES_PAGEDESC, RES_FRMATR_END-1 );
+ else
+ {
+ // --> OD 2007-01-25 #i73790# - method renamed
+ pTargetFmt->ResetAllFmtAttr();
+ // <--
+ }
+
+ if( USHRT_MAX != nPgDscPos )
+ rDoc.ChgPageDesc( nPgDscPos,
+ const_cast<const SwDoc &>(rDoc).
+ GetPageDesc(nPgDscPos) );
+ }
+ ((SwDocStyleSheet&)rTarget).SetItemSet( rSource.GetItemSet() );
+ }
+}
+
+SfxStyleSheetIterator* SwDocStyleSheetPool::CreateIterator(
+ SfxStyleFamily eFam, USHORT _nMask )
+{
+ return new SwStyleSheetIterator( this, eFam, _nMask );
+}
+
+void SwDocStyleSheetPool::dispose()
+{
+ mxStyleSheet.clear();
+}
+
+void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
+{
+ if( !pStyle )
+ return;
+
+ BOOL bBroadcast = TRUE;
+ SwImplShellAction aTmpSh( rDoc );
+ const String& rName = pStyle->GetName();
+ switch( pStyle->GetFamily() )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pFmt = lcl_FindCharFmt(rDoc, rName, 0, FALSE );
+ if(pFmt)
+ rDoc.DelCharFmt(pFmt);
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = lcl_FindParaFmt(rDoc, rName, 0, FALSE );
+ if(pColl)
+ rDoc.DelTxtFmtColl(pColl);
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFmt = lcl_FindFrmFmt(rDoc, rName, 0, FALSE );
+ if(pFmt)
+ rDoc.DelFrmFmt(pFmt);
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ USHORT nPos;
+ if( rDoc.FindPageDescByName( rName, &nPos ))
+ rDoc.DelPageDesc( nPos );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if( !rDoc.DelNumRule( rName ) )
+ // Broadcast nur versenden, wenn etwas geloescht wurde
+ bBroadcast = FALSE;
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ bBroadcast = FALSE;
+ }
+
+ if( bBroadcast )
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *pStyle ) );
+}
+
+
+
+BOOL SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam,
+ const String &rStyle, const String &rParent )
+{
+ SwFmt* pFmt = 0, *pParent = 0;
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( 0 != ( pFmt = lcl_FindCharFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindCharFmt(rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ if( 0 != ( pFmt = lcl_FindParaFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindParaFmt( rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ if( 0 != ( pFmt = lcl_FindFrmFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindFrmFmt( rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ BOOL bRet = FALSE;
+ if( pFmt && pFmt->DerivedFrom() &&
+ pFmt->DerivedFrom()->GetName() != rParent )
+ {
+ {
+ SwImplShellAction aTmpSh( rDoc );
+ bRet = pFmt->SetDerivedFrom( pParent );
+ }
+
+ if( bRet )
+ {
+ // nur fuer das Broadcasting
+ mxStyleSheet->PresetName( rStyle );
+ mxStyleSheet->PresetParent( rParent );
+ if( SFX_STYLE_FAMILY_PARA == eFam )
+ mxStyleSheet->PresetFollow( ((SwTxtFmtColl*)pFmt)->
+ GetNextTxtFmtColl().GetName() );
+ else
+ mxStyleSheet->PresetFollow( aEmptyStr );
+
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
+ *(mxStyleSheet.get()) ) );
+ }
+ }
+
+ return bRet;
+}
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
+ SfxStyleFamily eFam, USHORT n )
+{
+ USHORT nSMask = n;
+ if( SFX_STYLE_FAMILY_PARA == eFam && rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ {
+ // dann sind nur HTML-Vorlagen von Interesse
+ if( USHRT_MAX == nSMask )
+ nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED;
+ else
+ nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
+ SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
+ if( !nSMask )
+ nSMask = SWSTYLEBIT_HTML;
+ }
+
+ const BOOL bSearchUsed = ( n != SFXSTYLEBIT_ALL &&
+ n & SFXSTYLEBIT_USED ) ? TRUE : FALSE;
+ const SwModify* pMod = 0;
+
+ mxStyleSheet->SetPhysical( FALSE );
+ mxStyleSheet->PresetName( rName );
+ mxStyleSheet->SetFamily( eFam );
+ BOOL bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+
+ if( mxStyleSheet->IsPhysical() )
+ {
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pMod = mxStyleSheet->GetCharFmt();
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pMod = mxStyleSheet->GetCollection();
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pMod = mxStyleSheet->GetFrmFmt();
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ pMod = mxStyleSheet->GetPageDesc();
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRule* pRule = mxStyleSheet->GetNumRule();
+ if( pRule &&
+ !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pRule)) ) &&
+ (( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(pRule->GetPoolFmtId() & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bSearchUsed ))
+ bFnd = FALSE;
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ }
+
+ // dann noch die Maske auswerten:
+ if( pMod && !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pMod)) ) )
+ {
+ const USHORT nId = SFX_STYLE_FAMILY_PAGE == eFam
+ ? ((SwPageDesc*)pMod)->GetPoolFmtId()
+ : ((SwFmt*)pMod)->GetPoolFmtId();
+
+ if( ( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bSearchUsed )
+ bFnd = FALSE;
+ }
+ return bFnd ? mxStyleSheet.get() : 0;
+}
+
+/* */
+
+SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
+ SfxStyleFamily eFam, USHORT n )
+ : SfxStyleSheetIterator( pBase, eFam, n ),
+ mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) ),
+ mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) )
+{
+ bFirstCalled = FALSE;
+ nLastPos = 0;
+ StartListening( *pBase );
+}
+
+ SwStyleSheetIterator::~SwStyleSheetIterator()
+{
+ EndListening( mxIterSheet->GetPool() );
+}
+
+USHORT SwStyleSheetIterator::Count()
+{
+ // Liste richtig fuellen lassen !!
+ if( !bFirstCalled )
+ First();
+ return aLst.Count();
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::operator[]( USHORT nIdx )
+{
+ // gefunden
+ if( !bFirstCalled )
+ First();
+ mxStyleSheet->PresetNameAndFamily( *aLst[ nIdx ] );
+ mxStyleSheet->SetPhysical( FALSE );
+ mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+
+ return mxStyleSheet.get();
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::First()
+{
+ // Alte Liste loeschen
+ bFirstCalled = TRUE;
+ nLastPos = 0;
+ aLst.Erase();
+
+ // aktuellen loeschen
+ mxIterSheet->Reset();
+
+ SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ const USHORT nSrchMask = nMask;
+ const BOOL bIsSearchUsed = SearchUsed();
+
+ const BOOL bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
+ || nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nArrLen = rDoc.GetCharFmts()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
+ if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
+ continue;
+
+ const BOOL bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFmt));
+ if( !bUsed )
+ {
+ // Standard ist keine Benutzervorlage #46181#
+ const USHORT nId = rDoc.GetDfltCharFmt() == pFmt ?
+ USHORT( RES_POOLCHR_INET_NORMAL ):
+ pFmt->GetPoolFmtId();
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+
+ if( rDoc.get(IDocumentSettingAccess::HTML_MODE) && !(nId & USER_FMT) &&
+ !( RES_POOLCHR_HTML_BEGIN <= nId &&
+ nId < RES_POOLCHR_HTML_END ) &&
+ RES_POOLCHR_INET_NORMAL != nId &&
+ RES_POOLCHR_INET_VISIT != nId &&
+ RES_POOLCHR_FOOTNOTE != nId &&
+ RES_POOLCHR_ENDNOTE != nId )
+ continue;
+ }
+
+ aLst.Append( cCHAR, pFmt == rDoc.GetDfltCharFmt()
+ ? (const String&) *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ]
+ : pFmt->GetName() );
+ }
+
+ // PoolFormate
+ //
+ if( nSrchMask == SFXSTYLEBIT_ALL )
+ {
+ if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ else
+ {
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_INET_NORMAL - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_INET_VISIT - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_ENDNOTE - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_FOOTNOTE - RES_POOLCHR_BEGIN ] );
+ }
+ AppendStyleList(SwStyleNameMapper::GetHTMLChrFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ }
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PARA ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ USHORT nSMask = nSrchMask;
+ if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ {
+ // dann sind nur HTML-Vorlagen von Interesse
+ if( USHRT_MAX == nSMask )
+ nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
+ SFXSTYLEBIT_USED;
+ else
+ nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
+ SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
+ if( !nSMask )
+ nSMask = SWSTYLEBIT_HTML;
+ }
+
+ const USHORT nArrLen = rDoc.GetTxtFmtColls()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
+
+ if(pColl->IsDefault())
+ continue;
+
+ const BOOL bUsed = bOrganizer || rDoc.IsUsed(*pColl);
+ if( !(bIsSearchUsed && bUsed ))
+ {
+ const USHORT nId = pColl->GetPoolFmtId();
+ switch ( (nSMask & ~SFXSTYLEBIT_USED) )
+ {
+ case SFXSTYLEBIT_USERDEF:
+ if(!IsPoolUserFmt(nId)) continue;
+ break;
+ case SWSTYLEBIT_TEXT:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
+ break;
+ case SWSTYLEBIT_LIST:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
+ break;
+ case SWSTYLEBIT_IDX:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
+ break;
+
+ case SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF:
+ if(IsPoolUserFmt(nId))
+ break;
+ // ansonten weiter
+ case SWSTYLEBIT_HTML:
+ if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
+ {
+ // einige wollen wir aber auch in dieser Section sehen
+ BOOL bWeiter = TRUE;
+ switch( nId )
+ {
+ case RES_POOLCOLL_SENDADRESS: // --> ADDRESS
+ case RES_POOLCOLL_TABLE_HDLN: // --> TH
+ case RES_POOLCOLL_TABLE: // --> TD
+ case RES_POOLCOLL_TEXT: // --> P
+ case RES_POOLCOLL_HEADLINE_BASE:// --> H
+ case RES_POOLCOLL_HEADLINE1: // --> H1
+ case RES_POOLCOLL_HEADLINE2: // --> H2
+ case RES_POOLCOLL_HEADLINE3: // --> H3
+ case RES_POOLCOLL_HEADLINE4: // --> H4
+ case RES_POOLCOLL_HEADLINE5: // --> H5
+ case RES_POOLCOLL_HEADLINE6: // --> H6
+ case RES_POOLCOLL_STANDARD: // --> P
+ case RES_POOLCOLL_FOOTNOTE:
+ case RES_POOLCOLL_ENDNOTE:
+ bWeiter = FALSE;
+ break;
+ }
+ if( bWeiter )
+ continue;
+ }
+ break;
+ case SWSTYLEBIT_CONDCOLL:
+ if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
+ break;
+ default:
+ // benutzte gesucht und keine gefunden
+ if( bIsSearchUsed )
+ continue;
+ }
+ }
+ aLst.Append( cPARA, pColl->GetName() );
+ }
+
+ const BOOL bAll = nSMask == SFXSTYLEBIT_ALL;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
+ AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER )
+ AppendStyleList(SwStyleNameMapper::GetDocUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST )
+ AppendStyleList(SwStyleNameMapper::GetListsUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX )
+ AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA )
+ AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL )
+ {
+ if( !bIsSearchUsed ||
+ rDoc.IsPoolTxtCollUsed( RES_POOLCOLL_TEXT ))
+ aLst.Append( cPARA, *SwStyleNameMapper::GetTextUINameArray()[
+ RES_POOLCOLL_TEXT - RES_POOLCOLL_TEXT_BEGIN ] );
+ }
+ if ( bAll ||
+ (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_HTML ||
+ (nSMask & ~SFXSTYLEBIT_USED) ==
+ (SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) )
+ {
+ AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if( !bAll )
+ {
+ // dann auch die, die wir mappen:
+ static USHORT aPoolIds[] = {
+ RES_POOLCOLL_SENDADRESS, // --> ADDRESS
+ RES_POOLCOLL_TABLE_HDLN, // --> TH
+ RES_POOLCOLL_TABLE, // --> TD
+ RES_POOLCOLL_STANDARD, // --> P
+ RES_POOLCOLL_TEXT, // --> P
+ RES_POOLCOLL_HEADLINE_BASE, // --> H
+ RES_POOLCOLL_HEADLINE1, // --> H1
+ RES_POOLCOLL_HEADLINE2, // --> H2
+ RES_POOLCOLL_HEADLINE3, // --> H3
+ RES_POOLCOLL_HEADLINE4, // --> H4
+ RES_POOLCOLL_HEADLINE5, // --> H5
+ RES_POOLCOLL_HEADLINE6, // --> H6
+ RES_POOLCOLL_FOOTNOTE,
+ RES_POOLCOLL_ENDNOTE,
+ 0
+ };
+
+ USHORT* pPoolIds = aPoolIds;
+ String s;
+ while( *pPoolIds )
+ {
+ if( !bIsSearchUsed || rDoc.IsPoolTxtCollUsed( *pPoolIds ) )
+ aLst.Append( cPARA,
+ s = SwStyleNameMapper::GetUIName( *pPoolIds, s ));
+ ++pPoolIds;
+ }
+ }
+ }
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_FRAME ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nArrLen = rDoc.GetFrmFmts()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
+
+ if(pFmt->IsDefault() || pFmt->IsAuto())
+ {
+ continue;
+ }
+
+ const USHORT nId = pFmt->GetPoolFmtId();
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ {
+ continue;
+ }
+ }
+
+ aLst.Append( cFRAME, pFmt->GetName() );
+ }
+
+ // PoolFormate
+ //
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PAGE ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nCount = rDoc.GetPageDescCnt();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc& rDesc =
+ const_cast<const SwDoc &>(rDoc).GetPageDesc(i);
+ const USHORT nId = rDesc.GetPoolFmtId();
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+ }
+
+ aLst.Append( cPAGE, rDesc.GetName() );
+ }
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PSEUDO ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
+ for(USHORT i = 0; i < rNumTbl.Count(); ++i)
+ {
+ const SwNumRule& rRule = *rNumTbl[ i ];
+ if( !rRule.IsAutoRule() )
+ {
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(rRule.GetPoolFmtId() & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+ }
+
+ aLst.Append( cNUMRULE, rRule.GetName() );
+ }
+ }
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
+ }
+
+ if(aLst.Count() > 0)
+ {
+ nLastPos = USHRT_MAX;
+ return Next();
+ }
+ return 0;
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::Next()
+{
+ nLastPos++;
+ if(aLst.Count() > 0 && nLastPos < aLst.Count())
+ {
+ mxIterSheet->PresetNameAndFamily(*aLst[nLastPos]);
+ mxIterSheet->SetPhysical( FALSE );
+ mxIterSheet->SetMask( nMask );
+ if(mxIterSheet->pSet)
+ {
+ mxIterSheet->pSet->ClearItem(0);
+ mxIterSheet->pSet= 0;
+ }
+ return mxIterSheet.get();
+ }
+ return 0;
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::Find( const UniString& rName )
+{
+ // suchen
+ if( !bFirstCalled )
+ First();
+
+ nLastPos = lcl_FindName( aLst, nSearchFamily, rName );
+ if( USHRT_MAX != nLastPos )
+ {
+ // gefunden
+ mxStyleSheet->PresetNameAndFamily(*aLst[nLastPos]);
+ // neuer Name gesetzt, also bestimme seine Daten
+ mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+ if( !mxStyleSheet->IsPhysical() )
+ mxStyleSheet->SetPhysical( FALSE );
+
+ return mxStyleSheet.get();
+ }
+ return 0;
+}
+
+void SwStyleSheetIterator::AppendStyleList(const SvStringsDtor& rList,
+ BOOL bTestUsed,
+ USHORT nSection, char cType )
+{
+ if( bTestUsed )
+ {
+ SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ for ( USHORT i=0; i < rList.Count(); ++i )
+ {
+ BOOL bUsed = FALSE;
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(*rList[i], (SwGetPoolIdFromName)nSection);
+ switch ( nSection )
+ {
+ case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
+ bUsed = rDoc.IsPoolTxtCollUsed( nId );
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
+ bUsed = rDoc.IsPoolPageDescUsed( nId );
+ break;
+ default:
+ ASSERT( !this, "unknown PoolFmt-Id" );
+ }
+ if ( bUsed )
+ aLst.Append( cType, *rList[i] );
+ }
+ }
+ else
+ for ( USHORT i=0; i < rList.Count(); ++i )
+ aLst.Append( cType, *rList[i] );
+}
+
+void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ // suchen und aus der Anzeige-Liste entfernen !!
+ if( rHint.ISA( SfxStyleSheetHint ) &&
+ SFX_STYLESHEET_ERASED == ((SfxStyleSheetHint&) rHint).GetHint() )
+ {
+ SfxStyleSheetBase* pStyle = ((SfxStyleSheetHint&)rHint).GetStyleSheet();
+
+ if (pStyle)
+ {
+ USHORT nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(),
+ pStyle->GetName() );
+ if( nTmpPos < aLst.Count() )
+ aLst.DeleteAndDestroy( nTmpPos );
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src
new file mode 100644
index 000000000000..30b9bc7c0e35
--- /dev/null
+++ b/sw/source/ui/app/error.src
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * 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 __RSC
+
+
+ //#include <tools/errcode.hxx>
+#include "globals.hrc"
+#include "app.hrc"
+#include "swerror.h"
+#include "comcore.hrc" // MS: Warum gibst auf der Core-Seite
+ // jetzt Resourcen
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings
+ --------------------------------------------------------------------*/
+
+String STR_COMCORE_READERROR
+{
+ Text [ en-US ] = "Read-Error" ;
+};
+String STR_COMCORE_CANT_SHOW
+{
+ Text [ en-US ] = "Graphic cannot be displayed." ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Boxes
+ --------------------------------------------------------------------*/
+InfoBox ERR_CLPBRD_WRITE
+{
+ Message [ en-US ] = "Error while copying to the clipboard." ;
+};
+InfoBox ERR_CLPBRD_READ
+{
+ Message [ en-US ] = "Error reading from the clipboard." ;
+};
+
+
+#define ERR_CODE( class, err ) (class | (err - ERROR_SW_BASE))
+#define WARN_CODE( class, err ) (class | ( err - WARN_SW_BASE))
+
+Resource RID_SW_ERRHDL
+{
+ // Import-Errors
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_FILE_FORMAT_ERROR )
+ {
+ Text [ en-US ] = "File format error found." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_READ_ERROR )
+ {
+ Text [ en-US ] = "Error reading file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_INPUT_FILE )
+ {
+ Text [ en-US ] = "Input file error." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_NOWRITER_FILE )
+ {
+ Text [ en-US ] = "This is not a %PRODUCTNAME Writer file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_UNEXPECTED_EOF )
+ {
+ Text [ en-US ] = "Unexpected end of file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_PASSWD )
+ {
+ Text [ en-US ] = "Password-protected files cannot be opened." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW6_NO_WW6_FILE_ERR )
+ {
+ Text [ en-US ] = "This is not a WinWord6 file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW6_FASTSAVE_ERR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ Text [ en-US ] = "This file was saved with WinWord in 'Fast Save' mode. Please unmark the WinWord option 'Allow Fast Saves' and save the file again." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_ROWCOL )
+ {
+ Text [ en-US ] = "File format error found at $(ARG1)(row,col)." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_NEW_VERSION )
+ {
+ Text [ en-US ] = "File has been written in a newer version." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW8_NO_WW8_FILE_ERR )
+ {
+ Text [ en-US ] = "This is not a WinWord97 file.";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col).";
+ };
+ // Export-Errors
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_WRITE_ERROR )
+ {
+ Text [ en-US ] = "Error writing file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_OLD_GLOSSARY )
+ {
+ Text [ en-US ] = "Wrong AutoText document version." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_WRITE_ERROR_FILE )
+ {
+ Text [ en-US ] = "Error in writing sub-document $(ARG1).";
+ };
+ // Import-/Export-Errors
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_INTERNAL_ERROR )
+ {
+ Text [ en-US ] = "Internal error in %PRODUCTNAME Writer file format." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_INTERNAL_ERROR )
+ {
+ Text [ en-US ] = "Internal error in %PRODUCTNAME Writer file format." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_LOCKING , ERR_TXTBLOCK_NEWFILE_ERROR )
+ {
+ Text [ en-US ] = "$(ARG1) has changed." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_PATH , ERR_AUTOPATH_ERROR )
+ {
+ Text [ en-US ] = "$(ARG1) does not exist." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLSPLIT_ERROR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Zellen können nicht mehr geteilt werden : Zellen k÷nnen nicht mehr geteilt werden */
+ Text [ en-US ] = "Cells cannot be further split." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLINSCOL_ERROR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? weitere Spalten können nicht eingefügt werden : weitere Spalten k÷nnen nicht eingef³gt werden */
+ Text [ en-US ] = "Additional columns cannot be inserted." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLDDECHG_ERROR )
+ {
+ Text [ en-US ] = "The structure of a linked table cannot be modified." ;
+ };
+ // -------------------- Warnings -----------------------------------
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_NO_DRAWINGS )
+ {
+ Text [ en-US ] = "No drawings could be read." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_WW6_FASTSAVE_ERR )
+ {
+ Text [ en-US ] = "This file was saved with WinWord in 'Fast Save' mode. Please unmark the WinWord option 'Allow Fast Saves' and save the file again." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_FEATURES_LOST )
+ {
+ Text [ en-US ] = "Not all attributes could be read." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_FEATURES_LOST )
+ {
+ Text [ en-US ] = "Not all attributes could be recorded." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_OLE )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Einige OLE-Objekte konnten nur als Grafiken übernommen werden : Einige OLE-Objekte konnten nur als Grafiken ³bernommen werden */
+ Text [ en-US ] = "Some OLE objects could only be loaded as graphics." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_OLE )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Einige OLE-Objekte konnten nur als Grafiken übernommen werden : Einige OLE-Objekte konnten nur als Grafiken ³bernommen werden */
+ Text [ en-US ] = "Some OLE objects could only be saved as graphics." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_POOR_LOAD )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Dokument konnte nicht vollständig geladen werden : Dokument konnte nicht vollstõndig geladen werden */
+ Text [ en-US ] = "Document could not be completely loaded." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_POOR_LOAD )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Dokument konnte nicht vollständig gespeichert werden : Dokument konnte nicht vollstõndig gespeichert werden */
+ Text [ en-US ] = "Document could not be completely saved." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_HTML_NO_MACROS)
+ {
+ Text [ en-US ] = "This HTML document contains %PRODUCTNAME Basic macros.\nThey were not saved with the current export settings.";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_WRITE_ERROR_FILE )
+ {
+ Text [ en-US ] = "Error in writing sub-document $(ARG1).";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col).";
+ };
+};
+
diff --git a/sw/source/ui/app/mainwn.cxx b/sw/source/ui/app/mainwn.cxx
new file mode 100644
index 000000000000..e6085a4a8662
--- /dev/null
+++ b/sw/source/ui/app/mainwn.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <mdiexp.hxx>
+#include <tools/shl.hxx>
+#include <tools/string.hxx>
+#ifndef _SVARRAY_HXX
+#include <svl/svstdarr.hxx>
+#endif
+#include <sfx2/progress.hxx>
+#ifndef _RESID_HXX //autogen
+#include <tools/resid.hxx>
+#endif
+#include <docsh.hxx>
+#include <swmodule.hxx>
+#include "swtypes.hxx"
+
+class SwDocShell;
+
+struct SwProgress
+{
+ long nStartValue,
+ nStartCount;
+ SwDocShell *pDocShell;
+ SfxProgress *pProgress;
+};
+
+static SvPtrarr *pProgressContainer = 0;
+
+static SwProgress *lcl_SwFindProgress( SwDocShell *pDocShell )
+{
+ for ( USHORT i = 0; i < pProgressContainer->Count(); ++i )
+ {
+ SwProgress *pTmp = (SwProgress*)(*pProgressContainer)[i];
+ if ( pTmp->pDocShell == pDocShell )
+ return pTmp;
+ }
+ return 0;
+}
+
+
+void StartProgress( USHORT nMessResId, long nStartValue, long nEndValue,
+ SwDocShell *pDocShell )
+{
+ if( !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = 0;
+
+ if ( !pProgressContainer )
+ pProgressContainer = new SvPtrarr( 2, 2 );
+ else
+ {
+ if ( 0 != (pProgress = lcl_SwFindProgress( pDocShell )) )
+ ++pProgress->nStartCount;
+ }
+ if ( !pProgress )
+ {
+ pProgress = new SwProgress;
+ pProgress->pProgress = new SfxProgress( pDocShell,
+ SW_RESSTR(nMessResId),
+ nEndValue - nStartValue,
+ FALSE,
+ TRUE );
+ pProgress->nStartCount = 1;
+ pProgress->pDocShell = pDocShell;
+ pProgressContainer->Insert( (void*)pProgress, 0 );
+ }
+ pProgress->nStartValue = nStartValue;
+ }
+}
+
+
+void SetProgressState( long nPosition, SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->SetState(nPosition - pProgress->nStartValue);
+ }
+}
+
+
+void EndProgress( SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = 0;
+ USHORT i;
+ for ( i = 0; i < pProgressContainer->Count(); ++i )
+ {
+ SwProgress *pTmp = (SwProgress*)(*pProgressContainer)[i];
+ if ( pTmp->pDocShell == pDocShell )
+ {
+ pProgress = pTmp;
+ break;
+ }
+ }
+
+ if ( pProgress && 0 == --pProgress->nStartCount )
+ {
+ pProgress->pProgress->Stop();
+ pProgressContainer->Remove( i );
+ delete pProgress->pProgress;
+ delete pProgress;
+ //#112337# it may happen that the container has been removed
+ //while rescheduling
+ if ( pProgressContainer && !pProgressContainer->Count() )
+ delete pProgressContainer, pProgressContainer = 0;
+ }
+ }
+}
+
+
+void SetProgressText( USHORT nId, SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->SetStateText( 0, SW_RESSTR(nId) );
+ }
+}
+
+
+void RescheduleProgress( SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->Reschedule();
+ }
+}
+
+
diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk
new file mode 100644
index 000000000000..88f9ff9d6398
--- /dev/null
+++ b/sw/source/ui/app/makefile.mk
@@ -0,0 +1,101 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sw
+TARGET=app
+
+LIBTARGET=NO
+
+# future: DEMO\...
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+ app.src \
+ mn.src \
+ error.src
+
+
+SLOFILES = \
+ $(SLO)$/appenv.obj \
+ $(SLO)$/apphdl.obj \
+ $(SLO)$/applab.obj \
+ $(SLO)$/appopt.obj \
+ $(SLO)$/docsh.obj \
+ $(SLO)$/docsh2.obj \
+ $(SLO)$/docshdrw.obj \
+ $(SLO)$/docshini.obj \
+ $(SLO)$/docst.obj \
+ $(SLO)$/docstyle.obj \
+ $(SLO)$/mainwn.obj \
+ $(SLO)$/swmodule.obj \
+ $(SLO)$/swmodul1.obj \
+ $(SLO)$/swdll.obj \
+ $(SLO)$/swwait.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/docsh.obj \
+ $(SLO)$/docst.obj \
+ $(SLO)$/docshini.obj \
+ $(SLO)$/swmodule.obj \
+ $(SLO)$/swmodul1.obj \
+ $(SLO)$/apphdl.obj \
+ $(SLO)$/docsh2.obj
+
+LIB1TARGET= $(SLB)$/app.lib
+
+LIB1OBJFILES= \
+ $(SLO)$/appenv.obj \
+ $(SLO)$/apphdl.obj \
+ $(SLO)$/applab.obj \
+ $(SLO)$/appopt.obj \
+ $(SLO)$/docsh.obj \
+ $(SLO)$/docsh2.obj \
+ $(SLO)$/docshdrw.obj \
+ $(SLO)$/docshini.obj \
+ $(SLO)$/docst.obj \
+ $(SLO)$/docstyle.obj \
+ $(SLO)$/mainwn.obj \
+ $(SLO)$/swmodul1.obj \
+ $(SLO)$/swwait.obj
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(SRS)$/app.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
new file mode 100644
index 000000000000..81dad77566b2
--- /dev/null
+++ b/sw/source/ui/app/mn.src
@@ -0,0 +1,1108 @@
+/*************************************************************************
+ *
+ * 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 "swmn.hrc"
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Window
+------------------------------------------------------------------------*/
+
+#define MN_FRM_CAPTION_ITEM \
+ MenuItem\
+ {\
+ Identifier = FN_INSERT_CAPTION ;\
+ HelpID = FN_INSERT_CAPTION ;\
+ Text [ en-US ] = "~Caption..." ;\
+ };
+
+#define MN_TAB1 \
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_TABLE_DLG ; \
+ HelpID = FN_FORMAT_TABLE_DLG ; \
+ Text [ en-US ] = "~Table..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_MERGE_TABLE ; \
+ HelpID = FN_TABLE_MERGE_TABLE ; \
+ Text [ en-US ] = "Merge Tables";\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SPLIT_TABLE ; \
+ HelpID = FN_TABLE_SPLIT_TABLE ; \
+ Text [ en-US ] = "~Split Table" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_NUM_FORMAT_TABLE_DLG ; \
+ HelpID = FN_NUM_FORMAT_TABLE_DLG ; \
+ Text [ en-US ] = "N~umber Format..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_CELL ; \
+ HelpID = MN_CELL ; \
+ Command = ".uno:CellMenu" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ze~lle : Zelle */\
+ Text [ en-US ] = "~Cell" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenzelle : Einstellungen f³r die Tabellenzelle */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_MERGE_CELLS ; \
+ HelpID = FN_TABLE_MERGE_CELLS ; \
+ Text [ en-US ] = "~Merge" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SPLIT_CELLS ; \
+ HelpID = FN_TABLE_SPLIT_CELLS ; \
+ Text [ en-US ] = "~Split..." ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_NONE ; \
+ HelpID = FN_TABLE_VERT_NONE ; \
+ Text [ en-US ] = "~Top" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_CENTER ; \
+ HelpID = FN_TABLE_VERT_CENTER ; \
+ Text [ en-US ] = "C~enter" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_BOTTOM ; \
+ HelpID = FN_TABLE_VERT_BOTTOM ; \
+ Text [ en-US ] = "~Bottom" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_READ_ONLY_CELLS ; \
+ HelpID = FN_TABLE_SET_READ_ONLY_CELLS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schützen : ~Sch³tzen */\
+ Text [ en-US ] = "~Protect" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_UNSET_READ_ONLY_CELLS ; \
+ HelpID = FN_TABLE_UNSET_READ_ONLY_CELLS ; \
+ Text [ en-US ] = "~Unprotect" ; \
+ };\
+ };\
+ };\
+ };
+
+#define MN_TAB2 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_TBLROW ; \
+ HelpID = HID_MN_SUB_TBLROW ; \
+ Command = ".uno:RowMenu" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ze~ile : Zeile */\
+ Text [ en-US ] = "~Row" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenzeile : Einstellungen f³r die Tabellenzeile */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_ROW_HEIGHT ; \
+ HelpID = FN_TABLE_SET_ROW_HEIGHT ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Höhe... : ~H÷he... */\
+ Text [ en-US ] = "~Height..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_ROW_SPLIT;\
+ HelpID = FN_TABLE_ROW_SPLIT ; \
+ Text [ en-US ] = "Allow Row to Break A~cross Pages and Columns" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_OPTIMAL_HEIGHT ; \
+ HelpID = FN_TABLE_OPTIMAL_HEIGHT ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Optimale Höhe : ~Optimale H÷he */\
+ Text [ en-US ] = "~Optimal Height" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_BALANCE_ROWS ; \
+ HelpID = FN_TABLE_BALANCE_ROWS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Gleichmäßig ~verteilen : Gleichmõ˜ig ~verteilen */\
+ Text [ en-US ] = "Space ~Equally" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SELECT_ROW ; \
+ HelpID = FN_TABLE_SELECT_ROW ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Auswählen */\
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Ausw~õhlen */\
+ Text [ en-US ] = "~Select" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_INSERT_ROW_DLG ; \
+ HelpID = FN_TABLE_INSERT_ROW_DLG ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Einfügen... : ~Einf³gen... */\
+ Text [ en-US ] = "~Insert..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_DELETE_ROW ; \
+ HelpID = FN_TABLE_DELETE_ROW ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */\
+ Text [ en-US ] = "~Delete" ; \
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_SUB_TBLCOL ; \
+ HelpID = HID_MN_SUB_TBLCOL ; \
+ Command = ".uno:ColumnMenu" ; \
+ Text [ en-US ] = "Colu~mn" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenspalte : Einstellungen f³r die Tabellenspalte */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_COL_WIDTH ; \
+ HelpID = FN_TABLE_SET_COL_WIDTH ; \
+ Text [ en-US ] = "~Width..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_ADJUST_CELLS ; \
+ HelpID = FN_TABLE_ADJUST_CELLS ; \
+ Text [ en-US ] = "~Optimal Width " ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_BALANCE_CELLS ; \
+ HelpID = FN_TABLE_BALANCE_CELLS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Gleichmäßig ~verteilen : Gleichmõ˜ig ~verteilen */\
+ Text [ en-US ] = "Space ~Equally" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SELECT_COL ; \
+ HelpID = FN_TABLE_SELECT_COL ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Auswählen */\
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Ausw~õhlen */\
+ Text [ en-US ] = "~Select" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_INSERT_COL_DLG ; \
+ HelpID = FN_TABLE_INSERT_COL_DLG ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Einfügen... : ~Einf³gen... */\
+ Text [ en-US ] = "~Insert..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_DELETE_COL ; \
+ HelpID = FN_TABLE_DELETE_COL ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */\
+ Text [ en-US ] = "~Delete" ; \
+ };\
+ };\
+};\
+ };
+
+#define MN_DRWTXT \
+ MenuItem\
+ {\
+ ITEM_FORMAT_CHAR_DLG\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_PARA_DLG\
+ };\
+
+#define MN_DRWTXTATTR \
+ MenuItem\
+ {\
+ Identifier = FN_DRAWTEXT_ATTR_DLG ; \
+ HelpID = FN_DRAWTEXT_ATTR_DLG ; \
+ Text [ en-US ] = "Te~xt..." ; \
+ };
+
+#define MN_NAME_SHAPE \
+ MenuItem\
+ {\
+ Identifier = FN_NAME_SHAPE ; \
+ HelpID = FN_NAME_SHAPE ; \
+ Text [ en-US ] = "Name..." ; \
+ };
+
+// #i68101#
+#define MN_TITLE_DESCRIPTION_SHAPE\
+ MenuItem\
+ {\
+ Identifier = FN_TITLE_DESCRIPTION_SHAPE; \
+ HelpID = FN_TITLE_DESCRIPTION_SHAPE; \
+ Text [ en-US ] = "Description..." ; \
+ };
+
+#define MN_FRM \
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_FRAME_DLG ; \
+ HelpID = FN_FORMAT_FRAME_DLG ; \
+ Text [ en-US ] = "~Frame..." ; \
+ };
+
+#define MN_DRAW1 \
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTRIBUTES_LINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTRIBUTES_AREA\
+ };
+
+#define MN_ALIGN \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_LEFT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_CENTER\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_RIGHT\
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_UP\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_MIDDLE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_DOWN\
+ };\
+ };\
+ };\
+ };
+
+#define MN_ONE_STEP \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_UP ; \
+ HelpID = FN_FRAME_UP ; \
+ Text [ en-US ] = "Bring ~Forward" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_DOWN ; \
+ HelpID = FN_FRAME_DOWN ; \
+ Text [ en-US ] = "Send Back~ward" ; \
+ };
+
+#define MN_TOP \
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_TOP\
+ };\
+
+
+#define MN_DRAW5 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ARRANGE ; \
+ HelpID = HID_MN_SUB_ARRANGE ; \
+ Command = ".uno:ArrangeMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_TOP\
+ MN_ONE_STEP\
+ MN_BOTTOM\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_HEAVEN\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_HELL\
+ };\
+ };\
+ };\
+ };\
+ MN_ALIGN\
+
+#define MN_DRAW6 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ARRANGE ; \
+ HelpID = HID_MN_SUB_ARRANGE ; \
+ Command = ".uno:ArrangeMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_TOP\
+ MN_ONE_STEP\
+ MN_BOTTOM\
+ };\
+ };\
+ };\
+ MN_ALIGN\
+
+#define MN_DRAW3 \
+ ITEM_GROUP_MENU
+
+#define MN_FORM \
+ MenuItem\
+ {\
+ ITEM_FORM_CONTROL_PROPERTIES\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORM_PROPERTIES\
+ };\
+ MenuItem\
+ {\
+ ITEM_REPLACE_CONTROL\
+ };\
+
+
+#define MN_ANNOTATIONS \
+ MenuItem\
+ {\
+ Identifier = FN_REPLY ;\
+ HelpID = FN_DELETE_NOTE ;\
+ Text [ en-US ] = "Reply" ;\
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_NOTE ;\
+ HelpID = FN_DELETE_NOTE ;\
+ Text [ en-US ] = "Delete ~Comment" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_NOTE_AUTHOR ;\
+ HelpID = FN_DELETE_NOTE_AUTHOR ;\
+ Text [ en-US ] = "Delete ~All Comments by $1" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_ALL_NOTES ;\
+ HelpID = FN_DELETE_ALL_NOTES ;\
+ Text [ en-US ] = "~Delete All Comments" ;\
+ };\
+ /*
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_NOTE ;\
+ HelpID = FN_HIDE_NOTE ;\
+ Text [ en-US ] = "~Hide comment" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_NOTE_AUTHOR ;\
+ HelpID = FN_HIDE_NOTE_AUTHOR ;\
+ Text [ en-US ] = "Hide ~author" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_ALL_NOTES ;\
+ HelpID = FN_HIDE_ALL_NOTES ;\
+ Text [ en-US ] = "Hide all ~comments" ;\
+ };
+ */
+
+/*--Popups---------------------------------------------------------------*/
+
+String MN_TEXT_POPUPMENU
+{
+ Text [ en-US ] = "Text" ;
+};
+
+
+String MN_TAB_POPUPMENU
+{
+ Text [ en-US ] = "Table" ;
+};
+
+Menu MN_TAB_POPUPMENU
+{
+ ItemList =
+ {
+ MN_RESET
+ _NUMBERING_RELATED_MENU
+ SEPARATOR ;
+ MN_TEXT_ATTR
+ SEPARATOR ;
+ MenuItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_PARA_DLG
+ };
+ ITEM_TRANSLITERATE_MENU
+ // MN_BB
+ SEPARATOR ;
+ MN_TAB1
+ MN_TAB2
+ MN_FRM_CAPTION_ITEM
+ // SEPARATOR;
+ MenuItem
+ {
+ Identifier = FN_VIEW_TABLEGRID ;
+ HelpID = FN_VIEW_TABLEGRID ;
+ Text [ en-US ] = "Table Boundaries" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_SET_MODOPT_TBLNUMFMT ;
+ HelpID = FN_SET_MODOPT_TBLNUMFMT ;
+ Text [ en-US ] = "~Number Recognition";
+ };
+ SEPARATOR ;
+ _DEFAULT_TEXT_EDIT_ELEMENTS
+ };
+};
+
+#define MN_WRAP_CONTOUR \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_WRAP_CONTOUR ; \
+ HelpID = FN_FRAME_WRAP_CONTOUR ; \
+ Text [ en-US ] = "~Contour" ; \
+ };
+
+#define MN_EDIT_CONTOUR \
+ MenuItem\
+ {\
+ Identifier = SID_CONTOUR_DLG ; \
+ HelpID = SID_CONTOUR_DLG ; \
+ Text [ en-US ] = "~Edit Contour..." ; \
+ };
+
+#define MN_WRAP_CONTOUR_1 MN_WRAP_CONTOUR
+#define MN_EDIT_CONTOUR_1 MN_EDIT_CONTOUR
+
+#define MN_MOUSE_FRAME_BEGIN \
+ MenuItem\
+ {\
+ Identifier = MN_WRAP ; \
+ HelpID = MN_WRAP ; \
+ Command = ".uno:WrapMenu" ; \
+ Text [ en-US ] = "~Wrap" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpID = FN_FRAME_NOWRAP ; \
+ Text [ en-US ] = "~No Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP ; \
+ HelpID = FN_FRAME_WRAP ; \
+ Text [ en-US ] = "~Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP_IDEAL ; \
+ HelpID = FN_FRAME_WRAP_IDEAL ; \
+ Text [ en-US ] = "~Optimal Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU ; \
+ HelpID = FN_FRAME_WRAPTHRU ; \
+ Text [ en-US ] = "~Wrap Through" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU_TRANSP ; \
+ HelpID = FN_FRAME_WRAPTHRU_TRANSP ; \
+ Text [ en-US ] = "In ~Background" ; \
+ };\
+ SEPARATOR ; \
+ MN_WRAP_CONTOUR_1\
+ MN_EDIT_CONTOUR\
+ MenuItem\
+ {\
+ Identifier = FN_WRAP_ANCHOR_ONLY ; \
+ HelpID = FN_WRAP_ANCHOR_ONLY ; \
+ Text [ en-US ] = "~First Paragraph" ; \
+ };\
+ };\
+ };\
+ };
+
+
+#define MN_MOUSE_FRAME_WITH_CONTOUR MN_MOUSE_FRAME_BEGIN
+
+String MN_DRAW_POPUPMENU
+{
+ Text [ en-US ] = "Graphic" ;
+};
+#define MN_WRAP_DRAW \
+ MenuItem\
+ {\
+ Identifier = MN_WRAP ; \
+ HelpID = MN_WRAP ; \
+ Command = ".uno:WrapMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpID = FN_FRAME_NOWRAP ; \
+ Text [ en-US ] = "~No Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP ; \
+ HelpID = FN_FRAME_WRAP ; \
+ Text [ en-US ] = "~Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP_IDEAL ; \
+ HelpID = FN_FRAME_WRAP_IDEAL ; \
+ Text [ en-US ] = "~Optimal Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU ; \
+ HelpID = FN_FRAME_WRAPTHRU ; \
+ Text [ en-US ] = "~Wrap Through" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU_TRANSP ; \
+ HelpID = FN_FRAME_WRAPTHRU_TRANSP ; \
+ Text [ en-US ] = "In ~Background" ; \
+ };\
+ SEPARATOR ; \
+ MN_WRAP_CONTOUR_1\
+ MenuItem\
+ {\
+ Identifier = FN_WRAP_ANCHOR_ONLY ; \
+ HelpID = FN_WRAP_ANCHOR_ONLY ; \
+ Text [ en-US ] = "~First Paragraph" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_DRAW_WRAP_DLG ; \
+ HelpID = FN_DRAW_WRAP_DLG ; \
+ Text [ en-US ] = "~Edit..." ; \
+ };\
+ };\
+ };\
+ Text [ en-US ] = "~Wrap" ; \
+ };
+
+#define MN_BOTTOM \
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_BOTTOM\
+ };\
+
+#define MN_AT_FRAME \
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER_FRAME ; \
+ HelpID = FN_TOOL_ANKER_FRAME ; \
+ Text [ en-US ] = "To ~Frame" ; \
+ };
+
+#define MN_ANCHOR \
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER ; \
+ HelpID = FN_TOOL_ANKER ; \
+ Command = ".uno:AnchorMenu" ; \
+ Text [ en-US ] = "An~chor" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER_PAGE ; \
+ HelpID = FN_TOOL_ANKER_PAGE ; \
+ Text [ en-US ] = "To P~age" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER_PARAGRAPH ; \
+ HelpID = FN_TOOL_ANKER_PARAGRAPH ; \
+ Text [ en-US ] = "To ~Paragraph" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER_AT_CHAR ; \
+ HelpID = FN_TOOL_ANKER_AT_CHAR ; \
+ Text [ en-US ] = "To ~Character" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER_CHAR ; \
+ HelpID = FN_TOOL_ANKER_CHAR ; \
+ Text [ en-US ] = "As C~haracter" ; \
+ };\
+ MN_AT_FRAME\
+ };\
+ };\
+ };
+
+Menu MN_DRAW_POPUPMENU
+{
+ ItemList =
+ {
+ MN_DRAW1
+ MN_DRWTXTATTR
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_DRAW5
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ MN_FRM_CAPTION_ITEM
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+String MN_DRAWFORM_POPUPMENU
+{
+ Text [ en-US ] = "Control" ;
+};
+
+Menu MN_DRAWFORM_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_FORM
+ SEPARATOR ;
+ MN_DRAW6
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+String MN_DRWTXT_POPUPMENU
+{
+ Text [ en-US ] = "Draw Object text" ;
+};
+
+Menu MN_DRWTXT_POPUPMENU
+{
+ ItemList =
+ {
+ MN_RESET
+ SEPARATOR ;
+ MN_TEXT_ATTR
+ SEPARATOR ;
+ ITEM_TRANSLITERATE_MENU
+ SEPARATOR ;
+ MN_DRWTXT
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+#define MN_REDCOMMENT \
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_COMMENT ;\
+ HelpID = FN_DELETE_COMMENT ;\
+ Text [ en-US ] = "Delete ~Changes Note" ;\
+ };\
+
+Menu MN_ANNOTATION_POPUPMENU
+{
+ ItemList =
+ {
+ //MN_RESET
+ //SEPARATOR ;
+ //MN_TEXT_ATTR
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_POSTURE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\
+ };\
+ SEPARATOR ;
+ //ITEM_TRANSLITERATE_MENU
+ //SEPARATOR ;
+ //MN_DRWTXT
+ //MN_FRM_CAPTION_ITEM
+ SEPARATOR ;
+ MN_ANNOTATIONS
+ //MN_REDCOMMENT
+ };
+};
+
+Menu MN_ANNOTATION_BUTTON
+{
+ ItemList =
+ {
+ MN_ANNOTATIONS
+ };
+};
+
+Menu MN_REDCOMMENT_BUTTON
+{
+ ItemList =
+ {
+ MN_REDCOMMENT
+ };
+};
+
+String MN_GRF_POPUPMENU
+{
+ Text [ en-US ] = "Graphic" ;
+};
+
+#define MN_ALIGN_FRAME \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ALIGN ; \
+ HelpID = HID_MN_SUB_ALIGN ; \
+ Command = ".uno:ArrangeFrameMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_TOP\
+ };\
+ MN_ONE_STEP\
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_BOTTOM\
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_FORMAT_FRM_HORZ ; \
+ HelpID = MN_FORMAT_FRM_HORZ ; \
+ Command = ".uno:AlignFrameMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_LEFT ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_LEFT ; \
+ Text [ en-US ] = "~Left" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_CENTER ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_CENTER ; \
+ Text [ en-US ] = "~Centered" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ Text [ en-US ] = "~Right" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_TOP ; \
+ HelpID = FN_FRAME_ALIGN_VERT_TOP ; \
+ Text [ en-US ] = "Base at ~Top" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_CENTER ; \
+ HelpID = FN_FRAME_ALIGN_VERT_CENTER ; \
+ Text [ en-US ] = "Base in ~Middle" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ HelpID = FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ Text [ en-US ] = "Base at ~Bottom" ; \
+ };\
+ };\
+ };\
+ Text [ en-US ] = "A~lignment" ; \
+ };\
+ MN_ANCHOR
+
+Menu MN_GRF_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_FORMAT_GRAFIC_DLG ;
+ HelpID = FN_FORMAT_GRAFIC_DLG ;
+ Text [ en-US ] = "~Picture..." ;
+ };
+ MenuItem
+ {
+ Identifier = FN_SAVE_GRAPHIC;
+ HelpID = FN_SAVE_GRAPHIC;
+ Text [ en-US ] = "Save Graphics..." ;
+ };
+ MN_FRM_CAPTION_ITEM
+ MenuItem
+ {
+ ITEM_EDIT_IMAP
+ };
+ };
+};
+
+String MN_OLE_POPUPMENU
+{
+ Text [ en-US ] = "Object" ;
+};
+
+
+Menu MN_OLE_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_FORMAT_FRAME_DLG ;
+ HelpID = FN_FORMAT_FRAME_DLG ;
+ Text [ en-US ] = "Object..." ;
+ };
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+#define MN_MOUSE_FRAME_WITHOUT_CONTOUR MN_MOUSE_FRAME_BEGIN
+
+String MN_FRM_POPUPMENU
+{
+ Text [ en-US ] = "Frame" ;
+};
+
+Menu MN_FRM_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITHOUT_CONTOUR
+ // --> OD 2009-07-07 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MN_FRM
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+String MN_PPREVIEW_POPUPMENU
+{
+ Text [ en-US ] = "Draw Object text" ;
+};
+
+Menu MN_PPREVIEW_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = FN_PAGEUP ;
+ HelpID = FN_PAGEUP ;
+ Text [ en-US ] = "Previous Page" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_PAGEDOWN ;
+ HelpID = FN_PAGEDOWN ;
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Seite : Nõchste Seite */
+ Text [ en-US ] = "Next Page" ;
+ };
+ MenuItem
+ {
+ ITEM_VIEW_ATTR_ZOOM
+ /* ### ACHTUNG: Neuer Text in Resource? Schließt die Seitenvorschau : Schlie˜t die Seitenvorschau */
+ };
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_PRINT_PAGEPREVIEW ;
+ HelpID = FN_PRINT_PAGEPREVIEW ;
+ Text [ en-US ] = "Print" ;
+ };
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = SID_PRINTPREVIEW;
+ HelpID = SID_PRINTPREVIEW;
+ Text [ en-US ] = "Close Preview" ;
+ };
+ };
+};
+
+String MN_MEDIA_POPUPMENU
+{
+ Text [ en-US ] = "Media object" ;
+};
+
+Menu MN_MEDIA_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_DRAW6
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+Menu MN_TEXT_POPUPMENU
+ BASE_TEXT_POPUPMENU_BEGIN
+ BASE_TEXT_POPUPMENU_NOWEB
+ BASE_TEXT_POPUPMENU_END
+
diff --git a/sw/source/ui/app/swdll.cxx b/sw/source/ui/app/swdll.cxx
new file mode 100644
index 000000000000..71409e4dedf3
--- /dev/null
+++ b/sw/source/ui/app/swdll.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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 <svx/svdobj.hxx>
+#include <rtl/logfile.hxx>
+
+#ifndef _GLOBDOC_HRC
+#include "globdoc.hrc"
+#endif
+
+#ifndef _SWDLL_HXX
+#include <swdll.hxx>
+#endif
+#include <wdocsh.hxx>
+#include <globdoc.hxx>
+#include <initui.hxx>
+#include <swmodule.hxx>
+#include <swtypes.hxx>
+#include <init.hxx>
+#include <dobjfac.hxx>
+#include <cfgid.h>
+
+#include <unotools/moduleoptions.hxx>
+
+#ifndef _FM_FMOBJFAC_HXX
+#include <svx/fmobjfac.hxx>
+#endif
+#include <svx/svdfield.hxx>
+#include <svx/objfac3d.hxx>
+
+#include <unomid.h>
+
+
+/*************************************************************************
+|*
+|* Init
+|*
+\************************************************************************/
+
+void SwDLL::Init()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDLL" );
+
+ // the SdModule must be created
+ SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
+ if ( *ppShlPtr )
+ return;
+
+ SvtModuleOptions aOpt;
+ SfxObjectFactory* pDocFact = 0;
+ SfxObjectFactory* pGlobDocFact = 0;
+ if ( aOpt.IsWriter() )
+ {
+ pDocFact = &SwDocShell::Factory();
+ pGlobDocFact = &SwGlobalDocShell::Factory();
+ }
+
+ SfxObjectFactory* pWDocFact = &SwWebDocShell::Factory();
+
+ SwModule* pModule = new SwModule( pWDocFact, pDocFact, pGlobDocFact );
+ (*ppShlPtr) = pModule;
+
+ pWDocFact->SetDocumentServiceName(C2S("com.sun.star.text.WebDocument"));
+
+ if ( aOpt.IsWriter() )
+ {
+ pGlobDocFact->SetDocumentServiceName(C2S("com.sun.star.text.GlobalDocument"));
+ pDocFact->SetDocumentServiceName(C2S("com.sun.star.text.TextDocument"));
+ }
+
+ // SvDraw-Felder registrieren
+ SdrRegisterFieldClasses();
+
+ // 3D-Objekt-Factory eintragen
+ E3dObjFactory();
+
+ // form::component::Form-Objekt-Factory eintragen
+ FmFormObjFactory();
+
+ SdrObjFactory::InsertMakeObjectHdl( LINK( &aSwObjectFactory, SwObjectFactory, MakeObject ) );
+
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "Init Core/UI/Filter" );
+
+ //Initialisierung der Statics
+ ::_InitCore();
+ ::_InitFilter();
+ ::_InitUI();
+
+ pModule->InitAttrPool();
+ //jetzt darf das SwModule seinen Pool anlegen
+
+ // register your view-factories here
+ RegisterFactories();
+
+ // register your shell-interfaces here
+ RegisterInterfaces();
+
+ // register your controllers here
+ RegisterControls();
+}
+
+
+
+/*************************************************************************
+|*
+|* Exit
+|*
+\************************************************************************/
+
+void SwDLL::Exit()
+{
+ // called directly befor unloading the DLL
+ // do whatever you want, Sw-DLL is accessible
+
+ // der Pool muss vor den statics geloescht werden
+ SW_MOD()->RemoveAttrPool();
+
+ ::_FinitUI();
+ ::_FinitFilter();
+ ::_FinitCore();
+ // Objekt-Factory austragen
+ SdrObjFactory::RemoveMakeObjectHdl(LINK(&aSwObjectFactory, SwObjectFactory, MakeObject ));
+ // the SwModule must be destroyed
+ SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
+ delete (*ppShlPtr);
+ (*ppShlPtr) = NULL;
+}
+
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
new file mode 100644
index 000000000000..2b3a5df1391b
--- /dev/null
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -0,0 +1,675 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/childwin.hxx>
+#include <unotools/useroptions.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <svx/dataaccessdescriptor.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <swmodule.hxx>
+#include <swtypes.hxx>
+#include <usrpref.hxx>
+#include <modcfg.hxx>
+#include <view.hxx>
+#include <pview.hxx>
+#include <wview.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <dbmgr.hxx>
+#include <uinums.hxx>
+#include <prtopt.hxx> // fuer PrintOptions
+#include <navicfg.hxx>
+#include <doc.hxx>
+#include <cmdid.h>
+#include <app.hrc>
+#include "helpid.h"
+
+#include <unomid.h>
+#include <tools/color.hxx>
+#include "PostItMgr.hxx"
+
+using ::rtl::OUString;
+using namespace ::svx;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::lang;
+
+
+/*-----------------08/28/97 08:41pm-----------------
+
+--------------------------------------------------*/
+void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh )
+{
+ // in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen
+ sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
+ sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
+ sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
+
+ pSh->SetUIOptions(*pPref);
+ const SwViewOption* pNewPref = pSh->GetViewOptions();
+
+ // Scrollbars an / aus
+ if(bVScrollChanged)
+ {
+ pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
+ }
+ if(bHScrollChanged)
+ {
+ pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE));
+ }
+ //if only the position of the vertical ruler has been changed initiate an update
+ if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
+ pView->InvalidateBorder();
+
+ // Lineale an / aus
+ if(pNewPref->IsViewVRuler())
+ pView->CreateVLineal();
+ else
+ pView->KillVLineal();
+
+ // TabWindow an/aus
+ if(pNewPref->IsViewHRuler())
+ pView->CreateTab();
+ else
+ pView->KillTab();
+
+ pView->GetPostItMgr()->PrepareView(true);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelle SwWrtShell
+ --------------------------------------------------------------------*/
+
+
+SwWrtShell* GetActiveWrtShell()
+{
+ SwView *pActive = ::GetActiveView();
+ if( pActive )
+ return &pActive->GetWrtShell();
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pointer auf die aktuelle Sicht
+ --------------------------------------------------------------------*/
+
+
+SwView* GetActiveView()
+{
+ SfxViewShell* pView = SfxViewShell::Current();
+ return PTR_CAST( SwView, pView );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Ueber Views iterieren - static
+ --------------------------------------------------------------------*/
+
+SwView* SwModule::GetFirstView()
+{
+ // liefert nur sichtbare SwViews
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
+ return pView;
+}
+
+
+SwView* SwModule::GetNextView(SwView* pView)
+{
+ DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben");
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, TRUE);
+ return pNView;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Neuer Master fuer die Einstellungen wird gesetzt;
+ dieser wirkt sich auf die aktuelle Sicht und alle
+ folgenden aus.
+------------------------------------------------------------------------*/
+
+void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
+ sal_uInt16 nDest )
+{
+ SwView* pCurrView = pActView;
+ ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
+
+ SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
+ VIEWOPT_DEST_WEB == nDest ? sal_True :
+ VIEWOPT_DEST_TEXT== nDest ? sal_False :
+ pCurrView && pCurrView->ISA(SwWebView) ));
+
+ //per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden
+ sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
+ //PreView abfruehstuecken
+ SwPagePreView* pPPView;
+ if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
+ {
+ if(!bViewOnly)
+ pPref->SetUIOptions( rUsrPref );
+ pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
+ pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
+ if(!bViewOnly)
+ {
+ pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
+ pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
+ }
+ return;
+ }
+
+ if(!bViewOnly)
+ {
+ pPref->SetUsrPref( rUsrPref );
+ pPref->SetModified();
+ }
+
+ if( !pCurrView )
+ return;
+
+ // Weitergabe an die CORE
+ const sal_Bool bReadonly = pCurrView->GetDocShell()->IsReadOnly();
+ SwViewOption* pViewOpt;
+ if(!bViewOnly)
+ pViewOpt = new SwViewOption( *pPref );
+ else
+ pViewOpt = new SwViewOption( rUsrPref );
+ pViewOpt->SetReadonly( bReadonly );
+ if( !(*pSh->GetViewOptions() == *pViewOpt) )
+ {
+ //Ist evtl. nur eine ViewShell
+ pSh->StartAction();
+ pSh->ApplyViewOptions( *pViewOpt );
+ ((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea());
+ pSh->EndAction();
+ }
+ if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
+ pSh->SetReadonlyOption(bReadonly);
+
+ lcl_SetUIPrefs(pViewOpt, pCurrView, pSh);
+
+ // zum Schluss wird das Idle-Flag wieder gesetzt
+ // #42510#
+ pPref->SetIdle(sal_True);
+}
+/* -----------------------------28.09.00 12:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyUserMetric( FieldUnit eMetric, BOOL bWeb )
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ FieldUnit eOldMetric = pPref->GetMetric();
+ if(eOldMetric != eMetric)
+ pPref->SetMetric(eMetric);
+
+ FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
+ FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
+
+ SwView* pTmpView = SwModule::GetFirstView();
+ // fuer alle MDI-Fenster das Lineal umschalten
+ while(pTmpView)
+ {
+ if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
+ {
+ pTmpView->ChangeVLinealMetric(eVScrollMetric);
+ pTmpView->ChangeTabMetric(eHScrollMetric);
+ }
+
+ pTmpView = SwModule::GetNextView(pTmpView);
+ }
+}
+/*-- 12.11.2008 14:47:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwModule::ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb )
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ if( bHorizontal )
+ pPref->SetHScrollMetric(eMetric);
+ else
+ pPref->SetVScrollMetric(eMetric);
+
+ SwView* pTmpView = SwModule::GetFirstView();
+ // switch metric at the appropriate rulers
+ while(pTmpView)
+ {
+ if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
+ {
+ if( bHorizontal )
+ pTmpView->ChangeTabMetric(eMetric);
+ else
+ pTmpView->ChangeVLinealMetric(eMetric);
+ }
+ pTmpView = SwModule::GetNextView(pTmpView);
+ }
+}
+/*-----------------13.11.96 11.57-------------------
+
+--------------------------------------------------*/
+
+SwNavigationConfig* SwModule::GetNavigationConfig()
+{
+ if(!pNavigationConfig)
+ {
+ pNavigationConfig = new SwNavigationConfig;
+ }
+ return pNavigationConfig;
+}
+
+/*-----------------05.02.97 08.03-------------------
+
+--------------------------------------------------*/
+
+SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
+{
+ if(bWeb && !pWebPrtOpt)
+ {
+ pWebPrtOpt = new SwPrintOptions(TRUE);
+ }
+ else if(!bWeb && !pPrtOpt)
+ {
+ pPrtOpt = new SwPrintOptions(FALSE);
+ }
+
+ return bWeb ? pWebPrtOpt : pPrtOpt;
+}
+
+/*-----------------26.06.97 07.52-------------------
+
+--------------------------------------------------*/
+SwChapterNumRules* SwModule::GetChapterNumRules()
+{
+ if(!pChapterNumRules)
+ pChapterNumRules = new SwChapterNumRules;
+ return pChapterNumRules;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/)
+{
+ Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
+ Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
+
+ uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
+ rtl::OUString::createFromAscii("_beamer"),
+ FrameSearchFlag::CHILDREN);
+ if (xBeamerFrame.is())
+ { // the beamer has been opened by the SfxViewFrame
+ Reference<XController> xController = xBeamerFrame->getController();
+ Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
+ if (xControllerSelection.is())
+ {
+
+ ODataAccessDescriptor aSelection;
+ aSelection.setDataSource(rData.sDataSource);
+ aSelection[daCommand] <<= rData.sCommand;
+ aSelection[daCommandType] <<= rData.nCommandType;
+ xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
+ }
+ else {
+ DBG_ERROR("no selection supplier in the beamer!");
+ }
+ }
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Redlining
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::GetRedlineAuthor()
+{
+ if (!bAuthorInitialised)
+ {
+ const SvtUserOptions& rOpt = GetUserOptions();
+ if( !(sActAuthor = rOpt.GetFullName()).Len() )
+ if( !(sActAuthor = rOpt.GetID()).Len() )
+ sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ bAuthorInitialised = sal_True;
+ }
+ return InsertRedlineAuthor( sActAuthor );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
+{
+ DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
+ while (!(nPos<pAuthorNames->Count()))
+ {
+ InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
+ };
+ return *pAuthorNames->GetObject(nPos);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
+{
+ sal_uInt16 nPos = 0;
+
+ while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
+ nPos++;
+
+ if (nPos == pAuthorNames->Count())
+ pAuthorNames->Insert(new String(rAuthor), nPos);
+
+ return nPos;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
+ const AuthorCharAttr &rAttr )
+{
+ Color aCol( rAttr.nColor );
+
+ if( COL_TRANSPARENT == rAttr.nColor )
+ {
+ static const ColorData aColArr[] = {
+ COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
+ COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
+ COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
+
+ aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
+ sizeof( aColArr[0] )) ] );
+ }
+
+ sal_Bool bBackGr = COL_NONE == rAttr.nColor;
+
+ switch (rAttr.nItemId)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ {
+ SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
+ rSet.Put( aW );
+ aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
+ rSet.Put( aW );
+ aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
+ rSet.Put( aW );
+ }
+ break;
+
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
+ rSet.Put( aP );
+ aP.SetWhich( RES_CHRATR_CJK_POSTURE );
+ rSet.Put( aP );
+ aP.SetWhich( RES_CHRATR_CTL_POSTURE );
+ rSet.Put( aP );
+ }
+ break;
+
+ case SID_ATTR_CHAR_UNDERLINE:
+ rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
+ RES_CHRATR_UNDERLINE));
+ break;
+
+ case SID_ATTR_CHAR_STRIKEOUT:
+ rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
+ RES_CHRATR_CROSSEDOUT));
+ break;
+
+ case SID_ATTR_CHAR_CASEMAP:
+ rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
+ RES_CHRATR_CASEMAP));
+ break;
+
+ case SID_ATTR_BRUSH:
+ rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
+ bBackGr = sal_True;
+ break;
+ }
+
+ if( !bBackGr )
+ rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
+{
+ lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
+{
+ lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Fuer zukuenftige Erweiterung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
+{
+ lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::GetRedlineMarkPos()
+{
+ return pModuleConfig->GetMarkAlignMode();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblFormatNum(bHTML);
+}
+
+sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblAlignNum(bHTML);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const Color &SwModule::GetRedlineMarkColor()
+{
+ return pModuleConfig->GetMarkAlignColor();
+}
+
+/*-----------------03.03.98 16:47-------------------
+
+--------------------------------------------------*/
+const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
+{
+ return GetUsrPref( bWeb );
+}
+
+// returne den definierten DocStat - WordDelimiter
+const String& SwModule::GetDocStatWordDelim() const
+{
+ return pModuleConfig->GetWordDelimiter();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
+sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ return static_cast< sal_uInt16 >(pPref->GetMetric());
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// Update-Stati durchreichen
+sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ return pUsrPref->GetFldUpdateFlags();
+}
+/* -----------------------------28.09.00 14:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetFldUpdateFlags(eFldFlags);
+}
+/* -----------------------------28.09.00 14:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetUpdateLinkMode(nNewLinkMode);
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
+ sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
+{
+ sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
+ sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
+ if( bOnlineSpelling || bInvalid )
+ {
+ TypeId aType = TYPE(SwDocShell);
+ for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+ pDocSh;
+ pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
+ {
+ SwDoc* pTmp = pDocSh->GetDoc();
+ if ( pTmp->GetRootFrm() )
+ {
+ pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
+ ViewShell* pViewShell = 0;
+ pTmp->GetEditShell( &pViewShell );
+ if ( bSmartTags && pViewShell && pViewShell->GetWin() )
+ pViewShell->GetWin()->Invalidate();
+ }
+ }
+// pSpell->SetSpellWrongAgain( sal_False );
+// pSpell->SetSpellAllAgain( sal_False );
+ }
+}
+
+void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
+}
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
new file mode 100644
index 000000000000..a72d935f3796
--- /dev/null
+++ b/sw/source/ui/app/swmodule.cxx
@@ -0,0 +1,512 @@
+/*************************************************************************
+ *
+ * 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 <hintids.hxx>
+#ifndef _SWERROR_H
+#include <swerror.h>
+#endif
+#include <vcl/wrkwin.hxx>
+#include <vcl/graph.hxx>
+#include <svx/galbrws.hxx>
+#include <svx/svdobj.hxx>
+#include <svtools/ehdl.hxx>
+#include <svx/fntszctl.hxx>
+#include <svx/fntctl.hxx>
+#include <svx/SmartTagCtl.hxx>
+#include <svx/pszctrl.hxx>
+#include <svx/insctrl.hxx>
+#include <svx/selctrl.hxx>
+#include <svx/linectrl.hxx>
+#include <svx/tbxctl.hxx> //z-Zt falscher includeschutz!
+#include <svx/fillctrl.hxx>
+#include <svx/tbcontrl.hxx>
+#include <svx/verttexttbxctrl.hxx>
+#include <svx/formatpaintbrushctrl.hxx>
+#include <svx/contdlg.hxx>
+#include <svx/layctrl.hxx>
+#include <svx/fontwork.hxx>
+#include <SwSpellDialogChildWindow.hxx>
+#include <svx/tbxalign.hxx>
+#include <svx/grafctrl.hxx>
+#include <svx/tbxcolor.hxx>
+#include <svx/clipboardctl.hxx>
+#include <svx/lboxctrl.hxx>
+#include <svx/extrusioncontrols.hxx>
+#include <svx/hyprlink.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <svx/fontworkgallery.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/srchdlg.hxx>
+#include <svx/hyperdlg.hxx>
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <comphelper/processfactory.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <swmodule.hxx>
+#include <swevent.hxx>
+#include <swacorr.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <dobjfac.hxx>
+#include <init.hxx>
+#include <pview.hxx>
+#include <wview.hxx>
+#include <wdocsh.hxx>
+#include <globdoc.hxx>
+#ifndef _SRCVIEW_HXX //autogen
+#include <srcview.hxx>
+#endif
+#include <glshell.hxx>
+#include <tabsh.hxx>
+#include <listsh.hxx>
+#include <grfsh.hxx>
+#include <mediash.hxx>
+#include <olesh.hxx>
+#include <drawsh.hxx>
+#include <wformsh.hxx>
+#include <drwtxtsh.hxx>
+#include <beziersh.hxx>
+#include <wtextsh.hxx>
+#include <wfrmsh.hxx>
+#ifndef _DRFORMSH_HXX
+#include <drformsh.hxx>
+#endif
+#ifndef _WGRFSH_HXX
+#include <wgrfsh.hxx>
+#endif
+#ifndef _WOLESH_HXX
+#include <wolesh.hxx>
+#endif
+#ifndef _WLISTSH_HXX
+#include <wlistsh.hxx>
+#endif
+#ifndef _WTABSH_HXX
+#include <wtabsh.hxx>
+#endif
+#include <navipi.hxx>
+#include <chartins.hxx>
+#include <inputwin.hxx>
+#include <usrpref.hxx>
+#include <uinums.hxx>
+#include <prtopt.hxx>
+#include <bookctrl.hxx>
+#include <tmplctrl.hxx>
+#include <viewlayoutctrl.hxx>
+#include <svx/zoomsliderctrl.hxx>
+#include <tblctrl.hxx>
+#include <zoomctrl.hxx>
+#include <workctrl.hxx>
+#include <tbxanchr.hxx>
+#include <fldwrap.hxx>
+#ifndef _REDLNDLG_HXX
+#include <redlndlg.hxx>
+#endif
+#ifndef _SYNCBTN_HXX
+#include <syncbtn.hxx>
+#endif
+#include <mailmergechildwindow.hxx>
+#include <modcfg.hxx>
+#include <fontcfg.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/appuno.hxx>
+#include <swatrset.hxx>
+#include <idxmrk.hxx>
+#include <dlelstnr.hxx>
+#ifndef _BARCFG_HXX
+#include <barcfg.hxx>
+#endif
+#include <svx/rubydialog.hxx>
+// OD 14.02.2003 #107424#
+#include <svtools/colorcfg.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#ifndef _AVMEDIA_MEDIAPPLAYER_HXX
+#include <avmedia/mediaplayer.hxx>
+#endif
+#include <avmedia/mediatoolbox.hxx>
+
+#include <annotsh.hxx>
+
+#include <app.hrc>
+#include <svx/xmlsecctrl.hxx>
+ResMgr *pSwResMgr = 0;
+sal_Bool bNoInterrupt = sal_False;
+
+#include <sfx2/app.hxx>
+
+#include <svx/svxerr.hxx>
+
+#include <unomid.h>
+
+using namespace com::sun::star;
+
+
+TYPEINIT1( SwModule, SfxModule );
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+//************************************************************************
+
+SwModule::SwModule( SfxObjectFactory* pWebFact,
+ SfxObjectFactory* pFact,
+ SfxObjectFactory* pGlobalFact )
+ : SfxModule( SfxApplication::CreateResManager( "sw" ), sal_False, pWebFact,
+ pFact, pGlobalFact, NULL ),
+ pModuleConfig(0),
+ pUsrPref(0),
+ pWebUsrPref(0),
+ pPrtOpt(0),
+ pWebPrtOpt(0),
+ pChapterNumRules(0),
+ pStdFontConfig(0),
+ pNavigationConfig(0),
+ pToolbarConfig(0),
+ pWebToolbarConfig(0),
+ pDBConfig(0),
+ pColorConfig(0),
+ pAccessibilityOptions(0),
+ pCTLOptions(0),
+ pUserOptions(0),
+ pUndoOptions(0),
+ pAttrPool(0),
+ pView(0),
+ bAuthorInitialised(sal_False),
+ bEmbeddedLoadSave( sal_False ),
+ pClipboard( 0 ),
+ pDragDrop( 0 ),
+ pXSelection( 0 )
+{
+ SetName( String::CreateFromAscii("StarWriter") );
+ pSwResMgr = GetResMgr();
+ SvxErrorHandler::Get();
+ pErrorHdl = new SfxErrorHandler( RID_SW_ERRHDL,
+ ERRCODE_AREA_SW,
+ ERRCODE_AREA_SW_END,
+ pSwResMgr );
+
+ pModuleConfig = new SwModuleOptions;
+
+ //Die brauchen wie sowieso
+ pToolbarConfig = new SwToolbarConfigItem( sal_False );
+ pWebToolbarConfig = new SwToolbarConfigItem( sal_True );
+
+ pStdFontConfig = new SwStdFontConfig;
+
+ pAuthorNames = new SvStringsDtor(5, 1); // Alle Redlining-Autoren
+
+ //JP 18.10.96: SvxAutocorrect gegen die SwAutocorrect austauschen
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ if( pACfg )
+ {
+ const SvxAutoCorrect* pOld = pACfg->GetAutoCorrect();
+ pACfg->SetAutoCorrect(new SwAutoCorrect( *pOld ));
+ }
+
+ StartListening( *SFX_APP() );
+
+ // OD 14.02.2003 #107424# - init color configuration
+ // member <pColorConfig> is created and the color configuration is applied
+ // at the view options.
+ GetColorConfig();
+}
+
+//************************************************************************
+
+uno::Reference< scanner::XScannerManager >
+SwModule::GetScannerManager()
+{
+ if (!m_xScannerManager.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr (
+ comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ m_xScannerManager =
+ uno::Reference< scanner::XScannerManager >(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.scanner.ScannerManager" ) ),
+ uno::UNO_QUERY );
+ }
+ }
+ return m_xScannerManager;
+}
+
+uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser()
+{
+ if (!m_xLanguageGuesser.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
+ uno::UNO_QUERY );
+ }
+ }
+ return m_xLanguageGuesser;
+}
+
+//************************************************************************
+
+SwModule::~SwModule()
+{
+ SetPool(0);
+ SfxItemPool::Free(pAttrPool);
+ delete pErrorHdl;
+ EndListening( *SFX_APP() );
+}
+
+//************************************************************************
+
+void SwModule::CreateLngSvcEvtListener()
+{
+ if (!xLngSvcEvtListener.is())
+ xLngSvcEvtListener = new SwLinguServiceEventListener;
+}
+
+//************************************************************************
+
+void SwDLL::RegisterFactories()
+{
+ //Diese Id's duerfen nicht geaendert werden. Mittels der Id's wird vom
+ //Sfx die View (Dokumentansicht wiederherstellen) erzeugt.
+ if ( SvtModuleOptions().IsWriter() )
+ SwView::RegisterFactory ( 2 );
+
+ SwWebView::RegisterFactory ( 5 );
+
+ if ( SvtModuleOptions().IsWriter() )
+ {
+ SwSrcView::RegisterFactory ( 6 );
+ SwPagePreView::RegisterFactory ( 7 );
+ }
+}
+
+//************************************************************************
+
+
+void SwDLL::RegisterInterfaces()
+{
+ SwModule* pMod = SW_MOD();
+ SwModule::RegisterInterface( pMod );
+ SwDocShell::RegisterInterface( pMod );
+ SwWebDocShell::RegisterInterface( pMod );
+ SwGlosDocShell::RegisterInterface( pMod );
+ SwWebGlosDocShell::RegisterInterface( pMod );
+ SwView::RegisterInterface( pMod );
+ SwWebView::RegisterInterface( pMod );
+ SwPagePreView::RegisterInterface( pMod );
+ SwSrcView::RegisterInterface( pMod );
+
+
+ SwBaseShell::RegisterInterface(pMod);
+ SwTextShell::RegisterInterface(pMod);
+ SwTableShell::RegisterInterface(pMod);
+ SwListShell::RegisterInterface(pMod);
+ SwFrameShell::RegisterInterface(pMod);
+ SwDrawBaseShell::RegisterInterface(pMod);
+ SwDrawShell::RegisterInterface(pMod);
+ SwDrawFormShell::RegisterInterface(pMod);
+ SwDrawTextShell::RegisterInterface(pMod);
+ SwBezierShell::RegisterInterface(pMod);
+ SwGrfShell::RegisterInterface(pMod);
+ SwOleShell::RegisterInterface(pMod);
+ SwWebTextShell::RegisterInterface(pMod);
+ SwWebFrameShell::RegisterInterface(pMod);
+ SwWebGrfShell::RegisterInterface(pMod);
+ SwWebListShell::RegisterInterface(pMod);
+ SwWebTableShell::RegisterInterface(pMod);
+ SwWebDrawFormShell::RegisterInterface(pMod);
+ SwWebOleShell::RegisterInterface(pMod);
+ SwMediaShell::RegisterInterface(pMod);
+ SwAnnotationShell::RegisterInterface(pMod);
+}
+
+//************************************************************************
+
+void SwDLL::RegisterControls()
+{
+ SwModule* pMod = SW_MOD();
+ SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
+ SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod );
+ SwTbxAnchor::RegisterControl(FN_TOOL_ANKER, pMod );
+ SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod );
+ SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod );
+ SwTbxAutoTextCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod );
+ SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
+
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod );
+
+ svx::ExtrusionDepthControl::RegisterControl( SID_EXTRUSION_DEPTH_FLOATER, pMod );
+ svx::ExtrusionDirectionControl::RegisterControl( SID_EXTRUSION_DIRECTION_FLOATER, pMod );
+ svx::ExtrusionLightingControl::RegisterControl( SID_EXTRUSION_LIGHTING_FLOATER, pMod );
+ svx::ExtrusionSurfaceControl::RegisterControl( SID_EXTRUSION_SURFACE_FLOATER, pMod );
+ svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
+
+ svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
+ svx::FontWorkAlignmentControl::RegisterControl( SID_FONTWORK_ALIGNMENT_FLOATER, pMod );
+ svx::FontWorkCharacterSpacingControl::RegisterControl( SID_FONTWORK_CHARACTER_SPACING_FLOATER, pMod );
+
+ SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
+ SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
+ SvxUndoRedoControl::RegisterControl(SID_REDO, pMod );
+ svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
+
+ SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
+ SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
+ SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
+ SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
+ SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
+
+ SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
+// SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
+ SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod );
+ SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod );
+ SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
+ SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
+ SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR, pMod );
+ SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
+ SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
+ SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
+
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod );
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION, pMod );
+ SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE, pMod );
+ SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES, pMod );
+
+ SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
+ SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
+
+ SwZoomControl::RegisterControl(SID_ATTR_ZOOM, pMod );
+ SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM, pMod);
+ SvxPosSizeStatusBarControl::RegisterControl(0, pMod );
+ SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT, pMod );
+ SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE, pMod );
+ XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
+
+ SwBookmarkControl::RegisterControl(FN_STAT_PAGE, pMod );
+ SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE, pMod );
+ SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT, pMod );
+ SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod );
+
+ SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE, pMod);
+
+ SvxIMapDlgChildWindow::RegisterChildWindow( sal_False, pMod );
+ SvxSearchDialogWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxHlinkDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxHyperlinkDlgWrapper::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
+ SvxFontWorkChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwFldDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SwFldDataOnlyDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxContourDlgChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwNavigationChild::RegisterChildWindowContext( pMod );
+ SwInputChild::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
+ SwRedlineAcceptChild::RegisterChildWindow( sal_False, pMod );
+ SwSyncChildWin::RegisterChildWindow( sal_True, pMod );
+ SwMailMergeChildWindow::RegisterChildWindow( sal_False, pMod );
+// SwSendMailChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwInsertIdxMarkWrapper::RegisterChildWindow( sal_False, pMod );
+ SwInsertAuthMarkWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxRubyChildWindow::RegisterChildWindow( sal_False, pMod);
+ SwSpellDialogChildWindow::RegisterChildWindow(sal_False, pMod);
+
+ SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
+ SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
+ SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );
+ SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod );
+ SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod );
+ SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod );
+ SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod );
+ SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
+ SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod );
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
+
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
+
+ svx::ExtrusionDepthControl::RegisterControl( SID_EXTRUSION_DEPTH_FLOATER, pMod );
+ svx::ExtrusionDirectionControl::RegisterControl( SID_EXTRUSION_DIRECTION_FLOATER, pMod );
+ svx::ExtrusionLightingControl::RegisterControl( SID_EXTRUSION_LIGHTING_FLOATER, pMod );
+ svx::ExtrusionSurfaceControl::RegisterControl( SID_EXTRUSION_SURFACE_FLOATER, pMod );
+ svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
+
+ GalleryChildWindow::RegisterChildWindow(0, pMod);
+
+ ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX, pMod);
+ ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
+
+ SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
+}
+
+
+
+/*************************************************************************
+|*
+|* Modul laden (nur Attrappe fuer das Linken der DLL)
+|*
+\************************************************************************/
+
+/* -----------------20.04.99 10:46-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::InitAttrPool()
+{
+ DBG_ASSERT(!pAttrPool, "Pool ist schon da!");
+ pAttrPool = new SwAttrPool(0);
+ SetPool(pAttrPool);
+}
+/* -----------------20.04.99 10:46-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::RemoveAttrPool()
+{
+ SetPool(0);
+ SfxItemPool::Free(pAttrPool);
+}
+
+
diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx
new file mode 100644
index 000000000000..4392bdea04ac
--- /dev/null
+++ b/sw/source/ui/app/swwait.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * 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 <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/window.hxx>
+#include <docsh.hxx>
+#include <swwait.hxx>
+
+
+void SwDocShell::EnterWait( BOOL bLockDispatcher )
+{
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
+ while ( pFrame )
+ {
+ pFrame->GetWindow().EnterWait();
+ if ( bLockDispatcher )
+ pFrame->GetDispatcher()->Lock( TRUE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
+ }
+}
+
+void SwDocShell::LeaveWait( BOOL bLockDispatcher )
+{
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
+ while ( pFrame )
+ {
+ pFrame->GetWindow().LeaveWait();
+ if ( bLockDispatcher )
+ pFrame->GetDispatcher()->Lock( FALSE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
+ }
+}
+
+SwWait::SwWait( SwDocShell &rDocShell, BOOL bLockDispatcher ) :
+ rDoc ( rDocShell ),
+ bLock( bLockDispatcher )
+{
+ rDoc.EnterWait( bLock );
+}
+
+SwWait::~SwWait()
+{
+ rDoc.LeaveWait( bLock );
+}
+
+